コード例 #1
0
        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)
                    {
                    }
                }
            }
        }
コード例 #2
0
        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"));
        }
コード例 #3
0
        public void Execute(object parameter)
        {
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();

            folderBrowserDialog.ShowDialog();
            if (!("").Equals(folderBrowserDialog.SelectedPath))
            {
                InstallPathViewModel.GetInstance().InstallPath = folderBrowserDialog.SelectedPath;
            }
        }
コード例 #4
0
        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();
        }
コード例 #5
0
 public static InstallPathViewModel GetInstance()
 {
     if (install == null)
     {
         lock (syncRoot)
         {
             if (install == null)
             {
                 install = new InstallPathViewModel();
             }
         }
     }
     return(install);
 }
コード例 #6
0
 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();
 }
コード例 #7
0
        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"));
            }
        }