Beispiel #1
0
 private InterpreterConfiguration(IReadOnlyDictionary <string, object> properties)
 {
     Id                      = Read(properties, nameof(Id));
     _description            = Read(properties, nameof(Description)) ?? "";
     InterpreterPath         = Read(properties, nameof(InterpreterPath));
     PathEnvironmentVariable = Read(properties, nameof(PathEnvironmentVariable));
     LibraryPath             = Read(properties, nameof(LibraryPath));
     Architecture            = InterpreterArchitecture.TryParse(Read(properties, nameof(Architecture)));
     try {
         Version = Version.Parse(Read(properties, nameof(Version)));
     } catch (Exception ex) when(ex is ArgumentException || ex is FormatException)
     {
         Version = new Version();
     }
     if (properties.TryGetValue(nameof(SearchPaths), out object o))
     {
         var sp = new List <string>();
         if (o is string s)
         {
             sp.AddRange(s.Split(';'));
         }
         else if (o is IEnumerable <string> ss)
         {
             sp.AddRange(ss);
         }
         SearchPaths = sp.ToArray();
     }
 }
Beispiel #2
0
 private InterpreterConfiguration(IReadOnlyDictionary <string, object> properties)
 {
     InterpreterPath         = Read(properties, nameof(InterpreterPath));
     PathEnvironmentVariable = Read(properties, nameof(PathEnvironmentVariable));
     LibraryPath             = Read(properties, nameof(LibraryPath));
     Architecture            = InterpreterArchitecture.TryParse(Read(properties, nameof(Architecture)));
     try {
         Version = Version.Parse(Read(properties, nameof(Version)));
     } catch (Exception ex) when(ex is ArgumentException || ex is FormatException)
     {
         Version = new Version();
     }
 }