Example #1
0
        public static bool Load(string filename, ref TeamObservable obj)
        {
            bool       b          = true;
            FileStream fileStream = null;

            try
            {
                fileStream = File.OpenRead(filename);
                BinaryFormatter binaryFormatter = new BinaryFormatter();

                obj = binaryFormatter.Deserialize(fileStream) as TeamObservable;
            }
            catch (FileNotFoundException ex)
            {
                //obj.Log = new List<string>();
                b = false;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: " + ex.Message);
                b = false;
            }
            finally
            { if (fileStream != null)
              {
                  fileStream.Close();
              }
            }

            return(b);
        }
Example #2
0
        public static bool Save(string filename, TeamObservable obj)
        {
            bool       b          = true;
            FileStream fileStream = null;

            try
            {
                fileStream = File.Create(filename);
                BinaryFormatter binaryFormatter = new BinaryFormatter();

                binaryFormatter.Serialize(fileStream, obj);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: " + ex.Message);
                b = false;
            }
            finally
            { if (fileStream != null)
              {
                  fileStream.Close();
              }
            }

            return(b);
        }