Esempio n. 1
0
 public CefCommands(PackageLoader loader, DynamoModel model)
 {
     this.ProductName = !string.IsNullOrEmpty(model.HostName) ? model.HostName : "Dynamo"; 
     this.Loader = loader;
     this.Model = model;
     this.Client = new DynamoPackagesUIClient();
 }
 public InstalledPackagesViewModel(DynamoViewModel dynamoViewModel, PackageLoader model)
 {
     this.Model = model;
     this.dynamoViewModel = dynamoViewModel;
     
     InitializeLocalPackages();
 }
Esempio n. 3
0
 public void LoadPackagesReturnsNoPackagesForInvalidDirectory()
 {
     var pkgDir = Path.Combine(PackagesDirectory, "No directory");
     var loader = new PackageLoader(ViewModel.Model, pkgDir);
     loader.LoadPackages();
     Assert.AreEqual(0, loader.LocalPackages.Count);
 }
Esempio n. 4
0
 public void LoadPackagesReturnsNoPackagesForInvalidDirectory()
 {
     var pkgDir = Path.Combine(PackagesDirectory, "No directory");
     var loader = new PackageLoader(ViewModel.Model.Loader, ViewModel.Model.Logger, pkgDir);
     loader.LoadPackagesIntoDynamo(ViewModel.Model.PreferenceSettings, ViewModel.Model.EngineController.LibraryServices);
     Assert.AreEqual(0, loader.LocalPackages.Count);
 }
Esempio n. 5
0
        public void LoadPackagesReturnsAllValidPackagesInValidDirectory()
        {
            var loader = new PackageLoader(ViewModel.Model.Loader, ViewModel.Model.Logger);
            loader.LoadPackagesIntoDynamo(ViewModel.Model.PreferenceSettings, ViewModel.Model.EngineController.LibraryServices);

            Assert.AreEqual(1, loader.LocalPackages.Count);
        }
Esempio n. 6
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dynamoViewModel"></param>
        /// <param name="model"></param>
        /// <param name="address"></param>
        public PackageManagerViewModel(PackageLoader loader, DynamoModel model, string address)
        {
            PkgMgrCommands = new PackageManagerCommands(loader, model);

            var path = this.GetType().Assembly.Location;
            var config = ConfigurationManager.OpenExeConfiguration(path);
            this.Address = PACKAGE_MANAGER_URL + "/#/" + address;
        }
Esempio n. 7
0
 public PublishCommands(PackageLoader loader, DynamoModel model) 
 {
     fileCompressor = new MutatingFileCompressor();
     //customNodeDefinitions = new List<CustomNodeDefinition>();
     //Dependencies = new List<PackageDependency>();
     //Assemblies = new List<PackageAssembly>();
     //PackageAssemblyNodes = new List<TypeLoadData>();
     //FilesToUpload = new List<string>();
 }
 public void GetOwnerPackageReturnsNullForInvalidFunction()
 {
     var loader = new PackageLoader(PackagesDirectory);
     var info = dynSettings.CustomNodeManager.AddFileToPath(
         Path.Combine(new string[] {GetTestDirectory(), "core", "combine", "combine2.dyf"}));
     var funcDef = dynSettings.CustomNodeManager.GetFunctionDefinition(info.Guid);
     Assert.IsNotNull(funcDef);
     var foundPkg = loader.GetOwnerPackage(funcDef);
     Assert.IsNull(foundPkg);
 }
Esempio n. 9
0
        public PackagePathViewModel(PackageLoader loader, LoadPackageParams loadParams, CustomNodeManager customNodeManager)
        {
            this.packageLoader = loader;
            this.loadPackageParams = loadParams;
            this.customNodeManager = customNodeManager;
            RootLocations = new ObservableCollection<string>(setting.CustomPackageFolders);

            AddPathCommand = new DelegateCommand(p => InsertPath());
            DeletePathCommand = new DelegateCommand(p => RemovePathAt((int) p), CanDelete);
            MovePathUpCommand = new DelegateCommand(p => SwapPath((int) p, ((int) p) - 1), CanMoveUp);
            MovePathDownCommand = new DelegateCommand(p => SwapPath((int) p, ((int) p) + 1), CanMoveDown);
            UpdatePathCommand = new DelegateCommand(p => UpdatePathAt((int) p));
            SaveSettingCommand = new DelegateCommand(CommitChanges);

            SelectedIndex = 0;
        }
