Exemplo n.º 1
0
 /// <summary>
 /// Converts the message object into a string with its values separated by commas. No newline is added at the end of the string.
 /// </summary>
 /// <returns></returns>
 public string ToCSVString()
 {
     return(VersionMajor.ToString() + "," +
            VersionMinor.ToString() + "," +
            Name.ToString() + "," +
            IdHigh.ToString() + "," +
            IdLow.ToString() + "," +
            Length.ToString() + "," +
            FormatString.ToString());
 }
        public override int GetHashCode()
        {
            var hashCode = 1356543658;

            hashCode = hashCode * -1521134295 + VersionMajor.GetHashCode();
            hashCode = hashCode * -1521134295 + VersionMinor.GetHashCode();
            hashCode = hashCode * -1521134295 + VersionPatch.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(CustomVersionString);

            return(hashCode);
        }
Exemplo n.º 3
0
    //public bool NegTest1()
    //{
    //    bool retVal = true;

    //    TestLibrary.TestFramework.BeginScenario("NegTest1: ");

    //    try
    //    {
    //          //
    //          // Add your test logic here
    //          //
    //    }
    //    catch (Exception e)
    //    {
    //        TestLibrary.TestFramework.LogError("101", "Unexpected exception: " + e);
    //        TestLibrary.TestFramework.LogInformation(e.StackTrace);
    //        retVal = false;
    //    }

    //    return retVal;
    //}
    #endregion
    #endregion

    public static int Main()
    {
        VersionMajor test = new VersionMajor();

        TestLibrary.TestFramework.BeginTestCase("VersionMajor");

        if (test.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return(100);
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return(0);
        }
    }
Exemplo n.º 4
0
        public void Load()
        {
            LoadUniquesCsv();
            LoadEnchantsCsv();
            UniquesErrors.Clear();
            EnchantsErrors.Clear();
            GetJsonData(HC);
            GetJsonData(SC);
            string filterString = Util.ReadWebPage(FiltersUrl + filterFile);

            if (filterString.Length == 0)
            {
                MessageBox.Show("Failed to read the web URL: " + FiltersUrl + filterFile, "Error", MessageBoxButtons.OK);
                Environment.Exit(1);
            }
            Load(filterString.Split('\n'));

            Match m = versionRegex.Match(filterString);

            VersionMajor   = int.Parse(m.Groups[1].Value);
            VersionMinor   = int.Parse(m.Groups[2].Value);
            VersionRelease = int.Parse(m.Groups[3].Value);
            Version        = VersionMajor.ToString() + "." + VersionMinor + "." + VersionRelease;

            if (UniquesErrors.Count > 0 || EnchantsErrors.Count > 0)
            {
                UniquesErrors  = UniquesErrors.Distinct().OrderBy(x => x.BaseType).ThenBy(x => x.Name).ToList();
                EnchantsErrors = EnchantsErrors.Distinct().OrderBy(x => x.BaseType).ThenBy(x => x.Name).ToList();
                List <string> errs = new List <string>();
                if (UniquesErrors.Count > 0)
                {
                    errs.Add(UniquesErrors.Count + " uniques");
                }
                if (EnchantsErrors.Count > 0)
                {
                    errs.Add(EnchantsErrors.Count + " enchantments");
                }
                MessageBox.Show("Missing " + string.Join(", ", errs) + "\n\nThese will be copied to the clipboard. Add them to the CSV files.", "Load JSON", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
        public void Load()
        {
            ErrorCount = 0;
            LoadUniquesCsv();
            LoadEnchantsCsv();
            GetJsonData(HC);
            GetJsonData(SC);
            string filterString = Util.ReadWebPage(FiltersUrl + filterFile);

            if (filterString.Length == 0)
            {
                MessageBox.Show("Failed to read the web URL: " + FiltersUrl + filterFile, "Error", MessageBoxButtons.OK);
                Environment.Exit(1);
            }
            Load(filterString.Split('\n'));

            Match m = versionRegex.Match(filterString);

            VersionMajor   = int.Parse(m.Groups[1].Value);
            VersionMinor   = int.Parse(m.Groups[2].Value);
            VersionRelease = int.Parse(m.Groups[3].Value);
            Version        = VersionMajor.ToString() + "." + VersionMinor + "." + VersionRelease;
        }
Exemplo n.º 6
0
    //public bool NegTest1()
    //{
    //    bool retVal = true;

    //    TestLibrary.TestFramework.BeginScenario("NegTest1: ");

    //    try
    //    {
    //          //
    //          // Add your test logic here
    //          //
    //    }
    //    catch (Exception e)
    //    {
    //        TestLibrary.TestFramework.LogError("101", "Unexpected exception: " + e);
    //        TestLibrary.TestFramework.LogInformation(e.StackTrace);
    //        retVal = false;
    //    }

    //    return retVal;
    //}
    #endregion
    #endregion

    public static int Main()
    {
        VersionMajor test = new VersionMajor();

        TestLibrary.TestFramework.BeginTestCase("VersionMajor");

        if (test.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return 100;
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return 0;
        }
    }
Exemplo n.º 7
0
 public override int GetHashCode()
 {
     return((int)Math.Pow(VersionMajor.GetHashCode() + 1, Math.Pow(VersionMinor.GetHashCode() + 1, Math.Pow(VersionPatch.GetHashCode() + 1, VersionBuild.GetHashCode() + 1))));
 }