Example #1
0
        private static void CacheTools()
        {
            _byName   = new SortedDictionary <string, AnalysisTool>();
            _byProgId = new SortedDictionary <string, List <AnalysisTool> >();

            var analysisToolKey = Registry.LocalMachine.OpenSubKey(@"Software\META\AnalysisTools");

            if (analysisToolKey != null)
            {
                foreach (string subkeyname in analysisToolKey.GetSubKeyNames())
                {
                    AnalysisTool analysistool = new AnalysisTool()
                    {
                        Name = subkeyname
                    };

                    var    subkey = analysisToolKey.OpenSubKey(subkeyname);
                    string value;
                    value = subkey.GetValue("InstallLocation") as string;
                    if (value != null)
                    {
                        analysistool.InstallLocation = value;
                    }

                    value = subkey.GetValue("Version") as string;
                    if (value != null)
                    {
                        analysistool.Version = value;
                    }

                    value = subkey.GetValue("OutputDirectory") as string;
                    if (value != null)
                    {
                        analysistool.OutputDirectory = value;
                    }

                    value = subkey.GetValue("RunCommand") as string;
                    if (value != null)
                    {
                        analysistool.RunCommand = value;
                    }

                    value = subkey.GetValue("RequiredInterpreter") as string;
                    if (value != null)
                    {
                        analysistool.RequiredInterpreter = value;
                    }

                    List <AnalysisTool> tools = new List <AnalysisTool>();
                    _byProgId.TryGetValue(analysistool.RequiredInterpreter, out tools);
                    if (tools == null)
                    {
                        tools = new List <AnalysisTool>();
                    }
                    tools.Add(analysistool);
                    _byProgId[analysistool.RequiredInterpreter] = tools;
                    _byName[analysistool.Name] = analysistool;
                }
            }
        }
Example #2
0
        public static AnalysisTool GetByName(string analysisToolName)
        {
            if (_byName == null)
            {
                CacheTools();
            }
            AnalysisTool result = null;

            if (analysisToolName != null)
            {
                _byName.TryGetValue(analysisToolName, out result);
            }
            return(result);
        }
        private static void CacheTools()
        {
            _byName = new SortedDictionary<string, AnalysisTool>();
            _byProgId = new SortedDictionary<string, List<AnalysisTool>>();

            var analysisToolKey = Registry.LocalMachine.OpenSubKey(@"Software\META\AnalysisTools");
            if (analysisToolKey != null)
            {
                foreach (string subkeyname in analysisToolKey.GetSubKeyNames())
                {
                    AnalysisTool analysistool = new AnalysisTool()
                        {
                            Name = subkeyname
                        };

                    var subkey = analysisToolKey.OpenSubKey(subkeyname);
                    string value;
                    value = subkey.GetValue("InstallLocation") as string;
                    if (value != null)
                    {
                        analysistool.InstallLocation = value;
                    }

                    value = subkey.GetValue("Version") as string;
                    if (value != null)
                    {
                        analysistool.Version = value;
                    }

                    value = subkey.GetValue("OutputDirectory") as string;
                    if (value != null)
                    {
                        analysistool.OutputDirectory = value;
                    }

                    value = subkey.GetValue("RunCommand") as string;
                    if (value != null)
                    {
                        analysistool.RunCommand = value;
                    }

                    value = subkey.GetValue("RequiredInterpreter") as string;
                    if (value != null)
                    {
                        analysistool.RequiredInterpreter = value;
                    }

                    List<AnalysisTool> tools = new List<AnalysisTool>();
                    _byProgId.TryGetValue(analysistool.RequiredInterpreter, out tools);
                    if (tools == null)
                    {
                        tools = new List<AnalysisTool>();
                    }
                    tools.Add(analysistool);
                    _byProgId[analysistool.RequiredInterpreter] = tools;
                    _byName[analysistool.Name] = analysistool;
                }
            }
        }