Esempio n. 10
0
        public void ScanPackageDirectoryReturnsPackageForValidDirectory()
        {
            var pkgDir = Path.Combine(PackagesDirectory, "Custom Rounding");
            var loader = new PackageLoader();
            var pkg = loader.ScanPackageDirectory(pkgDir);

            Assert.IsNotNull(pkg);
            Assert.AreEqual("CAAD_RWTH", pkg.Group);
            Assert.AreEqual("Custom Rounding", pkg.Name);
            Assert.AreEqual("0.1.4", pkg.VersionName);
            Assert.AreEqual("This collection of nodes allows rounding, rounding up and rounding down to a specified precision.", pkg.Description);
            Assert.AreEqual("Round Up To Precision - Rounds a number *up* to a specified precision, Round Down To Precision - " 
                + "Rounds a number *down* to a specified precision, Round To Precision - Rounds a number to a specified precision", pkg.Contents);
            Assert.AreEqual("0.5.2.10107", pkg.EngineVersion);
            pkg.Load();
            Assert.AreEqual(3, pkg.LoadedCustomNodes.Count);
        }
Esempio n. 11
0
        /// <summary>
        ///     Validate the package manager url and initialize the PackageManagerClient object
        /// </summary>
        public void Startup(StartupParams startupParams)
        {
            var    path   = this.GetType().Assembly.Location;
            var    config = ConfigurationManager.OpenExeConfiguration(path);
            var    key    = config.AppSettings.Settings["packageManagerAddress"];
            string url    = null;

            if (key != null)
            {
                url = key.Value;
            }

            OnMessageLogged(LogMessage.Info("Dynamo will use the package manager server at : " + url));

            if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
            {
                throw new ArgumentException("Incorrectly formatted URL provided for Package Manager address.", "url");
            }

            PackageLoader = new PackageLoader(startupParams.PathManager.PackagesDirectories);
            PackageLoader.MessageLogged          += OnMessageLogged;
            RequestLoadNodeLibraryHandler         = startupParams.LibraryLoader.LoadNodeLibrary;
            RequestLoadCustomNodeDirectoryHandler = (dir) => startupParams.CustomNodeManager
                                                    .AddUninitializedCustomNodesInPath(dir, DynamoModel.IsTestMode, true);

            //raise the public events on this extension when the package loader requests.
            PackageLoader.RequestLoadExtension += RequestLoadExtension;
            PackageLoader.RequestAddExtension  += RequestAddExtension;

            PackageLoader.RequestLoadNodeLibrary         += RequestLoadNodeLibraryHandler;
            PackageLoader.RequestLoadCustomNodeDirectory += RequestLoadCustomNodeDirectoryHandler;

            var dirBuilder = new PackageDirectoryBuilder(
                new MutatingFileSystem(),
                new CustomNodePathRemapper(startupParams.CustomNodeManager, DynamoModel.IsTestMode));

            PackageUploadBuilder.SetEngineVersion(startupParams.DynamoVersion);
            var uploadBuilder = new PackageUploadBuilder(dirBuilder, new MutatingFileCompressor());

            PackageManagerClient = new PackageManagerClient(
                new GregClient(startupParams.AuthProvider, url),
                uploadBuilder, PackageLoader.DefaultPackagesDirectory);

            LoadPackages(startupParams.Preferences, startupParams.PathManager);
        }
        public void NewPackageVersionUpload_DoesNotThrowExceptionWhenDLLIsLoadedSeveralTimes()
        {
            string packagesDirectory = Path.Combine(TestDirectory, "pkgs");

            var loader = new PackageLoader(packagesDirectory);
            loader.LoadAll(new LoadPackageParams
            {
                Preferences = ViewModel.Model.PreferenceSettings
            });

            PublishPackageViewModel vm = null;
            Assert.DoesNotThrow(() =>
            {
                vm = PublishPackageViewModel.FromLocalPackage(ViewModel, loader.LocalPackages.First());
            });

            Assert.AreEqual(PackageUploadHandle.State.Error, vm.UploadState);
        }
