Beispiel #1
0
        public static ItemGroupFile new_ReadFromPath(string path)
        {
            IFormatter            formatter = new BinaryFormatter();
            Stream                stream    = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
            SerializableItemGroup sGroup    = (SerializableItemGroup)formatter.Deserialize(stream);

            stream.Close();

            ItemGroup group = sGroup.getDeserializedValue();

            return(new ItemGroupFile(path, group));
        }
Beispiel #2
0
        public void save()
        {
            //	Package the data to store
            var serializedItemGroup = new SerializableItemGroup();

            serializedItemGroup.serializeFrom(this.ItemGroup);

            IFormatter formatter = new BinaryFormatter();
            Stream     stream    = new FileStream(Path, FileMode.Create, FileAccess.Write, FileShare.None);

            formatter.Serialize(stream, serializedItemGroup);
            stream.Close();
        }