Exemple #1
0
        private static Dictionary <string, string> ComputeMd5(string folderPath)
        {
            Dictionary <string, string> result = new Dictionary <string, string>();
            string systemPath = UIPrefabProcessor.ToFileSystemPath(folderPath);

            string[]      allFilePaths = Directory.GetFiles(systemPath, "*.*");
            List <string> filePathList = new List <string>();

            foreach (string s in allFilePaths)
            {
                if (s.ToLower().EndsWith(".png") || s.ToLower().EndsWith(".png.meta"))
                {
                    filePathList.Add(s);
                }
            }
            //MD5 md5 = MD5.Create();
            for (int i = 0; i < filePathList.Count; i++)
            {
                string path = filePathList[i];
                //byte[] data = md5.ComputeHash(File.ReadAllBytes(path));
                //result.Add(UIPrefabProcessor.ToAssetPath(path), Convert.ToBase64String(data));
                result.Add(UIPrefabProcessor.ToAssetPath(path), AssetPatchMaker.GetFileLastWriteTime(path));
            }
            return(result);
        }
        private static string[] GetAssetPaths(string folderPath)
        {
            string systemPath = UIPrefabProcessor.ToFileSystemPath(folderPath);

            string[] filePaths = Directory.GetFiles(systemPath, "*.png");
            string[] result    = new string[filePaths.Length];
            for (int i = 0; i < filePaths.Length; i++)
            {
                result[i] = UIPrefabProcessor.ToAssetPath(filePaths[i]);
            }
            return(result);
        }
Exemple #3
0
        private static void WriteJson(string content, string path)
        {
            string jsonPath = UIPrefabProcessor.ToFileSystemPath(path);

            if (File.Exists(jsonPath) == true)
            {
                File.Delete(jsonPath);
            }
            if (!string.IsNullOrEmpty(content))
            {
                StreamWriter sw = File.CreateText(jsonPath);
                sw.Write(content);
                sw.Close();
                AssetDatabase.ImportAsset(path);
            }
        }