Esempio n. 13
0
        private void AddDllFile(string filename)
        {
            try
            {
                Assembly assem;

                // we're not sure if this is a managed assembly or not
                // we try to load it, if it fails - we add it as an additional file
                var result = PackageLoader.TryLoadFrom(filename, out assem);
                if (result)
                {
                    var assemName = assem.GetName().Name;

                    // The user has attempted to load an existing dll from another path. This is not allowed
                    // as the existing assembly cannot be modified while Dynamo is active.
                    if (this.Assemblies.Any(x => assemName == x.Assembly.GetName().Name))
                    {
                        MessageBox.Show(string.Format(Resources.PackageDuplicateAssemblyWarning,
                                                      dynamoViewModel.BrandingResourceProvider.ProductName),
                                        Resources.PackageDuplicateAssemblyWarningTitle,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Stop);
                        return; // skip loading assembly
                    }

                    Assemblies.Add(new PackageAssembly()
                    {
                        Assembly      = assem,
                        IsNodeLibrary = true // assume is node library when first added
                    });
                    RaisePropertyChanged("PackageContents");
                }
                else
                {
                    AddAdditionalFile(filename);
                }
            }
            catch (Exception e)
            {
                UploadState = PackageUploadHandle.State.Error;
                ErrorString = String.Format(Resources.MessageFailedToAddFile, filename);
                dynamoViewModel.Model.Logger.Log(e);
            }
        }
        public void GetOwnerPackageReturnsPackageForValidFunctionDefinition()
        {
            var loader = new PackageLoader(PackagesDirectory);
            loader.LoadPackages();
            var pkg = loader.LocalPackages.FirstOrDefault(x => x.Name == "Custom Rounding");
            Assert.AreEqual(3, pkg.LoadedCustomNodes.Count );

            foreach (var nodeInfo in pkg.LoadedCustomNodes)
            {
                var funcDef = dynSettings.CustomNodeManager.GetFunctionDefinition(nodeInfo.Guid);
                Assert.IsNotNull(funcDef);

                var foundPkg = loader.GetOwnerPackage(funcDef);

                Assert.IsNotNull(foundPkg);
                Assert.AreEqual(pkg.Name, foundPkg.Name);
                Assert.IsTrue(pkg.Name == foundPkg.Name);
            }
        }
Esempio n. 15
0
        /// <summary>
        ///     Enumerates all assemblies in the package
        /// </summary>
        /// <returns>The list of all node library assemblies</returns>
        internal IEnumerable <PackageAssembly> EnumerateAssembliesInBinDirectory()
        {
            var assemblies = new List <PackageAssembly>();

            if (!Directory.Exists(BinaryDirectory))
            {
                return(assemblies);
            }

            // Use the pkg header to determine which assemblies to load and prevent multiple enumeration
            // In earlier packages, this field could be null, which is correctly handled by IsNodeLibrary
            var nodeLibraries = Header.node_libraries;

            foreach (var assemFile in (new System.IO.DirectoryInfo(BinaryDirectory)).EnumerateFiles("*.dll"))
            {
                Assembly assem;

                // dll files may be un-managed, skip those
                var result = PackageLoader.TryLoadFrom(assemFile.FullName, out assem);
                if (result)
                {
                    // IsNodeLibrary may fail, we store the warnings here and then show
                    IList <ILogMessage> warnings = new List <ILogMessage>();

                    assemblies.Add(new PackageAssembly()
                    {
                        Assembly      = assem,
                        IsNodeLibrary = IsNodeLibrary(nodeLibraries, assem.GetName(), ref warnings)
                    });

                    warnings.ToList().ForEach(this.Log);
                }
            }

            foreach (var assem in assemblies)
            {
                LoadedAssemblies.Add(assem);
            }

            return(assemblies);
        }
