Unity-jump-proj
This commit is contained in:
@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Packages.Rider.Editor.Util
|
||||
{
|
||||
internal class CommandLineParser
|
||||
{
|
||||
public Dictionary<string, string> Options = new Dictionary<string, string>();
|
||||
|
||||
public CommandLineParser(string[] args)
|
||||
{
|
||||
var i = 0;
|
||||
while (i < args.Length)
|
||||
{
|
||||
var arg = args[i];
|
||||
if (!arg.StartsWith("-"))
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
string value = null;
|
||||
if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
|
||||
{
|
||||
value = args[i + 1];
|
||||
i++;
|
||||
}
|
||||
|
||||
if (!(Options.ContainsKey(arg)))
|
||||
{
|
||||
Options.Add(arg, value);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 154ace4bd16de9f4e84052ac257786d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using JetBrains.Annotations;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Packages.Rider.Editor.Util
|
||||
{
|
||||
internal static class FileSystemUtil
|
||||
{
|
||||
[NotNull]
|
||||
public static string GetFinalPathName([NotNull] string path)
|
||||
{
|
||||
if (path == null) throw new ArgumentNullException("path");
|
||||
|
||||
// up to MAX_PATH. MAX_PATH on Linux currently 4096, on Mac OS X 1024
|
||||
// doc: http://man7.org/linux/man-pages/man3/realpath.3.html
|
||||
var sb = new StringBuilder(8192);
|
||||
var result = LibcNativeInterop.realpath(path, sb);
|
||||
if (result == IntPtr.Zero)
|
||||
{
|
||||
throw new Win32Exception($"{path} was not resolved.");
|
||||
}
|
||||
|
||||
return new FileInfo(sb.ToString()).FullName;
|
||||
}
|
||||
|
||||
public static string FileNameWithoutExtension(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
var indexOfDot = -1;
|
||||
var indexOfSlash = 0;
|
||||
for (var i = path.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (indexOfDot == -1 && path[i] == '.')
|
||||
{
|
||||
indexOfDot = i;
|
||||
}
|
||||
|
||||
if (indexOfSlash == 0 && path[i] == '/' || path[i] == '\\')
|
||||
{
|
||||
indexOfSlash = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (indexOfDot == -1)
|
||||
{
|
||||
indexOfDot = path.Length;
|
||||
}
|
||||
|
||||
return path.Substring(indexOfSlash, indexOfDot - indexOfSlash);
|
||||
}
|
||||
|
||||
public static bool EditorPathExists(string editorPath)
|
||||
{
|
||||
return SystemInfo.operatingSystemFamily == OperatingSystemFamily.MacOSX && new DirectoryInfo(editorPath).Exists
|
||||
|| SystemInfo.operatingSystemFamily != OperatingSystemFamily.MacOSX && new FileInfo(editorPath).Exists;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bdbd564a9fdad0b738e76d030cad1204
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Packages.Rider.Editor.Util
|
||||
{
|
||||
internal static class LibcNativeInterop
|
||||
{
|
||||
[DllImport("libc", SetLastError = true)]
|
||||
public static extern IntPtr realpath(string path, StringBuilder resolved_path);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 071c17858dc6c47ada7b2a1f1ded5402
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,30 @@
|
||||
using JetBrains.Annotations;
|
||||
using Packages.Rider.Editor;
|
||||
using Unity.CodeEditor;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace JetBrains.Rider.Unity.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// Is called via commandline from Rider Notification after checking out from source control.
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
public static class RiderMenu
|
||||
{
|
||||
/// <summary>
|
||||
/// Is called via commandline from Rider Notification after checking out from source control.
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
public static void MenuOpenProject()
|
||||
{
|
||||
if (RiderScriptEditor.IsRiderOrFleetInstallation(RiderScriptEditor.CurrentEditor))
|
||||
{
|
||||
// Force the project files to be sync
|
||||
CodeEditor.CurrentEditor.SyncAll();
|
||||
|
||||
// Load Project
|
||||
CodeEditor.CurrentEditor.OpenProject();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8860c53ca4073d4f92c403e709c12ba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,14 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Rider.Editor.Util
|
||||
{
|
||||
internal static class RiderPathUtil
|
||||
{
|
||||
public static bool IsRiderDevEditor(string editorPath)
|
||||
{
|
||||
if (editorPath == null)
|
||||
return false;
|
||||
return "rider-dev".Equals(Path.GetFileNameWithoutExtension(editorPath));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d34a9510a5b9d21381c93e73867a193
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,51 @@
|
||||
using System;
|
||||
|
||||
namespace Packages.Rider.Editor.Util
|
||||
{
|
||||
[Serializable]
|
||||
internal class SerializableVersion
|
||||
{
|
||||
public SerializableVersion(Version version)
|
||||
{
|
||||
|
||||
Major = version.Major;
|
||||
Minor = version.Minor;
|
||||
if (version.Build >= 0)
|
||||
Build = version.Build;
|
||||
if (version.Revision >= 0)
|
||||
Revision = version.Revision;
|
||||
}
|
||||
|
||||
public int Build;
|
||||
public int Major;
|
||||
public int Minor;
|
||||
public int Revision;
|
||||
}
|
||||
|
||||
internal static class VersionExtension
|
||||
{
|
||||
public static SerializableVersion ToSerializableVersion(this Version version)
|
||||
{
|
||||
if (version == null)
|
||||
return null;
|
||||
|
||||
return new SerializableVersion(version);
|
||||
}
|
||||
|
||||
public static Version ToVersion(this SerializableVersion serializableVersion)
|
||||
{
|
||||
if (serializableVersion == null)
|
||||
return null;
|
||||
|
||||
var build = serializableVersion.Build;
|
||||
if (build < 0)
|
||||
build = 0;
|
||||
var revision = serializableVersion.Revision;
|
||||
if (revision < 0)
|
||||
revision = 0;
|
||||
|
||||
return new Version(serializableVersion.Major, serializableVersion.Minor, build,
|
||||
revision);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e1f00a9be2eb66438e2835fdf1ea11b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Packages.Rider.Editor.Util
|
||||
{
|
||||
internal static class StringBuilderExtensions
|
||||
{
|
||||
// StringBuilder.AppendJoin is very useful, but not available in 2019.2
|
||||
// It requires netstandard 2.1
|
||||
public static StringBuilder CompatibleAppendJoin(this StringBuilder stringBuilder, char separator, IEnumerable<string> parts)
|
||||
{
|
||||
var first = true;
|
||||
foreach (var part in parts)
|
||||
{
|
||||
if (!first) stringBuilder.Append(separator);
|
||||
stringBuilder.Append(part);
|
||||
first = false;
|
||||
}
|
||||
|
||||
return stringBuilder;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 302b1bdfb7a645db994491799832912b
|
||||
timeCreated: 1699444126
|
@ -0,0 +1,14 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Packages.Rider.Editor.Util
|
||||
{
|
||||
internal static class StringUtils
|
||||
{
|
||||
public static string NormalizePath(this string path)
|
||||
{
|
||||
return path.Replace(Path.DirectorySeparatorChar == '\\'
|
||||
? '/'
|
||||
: '\\', Path.DirectorySeparatorChar);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0221f76dde941d492827802c9b7c1f9
|
||||
timeCreated: 1623056718
|
Reference in New Issue
Block a user