Exemple #1
0
            public override int Compare(ServerEntry x, ServerEntry y)
            {
                var v = AlphanumComparatorFast.Compare(x.ActualName, y.ActualName);

                if (v != 0)
                {
                    return(v);
                }
                return(AlphanumComparatorFast.Compare(x.Id, y.Id));
            }
        public ActionResult StringSorter(string[] StringInput)
        {
            DataModel DB = new DataModel();

            DB.StringInput = StringInput;
            var result = StringInput.ToList();
            AlphanumComparatorFast myCamparer = new AlphanumComparatorFast();

            result.Sort(myCamparer);
            DB.SortedStrings = result;
            return(View(DB));
        }
            public int Compare(object x, object y)
            {
                if (!(x is ISelectionCollectionItemViewModel item1))
                {
                    return(0);
                }
                if (!(y is ISelectionCollectionItemViewModel item2))
                {
                    return(0);
                }
                AlphanumComparatorFast comp = new AlphanumComparatorFast();

                return(comp.Compare(item1.DisplayText, item2.DisplayText));
            }
Exemple #4
0
        public int Compare(object x, object y)
        {
            if (!(x is ITreeItem item1))
            {
                return(0);
            }
            if (!(y is ITreeItem item2))
            {
                return(0);
            }

            AlphanumComparatorFast comp = new AlphanumComparatorFast();

            return(comp.Compare(item1.DisplayName, item2.DisplayName));
        }
                public int Compare(object x, object y)
                {
                    var ix = x as GenericMod;
                    var iy = y as GenericMod;

                    if (ix == null)
                    {
                        return(iy == null ? 0 : 1);
                    }
                    if (iy == null)
                    {
                        return(-1);
                    }
                    if (ix.AppliedOrder != iy.AppliedOrder)
                    {
                        return(ix.AppliedOrder - iy.AppliedOrder);
                    }
                    return(AlphanumComparatorFast.Compare(ix.DisplayName, iy.DisplayName));
                }
Exemple #6
0
 public override int CompareTo(AcPlaceholderNew o)
 {
     return(Enabled == o.Enabled ?
            AlphanumComparatorFast.Compare(Id, o.Id) : Enabled ? -1 : 1);
 }
 protected override int Compare(string x, string y)
 {
     return(AlphanumComparatorFast.Compare(x, y));
 }
Exemple #8
0
        public static void RemoveDupes(DatDir tDat, bool testName = true, bool testWithMergeName = false)
        {
            for (int g = 0; g < tDat.ChildCount; g++)
            {
                DatDir mGame = (DatDir)tDat.Child(g);

                if (mGame.DGame == null)
                {
                    RemoveDupes(mGame, testName);
                }
                else
                {
                    bool found = true;
                    while (found)
                    {
                        found = false;


                        for (int r = 0; r < mGame.ChildCount; r++)
                        {
                            DatFile df0 = (DatFile)mGame.Child(r);
                            for (int t = r + 1; t < mGame.ChildCount; t++)
                            {
                                DatFile df1 = (DatFile)mGame.Child(t);

                                if (testName && df0.Name != df1.Name)
                                {
                                    continue;
                                }
                                bool hasCRC = df0.CRC != null && df1.CRC != null;
                                if (hasCRC && !ArrByte.bCompare(df0.CRC, df1.CRC))
                                {
                                    continue;
                                }
                                bool hasSHA1 = df0.SHA1 != null && df1.SHA1 != null;
                                if (hasSHA1 && !ArrByte.bCompare(df0.SHA1, df1.SHA1))
                                {
                                    continue;
                                }
                                bool hasMD5 = df0.MD5 != null && df1.MD5 != null;
                                if (hasMD5 && !ArrByte.bCompare(df0.MD5, df1.MD5))
                                {
                                    continue;
                                }
                                if (!hasCRC && !hasSHA1 && !hasMD5)
                                {
                                    continue;
                                }

                                found = true;

                                string name0 = df0.Name;
                                string name1 = df1.Name;

                                bool nS0 = name0.Contains("\\");
                                bool ns1 = name1.Contains("\\");

                                if (nS0 && !ns1)
                                {
                                    mGame.ChildRemove(df0);
                                }
                                else if (!nS0 && ns1)
                                {
                                    mGame.ChildRemove(df1);
                                }
                                else if (nS0 && ns1)
                                {
                                    string s0 = name0.Substring(0, name0.IndexOf("\\", StringComparison.Ordinal));
                                    string s1 = name1.Substring(0, name1.IndexOf("\\", StringComparison.Ordinal));
                                    if (s0 != s1)
                                    {
                                        mGame.ChildRemove(df1);
                                    }
                                    else
                                    {
                                        int res = AlphanumComparatorFast.Compare(name0, name1);
                                        mGame.ChildRemove(res >= 0 ? df0 : df1);
                                    }
                                }
                                else if ((name0 == name1) || (testWithMergeName && (name0 == df1.Merge)))
                                {
                                    mGame.ChildRemove(df1);
                                }
                                else
                                {
                                    found = false;
                                    continue;
                                }
                                r = mGame.ChildCount;
                                t = mGame.ChildCount;
                            }
                        }
                    }
                }
            }
        }
