Example #1
0
        public static void Store(string sPath, SimpleStore s)
        {
            using (var stream = new FileStream(sPath, FileMode.Create))
            {
                using (var w = new BinaryWriter(stream))
                {
                    w.Write(s.Meshes.Count);
                    for (int k = 0; k < s.Meshes.Count; ++k)
                    {
                        gSerialization.Store(s.Meshes[k], w);
                    }

                    w.Write(s.Points.Count);
                    for (int k = 0; k < s.Points.Count; ++k)
                    {
                        gSerialization.Store(s.Points[k], w);
                    }

                    w.Write(s.Strings.Count);
                    for (int k = 0; k < s.Strings.Count; ++k)
                    {
                        gSerialization.Store(s.Strings[k], w);
                    }

                    w.Write(s.IntLists.Count);
                    for (int k = 0; k < s.IntLists.Count; ++k)
                    {
                        gSerialization.Store(s.IntLists[k], w);
                    }
                }
            }
        }
Example #2
0
        public static SimpleStore Restore(string sPath)
        {
            var s = new SimpleStore();

            using (var stream = new FileStream(sPath, FileMode.Open))
            {
                using (var r = new BinaryReader(stream))
                {
                    int nMeshes = r.ReadInt32();
                    for (int k = 0; k < nMeshes; ++k)
                    {
                        var m = new DMesh3(); gSerialization.Restore(m, r); s.Meshes.Add(m);
                    }
                    int nPoints = r.ReadInt32();
                    for (int k = 0; k < nPoints; ++k)
                    {
                        Vector3d v = Vector3d.Zero; gSerialization.Restore(ref v, r); s.Points.Add(v);
                    }
                    int nStrings = r.ReadInt32();
                    for (int k = 0; k < nStrings; ++k)
                    {
                        string str = null; gSerialization.Restore(ref str, r); s.Strings.Add(str);
                    }
                    int nIntLists = r.ReadInt32();
                    for (int k = 0; k < nIntLists; ++k)
                    {
                        var l = new List <int>(); gSerialization.Restore(l, r); s.IntLists.Add(l);
                    }
                }
            }
            return(s);
        }
Example #3
0
        public static void Store(string sPath, object[] objs)
        {
            var s = new SimpleStore(objs);

            Store(sPath, s);
        }