示例#1
0
        private void Read()
        {
            try
            {
                string filename = GetFilename();

                if (!File.Exists(filename))
                {
                    return;
                }

                var bf = new BinaryFormatter();

                object data;

                using (var fs = File.OpenRead(filename))
                {
                    data = bf.Deserialize(fs);

                    fs.Close();
                }

                if (data == null || !(data is ArrayList))
                {
                    return;
                }

                var list = (ArrayList)data;

                if ((int)list[0] != _version)
                {
                    return;
                }

                _items      = (Dictionary <string, object>)list[1];
                _storeItems = new StoreItems(_items);
            }
            catch
            {
                // Ignore exceptions
            }
        }
示例#2
0
 public CommitStoreEventArgs(StoreItems items)
 {
     _items = items;
 }
示例#3
0
 private Store(int version)
 {
     _version    = version;
     _items      = new Dictionary <string, object>();
     _storeItems = new StoreItems(_items);
 }
示例#4
0
 public CommitStoreEventArgs(StoreItems items)
 {
     _items = items;
 }
示例#5
0
        private void Read()
        {
            try
            {
                string filename = GetFilename();

                if (!File.Exists(filename))
                {
                    return;
                }

                var bf = new BinaryFormatter();

                object data;

                using (var fs = File.OpenRead(filename))
                {
                    data = bf.Deserialize(fs);

                    fs.Close();
                }

                if (data == null || !(data is ArrayList))
                {
                    return;
                }

                var list = (ArrayList)data;

                if ((int)list[0] != _version)
                {
                    return;
                }

                _items = (Dictionary<string, object>)list[1];
                _storeItems = new StoreItems(_items);
            }
            catch
            {
                // Ignore exceptions
            }
        }
示例#6
0
 private Store(int version)
 {
     _version = version;
     _items = new Dictionary<string, object>();
     _storeItems = new StoreItems(_items);
 }