Esempio n. 16
0
        internal void UninstallCore(CustomNodeManager customNodeManager, PackageLoader packageLoader, IPreferences prefs, ILogger logger)
        {
            if (this.LoadedAssemblies.Any())
            {
                this.MarkForUninstall(prefs);
                return;
            }

            try
            {
                LoadedCustomNodes.ToList().ForEach(x => customNodeManager.RemoveFromDynamo(x.Guid));
                packageLoader.LocalPackages.Remove(this);
                Directory.Delete(this.RootDirectory, true);
            }
            catch (Exception e)
            {
                logger.Log("Exception when attempting to uninstall the package " + this.Name + " from " + this.RootDirectory);
                logger.Log(e.GetType() + ": " + e.Message);
                throw e;
            }
        }
Esempio n. 17
0
        internal void UninstallCore(CustomNodeManager customNodeManager, PackageLoader packageLoader, IPreferences prefs)
        {
            if (LoadedAssemblies.Any())
            {
                MarkForUninstall(prefs);
                return;
            }

            try
            {
                LoadedCustomNodes.ToList().ForEach(x => customNodeManager.Remove(x.FunctionId));
                packageLoader.Remove(this);
                Directory.Delete(RootDirectory, true);
            }
            catch (Exception e)
            {
                Log("Exception when attempting to uninstall the package " + Name + " from " + RootDirectory);
                Log(e.GetType() + ": " + e.Message);
                throw;
            }
        }
Esempio n. 18
0
        /// <summary>
        ///     Validate the package manager url and initialize the PackageManagerClient object
        /// </summary>
        public void Startup(StartupParams startupParams)
        {
            var path = this.GetType().Assembly.Location;
            var config = ConfigurationManager.OpenExeConfiguration(path);
            var key = config.AppSettings.Settings["packageManagerAddress"];
            string url = null;
            if (key != null)
            {
                url = key.Value;
            }

            OnMessageLogged(LogMessage.Info("Dynamo will use the package manager server at : " + url));

            if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
            {
                throw new ArgumentException("Incorrectly formatted URL provided for Package Manager address.", "url");
            }

            PackageLoader = new PackageLoader(startupParams.PathManager.PackagesDirectories);
            PackageLoader.MessageLogged += OnMessageLogged;
            RequestLoadNodeLibraryHandler = startupParams.LibraryLoader.LoadNodeLibrary;
            RequestLoadCustomNodeDirectoryHandler = (dir) => startupParams.CustomNodeManager
                    .AddUninitializedCustomNodesInPath(dir, DynamoModel.IsTestMode, true);

            PackageLoader.RequestLoadNodeLibrary += RequestLoadNodeLibraryHandler;
            PackageLoader.RequestLoadCustomNodeDirectory += RequestLoadCustomNodeDirectoryHandler;
                
            var dirBuilder = new PackageDirectoryBuilder(
                new MutatingFileSystem(),
                new CustomNodePathRemapper(startupParams.CustomNodeManager, DynamoModel.IsTestMode));

            PackageUploadBuilder.SetEngineVersion(startupParams.DynamoVersion);
            var uploadBuilder = new PackageUploadBuilder(dirBuilder, new MutatingFileCompressor());

            PackageManagerClient = new PackageManagerClient(
                new GregClient(startupParams.AuthProvider, url),
                uploadBuilder, PackageLoader.DefaultPackagesDirectory);

            LoadPackages(startupParams.Preferences, startupParams.PathManager);
        }
