public static void Save(string massmsgFilePath, MassMsgStorage storage) { FileStream fs = new FileStream(massmsgFilePath, FileMode.Create); // Construct a SoapFormatter and use it // to serialize the data to the stream. BinaryFormatter formatter = new BinaryFormatter(); try { storage.Conserve(); formatter.Serialize(fs, storage); } catch (SerializationException e) { throw; } finally { fs.Close(); } }
internal static void Load(string massmsgFilePath, ref MassMsgStorage massMsg) { using (FileStream fs = new FileStream(massmsgFilePath, FileMode.OpenOrCreate)) { BinaryFormatter formatter = new BinaryFormatter(); try { massMsg = (MassMsgStorage)formatter.Deserialize(fs); } catch (SerializationException e) { throw; } finally { fs.Close(); } } }
private void ResetAll() { CloseDocument(); docView.VirtualListSize = 0; docView.Columns.Clear(); /// logSB = new StringBuilder(); mainProgressBar.Value = 0; massMsg = new MassMsgStorage(); msm = new MySqlKannelManager(); massMsg.TranslitEnabled = smsSetts.NeedTransliteration; //massMsg.progressChanged += new ChangeProgress(ProgressChangedEventHandler); //massMsg.reportAdded+=new ReportTransl(addStringToLog); docView.ClearCache(); UpdateWinCap(); }