예제 #1
0
            static void TestFunction()
            {
                //FILE 00 - string
                Func <Dictionary <string, string>, string> toStr =
                    (x) => x["NAME"];
                Func <string, List <XmlLine> > toElem =
                    (s) => new List <XmlLine>().AddReturn(new XmlLine("NAME", s));

                Xml.CreateFileReader("TestFile00.xml", toStr, toElem, "SOMEONE");
                Xml.SaveFile("TestFile00.xml", new List <string>()
                {
                    "PEPE ARGENTO", "MONI ARGENTO"
                });

                //FILE 01 - PlayerData
                Func <Dictionary <string, string>, PlayerData> toPlayerData =
                    (x) => new PlayerData(
                        x["NAME"],
                        int.Parse(x["AGE"])
                        );
                Func <PlayerData, List <XmlLine> > toElem2 =
                    (pd) => new List <XmlLine>()
                    .AddReturn(new XmlLine("NAME", pd.name))
                    .AddReturn(new XmlLine("AGE", pd.age.ToString()));

                Xml.CreateFileReader("TestFile01.xml", toPlayerData, toElem2, "SOMEONE");
                Xml.SaveFile("TestFile01.xml", new List <PlayerData>()
                             .AddReturn(new PlayerData("PEPE ARGENTO", 40))
                             .AddReturn(new PlayerData("MONI ARGENTO", 38))
                             );
            }