public OperationResult StartDownload(InputPropertyPackage inputPropertyPackage)
		{
			double totalMemoryBefore = (double)GC.GetTotalMemory(false) / (1024 * 1024);
			Logger.Instance.WriteLog.InfoFormat("Total memory {0:N1} MBytes", totalMemoryBefore);

			OperationResult result = new OperationResult();
			try
			{
				result = PackageManagerParameters.Instance.LoadingInitialData(inputPropertyPackage);
				IList<ICommand> commandsList = CreateCommands();
				foreach (ICommand command in commandsList)
				{
					result = command.Execute();
					if (result.Status == StatusResult.Fail)
					{
						Logger.Instance.WriteLog.Error(command + ": " + result.ErrorMessage);
						return result;
					}
				}
			}
			catch (Exception ex)
			{
				Logger.Instance.WriteLog.Error(ex);
				throw;
			}
			Logger.Instance.WriteLog.Info("Installation package finished");

			double totalMemoryAfter = (double)GC.GetTotalMemory(false) / (1024 * 1024);
			Logger.Instance.WriteLog.InfoFormat("Memory footprint {0:N1} MBytes", totalMemoryAfter - totalMemoryBefore);

			return result;
		}
		internal OperationResult LoadingInitialData(InputPropertyPackage inputProperty)
		{
			Logger.Instance.WriteLog.Info("LoadingInitialData started");
			OperationResult result = ValidationValue.GetOperationResultAndCheckValueOnNullOrEmpty(new Dictionary<string, object>
			{
				// TODO: to check inputProperty on the basis of installed modules

				{"PackageDirectory", inputProperty.PackageDirectory.Value},
				{"PackageName", inputProperty.PackageName.Value},
				{"InnovatorDb", inputProperty.InnovatorDb.Value},
				{"InnovatorDirectory", inputProperty.InnovatorDirectory.Value}
			});
			InputProperty = inputProperty;
			Logger.Instance.WriteLog.Info("LoadingInitialData finished");
			return result;
		}
Ejemplo n.º 3
0
		private static void TestDownloadPackage()
		{
			try
			{
				InputPropertyPackage inputProperty = new InputPropertyPackage();
				inputProperty.PackageName.Value = "TehDocName";
				inputProperty.InnovatorDirectory.Value = ConfigurationManager.AppSettings["ArasApplicationWorkspace"];
				inputProperty.PackageDirectory.Value = ConfigurationManager.AppSettings["PackageManagerWorkspace"];
				inputProperty.InnovatorDb.Value = "InnovatorSolutions";
				inputProperty.DownloadPackageModel.FtpUserName = ConfigurationManager.AppSettings["FtpUserName"];
				inputProperty.DownloadPackageModel.FtpPassword = ConfigurationManager.AppSettings["FtpUserName"];
				inputProperty.DownloadPackageModel.PackageUrl = new Uri(ConfigurationManager.AppSettings["PackageUrl"]);
				inputProperty.DownloadPackageModel.ProtocolTypeForDownloadPackage = (ProtocolTypeForDownloadPackage)Enum.Parse(typeof(ProtocolTypeForDownloadPackage), ConfigurationManager.AppSettings["ProtocolType"]);
				inputProperty.SqlConnectionString = ConfigurationManager.AppSettings["SqlConnectionString"];
				inputProperty.AddInstallationModuleType(new List<InstallationModuleType>
				{
					InstallationModuleType.DbModule,
					InstallationModuleType.VaultServerModule,
					InstallationModuleType.InnovatorServerModule,
					InstallationModuleType.ConversionServerModule,
				});

				PackageManager.PackageManagerInstall packageManager = new PackageManager.PackageManagerInstall(Log);
				OperationResult result = packageManager.StartDownload(inputProperty);
				if (result.Status == StatusResult.Warning)
				{
					foreach (string warn in result.WarningMessages)
					{
						Console.WriteLine(warn);
					}
				}
				Console.WriteLine("End.");
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex);
			}
			Console.ReadKey();
		}
		public InnovatorSettingsViewModel(InputPropertyPackage inputPropertyPackage, RelayCommand<string> navCommand)
		{
			_inputPropertyPackage = inputPropertyPackage;
			NavigationViewModel = new NavigationViewModel(navCommand, "", "PackageList");
		}