public void ParseModify(bool oneByOneModify = false, bool update = false,
                                JsonParse jsonParse = null)
        {
            var urlList = GetModify(oneByOneModify);

            foreach (var url in urlList)
            {
                var baseFileUrl = url.ToString();
                var tempFileUrl = baseFileUrl.Split('/');

                var fileUrl = new StringBuilder();
                for (var j = 2; j < tempFileUrl.Length; j++)
                {
                    fileUrl.Append(tempFileUrl[j]);
                    if (j != tempFileUrl.Length - 1)
                    {
                        fileUrl.Append("/");
                    }
                }

                if (update)
                {
                    AddFileUrl(jsonParse, tempFileUrl.Last(), fileUrl.ToString(),
                               !oneByOneModify ? URL_TYPE.Modify : URL_TYPE.oneByOneModify);
                }
                else
                {
                    AddFileUrl(tempFileUrl.Last(), fileUrl.ToString(),
                               !oneByOneModify ? URL_TYPE.Modify : URL_TYPE.oneByOneModify);
                }
            }
        }
 public void AddFileUrl(JsonParse jsonParse, string name, string url, URL_TYPE uRL_TYPE)
 {
     jsonParse.FileUrls.Add(new FileUrl
     {
         Name     = name,
         Url      = url,
         URL_TYPE = uRL_TYPE
     });
 }
        public void DeleteFileUrl(JsonParse jsonParse, string name)
        {
            var fileUrls = jsonParse.FileUrls.SingleOrDefault(u => u.Name == name);

            jsonParse.FileUrls.Remove(fileUrls);
        }
        public async void UpdateUrlIndex(JsonParse jsonParse, bool first = false)
        {
            if (!Directory.Exists(Define.LocalPath + @"\Asset\Index\" + "r" + Define.NowRev))
            {
                Directory.CreateDirectory(Define.LocalPath + @"\Asset\Index\" + "r" + Define.NowRev);
            }
            if (!Directory.Exists(Define.LocalPath + @"\Asset\Index\Temp"))
            {
                Directory.CreateDirectory(Define.LocalPath + @"\Asset\Index\Temp");
            }
            if (await ParseResultJsonAsync(Define.GetUpdatePath()) == 1)
            {
                return;
            }

            var baseFileUrl = GetModify()[1].ToString();
            var tempFileUrl = baseFileUrl.Split('/');

            var downloadPath = new StringBuilder();

            for (var j = 0; j < 2; j++)
            {
                downloadPath.Append(tempFileUrl[j]);
                downloadPath.Append("/");
            }

            jsonParse.DownloadConfings.Add(new DownloadConfing
            {
                Revision             = ResultJsonObject["updateResource"]["revision"].ToString(),
                DownloadDomain       = ResultJsonObject["updateResource"]["downloadConfig"]["domain"].ToString(),
                DownloadPath         = downloadPath.ToString(),
                NewDownloadSize      = ResultJsonObject["updateResource"]["downloadSize"].ToString(),
                OneByOneDownloadPath = ResultJsonObject["updateResource"]["downloadConfig"]["oneByOneDownloadPath"]
                                       .ToString(),
                SubDomain = ResultJsonObject["updateResource"]["downloadConfig"]["subDomain"].ToString(),
                ImageRev  = ResultJsonObject["updateResource"]["imageRev"].ToString(),
                ImagePath = ResultJsonObject["updateResource"]["imagePath"].ToString()
            });
            var downloadConfing = JsonConvert.SerializeObject(jsonParse.DownloadConfings);

            using (var fileStream = File.OpenWrite(Define.LocalPath + @"\Asset\Index\Temp" + @"\Confing.json"))
            {
                var fileBytes = Encoding.UTF8.GetBytes(downloadConfing);
                fileStream.Write(fileBytes, 0, fileBytes.Length);
                fileStream.Close();
            }

            Define.JsonParse.DownloadConfings.Clear();
            Define.JsonParse.LoadConfing(Define.LocalPath + @"\Asset\Index\Temp" + @"\Confing.json");
            Define._ini_Coning();
            DownloadConfings.Clear();
            Directory.CreateDirectory(Define.LocalPath + @"\Asset\Index\" + "r" + Define.NowRev);
            File.Copy(Define.LocalPath + @"\Asset\Index\Temp" + @"\Confing.json",
                      Define.LocalPath + @"\Asset\Index\" + "r" + Define.NowRev + @"\Confing.json", true);
            File.Copy(Define.LocalPath + @"\Asset\Index\" + "r" + Define.NowRev + @"\Confing.json",
                      Define.GetConfingPath(), true);

            ParseModify(false, true, jsonParse);
            ParseModify(true, true, jsonParse);

            if (first == false)
            {
                foreach (var deleteFiles in GetModify(false, true))
                {
                    DeleteFileUrl(jsonParse, deleteFiles.ToString());
                }
            }

            var urlIndex = JsonConvert.SerializeObject(jsonParse.FileUrls.OrderBy(e => e.Name, StringComparer.Ordinal)
                                                       .Distinct(f => f.Name));

            using (var fileStream =
                       File.OpenWrite(Define.LocalPath + @"\Asset\Index\" + "r" + Define.NowRev + @"\Index.json"))
            {
                var fileBytes = Encoding.UTF8.GetBytes(urlIndex);
                fileStream.Write(fileBytes, 0, fileBytes.Length);
                fileStream.Close();
            }

            FileUrls.Clear();
            Define.JsonParse.FileUrls.Clear();
            File.Copy(Define.LocalPath + @"\Asset\Index\" + "r" + Define.NowRev + @"\Index.json",
                      Define.GetIndexPath(), true);
            Define.JsonParse.LoadUrlIndex(Define.GetIndexPath());

            File.Copy(Define.GetUpdatePath(),
                      Define.LocalPath + @"\Asset\Index\" + "r" + Define.NowRev + @"\Update.json"
                      , true);

            Define.IsGetNewComplete = true;
        }