Example #1
0
        static void Main(string[] args)
        {
            MySortedDictionary<string, List<int>> eventsToSerialize = new MySortedDictionary<string, List<int>>();
            eventsToSerialize["New Year"] = new List<int>(){31, 12};
            eventsToSerialize["Christmas"] = new List<int>(){7, 1};

            XmlSerializer serializer = new XmlSerializer(typeof(MySortedDictionary<string, List<int>>));

            using (var file = new StreamWriter("..\\..\\test.xml"))
            {
                serializer.Serialize(file, eventsToSerialize);
            }

            MySortedDictionary<string, List<int>> deserializedEvents = new MySortedDictionary<string, List<int>>();

            using (var file = new StreamReader("..\\..\\test.xml"))
            {
                deserializedEvents = (MySortedDictionary<string, List<int>>)serializer.Deserialize(file);
            }

            foreach (var node in deserializedEvents)
            {
                Console.WriteLine("Event: " + node.Key);
                Console.WriteLine("Date: " + node.Value[0] + "." + node.Value[1]);
            }

            Console.ReadKey();
        }
Example #2
0
 public a0(MyList <string> A_0)
 {
     this.a = new MyList <v>(0x4d);
     this.b = new MyList <string>(0x4e);
     this.c = new MySortedDictionary <int, TypedHashtable <k, v> >(0x4f);
     foreach (string str in A_0)
     {
         this.b.Add(str);
     }
 }
Example #3
0
        public static List <Person> GetMale(this MySortedDictionary <string, Person> dictionary)
        {
            List <Person> Males = new List <Person>();

            foreach (Person person in dictionary.Values)
            {
                if (person.gender == Gender.Male)
                {
                    Males.Add(person);
                }
            }
            return(Males);
        }
Example #4
0
        public static List <Person> GetSuernameLongerd(this MySortedDictionary <string, Person> dictionary)
        {
            List <Person> list = new List <Person>();

            foreach (Person person in dictionary.Values)
            {
                if (person.Surname.Length > 5)
                {
                    list.Add(person);
                }
            }
            return(list);
        }
Example #5
0
        public static string GetNumberMiddle(this MySortedDictionary <string, Person> dictionary)
        {
            int i = 0;

            foreach (Person person in dictionary.Values)
            {
                if (person is Working && ((Working)person).category == Category.Middle)
                {
                    i++;
                }
            }
            return(i.ToString());
        }
Example #6
0
        public static string GetNumberEng(this MySortedDictionary <string, Person> dictionary)
        {
            int num = 0;

            foreach (Person person in dictionary.Values)
            {
                if (person is Engineer)
                {
                    num++;
                }
            }
            return(num.ToString());
        }
Example #7
0
        public static string GetMinExp(this MySortedDictionary <string, Person> dictionary)
        {
            int minExp = 100;

            for (int i = 0; i < dictionary.Values.Count; i++)
            {
                if (dictionary.Values[i] is Administration && ((Administration)dictionary.Values[i]).Experience < minExp)
                {
                    minExp = ((Administration)dictionary.Values[i]).Experience;
                }
            }
            if (minExp != 100)
            {
                return(minExp.ToString());
            }
            else
            {
                return((-1).ToString());
            }
        }
Example #8
0
        static void Main(string[] args)
        {
            MySortedDictionary<char, List<string>> msd = new MySortedDictionary<char, List<string>>();

            for(int i = 65; i < 70; i++)
            {
                //string s = new string((char)i, 1);
                msd.Add(Convert.ToChar(i), new List<string>() { "Ab", "Bc", "Cd" });
            }

            foreach(var i in msd)
            {
                Console.WriteLine(i);

            }
            Console.WriteLine();

            // Serialization

            //XmlTextWriter writer = new XmlTextWriter("test.xml", null);
            //XmlSerializer serializer = new XmlSerializer(typeof(MySortedDictionary<char, List<int>>));
            //serializer.Serialize(writer, msd);

            //StreamWriter sw = new StreamWriter("../../test.xml");
            XmlSerializer serializer = new XmlSerializer(typeof(MySortedDictionary<char, List<string>>));
            //serializer.Serialize(sw, msd);

            Console.WriteLine("Serialization is finished!");

            // Deserialization

            //XmlReader reader = XmlReader.Create("../../test.xml");
            FileStream fs = new FileStream("../../test.xml", FileMode.Open);
            MySortedDictionary<char, List<string>> des_msd = (MySortedDictionary<char, List<string>>)serializer.Deserialize(fs);

            Console.ReadKey();
        }
        public PupilsGroup(string name)
        {
            pupils = new  MySortedDictionary<int, Pupil>();

            this.group_name = name;
        }
