Beispiel #1
0
        // code borrowed from CmdAceUpdater courtesy of lys
        // http://www.wowace.com/forums/index.php?topic=4778.0
        private AddonVersionNumber GetVersionFromChangelog(string addonName)
        {
            AddonVersionNumber version = AddonVersionNumber.NO_VERSION;

            string[] changelogFiles = Directory.GetFiles(Path.Combine(AptEnv.WoWAddonsPath, addonName), "Changelog*.txt");

            foreach (string changelog in changelogFiles)
            {
                string fileName = Path.GetFileName(changelog);
                Match  m        = Regex.Match(fileName, "(?<=r)[\\d\\.]+\\d");

                if (!m.Success)
                {
                    continue;
                }

                AddonVersionNumber check = AddonVersionNumber.Parse(m.ToString());
                if (check > version)
                {
                    version = check;
                }
            }

            return(version);
        }
Beispiel #2
0
        private compare Compare(AddonVersionNumber with)
        {
            compare c;

            if (_Major > with._Major)
            {
                c = compare.GREATER;
            }
            else if (_Major < with._Major)
            {
                c = compare.LESSER;
            }
            else
            {
                if (_Minor > with._Minor)
                {
                    c = compare.GREATER;
                }
                else if (_Minor < with._Minor)
                {
                    c = compare.LESSER;
                }
                else
                {
                    c = compare.EQUAL;
                }
            }

            return(c);
        }