Beispiel #1
0
 public bool IsGreaterThan(MEVersion version)
 {
     if (Int32.Parse(this.Major) > Int32.Parse(version.GetMajor()))
     {
         return(true);
     }
     if (Int32.Parse(this.Minor) > Int32.Parse(version.GetMinor()))
     {
         return(true);
     }
     return(false);
 }
Beispiel #2
0
        public bool IsEqualOrGreaterThan(string versionString)
        {
            MEVersion tempVersion = new MEVersion(versionString);

            return(this.IsEqualOrGreaterThan(tempVersion));
        }
Beispiel #3
0
 public bool IsEqualOrGreaterThan(MEVersion version)
 {
     return(this.IsEqualWith(version) || this.IsGreaterThan(version));
 }
Beispiel #4
0
 public bool IsEqualWith(MEVersion version)
 {
     return(this.Major == version.GetMajor() && this.Minor == version.GetMinor());
 }
        private void CalculateValues()
        {
            this.Database = "demo";
            this.Username = "******";
            this.Password = "******";
            this.Projects = new string [] { "Digital Watch" };
            this.Port     = 6390;
            this.Host     = "localhost";
            this.Logging  = false;
            this.Version  = new MEVersion("0.0");

            string programFilesPath = "";

            // Search for Program File (x86) folder from env. variable.
            IDictionary variables = System.Environment.GetEnvironmentVariables();

            if (variables.Contains("ProgramFiles(x86)"))
            {
                programFilesPath = (string)variables["ProgramFiles(x86)"];
            }
            else
            {
                programFilesPath = (string)variables["ProgramFiles"];
            }

            string[] programFilesDirectories = Directory.GetDirectories(programFilesPath);
            bool     isEval       = false;
            bool     isClient     = false;
            string   pathAddendum = "";
            string   exeAddendum  = "";

            foreach (string dir in programFilesDirectories)
            {
                if (dir.Contains("MetaEdit+") && !dir.Contains("Server"))
                {
                    MEVersion version = this.ParseVersion(dir);
                    isEval   = dir.Contains("Evaluation");
                    isClient = dir.Contains("Client");
                    if (version.IsEqualWith(Version))
                    {
                        if (!isEval && !isClient && checkExe(version, programFilesPath, "", ""))
                        {
                            pathAddendum = "";
                            exeAddendum  = "";
                        }
                        if (pathAddendum == " Client" && isEval && checkExe(version, programFilesPath, " Evaluation", "eval"))
                        {
                            pathAddendum = " Evaluation";
                            exeAddendum  = "eval";
                        }
                    }
                    if (version.IsGreaterThan(this.Version))
                    {
                        string tempPathAddendum = "";
                        string tempExeAddendum  = "";
                        if (isEval)
                        {
                            tempPathAddendum = " Evaluation";
                            tempExeAddendum  = "eval";
                        }
                        if (isClient)
                        {
                            tempPathAddendum = " Client";
                            tempExeAddendum  = "m";
                        }
                        if (checkExe(version, programFilesPath, tempPathAddendum, tempExeAddendum))
                        {
                            this.Version = version;
                            pathAddendum = tempPathAddendum;
                            exeAddendum  = tempExeAddendum;
                        }
                    }
                }
            }

            this.WorkingDir  = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "\\MetaEdit+ " + this.Version.VersionString();
            this.ProgramPath = this.ComposeProgramPath(this.Version, programFilesPath, pathAddendum, exeAddendum);
        }
 private bool checkExe(MEVersion version, string programFilesPath, string pathAddendum, string exeAddendum)
 {
     return(File.Exists(this.ComposeProgramPath(version, programFilesPath, pathAddendum, exeAddendum)));
 }
 private string ComposeProgramPath(MEVersion version, string programFilesPath, string pathAddendum, string exeAddendum)
 {
     return(programFilesPath + "\\MetaEdit+ " + version.VersionString() + pathAddendum + "\\mep" + version.ShortVersionString() + exeAddendum + ".exe");
 }