예제 #1
0
 void ConfigurationExtension_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) {
     var view = e.NewValue as EnvironmentView;
     if (view != null) {
         var current = Subcontext.DataContext as ConfigurationEnvironmentView;
         if (current == null || current.EnvironmentView != view) {
             var cev = new ConfigurationEnvironmentView(view);
             _provider.ResetConfiguration(cev);
             Subcontext.DataContext = cev;
         }
     }
 }
예제 #2
0
        public bool IsConfigurationChanged(ConfigurationEnvironmentView view)
        {
            if (_alwaysCreateNew)
            {
                return(true);
            }

            var factory = view.EnvironmentView.Factory;

            return(view.Description != factory.Configuration.Description ||
                   view.PrefixPath != factory.Configuration.GetPrefixPath() ||
                   view.InterpreterPath != factory.Configuration.InterpreterPath ||
                   view.WindowsInterpreterPath != factory.Configuration.GetWindowsInterpreterPath() ||
                   view.PathEnvironmentVariable != factory.Configuration.PathEnvironmentVariable ||
                   InterpreterArchitecture.TryParse(view.ArchitectureName) != factory.Configuration.Architecture ||
                   view.VersionName != factory.Configuration.Version.ToString());
        }
예제 #3
0
        public void ApplyConfiguration(ConfigurationEnvironmentView view)
        {
            var factory = view.EnvironmentView.Factory;

            if (view.Description != factory.Configuration.Description)
            {
                // We're renaming the interpreter, remove the old one...
                _interpreterOptions.RemoveConfigurableInterpreter(factory.Configuration.Id);
            }

            var newInterp = _interpreterOptions.AddConfigurableInterpreter(
                view.Description,
                new InterpreterConfiguration(
                    "",
                    view.Description,
                    view.PrefixPath,
                    view.InterpreterPath,
                    view.WindowsInterpreterPath,
                    view.PathEnvironmentVariable,
                    InterpreterArchitecture.TryParse(view.ArchitectureName),
                    Version.Parse(view.VersionName)
                    )
                );
        }
예제 #4
0
        public void RemoveConfiguration(ConfigurationEnvironmentView view)
        {
            var factory = view.EnvironmentView.Factory;

            _factoryProvider.RemoveInterpreter(factory.Id);
        }
예제 #5
0
 public void RemoveConfiguration(ConfigurationEnvironmentView view) {
     var factory = view.EnvironmentView.Factory;
     _interpreterOptions.RemoveConfigurableInterpreter(factory.Configuration.Id);
 }
예제 #6
0
 public void ResetConfiguration(ConfigurationEnvironmentView view) {
     var factory = view.EnvironmentView.Factory;
     view.Description = factory.Configuration.Description;
     view.PrefixPath = factory.Configuration.PrefixPath;
     view.InterpreterPath = factory.Configuration.InterpreterPath;
     view.WindowsInterpreterPath = factory.Configuration.WindowsInterpreterPath;
     view.PathEnvironmentVariable = factory.Configuration.PathEnvironmentVariable;
     view.ArchitectureName = factory.Configuration.Architecture.ToString();
     view.VersionName = factory.Configuration.Version.ToString();
 }
예제 #7
0
 public bool IsConfigurationChanged(ConfigurationEnvironmentView view) {
     var factory = view.EnvironmentView.Factory;
     return view.Description != factory.Configuration.Description ||
         view.PrefixPath != factory.Configuration.PrefixPath ||
         view.InterpreterPath != factory.Configuration.InterpreterPath ||
         view.WindowsInterpreterPath != factory.Configuration.WindowsInterpreterPath ||
         view.PathEnvironmentVariable != factory.Configuration.PathEnvironmentVariable ||
         InterpreterArchitecture.TryParse(view.ArchitectureName) != factory.Configuration.Architecture ||
         view.VersionName != factory.Configuration.Version.ToString();
 }
예제 #8
0
        public void ApplyConfiguration(ConfigurationEnvironmentView view) {
            var factory = view.EnvironmentView.Factory;
            if (view.Description != factory.Configuration.Description) {
                // We're renaming the interpreter, remove the old one...
                _interpreterOptions.RemoveConfigurableInterpreter(factory.Configuration.Id);
            }

            var newInterp = _interpreterOptions.AddConfigurableInterpreter(
                view.Description,
                new InterpreterConfiguration(
                    "",
                    view.Description,
                    view.PrefixPath,
                    view.InterpreterPath,
                    view.WindowsInterpreterPath,
                    view.PathEnvironmentVariable,
                    InterpreterArchitecture.TryParse(view.ArchitectureName),
                    Version.Parse(view.VersionName)
                )
            );
        }
