Пример #1
0
        ///<inheritdoc/>
        public override void Load()
        {
            try
            {
                DirectoryInfo directory = new DirectoryInfo(this.path);
                JournalFileSystemController      journal      = new JournalFileSystemController();
                ObservableCollection <FileModel> currentFiles = new ObservableCollection <FileModel>();

                foreach (var file in directory.GetFiles())
                {
                    var fileModel = new FileModel()
                    {
                        body      = FileSystemHellpers.GetBodyFile(file.FullName),
                        fileName  = file.Name.Substring(0, file.Name.LastIndexOf('.')),
                        extension = file.Extension
                    };

                    currentFiles.Add(fileModel);
                    journal.Add(fileModel, this.filesList);
                }
                journal.CheckDeleteFiles(this.filesList, currentFiles);
                FileSystemHellpers.UpdateFileList(this.filesList, journal);
            }
            catch (Exception exc)
            {
                MessageBoxHellpers.Error("Ошибка", exc.Message);
            }
        }
Пример #2
0
        ///<inheritdoc/>
        public override void Load()
        {
            try
            {
                DirectoryInfo directory = new DirectoryInfo(this.path);

                foreach (var file in directory.GetFiles())
                {
                    var fileModel = new FileModel()
                    {
                        body      = FileSystemHellpers.GetBodyFile(file.FullName),
                        fileName  = file.Name.Substring(0, file.Name.LastIndexOf('.')),
                        extension = file.Extension
                    };

                    this.filesBackupList.Add(fileModel);
                }
            }
            catch (Exception exc)
            {
                MessageBoxHellpers.Error("Ошибка", exc.Message);
            }
        }