Exemplo n.º 1
0
 public void saveLog(FsysLog toBeSaved, string logFilePath)
 {
     serializer = new BinaryFormatter();
     writeStream = File.OpenWrite(logFilePath);
     serializer.Serialize(writeStream, toBeSaved);
     writeStream.Close();
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
 private void initialiseLog()
 {
     LogSerialiser lS = new LogSerialiser();
     this.currentLog = lS.loadLog(currentSetting.logPath);
     logPasswordCheck();
     updateLogDisplay();
     updateListView();
     saveLog();
 }
Exemplo n.º 6
0
 public PasswordCheck(FsysLog currentLog)
 {
     InitializeComponent();
     current = currentLog;
 }