Example #10
0
        static void Main(string[] args)
        {
            MySortedDictionary <string, Person> mySortedDictionary = new MySortedDictionary <string, Person>(12);

            mySortedDictionary.Add("ИвинаАлена", new Administration("Алена", "Ивина", Gender.Female, 2));
            mySortedDictionary.Add("БетевИван", new Administration("Иван", "Бетев", Gender.Male, 5));
            mySortedDictionary.Add("ГаукДана", new Working("Дана", "Гаук", Gender.Female, Category.Middle));
            mySortedDictionary.Add("ИвановАндрей", new Engineer("Андрей", "Иванов", Gender.Male, Category.Beginner));
            mySortedDictionary.Add("ТучинСергей", new Administration("Сергей", "Тучин", Gender.Male, 4));
            mySortedDictionary.Add("ИвинСергей", new Administration("Сергей", "Ивин", Gender.Male, 3));
            mySortedDictionary.Add("ФиллиповаНастя", new Working("Настя", "Филлипова", Gender.Female, Category.Middle));
            mySortedDictionary.Add("КраснюковаКатя", new Engineer("Катя", "Краснюкова", Gender.Female, Category.Beginner));
            mySortedDictionary.Add("ЯрыжновМаксим", new Administration("Максим", "Ярыжнов", Gender.Male, 5));
            mySortedDictionary.Add("БызоваНастя", new Working("Настя", "Бызова", Gender.Female, Category.Middle));
            mySortedDictionary.Add("ВасилюкАнтон", new Engineer("Антон", "Василюк", Gender.Male, Category.God));
            mySortedDictionary.Add("ГатауллинаЭля", new Engineer("Эля", "Гатауллина", Gender.Female, Category.God));

            Console.WriteLine(mySortedDictionary);

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("=========================================");
            Console.ForegroundColor = ConsoleColor.White;

            var Males = GetMale(mySortedDictionary);

            Console.WriteLine("GetMale:(LINQ лямда)");
            foreach (Person person in Males)
            {
                Console.WriteLine(person.Surname + " " + person.Firstname);
            }

            Console.WriteLine("\nNumberMiddle:(LINQ лямда) " + GetNumberMiddle(mySortedDictionary));
            Console.WriteLine("\nMinExp:(LINQ лямда) " + GetMinExp(mySortedDictionary));
            Console.WriteLine("\nNumberEngineers:(LINQ лямда) " + GetNumberEng(mySortedDictionary));

            var people = GetSuernameLongerd(mySortedDictionary);

            Console.WriteLine("\nGetSurnameLong:(LINQ лямда)");
            foreach (Person person in people)
            {
                Console.WriteLine(person.Surname + " " + person.Firstname);
            }

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("=========================================");
            Console.ForegroundColor = ConsoleColor.White;
            //==============================

            Console.WriteLine("\nGetMale:(свой расширение)");
            foreach (Person person in mySortedDictionary.GetMale())
            {
                Console.WriteLine(person.Surname + " " + person.Firstname);
            }

            Console.WriteLine("\nNumberMiddle:(свой расширение) " + mySortedDictionary.GetNumberMiddle());
            Console.WriteLine("\nMinExp:(свой расширение) " + mySortedDictionary.GetMinExp());
            Console.WriteLine("\nNumberEngineers:(свой расширение) " + mySortedDictionary.GetNumberEng());

            Console.WriteLine("\nGetSurnameLong: (свой расширение)");
            foreach (Person person in mySortedDictionary.GetSuernameLongerd())
            {
                Console.WriteLine(person.Surname + " " + person.Firstname);
            }
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("=========================================");
            Console.ForegroundColor = ConsoleColor.White;

            //==============================

            var Males_2 = GetMale_2(mySortedDictionary);

            Console.WriteLine("\nGetMale:(LINQ выражения)");
            foreach (Person person in Males_2)
            {
                Console.WriteLine(person.Surname + " " + person.Firstname);
            }

            Console.WriteLine("\nNumberMiddle:(LINQ выражения) " + GetNumberMiddle_2(mySortedDictionary));
            Console.WriteLine("\nMinExp:(LINQ выражения) " + GetMinExp_2(mySortedDictionary));
            Console.WriteLine("\nNumberEngineers:(LINQ выражения) " + GetNumberEng_2(mySortedDictionary));

            var people_2 = GetSuernameLongerd_2(mySortedDictionary);

            Console.WriteLine("\nGetSurnameLong:(LINQ выражения)");
            foreach (Person person in people_2)
            {
                Console.WriteLine(person.Surname + " " + person.Firstname);
            }

            Console.ReadLine();
        }
Example #11
0
        static string GetNumberEng(MySortedDictionary <string, Person> dictionary)
        {
            string numberEng = dictionary.Values.Where(s => s is Engineer).Count().ToString();

            return(numberEng);
        }
Example #12
0
        static string GetNumberMiddle(MySortedDictionary <string, Person> dictionary)
        {
            string numberMiddle = dictionary.Values.Where(s => s is Working && ((Working)s).category == Category.Middle).LongCount().ToString();

            return(numberMiddle);
        }
