private void SaveVersionMainData(ref VersionsModel data, string path)
 {
     data.ReadySave();
     XConfig.SaveJson(data, path, AssetLoadType.SystemIO);
 }
        private Dictionary <string, VersionBranch> mDict_Branches = new Dictionary <string, VersionBranch>(); //string: branch name

        public VFSVersionsManagerEditor()
        {
            mVersionData_BranchIndex_FolderPath = Path.Combine(mVersionDataFolderPath, "BrancheIndexes");
            //mVersionData_Branches_Data_FolderPath = Path.Combine(mVersionDataFolderPath, "Branches");
            mVersionBinary_Branches_FolderPath = Path.Combine(mVersionBinaryFolderPath, "Branches");
            XDirectory.CreateIfNotExists(mVersionRootFolderPath);
            XDirectory.CreateIfNotExists(mVersionDataFolderPath);
            XDirectory.CreateIfNotExists(mVersionData_BranchIndex_FolderPath);

            #region 初始化版本数据

            //主索引文件
            bool flag_create = false;
            if (File.Exists(mVersionMainFilePath))
            {
                try
                {
                    mVersionMainData = XConfig.GetJson <VersionsModel>(mVersionMainFilePath, AssetLoadType.SystemIO, false);
                }
                catch
                {
                    flag_create = true;
                }
            }
            else
            {
                flag_create = true;
            }

            if (flag_create)
            {
                mVersionMainData = new VersionsModel();
            }

            if (mVersionMainData.branches == null)
            {
                mVersionMainData.branches = new string[0];
            }

            //各个分支的配置文件
            foreach (var branchName in mVersionMainData.branches)
            {
                string branchIndexFilePath = Path.Combine(mVersionData_BranchIndex_FolderPath, $"{branchName}.json");
                bool   flag_create_branch  = false;

                if (File.Exists(branchIndexFilePath))
                {
                    try
                    {
                        var obj = XConfig.GetJson <VersionBranch>(branchIndexFilePath, AssetLoadType.SystemIO, false);
                        if (obj != null)
                        {
                            if (mDict_Branches.ContainsKey(branchName))
                            {
                                mDict_Branches[branchName] = obj;
                            }
                            else
                            {
                                mDict_Branches.Add(branchName, obj);
                            }
                        }
                    }
                    catch
                    {
                        flag_create_branch = true;
                    }
                }
                else
                {
                    flag_create_branch = true;
                }

                if (flag_create_branch)
                {
                    var obj = new VersionBranch();
                    obj.BranchName = branchName;
                    obj.BType      = VersionBranch.BranchType.MainPackage;

                    mDict_Branches.Add(branchName, obj);
                    SaveBranchFile(ref obj);
                }
            }

            #endregion
        }