Exemple #9
0
        public override int CompareTo(AcPlaceholderNew o)
        {
            var c = o as KunosCareerObject;

            return(c == null?base.CompareTo(o) : AlphanumComparatorFast.Compare(Id, c.Id));
        }
	int IComparer.Compare(object a, object b)
	{
		t1 = (Texture2D)a;
		t2 = (Texture2D)b;

		AlphanumComparatorFast comparer = new AlphanumComparatorFast();

		return comparer.Compare(t1.name, t2.name);
	}
Exemple #11
0
 private static int Compare(string x, string y)
 {
     return(AlphanumComparatorFast.Compare(x, y));
 }
 private static void EnsureAboveOf(string a, string b)
 {
     Assert.AreEqual(true, AlphanumComparatorFast.Compare(a, b) < 0);
     Assert.AreEqual(true, AlphanumComparatorFast.Compare(b, a) > 0);
 }
 private static void EnsureSame(string a, string b)
 {
     Assert.AreEqual(true, AlphanumComparatorFast.Compare(a, b) == 0);
     Assert.AreEqual(true, AlphanumComparatorFast.Compare(b, a) == 0);
 }
Exemple #14
0
        public static void RemoveDupes(DatDir tDat)
        {
            for (int g = 0; g < tDat.ChildCount; g++)
            {
                DatDir mGame = (DatDir)tDat.Child(g);

                if (mGame.DGame == null)
                {
                    RemoveDupes(mGame);
                }
                else
                {
                    bool found = true;
                    while (found)
                    {
                        found = false;


                        for (int r = 0; r < mGame.ChildCount; r++)
                        {
                            DatFile df0 = (DatFile)mGame.Child(r);
                            for (int t = r + 1; t < mGame.ChildCount; t++)
                            {
                                DatFile df1 = (DatFile)mGame.Child(t);

                                if (!ArrByte.bCompare(df0.CRC, df1.CRC))
                                {
                                    continue;
                                }

                                found = true;

                                string name0 = df0.Name;
                                string name1 = df1.Name;

                                bool nS0 = name0.Contains("\\");
                                bool ns1 = name1.Contains("\\");

                                if (nS0 && !ns1)
                                {
                                    mGame.ChildRemove(df0);
                                }
                                else if (!nS0 && ns1)
                                {
                                    mGame.ChildRemove(df1);
                                }
                                else if (nS0 && ns1)
                                {
                                    string s0 = name0.Substring(0, name0.IndexOf("\\", StringComparison.Ordinal));
                                    string s1 = name1.Substring(0, name1.IndexOf("\\", StringComparison.Ordinal));
                                    if (s0 != s1)
                                    {
                                        mGame.ChildRemove(df1);
                                    }
                                    else
                                    {
                                        int res = AlphanumComparatorFast.Compare(name0, name1);
                                        mGame.ChildRemove(res >= 0 ? df0 : df1);
                                    }
                                }
                                else if (name0 == name1)
                                {
                                    mGame.ChildRemove(df1);
                                }
                                else
                                {
                                    found = false;
                                    continue;
                                }
                                r = mGame.ChildCount;
                                t = mGame.ChildCount;
                            }
                        }
                    }
                }
            }
        }
Exemple #15
0
 int IComparer.Compare(object x, object y)
 {
     return(AlphanumComparatorFast.Compare((x as AcItemWrapper)?.Id, (y as AcItemWrapper)?.Id));
 }
 public BusStopLoader()
 {
     busArrivalComparator = new AlphanumComparatorFast();
 }