Ejemplo n.º 1
0
        /// <summary>
        /// Lis le fichier xml dédié pour retourner la liste des jeux - Read dedicated xml file to get the list of games
        /// </summary>
        /// <param name="lGames"></param>
        internal Dictionary <string, ShortGame> ListGames()
        {
            Dictionary <string, ShortGame> lGames = new Dictionary <string, ShortGame>();

            XPathNavigator    nav   = _XDoc.CreateNavigator();
            XPathNodeIterator nodes = nav.Select(nav.Compile("//LaunchBox/Game"));

            if (nodes.Count != 0)
            {
                while (nodes.MoveNext())
                {
                    Console.WriteLine(nodes.Current.Name);
                    nodes.Current.MoveToFirstChild();

                    ShortGame zeGame = new ShortGame();

                    do
                    {
                        switch (nodes.Current.Name)
                        {
                        case "Title":
                            Console.WriteLine(nodes.Current.Value);
                            zeGame.Title = StringOp.Convert(nodes.Current.Value);
                            break;

                        case "ID":
                            Console.WriteLine(nodes.Current.Value);
                            zeGame.ID = nodes.Current.Value;
                            break;

                        case "ApplicationPath":
                            Console.WriteLine(nodes.Current.Value);
                            zeGame.FileName            = Path.GetFileName(nodes.Current.Value);
                            zeGame.ExploitableFileName = Path.GetFileNameWithoutExtension(zeGame.FileName);    //2020zeGame.FileName.Split('.')[0];
                            break;

                        case "Region":
                            Console.WriteLine(nodes.Current.Value);
                            zeGame.Region = nodes.Current.Value;
                            break;

                            //case "Version":
                            //    Console.WriteLine(nodes.Current.Value);

                            //    zeGame.Version = nodes.Current.Value;
                            //    break;
                        }
                    } while (nodes.Current.MoveToNext());

                    lGames.Add(zeGame.ID, zeGame);
                }
            }
            return(lGames);
        }
Ejemplo n.º 2
0
        public void Task_FirstUpper()
        {
            //Arrange
            var str            = "gateway group";
            var expectedString = "Gateway group";

            //Act
            var result = StringOp.FirstUpper(str);

            //Assert
            Assert.Equal(expectedString, result);
        }
Ejemplo n.º 3
0
        public void Task_HasNumeric()
        {
            //Arrange
            var str            = "Gateway Group1";
            var expectedString = "true";

            //Act
            var result = StringOp.FirstUpper(str);

            //Assert
            Assert.Equal(expectedString, result);
        }
Ejemplo n.º 4
0
        public void Task_TitleCase()
        {
            //Arrange
            var str            = "gateway group";
            var expectedString = "Gateway Group";

            //Act
            var result = StringOp.TitleCase(str);

            //Assert
            Assert.Equal(expectedString, result);
        }
Ejemplo n.º 5
0
        public void Task_InLower()
        {
            //Arrange
            var str            = "GateWay Group";
            var expectedString = "ateay roup";

            //Act
            var result = StringOp.InLower(str);

            //Assert
            Assert.Equal(expectedString, result);
        }
Ejemplo n.º 6
0
        public void Task_ConvertToInt()
        {
            //Arrange
            var str            = "111";
            var expectedString = "111";

            //Act
            var result = StringOp.ConvertToInt(str);

            //Assert
            Assert.Equal(expectedString, result);
        }
Ejemplo n.º 7
0
        public void Task_LowerCase()
        {
            //Arrange
            var str            = "GATEWAY GROUP";
            var expectedString = "gateway group";

            //Act
            var result = StringOp.LowerCase(str);

            //Assert
            Assert.Equal(expectedString, result);
        }
Ejemplo n.º 8
0
        public void Task_WordCount()
        {
            //Arrange
            var str            = "Gateway Group";
            var expectedString = "13";

            //Act
            var result = StringOp.WordCount(str);

            //Assert
            Assert.Equal(expectedString, result);
        }
Ejemplo n.º 9
0
        public void Task_RemoveLast()
        {
            //Arrange
            var str            = "Gateway Group";
            var expectedString = "Gateway Grou";

            //Act
            var result = StringOp.RemoveLast(str);

            //Assert
            Assert.Equal(expectedString, result);
        }
