Exemple #1
0
 public void AddTool(float toolID)
 {
     if (!ToolIsAvailable(toolID))
     {
         AvailableTools.Add(toolID);
     }
 }
        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 (AvailableTools == null)
            {
                AvailableTools = new List <Tool>();
            }

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

                newValue      = ResolveValue.Inst.ResolveFullPath(item.ToolPath);
                item.ToolPath = newValue;

                Tool addTool = null;

                if (item.Type == ToolType.RegularApp)
                {
                    if (File.Exists(item.Path))
                    {
                        addTool = item;
                    }
                }
                else
                {
                    addTool = item;
                }

                if (addTool != null)
                {
                    //if editor is not explicitly defined then assume tool name and editor name is same
                    if (string.IsNullOrWhiteSpace(addTool.Editor))
                    {
                        addTool.Editor = addTool.Name;
                    }
                    AvailableTools.Add(addTool);
                }
            }
        }