public void Loaded() { _unzip = new UnzipManager(this.FolderPath); _unzip.Loaded += unzip_Loaded; _unzip.ProgressChanged += unzip_ProgressChanged; _unzip.Completed += unzip_Completed; _unzip.ExtractAsync(); }
/// <summary> /// decompresses the file /// </summary> public string Decompress() { UnzipManager unzip = new UnzipManager(m_zipFilePath, m_verifyName, m_UnzipedFilePath); if (unzip.Unzip()) { return(m_UnzipedFilePath); } return(""); }
public static bool MakeNewProject(NewProjectViewModel viewModel) { IMessageBox messageBox = Container.Get <IMessageBox>(); string stringToReplace; string zipToUnpack; GetDefaultZipLocationAndStringToReplace(viewModel.ProjectType, out zipToUnpack, out stringToReplace); string fileToDownload = GetFileToDownload(viewModel); bool succeeded = true; if (NewProjectCreator.Managers.CommandLineManager.Self.OpenedBy != null && NewProjectCreator.Managers.CommandLineManager.Self.OpenedBy.ToLower() == "glue") { PlatformProjectInfo ppi = viewModel.ProjectType; if (!ppi.SupportedInGlue) { succeeded = false; messageBox.Show("This project type is not supported in Glue. You must launch the New Project Creator manually"); } } string unpackDirectory = viewModel.ProjectLocation; if (succeeded) { bool isFileNameValid = GetIfFileNameIsValid(viewModel, messageBox, ref unpackDirectory); if (!isFileNameValid) { succeeded = false; } } if (succeeded) { bool hasUserCancelled = false; bool shouldTryDownloading; zipToUnpack = GetZipToUnpack(viewModel, fileToDownload, ref hasUserCancelled, out shouldTryDownloading); if (shouldTryDownloading) { // Checks for a newer version and downloads it if necessary bool downloadSucceeded = DownloadFileSync(viewModel, zipToUnpack, fileToDownload); if (!downloadSucceeded) { ShowErrorMessageBox(ref hasUserCancelled, ref zipToUnpack, "Error downloading the file. What would you like to do?"); } } if (!hasUserCancelled) { try { Directory.CreateDirectory(unpackDirectory); } catch (UnauthorizedAccessException) { messageBox.Show("The program does not have permission to create a directory at\n\n" + unpackDirectory + "\n\nPlease run as administrator mode"); succeeded = false; } if (succeeded) { if (!File.Exists(zipToUnpack)) { messageBox.Show("Could not find the template file:\n" + zipToUnpack); } succeeded = UnzipManager.UnzipFile(zipToUnpack, unpackDirectory); } if (succeeded) { RenameEverything(viewModel, stringToReplace, unpackDirectory); GuidLogic.ReplaceGuids(unpackDirectory); if (viewModel.OpenSlnFolderAfterCreation) { Process.Start(unpackDirectory); } System.Console.Out.WriteLine(unpackDirectory); } } } return(succeeded); }