Exemplo n.º 1
0
        //檢查是否需要上傳
        private static bool CheckNeedUpload(rRes data, List <rRes> list)
        {
            if (list == null)
            {
                return(true);
            }

            for (int i = 0; i < list.Count; i++)
            {
                if (data.Path != list[i].Path)
                {
                    continue;
                }

                if (data.FileName != list[i].FileName)
                {
                    continue;
                }

                if (data.MD5Code == list[i].MD5Code)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        private static void BuildVersion(string lang, string path, string versionName)
        {
            //檢查目錄是否存在
            if (Directory.Exists(path) == true)
            {
                List <rRes> container = new List <rRes>();
                //取得目錄底下的Data檔案
                string[] files = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories);
                for (int i = 0; i < files.Length; i++)
                {
                    FileInfo info = new FileInfo(files[i]);
                    if (!CheckFileExtension(info))
                    {
                        continue;
                    }

                    string filePath = Path.GetDirectoryName(files[i]).Replace("\\", "/");
                    rRes   data     = new rRes();
                    data.Version  = Setting.Ver;
                    data.FileName = info.Name;
                    data.Path     = GetDataPath(filePath, Application.dataPath + "/" + Setting.OutputAssetsFolder + "/");
                    data.FileSize = info.Length;
                    data.MD5Code  = GetMd5File(filePath + "/", info.Name);
                    container.Add(data);
                }
                //整合資料
                rRes[] resData = container.ToArray();
                //轉成Json
                string json = Tools.SerializeObject(resData);
                //寫入檔案
                Tools.Save(Application.dataPath + "/" + Setting.OutputAssetsFolder + "/" + lang + "/" + "Versions" + "/", versionName, System.Text.UTF8Encoding.UTF8.GetBytes(json));
            }
        }