Esempio n. 19
0
        public void GetOwnerPackageReturnsPackageForValidFunctionDefinition()
        {
            //Assert.Inconclusive("Porting : Formula");

            var loader = new PackageLoader(ViewModel.Model.Loader, ViewModel.Model.Logger, PackagesDirectory);
            loader.LoadPackagesIntoDynamo(ViewModel.Model.PreferenceSettings, ViewModel.Model.EngineController.LibraryServices);
            var pkg = loader.LocalPackages.FirstOrDefault(x => x.Name == "Custom Rounding");
            Assert.AreEqual(3, pkg.LoadedCustomNodes.Count);

            foreach (var nodeInfo in pkg.LoadedCustomNodes)
            {
                var funcDef = ViewModel.Model.CustomNodeManager.GetFunctionDefinition(nodeInfo.Guid);
                Assert.IsNotNull(funcDef);

                var foundPkg = loader.GetOwnerPackage(funcDef);

                Assert.IsNotNull(foundPkg);
                Assert.AreEqual(pkg.Name, foundPkg.Name);
                Assert.IsTrue(pkg.Name == foundPkg.Name);
            }
        
        }
Esempio n. 20
0
        internal void UninstallCore(CustomNodeManager customNodeManager, PackageLoader packageLoader, IPreferences prefs)
        {
            if (LoadedAssemblies.Any())
            {
                MarkForUninstall(prefs);
                return;
            }

            try
            {
                LoadedCustomNodes.ToList().ForEach(x => customNodeManager.Remove(x.FunctionId));
                if (BuiltInPackage)
                {
                    LoadState.SetAsUnloaded();
                    Analytics.TrackEvent(Actions.BuiltInPackageConflict, Categories.PackageManagerOperations, $"{Name } {versionName} set unloaded");

                    RaisePropertyChanged(nameof(LoadState));

                    if (!prefs.PackageDirectoriesToUninstall.Contains(RootDirectory))
                    {
                        prefs.PackageDirectoriesToUninstall.Add(RootDirectory);
                    }
                }
                else
                {
                    packageLoader.Remove(this);
                    Directory.Delete(RootDirectory, true);
                }
            }
            catch (Exception e)
            {
                Log("Exception when attempting to uninstall the package " + Name + " from " + RootDirectory);
                Log(e.GetType() + ": " + e.Message);
                throw;
            }
        }
Esempio n. 21
0
        private void AddDllFile(string filename)
        {
            try
            {
                Assembly assem;

                // we're not sure if this is a managed assembly or not
                // we try to load it, if it fails - we add it as an additional file
                var result = PackageLoader.TryLoadFrom(filename, out assem);
                if (result)
                {
                    this.Assemblies.Add(assem);
                    this.RaisePropertyChanged("PackageContents");
                }
                else
                {
                    AddAdditionalFile(filename);
                }
            }
            catch (Exception e)
            {
                this.dynamoViewModel.Model.Logger.Log(e);
            }
        }
Esempio n. 22
0
        public static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoViewModel, Package l)
        {
            var defs = new List <CustomNodeDefinition>();

            foreach (var x in l.LoadedCustomNodes)
            {
                CustomNodeDefinition def;
                if (dynamoViewModel.Model.CustomNodeManager.TryGetFunctionDefinition(
                        x.FunctionId,
                        DynamoModel.IsTestMode,
                        out def))
                {
                    defs.Add(def);
                }
            }

            var vm = new PublishPackageViewModel(dynamoViewModel)
            {
                Group       = l.Group,
                Description = l.Description,
                Keywords    = l.Keywords != null?String.Join(" ", l.Keywords) : "",
                                  CustomNodeDefinitions = defs,
                                  Name          = l.Name,
                                  RepositoryUrl = l.RepositoryUrl ?? "",
                                  SiteUrl       = l.SiteUrl ?? "",
                                  Package       = l,
                                  License       = l.License
            };

            // add additional files
            l.EnumerateAdditionalFiles();
            foreach (var file in l.AdditionalFiles)
            {
                vm.AdditionalFiles.Add(file.Model.FullName);
            }

            var nodeLibraryNames = l.Header.node_libraries;

            // load assemblies into reflection only context
            foreach (var file in l.EnumerateAssemblyFilesInBinDirectory())
            {
                Assembly assem;
                var      result = PackageLoader.TryReflectionOnlyLoadFrom(file, out assem);

                if (result)
                {
                    var isNodeLibrary = nodeLibraryNames == null || nodeLibraryNames.Contains(assem.FullName);
                    vm.Assemblies.Add(new  PackageAssembly()
                    {
                        IsNodeLibrary = isNodeLibrary,
                        Assembly      = assem
                    });
                }
                else
                {
                    // if it's not a .NET assembly, we load it as an additional file
                    vm.AdditionalFiles.Add(file);
                }
            }

            if (l.VersionName == null)
            {
                return(vm);
            }

            var parts = l.VersionName.Split('.');

            if (parts.Count() != 3)
            {
                return(vm);
            }

            vm.MajorVersion = parts[0];
            vm.MinorVersion = parts[1];
            vm.BuildVersion = parts[2];
            return(vm);
        }
