Example #1
0
        //RESTORE
        public Form1()
        {
            cacheFile = Application.StartupPath + "\\MyObj.bin";
            InitializeComponent();

            _cache = new PCache();
            if (File.Exists(cacheFile))
            {
                FileStream fs = new FileStream(cacheFile, FileMode.Open, FileAccess.Read, FileShare.None);
                byte[] array = new byte[fs.Length];
                fs.Read(array, 0, (Int32)fs.Length);
                fs.Close();
                
                //below simple method converts saved byte data into cache object
                if(array.Length>0)
                    _cache.RestoreCache(array, true);
            } 

            CleanView(true);
        }
Example #2
0
        //RESTORE
        public Form1()
        {
            cacheFile = Application.StartupPath + "\\MyObj.bin";
            InitializeComponent();

            _cache = new PCache();
            if (File.Exists(cacheFile))
            {
                FileStream fs    = new FileStream(cacheFile, FileMode.Open, FileAccess.Read, FileShare.None);
                byte[]     array = new byte[fs.Length];
                fs.Read(array, 0, (Int32)fs.Length);
                fs.Close();

                //below simple method converts saved byte data into cache object
                if (array.Length > 0)
                {
                    _cache.RestoreCache(array, true);
                }
            }

            CleanView(true);
        }