예제 #9
0
        public void RemoveConfiguration(ConfigurationEnvironmentView view)
        {
            var factory = view.EnvironmentView.Factory;

            _interpreterOptions.RemoveConfigurableInterpreter(factory.Configuration.Id);
        }
예제 #10
0
 public void RemoveConfiguration(ConfigurationEnvironmentView view) {
     var factory = view.EnvironmentView.Factory;
     _factoryProvider.RemoveInterpreter(factory.Id);
 }
예제 #11
0
 public void ResetConfiguration(ConfigurationEnvironmentView view) {
     var factory = view.EnvironmentView.Factory;
     view.Description = factory.Description;
     view.PrefixPath = factory.Configuration.PrefixPath;
     view.InterpreterPath = factory.Configuration.InterpreterPath;
     view.WindowsInterpreterPath = factory.Configuration.WindowsInterpreterPath;
     view.LibraryPath = factory.Configuration.LibraryPath;
     view.PathEnvironmentVariable = factory.Configuration.PathEnvironmentVariable;
     view.ArchitectureName = factory.Configuration.Architecture == ProcessorArchitecture.Amd64 ? "64-bit" : "32-bit";
     view.VersionName = factory.Configuration.Version.ToString();
 }
예제 #12
0
 public bool IsConfigurationChanged(ConfigurationEnvironmentView view) {
     var factory = view.EnvironmentView.Factory;
     var arch = factory.Configuration.Architecture == ProcessorArchitecture.Amd64 ? "64-bit" : "32-bit";
     return view.Description != factory.Description ||
         view.PrefixPath != factory.Configuration.PrefixPath ||
         view.InterpreterPath != factory.Configuration.InterpreterPath ||
         view.WindowsInterpreterPath != factory.Configuration.WindowsInterpreterPath ||
         view.LibraryPath != factory.Configuration.LibraryPath ||
         view.PathEnvironmentVariable != factory.Configuration.PathEnvironmentVariable ||
         view.ArchitectureName != arch ||
         view.VersionName != factory.Configuration.Version.ToString();
 }
예제 #13
0
 public void ApplyConfiguration(ConfigurationEnvironmentView view) {
     _factoryProvider.SetOptions(new InterpreterFactoryCreationOptions {
         Id = view.EnvironmentView.Factory.Id,
         Description = view.Description,
         PrefixPath = view.PrefixPath,
         InterpreterPath = view.InterpreterPath,
         WindowInterpreterPath = view.WindowsInterpreterPath,
         LibraryPath = view.LibraryPath,
         PathEnvironmentVariableName = view.PathEnvironmentVariable,
         Architecture = view.ArchitectureName == "64-bit" ? ProcessorArchitecture.Amd64 : ProcessorArchitecture.X86,
         LanguageVersionString = view.VersionName
     });
 }
예제 #14
0
        public void RemoveConfiguration(ConfigurationEnvironmentView view) {
            if (_alwaysCreateNew) {
                return;
            }

            var factory = view.EnvironmentView.Factory;
            _interpreterOptions.RemoveConfigurableInterpreter(factory.Configuration.Id);
        }
예제 #15
0
 public bool CanApply(ConfigurationEnvironmentView view) {
     if (string.IsNullOrEmpty(view.Description) || string.IsNullOrEmpty(view.InterpreterPath)) {
         return false;
     }
     return true;
 }
예제 #16
0
        public string ApplyConfiguration(ConfigurationEnvironmentView view) {
            if (!_alwaysCreateNew) {
                var factory = view.EnvironmentView.Factory;
                if (view.Description != factory.Configuration.Description) {
                    // We're renaming the interpreter, remove the old one...
                    _interpreterOptions.RemoveConfigurableInterpreter(factory.Configuration.Id);
                }
            }

            Version version;
            if (!Version.TryParse(view.VersionName, out version)) {
                version = null;
            }

            return _interpreterOptions.AddConfigurableInterpreter(
                view.Description,
                new InterpreterConfiguration(
                    "",
                    view.Description,
                    view.PrefixPath,
                    view.InterpreterPath,
                    view.WindowsInterpreterPath,
                    view.PathEnvironmentVariable,
                    InterpreterArchitecture.TryParse(view.ArchitectureName ?? ""),
                    version
                )
            );
        }