Exemplo n.º 1
0
        public void Save(GlobalSettingValue g_value)
        {
            try
            {
                BinaryFormatter binFmt = new BinaryFormatter();

                using (System.IO.FileStream fs = new System.IO.FileStream(DateTime.Now.ToString("MM_dd") + LOAD_DATA_FILE_NAME, FileMode.Create))
                {
                    binFmt.Serialize(fs, g_value);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 2
0
        public void Load()
        {
            BinaryFormatter binFmt = new BinaryFormatter();

            try
            {
                using (FileStream rdr = new FileStream(DateTime.Now.ToString("MM_dd") + LOAD_DATA_FILE_NAME, FileMode.Open))
                {
                    GlobalSettingValue item = (GlobalSettingValue)binFmt.Deserialize(rdr);
                    Form2.curProfit = item.trading_profit;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }