Exemple #1
0
        /// <summary>载入配置文件</summary>
        private IndexSubmissionConfig LoadConfig(string configFile = null)
        {
            if (configFile.IsNullOrEmpty())
            {
                if (this.ConfigFile.IsNullOrEmpty())
                {
                    configFile = this.DefaultConfigFile;
                }
                else
                {
                    configFile = this.ConfigFile;
                }
            }
            IndexSubmissionConfig config = null;

            if (File.Exists(configFile))
            {
                config = configFile.XmlDeserialize <IndexSubmissionConfig>();
            }
            if (config == null)
            {
                config = new IndexSubmissionConfig();
            }
            config.Load();
            AddBuildInVariables(config, config.Variables);
            this.ConfigFile = configFile;
            return(config);
        }
Exemple #2
0
 /// <summary>加入内置变量</summary>
 private void AddBuildInVariables(IndexSubmissionConfig config, List <XmlVariable> variables)
 {
     AddBuildInVariable(variables, SubmissionConsts.ToolName, "本工具名称", PKSWebConsts.GetSubSystemCode());
     AddBuildInVariable(variables, SubmissionConsts.Guid, "自动生成唯一值", string.Empty, new GuidValueProvider());
     AddBuildInVariable(variables, SubmissionConsts.UserName, "用户名称", config.ApiService.UserName);
     AddBuildInVariable(variables, SubmissionConsts.WebApiUrl, "WebAPI站点URL", config.ApiService.Url);
     AddBuildInVariable(variables, SubmissionConsts.ProductFolder, "成果文件夹", config.Product.Folder);
     AddBuildInVariable(variables, SubmissionConsts.ExcelFileName, "Excel文件名", Path.GetFileNameWithoutExtension(config.Product.ExcelFile));
     AddBuildInVariable(variables, SubmissionConsts.ShowType, "扩展名自动生成", string.Empty, new ExtToIndexDataTypeValueProvider());
     AddBuildInVariable(variables, SubmissionConsts.ProductFileName, "成果文件名(无扩展名)", string.Empty, new FileNameValueProvider());
 }