Beispiel #1
0
        static void Testing()
        {
            XmlLayer rootLayer = XmlLoader.Load(FILE_TEST);

            XmlLayer newLayer = rootLayer.GoTo("Child", "InnerChild");
            XmlLayer layer    = XmlLayer.CreateRootLayer(FILE_TEST);

            XmlLayer serverConfigRootLayer = XmlLayer.CreateRootLayer(FILE_SERVER_CONFIG);
            XmlLayer consoleFilterLayer    = serverConfigRootLayer.GoTo("Logging", "Console", "Filters");
            XmlLayer jsonFilterLayer       = serverConfigRootLayer.GoTo("Logging", "Json", "Filters");

            Extraction consoleExtraction = Extraction.OnMany((() => new List <string>()),
                                                             (list, data) => list.Add($"From: {data[0].Source}. {data[0].Data}"),
                                                             (list =>
            {
                foreach (string filter in list)
                {
                    Console.WriteLine(filter);
                }
            }))
                                           .OnOne(data => Console.WriteLine($"One Filter was found, {data[0].Source}. {data[0].Data}"))
                                           .OnNone((() => Console.WriteLine("No filters detected.")));

            consoleFilterLayer.ExtractIntoFromElements(consoleExtraction);

            ExtractionRaw raw = ExtractionRaw.OnOne(data => Console.WriteLine($"From {data[0].Source}. {data[0].Data}"))
                                .OnNone(() => Console.WriteLine("No raw data found."));

            serverConfigRootLayer.ExtractIntoFromRaw(raw, "General.Port");

            layer.Dispose();

            layer = XmlLoader.Load(FILE_TEST);
            layer = layer.CreateRootLayer();
        }
Beispiel #2
0
        protected World()
        {
            XmlLayer   root = XmlLayer.CreateRootLayer(PlaceHolderFileSystem.ConfigFilePath);
            Extraction extractionWorldSize = Extraction.OnMany(WorldSizeRoute)
                                             .OnNone(() => { Height = 100; Width = 100; });

            root.ExtractIntoFromElements(extractionWorldSize, "World");
            root.Dispose();

            PopulateWorld();
        }