public void saveLog(FsysLog toBeSaved, string logFilePath) { serializer = new BinaryFormatter(); writeStream = File.OpenWrite(logFilePath); serializer.Serialize(writeStream, toBeSaved); writeStream.Close(); }
public FsysLog loadLog(string logFilePath) { FsysLog result; serializer = new BinaryFormatter(); try { readStream = File.OpenRead(logFilePath); result = (FsysLog)serializer.Deserialize(readStream); readStream.Close(); } catch (FileNotFoundException) { result = new FsysLog("Default Log", "Default User"); } catch (DirectoryNotFoundException) { Directory.CreateDirectory(".\\Logs"); result = new FsysLog("Default Log", "Default User"); } return result; }
private void undolog() { LogSerialiser logS = new LogSerialiser(); logS.saveLog(currentLog, ".\\Settings\\redostack.fsu"); LogSerialiser lS = new LogSerialiser(); this.currentLog = lS.loadLog(".\\Settings\\undostack.fsu"); saveLog(); updateListView(); redoToolStripMenuItem.Enabled = true; redoValid = true; undoToolStripMenuItem.Enabled = false; undoValid = false; }
private void newLogToolStripMenuItem_Click(object sender, EventArgs e) { NewLog newWindow = new NewLog(); newWindow.ShowDialog(); if (newWindow.DialogResult == System.Windows.Forms.DialogResult.OK) { if (newWindow.password == "") { this.currentLog = new FsysLog(newWindow.logName, newWindow.userName); } else { this.currentLog = new FsysLog(newWindow.logName, newWindow.userName, newWindow.password); } saveFileDialog1.InitialDirectory = ".\\Logs"; saveFileDialog1.FileName = currentLog.getName(); currentSetting.logPath = ".\\Logs\\newLog.fsl"; saveFileDialog1.ShowDialog(); } updateLogDisplay(); updateListView(); }
private void initialiseLog() { LogSerialiser lS = new LogSerialiser(); this.currentLog = lS.loadLog(currentSetting.logPath); logPasswordCheck(); updateLogDisplay(); updateListView(); saveLog(); }
public PasswordCheck(FsysLog currentLog) { InitializeComponent(); current = currentLog; }