Beispiel #1
0
        private static StackContainer GetSettings()
        {
            if (!File.Exists("settings.bin"))
            {
                StackContainer settings = new StackContainer();

                settings.CreateContainer("products");

                settings.OpenContainer("products");
                settings.WriteValue("product1", "Product 1 Example Name", Encoding.ASCII);
                settings.WriteValue("product2", "Product 2 Example Name", Encoding.ASCII);
                settings.WriteValue("product3", "Product 3 Example Name", Encoding.ASCII);
                settings.Back();

                settings.CreateContainer("config");

                settings.OpenContainer("config");
                settings.WriteValue("show_help", BitConverter.GetBytes(false), true);
                settings.WriteValue("store_id", BitConverter.GetBytes(125778), true);

                settings.Back();
                File.WriteAllBytes("setting.bin", settings.Serialize());
                return(settings);
            }
            else
            {
                return(new StackContainer(File.ReadAllBytes("settings.bin")));
            }
        }