Exemple #1
0
        /// <summary>
        /// Konstruktor
        /// </summary>
        public CheckForUSB() {

            try
            {
                this._DriveL = new DriveLetter();
            }
            catch (Exception ex) {
                throw ex;    
            }
            //Rufe alle relevanten Daten aus der Konfigurationsdatei ab.
            try
            {
                this._VOLUME_LABEL = Parser.IniParser.GetSetting("USB", "VOLUME_LABEL");
            }
            catch {
                throw new Exception("Fehler in der Konfigurationsdatei (VOLUME_LABEL). ");
            }
            if (_VOLUME_LABEL == "") {
                throw new Exception("Fehler in der Konfigurationsdatei (VOLUME_LABEL).");
            }
        }
Exemple #2
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 public CheckForUSB()
 {
     try
     {
         this._DriveL = new DriveLetter();
     }
     catch (Exception ex) {
         throw ex;
     }
     //Rufe alle relevanten Daten aus der Konfigurationsdatei ab.
     try
     {
         this._VOLUME_LABEL = Parser.IniParser.GetSetting("USB", "VOLUME_LABEL");
     }
     catch {
         throw new Exception("Fehler in der Konfigurationsdatei (VOLUME_LABEL). ");
     }
     if (_VOLUME_LABEL == "")
     {
         throw new Exception("Fehler in der Konfigurationsdatei (VOLUME_LABEL).");
     }
 }
Exemple #3
0
        /// <summary>
        /// Die dispatcherTimer Methode; ruft die Backup oder die Restore Klasse auf.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dispatcherTimer_Tick(object sender, EventArgs e)
        {
            changeLayout("startDispatcherTimer");
            this._Counter += _ADD_COUNT_FACTOR;
            if (_Counter == _TIME_FACTOR_TO_ENABLED_BACKUP_CANCEL_BUTTON || this._DbLevel == "restore")
            {
                btCancelProcess.Visibility = System.Windows.Visibility.Visible;
            }
            try
            {
                if (_Cusb.checkUSB())
                {
                    KöTaf.Utils.BackupRestore.DriveLetter drivelet = _Cusb._DriveL;
                    String dl = drivelet._DriveLetter;
                    switch (this._DbLevel)
                    {
                    case "backupExist":
                        break;

                    case "backup":
                        dispatcherTimer.Stop();
                        try
                        {
                            br.StartBR("backupDB", dl + _USB_FOLDER_NAME);
                        }
                        catch (Exception ex)
                        {
                            textBlock1.Text = IniParser.GetSetting("ERRORMSG", "backupRuntimeError") + ex.ToString();
                        }
                        changeLayout("backup");
                        Timer timer = new Timer();
                        timer.writeToXML(Environment.CurrentDirectory + @"\TimeStamp.xml", "True", DateTime.Now.ToShortDateString(), "timeStamp/backup/date", "timeStamp/backup/iswrite");
                        break;

                    case "restore":
                        string[] FileList;
                        dispatcherTimer.Stop();
                        hList = drivelet.CheckSavedFiles(drivelet._DriveLetter);
                        //Rufe alle Backup Dateien von USB - Datenspeicher ab.
                        var Files = new DirectoryInfo(dl + _USB_FOLDER_NAME).GetFiles()
                                    .OrderBy(f => f.CreationTime)
                                    .ToArray();
                        for (int i = Files.Count() - 1; i >= 0; i--)
                        {
                            try
                            {
                                FileList = Files[i].ToString().Split(new Char[] { '.' });
                                if (FileList[2].ToString() == this._FILENAME_DB_EXTENSION.ToString())
                                {
                                    listBox1.Items.Add(Files[i]);
                                }
                            }
                            catch
                            {
                                throw new Exception(IniParser.GetSetting("ERRORMSG", "falseFilesInFolder"));
                            }
                        }
                        changeLayout("restore");
                        break;
                    }
                    return;
                }
                decide_DbLevel(this._DbLevel);
            }
            catch (Exception ex)
            {
                isNotCorrectUSB(ex.Message);
            }
        }