11 [SerializeField]
private bool initialized =
true;
13 public bool Initialized
26 private static bool inSourceMode =
false;
27 private const string sourceModePath =
"Assets/Editor/build/";
28 private const string realPath =
"Assets/Plugins/GitHub/Editor/";
30 private static string[] assemblies20 = {
"System.Threading.dll",
"AsyncBridge.Net35.dll",
"ReadOnlyCollectionsInterfaces.dll",
"GitHub.Api.dll",
"GitHub.Unity.dll" };
31 private static string[] assemblies45 = {
"GitHub.Api.45.dll",
"GitHub.Unity.45.dll" };
33 private const string GITHUB_UNITY_DISABLE =
"GITHUB_UNITY_DISABLE";
34 private static bool IsDisabled {
get {
return Environment.GetEnvironmentVariable(GITHUB_UNITY_DISABLE) ==
"1"; } }
42 EditorApplication.update += Initialize;
45 private static void Initialize()
47 EditorApplication.update -= Initialize;
53 var scriptPath = Path.Combine(Application.dataPath,
"Editor" + Path.DirectorySeparatorChar +
"GitHub.Unity" + Path.DirectorySeparatorChar +
"EntryPoint.cs");
54 inSourceMode = File.Exists(scriptPath);
57 AssetDatabase.SaveAssets();
62 private static void ToggleAssemblies()
64 var path = inSourceMode ? sourceModePath : realPath;
66 ToggleAssemblies(path, assemblies20,
false);
67 ToggleAssemblies(path, assemblies45,
true);
69 ToggleAssemblies(path, assemblies45,
false);
70 ToggleAssemblies(path, assemblies20,
true);
74 private static void ToggleAssemblies(
string path,
string[] assemblies,
bool enable)
76 foreach (var file
in assemblies)
78 var filepath = path + file;
79 PluginImporter importer = AssetImporter.GetAtPath(filepath) as PluginImporter;
82 Debug.LogFormat(
"GitHub for Unity: Could not find importer for {0}. Some functionality may fail.", filepath);
85 if (importer.GetCompatibleWithEditor() != enable)
87 importer.SetCompatibleWithEditor(enable);
88 importer.SaveAndReimport();