private void Decompression() { string targetLocation = InstallPathViewModel.GetInstance().InstallPath; using (FileStream fs = System.IO.File.Open(this.mSrcCAB, FileMode.Open, FileAccess.Read, FileShare.Read)) { this.mCabFileSize = fs.Length; } if (!Directory.Exists(targetLocation)) { Directory.CreateDirectory(targetLocation); } using (ZipFile zip = ZipFile.Read(new FileStream(this.mSrcCAB, FileMode.Open, FileAccess.ReadWrite))) { zip.ExtractProgress += DecompressionProgres; foreach (ZipEntry file in zip.Entries) { try { file.Extract(targetLocation, ExtractExistingFileAction.OverwriteSilently); } catch (Exception ex) { } } } }
private void SaveConfig() { XElement config = new XElement("configuration", new XElement("mongod", new XAttribute("path", MongoSetViewModel.GetInstance().MongodPath)) ); config.Save(Path.Combine(InstallPathViewModel.GetInstance().InstallPath, "mms.config")); }
public void Execute(object parameter) { FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); folderBrowserDialog.ShowDialog(); if (!("").Equals(folderBrowserDialog.SelectedPath)) { InstallPathViewModel.GetInstance().InstallPath = folderBrowserDialog.SelectedPath; } }
private void CreateDestopShortcut() { WshShell shell = new WshShell(); IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "Mongodb Manager Studion.lnk")); shortcut.TargetPath = Path.Combine(InstallPathViewModel.GetInstance().InstallPath, "MMS.Client.exe"); shortcut.WorkingDirectory = InstallPathViewModel.GetInstance().InstallPath; shortcut.WindowStyle = 1; shortcut.Description = "Mongodb Manager Studion"; shortcut.IconLocation = Path.Combine(InstallPathViewModel.GetInstance().InstallPath, @"Images\displayLogo.ico"); shortcut.Save(); }
public void Execute(object parameter) { try { Process process = new Process(); process.StartInfo = new ProcessStartInfo(); process.StartInfo.FileName = Path.Combine(InstallPathViewModel.GetInstance().InstallPath, "MMS.Client.exe"); process.StartInfo.WorkingDirectory = InstallPathViewModel.GetInstance().InstallPath; process.Start(); } catch (Exception e) { } Application.Current.Shutdown(); }
private void CreateRegistry() { RegistryKey root = Registry.LocalMachine; if (root.OpenSubKey(this.mRegistryKey) != null) { root.DeleteSubKey(this.mRegistryKey); } root.CreateSubKey(this.mRegistryKey); RegistryKey key = root.OpenSubKey(this.mRegistryKey, true); if (key != null) { key.SetValue("DisplayName", "Mongodb Manager Studio"); key.SetValue("UninstallString", "#"); key.SetValue("InstallLocation", InstallPathViewModel.GetInstance().InstallPath); key.SetValue("DisplayVersion", "1.0.0"); key.SetValue("DisplayVersion", "liguifa"); key.SetValue("HelpLink", ""); key.SetValue("DisplayIcon", Path.Combine(InstallPathViewModel.GetInstance().InstallPath, @"Images\displayLogo.ico")); } }