Exemplo n.º 1
0
        public static void ExportScene()
        {
            string[] scenes  = MarkTool.GetSceneArray();
            string   content = string.Join("\n", scenes);

            FileUtilTool.WriteFile(sceneConfigPath, content);
        }
Exemplo n.º 2
0
        public static void WriteRecordFile(string[] lines, string filePath)
        {
            string data = string.Join("\n", lines);

            FileUtilTool.CreateFolderForFile(filePath);
            FileUtilTool.DelFile(filePath);
            FileUtilTool.WriteFile(filePath, data);
        }
Exemplo n.º 3
0
 public static void UpgradeCodeVersion()
 {
     PlayerSettings.Android.bundleVersionCode = versionCode + 1;
     FileUtilTool.WriteFile(versionCodeFile, PlayerSettings.Android.bundleVersionCode.ToString());
     FileUtilTool.WriteFile(Application.streamingAssetsPath + "/" + versionCodeFile, PlayerSettings.Android.bundleVersionCode.ToString());
     CallShellCommandForVersionCode();
     CallShellCommandForVersionRes();
 }
Exemplo n.º 4
0
        public static void CheckScriptsQuiet()
        {
            List <string> difList = new List <string>();

            List <string> checkFiles = new List <string>();

            string[] csFiles      = Directory.GetFiles(Application.dataPath, "*.cs", SearchOption.AllDirectories);
            string   ManifestFile = Application.dataPath + "/Plugins/Android/AndroidManifest.xml";

            string[] jarFiles = Directory.GetFiles(Application.dataPath, "*.jar", SearchOption.AllDirectories);

            checkFiles.AddRange(csFiles);
            checkFiles.AddRange(jarFiles);
            checkFiles.Add(ManifestFile);

            int            i  = 0;
            CustomBuildLog fl = new CustomBuildLog();

            foreach (string f in checkFiles)
            {
                string path = f.Replace('\\', '/');
                string md5  = ResCommon.GetFileMD5(path);

                if (lastestCSMD5.ContainsKey(path))
                {
                    if (lastestCSMD5[path] != md5)
                    {
                        difList.Add(path);
                    }
                }
                else
                {
                    difList.Add(path);
                }

                i++;
                newBuildLog.AddData(new FileMD5Data(path, md5));

                EditorUtility.DisplayProgressBar("安卓打包", "检查脚本 " + f, (float)i / (float)csFiles.Length);
            }

            EditorUtility.ClearProgressBar();

            if (difList.Count > 0)
            {
                BuildQuietScriptDiff();
            }
            else
            {
                BuildQuietResources();
            }

            string json = JsonMapper.ToJson(difList);

            FileUtilTool.DelFile(diffLogFile);
            FileUtilTool.WriteFile(diffLogFile, json);
        }
Exemplo n.º 5
0
        static void SaveLastBuildLog()
        {
            newBuildLog.version = versionRes.ToString();
            string jSon = JsonMapper.ToJson(newBuildLog);

            FileUtilTool.WriteFile(tempDataFile, jSon);

            FileUtilTool.WriteFile(versionResFile, versionRes.ToString());
        }
Exemplo n.º 6
0
        //[MenuItem("Tools/程序狗专用/Res/MD5")]
        public static void GenMD5()
        {
            FileUtilTool.DelFile(mdFile);
            string fresfolder = resFolder.Replace("\\", "/");
            List <AssetbundleJsonData> data = GetMD5ForFolder(resFolder, fresfolder);
            AssetbundleJsonMap         map  = new AssetbundleJsonMap();

            map.arrayRes = data.ToArray();
            string jsonStr = JsonMapper.ToJson(map);

            FileUtilTool.WriteFile(mdFile, jsonStr);
        }
Exemplo n.º 7
0
        void OnGUI()
        {
            release = EditorGUILayout.TextField("正式版本号", release);
            beta    = EditorGUILayout.TextField("Beta版本号", beta);


            if (GUILayout.Button("保存"))
            {
                string      path = EditorUtility.SaveFilePanel("保存地方", Application.dataPath, "version", "dat");
                VersionData data = new VersionData();
                data.beta   = beta;
                data.relase = release;

                FileUtilTool.WriteFile(path, LitJson.JsonMapper.ToJson(data));
            }
        }
