Exemplo n.º 1
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();
                    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;
            }
        }
Exemplo n.º 2
0
 internal void UninstallCore()
 {
     try
     {
         LoadedCustomNodes.ToList().ForEach(x => dynamoModel.CustomNodeManager.RemoveFromDynamo(x.Guid));
         dynamoModel.Loader.PackageLoader.LocalPackages.Remove(this);
         Directory.Delete(this.RootDirectory, true);
     }
     catch (Exception e)
     {
         dynamoModel.Logger.Log("Exception when attempting to uninstall the package " + this.Name + " from " + this.RootDirectory);
         dynamoModel.Logger.Log(e.GetType() + ": " + e.Message);
         throw e;
     }
 }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
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;
            }
        }
Exemplo n.º 5
0
        private void Uninstall()
        {
            var res = MessageBox.Show("Are you sure you want to uninstall " + this.Name + "?  This will delete the packages root directory.\n\n You can always redownload the package.", "Uninstalling Package", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (res == MessageBoxResult.No)
            {
                return;
            }

            try
            {
                LoadedCustomNodes.ToList().ForEach(x => dynSettings.CustomNodeManager.RemoveFromDynamo(x.Guid));
                dynSettings.PackageLoader.LocalPackages.Remove(this);
                Directory.Delete(this.RootDirectory, true);
            }
            catch (Exception e)
            {
                MessageBox.Show("Dynamo failed to uninstall the package.  You may need to delete the package's root directory manually.", "Uninstall Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                dynSettings.DynamoLogger.Log("Exception when attempting to uninstall the package " + this.Name + " from " + this.RootDirectory);
                dynSettings.DynamoLogger.Log(e.GetType() + ": " + e.Message);
            }
        }