Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 76e6229

Browse files
Merge branch 'master' into fixes/repository-refactor
2 parents 2238a80 + 07aba6a commit 76e6229

File tree

4 files changed

+1
-502
lines changed

4 files changed

+1
-502
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/GitHub.Unity.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@
9191
<Compile Include="Misc\Utility.cs" />
9292
<Compile Include="Services\AuthenticationService.cs" />
9393
<Compile Include="Services\StatusService.cs" />
94-
<Compile Include="Tasks\EvaluateProjectConfigurationTask.cs" />
95-
<Compile Include="Tasks\TaskException.cs" />
9694
<Compile Include="Tools\MozRoots.cs" />
9795
<Compile Include="UI\AuthenticationView.cs" />
9896
<Compile Include="UI\BranchesView.cs" />

src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Utility.cs

Lines changed: 1 addition & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,14 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.IO;
43
using System.Linq;
54
using System.Reflection;
6-
using System.Text.RegularExpressions;
75
using UnityEditor;
86
using UnityEngine;
97

108
namespace GitHub.Unity
119
{
1210
class Utility : ScriptableObject
1311
{
14-
private static readonly ILogging logger = Logging.GetLogger<Utility>();
15-
16-
public const string StatusRenameDivider = "->";
17-
public static readonly Regex ListBranchesRegex =
18-
new Regex(@"^(?<active>\*)?\s+(?<name>[\w\d\/\-_]+)\s*(?:[a-z|0-9]{7} \[(?<tracking>[\w\d\/\-\_]+)\])?");
19-
public static readonly Regex ListRemotesRegex =
20-
new Regex(@"(?<name>[\w\d\-_]+)\s+(?<url>https?:\/\/(?<login>(?<user>[\w\d]+)(?::(?<token>[\w\d]+))?)@(?<host>[\w\d\.\/\%]+))\s+\((?<function>fetch|push)\)");
21-
public static readonly Regex LogCommitRegex = new Regex(@"commit\s(\S+)");
22-
public static readonly Regex LogMergeRegex = new Regex(@"Merge:\s+(\S+)\s+(\S+)");
23-
public static readonly Regex LogAuthorRegex = new Regex(@"Author:\s+(.+)\s<(.+)>");
24-
public static readonly Regex LogTimeRegex = new Regex(@"Date:\s+(.+)");
25-
public static readonly Regex LogDescriptionRegex = new Regex(@"^\s+(.+)");
26-
public static readonly Regex StatusStartRegex = new Regex(@"(?<status>[AMRDC]|\?\?)(?:\d*)\s+(?<path>[\w\d\/\.\-_ \@]+)");
27-
public static readonly Regex StatusEndRegex = new Regex(@"->\s(?<path>[\w\d\/\.\-_ ]+)");
28-
public static readonly Regex StatusBranchLineValidRegex = new Regex(@"\#\#\s+(?:[\w\d\/\-_\.]+)");
29-
public static readonly Regex StatusAheadBehindRegex =
30-
new Regex(
31-
@"\[ahead (?<ahead>\d+), behind (?<behind>\d+)\]|\[ahead (?<ahead>\d+)\]|\[behind (?<behind>\d+>)\]");
32-
33-
private static bool ready;
34-
private static Action onReady;
35-
36-
public static void RegisterReadyCallback(Action callback)
37-
{
38-
if (!ready)
39-
{
40-
onReady += callback;
41-
}
42-
else
43-
{
44-
try
45-
{
46-
callback();
47-
}
48-
catch (Exception ex)
49-
{
50-
Debug.LogException(ex);
51-
}
52-
53-
}
54-
}
55-
56-
public static void UnregisterReadyCallback(Action callback)
57-
{
58-
onReady -= callback;
59-
}
60-
61-
public static void Initialize()
62-
{
63-
// Evaluate project settings
64-
Issues = new List<ProjectConfigurationIssue>();
65-
}
66-
67-
public static void Run()
68-
{
69-
ready = true;
70-
onReady.SafeInvoke();
71-
}
72-
7312
public static Texture2D GetIcon(string filename, string filename2x = "")
7413
{
7514
if (EditorGUIUtility.pixelsPerPoint > 1f && !string.IsNullOrEmpty(filename2x))
@@ -81,73 +20,9 @@ public static Texture2D GetIcon(string filename, string filename2x = "")
8120
if (stream != null)
8221
return stream.ToTexture2D();
8322

84-
var iconPath = ExtensionInstallPath.ToNPath().Combine("IconsAndLogos", filename).ToString(SlashMode.Forward);
23+
var iconPath = EntryPoint.Environment.ExtensionInstallPath.Combine("IconsAndLogos", filename).ToString(SlashMode.Forward);
8524
return AssetDatabase.LoadAssetAtPath<Texture2D>(iconPath);
8625
}
87-
88-
public static Texture2D CreateTextureFromColor(Color color)
89-
{
90-
Texture2D backgroundTexture = new Texture2D(1, 1);
91-
Color c = color;
92-
backgroundTexture.SetPixel(1, 1, c);
93-
backgroundTexture.Apply();
94-
95-
return backgroundTexture;
96-
}
97-
98-
public static string GitInstallPath
99-
{
100-
get { return EntryPoint.Environment.GitExecutablePath; }
101-
}
102-
103-
public static string GitRoot
104-
{
105-
get { return EntryPoint.Environment.RepositoryPath; }
106-
}
107-
108-
public static string UnityAssetsPath
109-
{
110-
get { return EntryPoint.Environment.UnityAssetsPath; }
111-
}
112-
113-
public static string UnityProjectPath
114-
{
115-
get { return EntryPoint.Environment.UnityProjectPath; }
116-
}
117-
118-
public static string ExtensionInstallPath
119-
{
120-
get { return EntryPoint.Environment.ExtensionInstallPath; }
121-
}
122-
123-
public static List<ProjectConfigurationIssue> Issues { get; protected set; }
124-
125-
public static bool GitFound
126-
{
127-
get { return !string.IsNullOrEmpty(GitInstallPath); }
128-
}
129-
130-
public static bool ActiveRepository
131-
{
132-
get { return !string.IsNullOrEmpty(GitRoot); }
133-
}
134-
135-
public static bool IsDevelopmentBuild
136-
{
137-
get { return File.Exists(Path.Combine(UnityProjectPath.Replace('/', Path.DirectorySeparatorChar), ".devroot")); }
138-
}
139-
140-
public static Texture2D GetTextureFromColor(Color color)
141-
{
142-
Color[] pix = new Color[1];
143-
pix[0] = color;
144-
145-
Texture2D result = new Texture2D(1, 1);
146-
result.SetPixels(pix);
147-
result.Apply();
148-
149-
return result;
150-
}
15126
}
15227

15328
static class StreamExtensions

0 commit comments

Comments
 (0)