Esempio n. 1
0
        public bool Compile()
        {
            bool            successCompile       = true;
            ComplierMessage projectTemplateCheck = this.projectTemplate.IsSame();

            if (projectTemplateCheck.Success)
            {
                ComplierMessage configsCheck = this.projectConfigs.IsSuitClone();
                ComplierMessage compileCheck = projectTemplateCheck + configsCheck;
                if (compileCheck.Success)
                {
                    this.projectConfigs.CreateConfigFiles();
                }
                else
                {
                    successCompile = false;
                    compileCheck.PrintMessage();
                }
            }
            else
            {
                successCompile = false;
                projectTemplateCheck.PrintMessage();
            }
            return(successCompile);
        }
Esempio n. 2
0
        public ComplierMessage IsSuitClone()
        {
            ComplierMessage             result       = new ComplierMessage(true);
            Dictionary <string, string> replaceSigns = new Dictionary <string, string>();

            foreach (TplFile tplfile in this.TplFiles)
            {
                foreach (KeyValuePair <string, string> sign in tplfile.ReplaceSign)
                {
                    if (!replaceSigns.ContainsKey(sign.Key))
                    {
                        replaceSigns.Add(sign.Key, sign.Value);
                    }
                }
            }
            foreach (KeyValuePair <string, string> replaceSign in replaceSigns)
            {
                if (!this.currentEnvironment.NodePairs.ContainsKey(replaceSign.Value))
                {
                    result.Success = false;
                    result.ComplierMsg.Add(string.Format("{0}:缺少节点{1},资源标识{2}", this.currentEnvironment.EnvironmentName, replaceSign.Value, replaceSign.Key));
                }
            }
            return(result);
        }
Esempio n. 3
0
        public static ComplierMessage operator +(ComplierMessage a, ComplierMessage b)
        {
            ComplierMessage newComplierMessage = new ComplierMessage(a.success && b.success);

            newComplierMessage.complierMsg.AddRange(a.complierMsg);
            newComplierMessage.complierMsg.AddRange(b.complierMsg);
            return(newComplierMessage);
        }
Esempio n. 4
0
        public ComplierMessage IsSame()
        {
            ComplierMessage     result = new ComplierMessage(true);
            TemplateEnvironment currentEnvironmentTemplate = (from template in this.Environments
                                                              where template.EnvironmentName.Equals(this.currentEnvironment)
                                                              select template).First <TemplateEnvironment>();

            foreach (TemplateEnvironment environmentTemplate in this.Environments)
            {
                if (!currentEnvironmentTemplate.Equals(environmentTemplate))
                {
                    result.Success = false;
                    result.ComplierMsg.AddRange(this.PrintDifference(currentEnvironmentTemplate, environmentTemplate));
                }
            }
            return(result);
        }