Exemple #1
0
 /// <summary>
 /// Loads the plugin settings
 /// </summary>
 public void LoadSettings()
 {
     settingObject = new Settings();
     if (!File.Exists(this.settingFilename)) this.SaveSettings();
     else
     {
         Object obj = ObjectSerializer.Deserialize(this.settingFilename, settingObject);
         settingObject = (Settings)obj;
     }
     // Try to find svn path from: Tools/sliksvn/
     if (settingObject.SVNPath == "svn.exe")
     {
         String svnCmdPath = Path.Combine(PathHelper.ToolDir, @"sliksvn\bin\svn.exe");
         if (File.Exists(svnCmdPath)) settingObject.SVNPath = svnCmdPath;
     }
     // Try to find TortoiseProc path from program files
     if (settingObject.TortoiseSVNProcPath == "TortoiseProc.exe")
     {
         String programFiles = Environment.GetEnvironmentVariable("ProgramFiles");
         String torProcPath = Path.Combine(programFiles, @"TortoiseSVN\bin\TortoiseProc.exe");
         if (File.Exists(torProcPath)) settingObject.TortoiseSVNProcPath = torProcPath;
     }
 }
        /// <summary>
        /// Loads the plugin settings
        /// </summary>
        public void LoadSettings()
        {
            settingObject = new Settings();
            if (!File.Exists(this.settingFilename)) this.SaveSettings();
            else
            {
                Object obj = ObjectSerializer.Deserialize(this.settingFilename, settingObject);
                settingObject = (Settings)obj;
            }

            #region Detect Git

            // Try to find git path from program files
            if (settingObject.GITPath == "git.exe")
            {
                String gitPath = PathHelper.FindFromProgramFiles(@"Git\bin\git.exe");
                if (File.Exists(gitPath)) settingObject.GITPath = gitPath;

            }
            // Try to find TortoiseProc path from program files
            if (settingObject.TortoiseGITProcPath == "TortoiseGitProc.exe")
            {
                String torProcPath = PathHelper.FindFromProgramFiles(@"TortoiseGit\bin\TortoiseGitProc.exe");
                if (File.Exists(torProcPath)) settingObject.TortoiseGITProcPath = torProcPath;
            }

            #endregion

            #region Detect SVN

            // Try to find svn path from: Tools/sliksvn/
            if (settingObject.SVNPath == "svn.exe")
            {
                String svnCmdPath = @"Tools\sliksvn\bin\svn.exe";
                if (PathHelper.ResolvePath(svnCmdPath) != null) settingObject.SVNPath = svnCmdPath;
            }
            // Try to find sliksvn path from program files
            if (settingObject.SVNPath == "svn.exe")
            {
                String slSvnPath = PathHelper.FindFromProgramFiles(@"SlikSvn\bin\svn.exe");
                if (File.Exists(slSvnPath)) settingObject.SVNPath = slSvnPath;
            }
            // Try to find svn from TortoiseSVN
            if (settingObject.SVNPath == "svn.exe")
            {
                String torSvnPath = PathHelper.FindFromProgramFiles(@"TortoiseSVN\bin\svn.exe");
                if (File.Exists(torSvnPath)) settingObject.SVNPath = torSvnPath;
            }
            // Try to find TortoiseProc path from program files
            if (settingObject.TortoiseSVNProcPath == "TortoiseProc.exe")
            {
                String torProcPath = PathHelper.FindFromProgramFiles(@"TortoiseSVN\bin\TortoiseProc.exe");
                if (File.Exists(torProcPath)) settingObject.TortoiseSVNProcPath = torProcPath;
            }

            #endregion

            CheckPathExists(settingObject.SVNPath, "TortoiseSVN (svn)");
            CheckPathExists(settingObject.TortoiseSVNProcPath, "TortoiseSVN (Proc)");
            CheckPathExists(settingObject.GITPath, "TortoiseGit (git)");
            CheckPathExists(settingObject.TortoiseGITProcPath, "TortoiseGIT (Proc)");
            CheckPathExists(settingObject.HGPath, "TortoiseHG (hg)");
            CheckPathExists(settingObject.TortoiseHGProcPath, "TortoiseHG (Proc)");
        }
Exemple #3
0
 /// <summary>
 /// Loads the plugin settings
 /// </summary>
 public void LoadSettings()
 {
     settingObject = new Settings();
     if (!File.Exists(this.settingFilename)) this.SaveSettings();
     else
     {
         Object obj = ObjectSerializer.Deserialize(this.settingFilename, settingObject);
         settingObject = (Settings)obj;
     }
     // Try to find svn path from: Tools/sliksvn/
     if (settingObject.SVNPath == "svn.exe")
     {
         String svnCmdPath = @"Tools\sliksvn\bin\svn.exe";
         if (PathHelper.ResolvePath(svnCmdPath) != null) settingObject.SVNPath = svnCmdPath;
     }
     // Try to find TortoiseProc path from program files
     if (settingObject.TortoiseSVNProcPath == "TortoiseProc.exe")
     {
         String programFiles = Environment.GetEnvironmentVariable("ProgramFiles");
         String torProcPath = Path.Combine(programFiles, @"TortoiseSVN\bin\TortoiseProc.exe");
         if (File.Exists(torProcPath)) settingObject.TortoiseSVNProcPath = torProcPath;
     }
     CheckPathExists(settingObject.SVNPath, "TortoiseSVN (svn)");
     CheckPathExists(settingObject.TortoiseSVNProcPath, "TortoiseSVN (Proc)");
     CheckPathExists(settingObject.GITPath, "TortoiseGit (git)");
     CheckPathExists(settingObject.TortoiseGITProcPath, "TortoiseGIT (Proc)");
     CheckPathExists(settingObject.HGPath, "TortoiseHG (hg)");
     CheckPathExists(settingObject.TortoiseHGProcPath, "TortoiseHG (Proc)");
 }