コード例 #1
0
ファイル: TrainsCache.cs プロジェクト: belsoft/traingraph
 public override bool Load(string versionReuired)
 {
     try
     {
         string             str;
         TrainsCacheStorage storage = new TrainsCacheStorage();
         if (storage.Load(out str, out this.LastError))
         {
             TrainsCache cache = DCSerializer.DeserializeWithDCS(typeof(TrainsCache), str) as TrainsCache;
             base.CacheTime = cache.CacheTime;
             this.Trains    = cache.Trains;
             base.Version   = cache.Version;
             if (!cache.IsValid(versionReuired, out this.LastError))
             {
                 return(false);
             }
             return(true);
         }
     }
     catch (Exception exception)
     {
         base.LastError = exception.Message;
     }
     return(false);
 }
コード例 #2
0
ファイル: TrainsCache.cs プロジェクト: belsoft/traingraph
 public override bool Load(string versionReuired)
 {
     try
     {
         string str;
         TrainsCacheStorage storage = new TrainsCacheStorage();
         if (storage.Load(out str, out this.LastError))
         {
             TrainsCache cache = DCSerializer.DeserializeWithDCS(typeof(TrainsCache), str) as TrainsCache;
             base.CacheTime = cache.CacheTime;
             this.Trains = cache.Trains;
             base.Version = cache.Version;
             if (!cache.IsValid(versionReuired, out this.LastError))
             {
                 return false;
             }
             return true;
         }
     }
     catch (Exception exception)
     {
         base.LastError = exception.Message;
     }
     return false;
 }
コード例 #3
0
ファイル: EventLogDialog.cs プロジェクト: belsoft/traingraph
 private void buttonClearCache_Click(object sender, RoutedEventArgs e)
 {
     bool flag = true;
     string str = "";
     TrainsCacheStorage storage = new TrainsCacheStorage();
     if (!storage.Clear())
     {
         flag = false;
         str = str + string.Format("\n\r {0}", storage.LastError);
     }
     TrainGraphCacheStorage storage2 = new TrainGraphCacheStorage();
     if (!storage2.Clear())
     {
         flag = false;
         str = str + string.Format("\n\r {0}", storage2.LastError);
     }
     LayoutCacheStorage storage3 = new LayoutCacheStorage();
     if (!storage3.Clear())
     {
         flag = false;
         str = str + string.Format("\n\r {0}", storage3.LastError);
     }
     if (flag)
     {
         MessageBox.Show("Cache removed successfully");
     }
     else
     {
         MessageBox.Show("Cache removing failed..." + str);
     }
 }
コード例 #4
0
        private void buttonClearCache_Click(object sender, RoutedEventArgs e)
        {
            bool               flag    = true;
            string             str     = "";
            TrainsCacheStorage storage = new TrainsCacheStorage();

            if (!storage.Clear())
            {
                flag = false;
                str  = str + string.Format("\n\r {0}", storage.LastError);
            }
            TrainGraphCacheStorage storage2 = new TrainGraphCacheStorage();

            if (!storage2.Clear())
            {
                flag = false;
                str  = str + string.Format("\n\r {0}", storage2.LastError);
            }
            LayoutCacheStorage storage3 = new LayoutCacheStorage();

            if (!storage3.Clear())
            {
                flag = false;
                str  = str + string.Format("\n\r {0}", storage3.LastError);
            }
            if (flag)
            {
                MessageBox.Show("Cache removed successfully");
            }
            else
            {
                MessageBox.Show("Cache removing failed..." + str);
            }
        }
コード例 #5
0
ファイル: TrainsCache.cs プロジェクト: belsoft/traingraph
 public override bool Save()
 {
     TrainsCacheStorage storage = new TrainsCacheStorage();
     string data = DCSerializer.SerializeWithDCS(this);
     storage.Clear();
     bool flag = storage.Save(data, out this.LastError);
     base.LastError = base.LastError + string.Format(" Len={0}", data.Length);
     return flag;
 }
コード例 #6
0
ファイル: TrainsCache.cs プロジェクト: belsoft/traingraph
        public override bool Save()
        {
            TrainsCacheStorage storage = new TrainsCacheStorage();
            string             data    = DCSerializer.SerializeWithDCS(this);

            storage.Clear();
            bool flag = storage.Save(data, out this.LastError);

            base.LastError = base.LastError + string.Format(" Len={0}", data.Length);
            return(flag);
        }