public void Startup() { _directoryWrapper = new DirectoryWrapper(); if (_directoryWrapper.Exists(ResourcesBackup)) { _directoryWrapper.Delete(ResourcesBackup, true); } if (_directoryWrapper.Exists(EnvironmentVariables.ResourcePath)) { _directoryWrapper.Move(EnvironmentVariables.ResourcePath, ResourcesBackup); } var serverUnderTest = Process.GetProcessesByName("Warewolf Server")[0]; string exePath; try { exePath = Path.GetDirectoryName(serverUnderTest.MainModule?.FileName); } catch (Win32Exception) { exePath = Environment.CurrentDirectory; } var destDirName = Path.Combine(exePath, "Resources"); if (!_directoryWrapper.Exists(destDirName)) { _directoryWrapper.Move(Path.Combine(exePath, "Resources - Release", "Resources"), destDirName); } }
public void Cleanup() { if (_directoryWrapper.Exists(EnvironmentVariables.ResourcePath)) { _directoryWrapper.Delete(EnvironmentVariables.ResourcePath, true); } if (_directoryWrapper.Exists(ResourcesBackup)) { _directoryWrapper.Move(ResourcesBackup, EnvironmentVariables.ResourcePath); } ExecuteRequest(new Uri("http://localhost:3142/services/FetchExplorerItemsService.json?ReloadResourceCatalogue=true")); }