Ejemplo n.º 10
0
    static void Main()
    {
        string word     = "bug it?";
        string sentence = "Everyone knows that debugging is twice as hard as writing a program in the first place." +
                          " So if you're as clever as you can be when you write it, how will you ever debug it?";

        string str = "Hello World!";
        char   ch  = 'l';
        bool   flag;
        int    cn  = 0;
        string st1 = "";

        flag = StringOp.IsCharFinded(str, ch);
        cn   = StringOp.CharAmountInString(str, ch);
        st1  = StringOp.RemoveCharacter(str, ch);

        StringOp.FindSubString(sentence, word);

        sentence = "Hello world           ssddds s s";
        sentence = StringOp.RemoveDuplicateContinuousCharacter(sentence);

        Console.ReadKey();
    }
Ejemplo n.º 11
0
Archivo: Http.cs Proyecto: Skye347/KLib
        public HTTPResponse ParseHeader(string data)
        {
            StringOp strop = new StringOp();

            strop.LoadText(data);
            String[] splitStatusLine           = strop.GetLine(1).Split(' ');
            Dictionary <string, string> status = new Dictionary <String, String> {
                { "Protocol", splitStatusLine[0] },
                { "StatusCode", splitStatusLine[1] },
                { "StatusMessage", splitStatusLine[2] }
            };
            Dictionary <string, string> header = new Dictionary <String, String>();

            this.status = status;
            int line = 2;

            while (true)
            {
                String HeaderLine = strop.GetLine(line);
                if (HeaderLine == null)
                {
                    break;
                }
                String[] splitHeaderLine = HeaderLine.Split(new char[] { ':' }, 2);
                if (header.ContainsKey(splitHeaderLine[0]))
                {
                    header[splitHeaderLine[0]] += ";" + splitHeaderLine[1].Substring(1);
                }
                else
                {
                    header.Add(splitHeaderLine[0], splitHeaderLine[1].Substring(1));
                }
                line++;
            }
            this.header = header;
            return(this);
        }
Ejemplo n.º 12
0
        public static void Main(string[] args)
        {
            // Create a new Student object:
            StudentProperties s = new StudentProperties();

            // Setting code, name and the age of the student
            s.Code = "001";
            s.Name = "Zara";
            s.Age  = 9;//
            Console.WriteLine("*************C# Properties***************");
            Console.WriteLine("Student Info: {0}", s);
            //
            //let us increase age
            s.Age += 1;
            Console.WriteLine("Student Info: {0}", s);

            KushalProperty k = new KushalProperty();

            k.Name = "SetKushal";
            string GetKushal = k.Name;

            Console.WriteLine("Set Kushal Prop: {0}", k.Name);
            Console.WriteLine("Get Kushal Prop: {0}", GetKushal);


            Console.WriteLine("*************C# Abstract Class***************");
            AbstractBaseClass sh;

            sh = new Rectangle();
            sh.draw();
            sh = new Circle();
            sh.draw();
            sh.Pprintline();

            Console.WriteLine("*************C# Interface***************");
            SubClass inter = new SubClass();

            inter.SetTutorial(1, "Interface example");
            Console.WriteLine(inter.GetTutorial());

            Console.WriteLine("*************C# Missing Element Array***************");
            ArrayOp ar = new ArrayOp();

            ar.ArrayMissingEle();
            ar.ArrayReverse();

            Console.WriteLine("*************C# string word reverse Element Array***************");
            StringOp str = new StringOp();

            str.StringRev();

            Console.WriteLine("******************C# Default Constructor**********************************");
            ConstructorDefault cn = new ConstructorDefault();

            cn.Display();

            Console.WriteLine("*******************C# Copy Constructor**********************************");
            ConstructorCopy pc  = new ConstructorCopy(10); pc.Display();
            ConstructorCopy pc1 = new ConstructorCopy(pc); pc1.Display();

            Console.WriteLine("******************C# Static Constructor**********************************");
            ConstructorStatic sc = new ConstructorStatic(); sc.Display();

            Console.WriteLine("******************C# Enummmm Under Namespace**********************************");
            WeekDays d = WeekDays.Tuesday;

            Console.WriteLine(d);

            Console.WriteLine("******************END OF THE PROGRAM**********************************");
        }
Ejemplo n.º 13
0
 public StringCondition(string property, StringOp op, string value)
 {
     _property = property;
     _op       = op;
     _value    = value;
 }