コード例 #1
0
        public override void Launch(LaunchConfig config)
        {
            string toolPath;

            var foundConfig = config.Configs.FirstOrDefault((item) => item.Type == ConfigType.windbg);

            if (foundConfig == null)
            {
                toolPath = RuntimeInfo.Inst.GetToolPath(ToolName);

                if (!File.Exists(toolPath))
                {
                    ErrorLog.Inst.ShowError("Unable to find Windbg at Path {0}", toolPath);
                    return;
                }
            }
            else
            {
                //means use local path
                if (Tool.Name.Contains("-32Bit"))
                {
                    toolPath = string.Format("{0}\\x86\\windbg.exe", ResolveValue.Inst.ResolveFullPath(foundConfig.InstallPath));
                }
                else
                {
                    toolPath = string.Format("{0}\\x64\\windbg.exe", ResolveValue.Inst.ResolveFullPath(foundConfig.InstallPath));
                }

                if (foundConfig.Envs == null)
                {
                    foundConfig.Envs = new List <EnviromentVariable>();
                }

                EnviromentVariable pathVar = new EnviromentVariable()
                {
                    Name = "PATH", Value = Path.GetDirectoryName(toolPath)
                };
                foundConfig.Envs.Add(pathVar);
                //var foundVar = foundConfig.Envs.FirstOrDefault((item) => string.Compare(item.Name, "Scripts", true) == 0);

                //if(foundVar != null)
                //{
                //    string scriptFolder = ResolveValue.Inst.ResolveFullPath(foundVar.Value);
                //    DynamicArgument = string.Format("-c\".cmdtree {0}\\cmdtree_default.txt\"", scriptFolder);
                //}
            }

            DynamicEditor = toolPath;

            base.Launch(config);
        }
コード例 #2
0
        public void Should_Env_Config_XML_Serializable()
        {
            IEnviromentVariables eVariables       = null;
            IEnviromentVariables currentVariables = null;

            currentVariables = _configuration.EnviromentVariables;
            try
            {
                Serialize(_configuration.EnviromentVariables);
                Deserialize(out eVariables);
            } catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
            if (eVariables != null)
            {
                IEnumerator it = eVariables.GetEnumerator();
                do
                {
                    EnviromentVariable ev = (EnviromentVariable)it.Current;
                    Assert.True(currentVariables.IsSet(ev.Config, ev.Key));
                } while (it.MoveNext());
            }
        }