Ejemplo n.º 1
0
        /// <summary>
        /// 从JSON文件,导入打包配置信息.
        /// </summary>
        /// <returns><c>true</c>, 导入成功, <c>false</c> 导入失败.</returns>
        /// <param name="iImportDir">导入路径.</param>
        /// <param name="iForceClear">强制清空.</param>
        public virtual bool ImportFromJsonFile(string iImportDir, bool iForceClear = true)
        {
            string importDir = iImportDir;

            if (true == string.IsNullOrEmpty(iImportDir))
            {
                importDir = this.GetImportPath();
            }
            else
            {
                this.ImportJsonPath = iImportDir;
            }
            bool fileExistFlg = false;
            T2   jsonData     = UtilsAsset.ImportDataByDir <T2> (out fileExistFlg, importDir);

            if (jsonData != null)
            {
                this.ApplyData(jsonData, iForceClear);
                return(true);
            }
            // 文件不存在则,视为导入成功
            if (false == fileExistFlg)
            {
                this.Init();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 从JSON文件,导入打包配置信息.
        /// </summary>
        /// <returns><c>true</c>, 导入成功, <c>false</c> 导入失败.</returns>
        /// <param name="iImportDir">导入路径.</param>
        /// <param name="iForceClear">强制清空.</param>
        public virtual bool ImportFromJsonFile(string iImportDir, bool iForceClear = true)
        {
            string importDir = iImportDir;

            if (true == string.IsNullOrEmpty(iImportDir))
            {
                importDir = this.JsonPath;
            }
            bool fileExistFlg = false;
            T1   jsonData     = UtilsAsset.ImportDataByDir <T1> (out fileExistFlg, importDir);

            if (jsonData != null)
            {
                this.ApplyImportData(jsonData, iForceClear);
                return(true);
            }
            return(false);
        }