Example #13
0
        static string GetMinExp_2(MySortedDictionary <string, Person> dictionary)
        {
            string minExp = (from s in dictionary.Values where s is Administration select((Administration)s).Experience).Min().ToString();

            return(minExp);
        }
Example #14
0
        static string GetNumberMiddle_2(MySortedDictionary <string, Person> dictionary)
        {
            string numberMiddle = (from s in dictionary.Values where s is Working && ((Working)s).category == Category.Middle select s).Count().ToString();

            return(numberMiddle);
        }
Example #15
0
        static IEnumerable <Person> GetMale_2(MySortedDictionary <string, Person> dictionary)
        {
            var listMale = from s in dictionary.Values where s.gender == Gender.Male select s;

            return(listMale);
        }
Example #16
0
        static IEnumerable <Person> GetSuernameLongerd(MySortedDictionary <string, Person> dictionary)
        {
            var listSurlong = dictionary.Values.Where(s => s.Surname.Length > 5);

            return(listSurlong);
        }
Example #17
0
 public a0()
 {
     this.a = new MyList <v>(0x4d);
     this.b = new MyList <string>(0x4e);
     this.c = new MySortedDictionary <int, TypedHashtable <k, v> >(0x4f);
 }
Example #18
0
        static IEnumerable <Person> GetMale(MySortedDictionary <string, Person> dictionary)
        {
            var listMale = dictionary.Values.Where(s => s.gender == Gender.Male);

            return(listMale);
        }
Example #19
0
        static string GetNumberEng_2(MySortedDictionary <string, Person> dictionary)
        {
            string numberEng = (from s in dictionary.Values where s is Engineer select s).Count().ToString();

            return(numberEng);
        }
Example #20
0
        static string GetMinExp(MySortedDictionary <string, Person> dictionary)
        {
            string minExp = dictionary.Values.Where(s => s is Administration).Min(s => ((Administration)s).Experience).ToString();

            return(minExp);
        }
Example #21
0
    public bool d()
    {
        bool flag = false;
        int  num  = 0;
        int  k    = 0;

        if (er.j("AutoStack"))
        {
            MySortedDictionary <bd.a, int> dictionary = new MySortedDictionary <bd.a, int>(0x66);
            foreach (cv cv in PluginCore.cq.p.d())
            {
                if (!this.a.ContainsKey(cv.k))
                {
                    int num3 = cv.a(dt.cu, 0);
                    int num4 = cv.a(dt.ct, 0);
                    if (((num3 != 0) && (num4 != 0)) && (num4 < num3))
                    {
                        bd.a key = new bd.a {
                            a = cv.g(),
                            b = cv.a(dt.co, 0)
                        };
                        if (dictionary.ContainsKey(key))
                        {
                            if (dictionary[key] == cv.k)
                            {
                                continue;
                            }
                            num  = dictionary[key];
                            k    = cv.k;
                            flag = true;
                            break;
                        }
                        dictionary.Add(key, cv.k);
                    }
                }
            }
        }
        if (er.j("AutoCram") && !flag)
        {
            ReadOnlyCollection <cv> onlys2 = PluginCore.cq.p.e(PluginCore.cg);
            int  num5  = 0;
            bool flag2 = false;
            foreach (cv cv2 in onlys2)
            {
                if ((!this.a.ContainsKey(cv2.k) && (cv2.c() != ObjectClass.Container)) && ((cv2.c() != ObjectClass.Foci) && (cv2.a(dt.d, -9999) == -9999)))
                {
                    num5  = cv2.k;
                    flag2 = true;
                    break;
                }
            }
            if (flag2)
            {
                ReadOnlyCollection <cv> onlys3 = PluginCore.cq.p.a(ObjectClass.Container);
                bool flag3 = false;
                int  num6  = 0;
                foreach (cv cv3 in onlys3)
                {
                    if (!this.a.ContainsKey(cv3.k) && (PluginCore.cq.p.f(cv3.k) == PluginCore.cg))
                    {
                        int num7 = cv3.a(dt.cr, 0);
                        if ((num7 != 0) && (PluginCore.cq.p.e(cv3.k).Count < num7))
                        {
                            flag3 = true;
                            num6  = cv3.k;
                            break;
                        }
                    }
                }
                if (flag3)
                {
                    this.c = false;
                    this.d = num5;
                    this.e = num6;
                    return(true);
                }
            }
        }
        if (flag)
        {
            this.c = true;
            this.d = num;
            this.e = k;
            return(true);
        }
        return(false);
    }
Example #22
0
        static IEnumerable <Person> GetSuernameLongerd_2(MySortedDictionary <string, Person> dictionary)
        {
            var listSurlong = from s in dictionary.Values where s.Surname.Length > 5 select s;

            return(listSurlong);
        }