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

Commit 3a70c7c

Browse files
Removing unused code in Utilty.cs and a few things attached to it
1 parent de49b59 commit 3a70c7c

File tree

3 files changed

+1
-496
lines changed

3 files changed

+1
-496
lines changed

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

Lines changed: 1 addition & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +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 LogCommitRegex = new Regex(@"commit\s(\S+)");
18-
public static readonly Regex LogMergeRegex = new Regex(@"Merge:\s+(\S+)\s+(\S+)");
19-
public static readonly Regex LogAuthorRegex = new Regex(@"Author:\s+(.+)\s<(.+)>");
20-
public static readonly Regex LogTimeRegex = new Regex(@"Date:\s+(.+)");
21-
public static readonly Regex LogDescriptionRegex = new Regex(@"^\s+(.+)");
22-
public static readonly Regex StatusStartRegex = new Regex(@"(?<status>[AMRDC]|\?\?)(?:\d*)\s+(?<path>[\w\d\/\.\-_ \@]+)");
23-
public static readonly Regex StatusEndRegex = new Regex(@"->\s(?<path>[\w\d\/\.\-_ ]+)");
24-
public static readonly Regex StatusBranchLineValidRegex = new Regex(@"\#\#\s+(?:[\w\d\/\-_\.]+)");
25-
public static readonly Regex StatusAheadBehindRegex =
26-
new Regex(
27-
@"\[ahead (?<ahead>\d+), behind (?<behind>\d+)\]|\[ahead (?<ahead>\d+)\]|\[behind (?<behind>\d+>)\]");
28-
29-
private static bool ready;
30-
private static Action onReady;
31-
32-
public static void RegisterReadyCallback(Action callback)
33-
{
34-
if (!ready)
35-
{
36-
onReady += callback;
37-
}
38-
else
39-
{
40-
try
41-
{
42-
callback();
43-
}
44-
catch (Exception ex)
45-
{
46-
Debug.LogException(ex);
47-
}
48-
49-
}
50-
}
51-
52-
public static void UnregisterReadyCallback(Action callback)
53-
{
54-
onReady -= callback;
55-
}
56-
57-
public static void Initialize()
58-
{
59-
// Evaluate project settings
60-
Issues = new List<ProjectConfigurationIssue>();
61-
}
62-
63-
public static void Run()
64-
{
65-
ready = true;
66-
onReady.SafeInvoke();
67-
}
68-
6912
public static Texture2D GetIcon(string filename, string filename2x = "")
7013
{
7114
if (EditorGUIUtility.pixelsPerPoint > 1f && !string.IsNullOrEmpty(filename2x))
@@ -77,73 +20,9 @@ public static Texture2D GetIcon(string filename, string filename2x = "")
7720
if (stream != null)
7821
return stream.ToTexture2D();
7922

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

14928
static class StreamExtensions

0 commit comments

Comments
 (0)