Esempio n. 23
0
 public void ScanPackageDirectoryReturnsNullForInvalidDirectory()
 {
     var pkgDir = "";
     var loader = new PackageLoader();
     var pkg = loader.ScanPackageDirectory(pkgDir);
 }
Esempio n. 24
0
        internal void UninstallCore( CustomNodeManager customNodeManager, PackageLoader packageLoader, IPreferences prefs, ILogger logger )
        {
            if (this.LoadedAssemblies.Any())
            {
                this.MarkForUninstall(prefs);
                return;
            }

            try
            {
                LoadedCustomNodes.ToList().ForEach(x => customNodeManager.RemoveFromDynamo(x.Guid));
                packageLoader.LocalPackages.Remove(this);
                Directory.Delete(this.RootDirectory, true);
            }
            catch (Exception e)
            {
                logger.Log("Exception when attempting to uninstall the package " + this.Name + " from " + this.RootDirectory);
                logger.Log(e.GetType() + ": " + e.Message);
                throw e;
            }
        }
Esempio n. 25
0
        /// <summary>
        ///     Validate the package manager url and initialize the PackageManagerClient object
        /// </summary>
        public void Startup(StartupParams startupParams)
        {
            var    path   = this.GetType().Assembly.Location;
            var    config = ConfigurationManager.OpenExeConfiguration(path);
            var    key    = config.AppSettings.Settings["packageManagerAddress"];
            string url    = null;

            if (key != null)
            {
                url = key.Value;
            }

            OnMessageLogged(LogMessage.Info("Dynamo will use the package manager server at : " + url));

            if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
            {
                throw new ArgumentException("Incorrectly formatted URL provided for Package Manager address.", "url");
            }

            //Initialize the PackageLoader with the CommonDataDirectory so that packages found here are checked first for dll's with signed certificates
            PackageLoader = new PackageLoader(startupParams.PathManager.PackagesDirectories, new [] { startupParams.PathManager.CommonDataDirectory });
            PackageLoader.MessageLogged  += OnMessageLogged;
            PackageLoader.PackgeLoaded   += OnPackageLoaded;
            PackageLoader.PackageRemoved += OnPackageRemoved;
            RequestLoadNodeLibraryHandler = (startupParams.LibraryLoader as ExtensionLibraryLoader).LoadLibraryAndSuppressZTSearchImport;
            //TODO: Add LoadPackages to ILibraryLoader interface in 3.0
            LoadPackagesHandler = (startupParams.LibraryLoader as ExtensionLibraryLoader).LoadPackages;
            customNodeManager   = (startupParams.CustomNodeManager as Core.CustomNodeManager);

            //TODO - in 3.0 we can add the other overload of AddUninitializedCustomNodesInPath to the ICustomNodeManager interface.
            RequestLoadCustomNodeDirectoryHandler = (dir, pkgInfo) => customNodeManager
                                                    .AddUninitializedCustomNodesInPath(dir, DynamoModel.IsTestMode, pkgInfo);

            //when the customNodeManager requests to know the owner of a customNode handle this query.
            customNodeManager.RequestCustomNodeOwner += handleCustomNodeOwnerQuery;

            //raise the public events on this extension when the package loader requests.
            PackageLoader.RequestLoadExtension           += RequestLoadExtension;
            PackageLoader.RequestAddExtension            += RequestAddExtension;
            PackageLoader.PackagesLoaded                 += LoadPackagesHandler;
            PackageLoader.RequestLoadNodeLibrary         += RequestLoadNodeLibraryHandler;
            PackageLoader.RequestLoadCustomNodeDirectory += RequestLoadCustomNodeDirectoryHandler;

            var dirBuilder = new PackageDirectoryBuilder(
                new MutatingFileSystem(),
                new CustomNodePathRemapper(startupParams.CustomNodeManager, DynamoModel.IsTestMode));

            PackageUploadBuilder.SetEngineVersion(startupParams.DynamoVersion);
            var uploadBuilder = new PackageUploadBuilder(dirBuilder, new MutatingFileCompressor());

            // Align the package upload directory with the package download directory -
            // either the one selected by the user or the default directory.
            string packageUploadDirectory;

            if (startupParams.Preferences is PreferenceSettings preferences)
            {
                packageUploadDirectory = string.IsNullOrEmpty(preferences.SelectedPackagePathForInstall) ?
                                         startupParams.PathManager.DefaultPackagesDirectory : preferences.SelectedPackagePathForInstall;
            }
            else
            {
                packageUploadDirectory = startupParams.PathManager.DefaultPackagesDirectory;
            }
            PackageManagerClient = new PackageManagerClient(
                new GregClient(startupParams.AuthProvider, url),
                uploadBuilder, packageUploadDirectory);

            LoadPackages(startupParams.Preferences, startupParams.PathManager);
        }
