public static void GeneratorChecklist() { string newFilePath = PackagePlatform.GetPackagePath() + Global.PackageManifestFileName; if (File.Exists(newFilePath)) { File.Delete(newFilePath); } List <string> files = new List <string>(); Util.RecursiveDir(PackagePlatform.GetPackagePath(), ref files); FileStream fs = new FileStream(newFilePath, FileMode.CreateNew); StreamWriter sw = new StreamWriter(fs); for (int i = 0; i < files.Count; i++) { string file = files[i]; if (file.EndsWith(".meta") || file.Contains(".DS_Store")) { continue; } string md5 = Util.MD5File(file); string value = file.Replace(PackagePlatform.GetPackagePath(), string.Empty); sw.WriteLine(value + "|" + md5); } sw.Close(); fs.Close(); AssetDatabase.Refresh(); }
public static void ResetPackageDir() { string path = PackagePlatform.GetPackagePath(); if (Directory.Exists(path)) { Directory.Delete(path, true); } Directory.CreateDirectory(path); }
public static void GeneratorVersion(string mainVersion, string minorVersion) { string newFilePath = PackagePlatform.GetPackagePath() + Global.PackageVersionFileName; if (File.Exists(newFilePath)) { File.Delete(newFilePath); } FileStream fs = new FileStream(newFilePath, FileMode.CreateNew); StreamWriter sw = new StreamWriter(fs); string version = mainVersion + '.' + minorVersion; sw.WriteLine(version); sw.Close(); fs.Close(); AssetDatabase.Refresh(); }
public static void BuildDefaultSpecify(PackagePlatform.PlatformType rBuildPlatform) { //打包DataTable if (Directory.Exists("Assets/RawResources/DataTable")) { Debug.Log("打包 DataTable"); string outPath = PackagePlatform.GetPackagePath() + "DataTable"; if (Directory.Exists(outPath)) { Directory.Delete(outPath, true); } Directory.CreateDirectory(outPath); string inPath = "Assets/RawResources/DataTable"; string[] files = Directory.GetFiles(inPath); float doneCount = 0f; for (int i = 0; i < files.Length; i++) { string file = files[i]; if (file.Contains(".meta")) { continue; } Debug.Log(file); string outfile = file.Replace("Assets/RawResources", PackagePlatform.GetPackagePath()); if (File.Exists(outfile)) { File.Delete(outfile); } File.Copy(file, outfile, true); doneCount++; float p = (doneCount / (float)files.Length); EditorUtility.DisplayProgressBar("Package", "Package Default Resources", p); } EditorUtility.ClearProgressBar(); } //打包Code if (Directory.Exists("Assets/RawResources/Code")) { Debug.Log("打包 Code"); string outPath = PackagePlatform.GetPackagePath() + "Code"; if (Directory.Exists(outPath)) { Directory.Delete(outPath, true); } Directory.CreateDirectory(outPath); string inPath = "Assets/RawResources/Code"; string[] files = Directory.GetFiles(inPath); float doneCount = 0f; for (int i = 0; i < files.Length; i++) { string file = files[i]; if (file.Contains(".meta")) { continue; } Debug.Log(file); string outfile = file.Replace("Assets/RawResources", PackagePlatform.GetPackagePath()); if (File.Exists(outfile)) { File.Delete(outfile); } File.Copy(file, outfile, true); doneCount++; float p = (doneCount / (float)files.Length); EditorUtility.DisplayProgressBar("Package", "Package Default Resources", p); } EditorUtility.ClearProgressBar(); } }