public static void DeleteOldDemiLibCore() { string assemblyFilePath = EditorUtils.GetAssemblyFilePath(typeof(DOTween).Assembly); string str1 = assemblyFilePath.IndexOf("/") != -1 ? "/" : "\\"; string str2 = assemblyFilePath.Substring(0, assemblyFilePath.LastIndexOf(str1)); string fullPath = str2.Substring(0, str2.LastIndexOf(str1)) + str1 + "DemiLib"; string adbPath = EditorUtils.FullPathToADBPath(fullPath); if (!EditorUtils.AssetExists(adbPath)) { return; } string str3 = adbPath + "/Core"; if (!EditorUtils.AssetExists(str3)) { return; } EditorUtils.DeleteAssetsIfExist(new string[7] { adbPath + "/DemiLib.dll", adbPath + "/DemiLib.xml", adbPath + "/DemiLib.dll.mdb", adbPath + "/Editor/DemiEditor.dll", adbPath + "/Editor/DemiEditor.xml", adbPath + "/Editor/DemiEditor.dll.mdb", adbPath + "/Editor/Imgs" }); if (!EditorUtils.AssetExists(adbPath + "/Editor") || Directory.GetFiles(fullPath + str1 + "Editor").Length != 0) { return; } AssetDatabase.DeleteAsset(adbPath + "/Editor"); AssetDatabase.ImportAsset(str3, ImportAssetOptions.ImportRecursive); }
// Deletes old DemiLib core if new one (inside Core directory) exists public static void DeleteOldDemiLibCore() { string demiLibDir = EditorUtils.GetAssemblyFilePath(typeof(DOTween).Assembly); string slash = demiLibDir.IndexOf("/") != -1 ? "/" : "\\"; demiLibDir = demiLibDir.Substring(0, demiLibDir.LastIndexOf(slash)); demiLibDir = demiLibDir.Substring(0, demiLibDir.LastIndexOf(slash)) + slash + "DemiLib"; string adbDemiLibDir = FullPathToADBPath(demiLibDir); if (!AssetExists(adbDemiLibDir)) { return; } string demiLibNewCoreDir = adbDemiLibDir + "/Core"; if (!AssetExists(demiLibNewCoreDir)) { return; } // New version present, delete old versions DeleteAssetsIfExist(new[] { adbDemiLibDir + "/DemiLib.dll", adbDemiLibDir + "/DemiLib.xml", adbDemiLibDir + "/DemiLib.dll.mdb", adbDemiLibDir + "/Editor/DemiEditor.dll", adbDemiLibDir + "/Editor/DemiEditor.xml", adbDemiLibDir + "/Editor/DemiEditor.dll.mdb", adbDemiLibDir + "/Editor/Imgs" }); // Delete Editor folder if empty if (AssetExists(adbDemiLibDir + "/Editor") && Directory.GetFiles(demiLibDir + slash + "Editor").Length == 0) { AssetDatabase.DeleteAsset(adbDemiLibDir + "/Editor"); // Reimport correct Core libraries AssetDatabase.ImportAsset(demiLibNewCoreDir, ImportAssetOptions.ImportRecursive); } }
public static void StoreDOTweenDirs() { string str = Path.DirectorySeparatorChar.ToString(); EditorUtils._dotweenDir = Path.GetDirectoryName(EditorUtils.GetAssemblyFilePath(Assembly.GetAssembly(typeof(DOTween)))) + str; EditorUtils._dotweenDir = EditorUtils._dotweenDir.Substring(0, EditorUtils._dotweenDir.LastIndexOf(str) + 1); EditorUtils._dotweenProDir = EditorUtils._dotweenDir.Substring(0, EditorUtils._dotweenDir.LastIndexOf(str)); EditorUtils._dotweenProDir = EditorUtils._dotweenProDir.Substring(0, EditorUtils._dotweenProDir.LastIndexOf(str) + 1) + "DOTweenPro" + str; EditorUtils._demigiantDir = EditorUtils._dotweenDir.Substring(0, EditorUtils._dotweenDir.LastIndexOf(str)); EditorUtils._demigiantDir = EditorUtils._demigiantDir.Substring(0, EditorUtils._demigiantDir.LastIndexOf(str) + 1); if (EditorUtils._demigiantDir.Substring(EditorUtils._demigiantDir.Length - 10, 9) != "Demigiant") { EditorUtils._demigiantDir = (string)null; } EditorUtils._dotweenDir = EditorUtils._dotweenDir.Replace(EditorUtils.pathSlashToReplace, EditorUtils.pathSlash); EditorUtils._dotweenProDir = EditorUtils._dotweenProDir.Replace(EditorUtils.pathSlashToReplace, EditorUtils.pathSlash); EditorUtils._dotweenModulesDir = EditorUtils._dotweenDir + "Modules" + EditorUtils.pathSlash; if (EditorUtils._demigiantDir == null) { return; } EditorUtils._demigiantDir = EditorUtils._demigiantDir.Replace(EditorUtils.pathSlashToReplace, EditorUtils.pathSlash); }
private static void StoreEditorADBDir() { EditorUtils._editorADBDir = Path.GetDirectoryName(EditorUtils.GetAssemblyFilePath(Assembly.GetExecutingAssembly())).Substring(Application.dataPath.Length + 1).Replace("\\", "/") + "/"; }