Esempio n. 26
0
 public DynamoLoader(DynamoModel model)
 {
     this.dynamoModel = model;
     this.PackageLoader = new PackageLoader(this, dynamoModel.Logger);
 }
Esempio n. 27
0
 public void LoadPackagesReturnsAllValidPackagesInValidDirectory()
 {
     var loader = new PackageLoader(ViewModel.Model);
     loader.LoadPackages();
     Assert.AreEqual(1, loader.LocalPackages.Count);
 }
Esempio n. 28
0
        internal void UninstallCore(CustomNodeManager customNodeManager, PackageLoader packageLoader, IPreferences prefs)
        {
            if (LoadedAssemblies.Any())
            {
                MarkForUninstall(prefs);
                return;
            }

            try
            {
                LoadedCustomNodes.ToList().ForEach(x => customNodeManager.Remove(x.FunctionId));
                packageLoader.Remove(this);
                Directory.Delete(RootDirectory, true);
            }
            catch (Exception e)
            {
                Log("Exception when attempting to uninstall the package " + Name + " from " + RootDirectory);
                Log(e.GetType() + ": " + e.Message);
                throw;
            }
        }
Esempio n. 29
0
 private PackagePathViewModel CreatePackagePathViewModel(PreferenceSettings setting)
 {
     PackageLoader loader = new PackageLoader(setting.CustomPackageFolders);
     LoadPackageParams loadParams = new LoadPackageParams
     {
         Preferences = setting,
         PathManager = Model.PathManager
     };
     CustomNodeManager customNodeManager = Model.CustomNodeManager;
     return new PackagePathViewModel(loader, loadParams, customNodeManager);
 }
Esempio n. 30
0
 public PackageManagerCommands(PackageLoader loader, DynamoModel model) : 
     base(loader, model)
 {
 }
Esempio n. 31
0
 public PackageManagerCommands(PackageLoader loader, DynamoModel model) 
 {
     this.Loader = loader;
     this.Model = model;
 }
Esempio n. 32
0
 public DynamoLoader(DynamoModel model)
 {
     this.dynamoModel = model;
     this.PackageLoader = new PackageLoader(dynamoModel);
 }