Exemplo n.º 8
0
        //[MenuItem("Package/测试/生成场景文件のMD5", false, 4)]
        public static void GenMD5()
        {
            List <string> md5s = new List <string>();

            string[] files = Directory.GetFiles("test/", "*.*", SearchOption.AllDirectories);
            foreach (var k in files)
            {
                md5s.Add(k + "\t" + ResCommon.GetFileMD5(k));
                //if(!k.EndsWith(".manifest"))
                //{
                //    byte[] bs = File.ReadAllBytes(k);
                //    AssetBundle ab = AssetBundle.LoadFromMemory(bs);
                //    string []assetNames = ab.GetAllAssetNames();
                //}
            }
            FileUtilTool.WriteFile("testscenes.md5", string.Join("\r\n", md5s.ToArray()));
        }
Exemplo n.º 9
0
        public static void GenMD5Second()
        {
            string mdSecondFile = resFolder + "/MD2.dat";
            string fresfolder   = resFolder.Replace("\\", "/");
            string jsonStr      = "";

            if (File.Exists(mdSecondFile))
            {
                string data = FileUtilTool.ReadFile(mdSecondFile);
                MD2    md2  = JsonMapper.ToObject <MD2>(data);
                jsonStr = GetMD5SecondForFile(mdFile, fresfolder, md2.time);
            }
            else
            {
                jsonStr = GetMD5SecondForFile(mdFile, fresfolder);
            }
            FileUtilTool.DelFile(mdSecondFile);
            FileUtilTool.WriteFile(mdSecondFile, jsonStr);
        }
Exemplo n.º 10
0
        public static void CheckScripts()
        {
            List <string> difList = new List <string>();

            List <string> checkFiles = new List <string>();

            string[] csFiles      = Directory.GetFiles(Application.dataPath, "*.cs", SearchOption.AllDirectories);
            string   ManifestFile = Application.dataPath + "/Plugins/Android/AndroidManifest.xml";

            string[] jarFiles = Directory.GetFiles(Application.dataPath, "*.jar", SearchOption.AllDirectories);

            checkFiles.AddRange(csFiles);
            checkFiles.AddRange(jarFiles);
            checkFiles.Add(ManifestFile);

            int            i  = 0;
            CustomBuildLog fl = new CustomBuildLog();

            foreach (string f in checkFiles)
            {
                string path = f.Replace('\\', '/');
                string md5  = ResCommon.GetFileMD5(path);

                if (lastestCSMD5.ContainsKey(path))
                {
                    if (lastestCSMD5[path] != md5)
                    {
                        difList.Add(path);
                    }
                }
                else
                {
                    difList.Add(path);
                }

                //Debug.Log(f + " md5:" + md5);
                i++;
                newBuildLog.AddData(new FileMD5Data(path, md5));

                EditorUtility.DisplayProgressBar("安卓打包", "检查脚本 " + f, (float)i / (float)csFiles.Length);
            }

            EditorUtility.ClearProgressBar();

            if (difList.Count > 0)
            {
                if (EditorUtility.DisplayDialog("安卓打包", string.Format("本次打包含程序和资源更新\r\n 原资源版本号:{0}", versionRes), "继续", "取消"))
                {
                    ShowScriptDiff(difList);
                }
            }
            else
            {
                if (EditorUtility.DisplayDialog("安卓打包", string.Format("本次打包只包含资源更新\r\n 原资源版本号:{0}", versionRes), "继续", "取消"))
                {
                    CheckResources();
                }
            }

            //Debug.Log("diff list :");
            //foreach (string str in difList)
            //{
            //    Debug.Log(str);
            //}

            string json = JsonMapper.ToJson(difList);

            FileUtilTool.DelFile(diffLogFile);
            FileUtilTool.WriteFile(diffLogFile, json);
        }
Exemplo n.º 11
0
        public static void SaveBuildLog(BuildLog buildLog)
        {
            string data = JsonMapper.ToJson(buildLog);

            FileUtilTool.WriteFile(buildLogFile, data);
        }