Esempio n. 1
0
        public void ProcessRuntimeInfo()
        {
            AutoDetectToolPath();


            if (Envs != null)
            {
                foreach (var item in Envs)
                {
                    string currentValue = Environment.GetEnvironmentVariable(item.Name);
                    if (!string.IsNullOrWhiteSpace(currentValue))
                    {
                        switch (item.Action)
                        {
                        case EnvironmentAction.Overwrite:
                        {
                            string newValue = ResolveValue.Inst.ResolveEnvironmentValue(item.Type, item.Value);
                            Environment.SetEnvironmentVariable(item.Name, newValue, EnvironmentVariableTarget.Process);
                        }
                        break;

                        case EnvironmentAction.Prefix:
                        {
                            string newValue = ResolveValue.Inst.ResolveEnvironmentValue(item.Type, item.Value) + ";" + currentValue;
                            Environment.SetEnvironmentVariable(item.Name, newValue, EnvironmentVariableTarget.Process);
                        }
                        break;

                        case EnvironmentAction.Append:
                        {
                            string newValue = currentValue + ";" + ResolveValue.Inst.ResolveEnvironmentValue(item.Type, item.Value);
                            Environment.SetEnvironmentVariable(item.Name, newValue, EnvironmentVariableTarget.Process);
                        }
                        break;
                        }
                    }
                    else
                    {
                        string newValue = ResolveValue.Inst.ResolveEnvironmentValue(item.Type, item.Value);
                        Environment.SetEnvironmentVariable(item.Name, newValue, EnvironmentVariableTarget.Process);
                    }
                }
            }

            if (ToolPath == null)
            {
                ToolPath = new List <Tool>();
            }

            //merge tool bar
            if (ToolBar != null)
            {
                foreach (var item in ToolBar)
                {
                    ToolPath.AddRange(item.Group);
                }
            }

            //merge editors to tool path
            if (MenuBar != null)
            {
                foreach (var item in MenuBar)
                {
                    if (item.Tools != null)
                    {
                        ToolPath.AddRange(item.Tools);
                    }
                }
            }

            foreach (var item in ToolPath)
            {
                string newValue = ResolveValue.Inst.ResolveFullPath(item.Path);
                item.Path = newValue;

                newValue     = ResolveValue.Inst.ResolveFullPath(item.BaseDir);
                item.BaseDir = newValue;
            }
        }