[PrincipalPermission(SecurityAction.Demand)] // Principal must be authenticated protected override void OnStartup(System.Windows.StartupEventArgs e) { CustomContainer.Register <IFieldAndPropertyMapper>(new FieldAndPropertyMapper()); ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose; Task.Factory.StartNew(() => { var dir = new DirectoryWrapper(); var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), GlobalConstants.Warewolf, "Feedback"); dir.CleanUp(path); dir.CleanUp(Path.Combine(GlobalConstants.TempLocation, GlobalConstants.Warewolf, "Debug")); }); var localprocessGuard = new Mutex(true, GlobalConstants.WarewolfStudio, out bool createdNew); if (createdNew) { _processGuard = localprocessGuard; } else { Environment.Exit(Environment.ExitCode); } InitializeShell(e); #if !(DEBUG) var versionChecker = new VersionChecker(); if (versionChecker.GetNewerVersion()) { WebLatestVersionDialog dialog = new WebLatestVersionDialog(); dialog.ShowDialog(); } #endif }
static void DeleteDir(string rootFolder) { if (Directory.Exists(rootFolder + @"\Dev2\")) { var dir = new DirectoryWrapper(); dir.CleanUp(rootFolder + @"\Dev2\"); } }
[PrincipalPermission(SecurityAction.Demand)] // Principal must be authenticated protected override void OnStartup(System.Windows.StartupEventArgs e) { CustomContainer.Register <IFieldAndPropertyMapper>(new FieldAndPropertyMapper()); CustomContainer.Register(ApplicationTrackerFactory.GetApplicationTrackerProvider()); var applicationTracker = CustomContainer.Get <IApplicationTracker>(); applicationTracker?.EnableApplicationTracker(VersionInfo.FetchVersionInfo(), VersionInfo.FetchInformationalVersion(), @"Warewolf" + $" ({ClaimsPrincipal.Current.Identity.Name})".ToUpperInvariant()); ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose; Task.Factory.StartNew(() => { var dir = new DirectoryWrapper(); var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), GlobalConstants.Warewolf, "Feedback"); dir.CleanUp(path); dir.CleanUp(Path.Combine(GlobalConstants.TempLocation, GlobalConstants.Warewolf, "Debug")); }); var localprocessGuard = new Mutex(true, GlobalConstants.WarewolfStudio, out bool createdNew); if (createdNew) { _processGuard = localprocessGuard; } else { Environment.Exit(Environment.ExitCode); } InitializeShell(e); #if !(DEBUG) var versionChecker = new VersionChecker(); if (versionChecker.GetNewerVersion()) { WebLatestVersionDialog dialog = new WebLatestVersionDialog(); dialog.ShowDialog(); } #endif }
public string ZipDirectoryToALocalTempFile(IActivityIOOperationsEndPoint src, IDev2ZipOperationTO args) { var tmpDir = _common.CreateTmpDirectory(); var tempFilename = CreateTmpFile(); var tmpPath = ActivityIOFactory.CreatePathFromString(tmpDir, "", ""); var tmpEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(tmpPath); TransferDirectoryContents(src, tmpEndPoint, new Dev2CRUDOperationTO(true)); using (var zip = new ZipFile()) { zip.SaveProgress += (sender, eventArgs) => { if (eventArgs.CurrentEntry != null) { Dev2Logger.Debug($"Event Type: {eventArgs.EventType} Total Entries: {eventArgs.EntriesTotal} Entries Saved: {eventArgs.EntriesSaved} Current Entry: {eventArgs.CurrentEntry.FileName}", GlobalConstants.WarewolfDebug); } }; if (args.ArchivePassword != string.Empty) { zip.Password = args.ArchivePassword; } zip.CompressionLevel = _common.ExtractZipCompressionLevel(args.CompressionRatio); var toAdd = ListDirectory(tmpEndPoint, ReadTypes.FilesAndFolders); foreach (var p in toAdd) { if (tmpEndPoint.PathIs(p) == enPathType.Directory) { var directoryPathInArchive = p.Path.Replace(tmpPath.Path, ""); zip.AddDirectory(p.Path, directoryPathInArchive); } else { zip.AddFile(p.Path, "."); } } zip.Save(tempFilename); } var dir = new DirectoryWrapper(); dir.CleanUp(tmpDir); return(tempFilename); }
public void DeleteAllTests(List <string> testsToList) { var info = new DirectoryInfo(EnvironmentVariables.TestPath); if (!info.Exists) { return; } var fileInfos = info.GetDirectories(); var dir = new DirectoryWrapper(); foreach (var fileInfo in fileInfos.Where(fileInfo => !testsToList.Contains(fileInfo.Name.ToUpper()))) { dir.CleanUp(fileInfo.FullName); } Load(); }