Пример #1
0
        /// <summary>
        /// Начать копирование значений.
        /// </summary>
        private void StartButton_Click()
        {
            if (DictionaryEntryElements.Any(x => string.IsNullOrWhiteSpace(x.NewKey)))
            {
                _logService.AddMessage($"Один из элементов пустой");
                return;
            }

            _logService.AddMessage($"Запущен процесс копирования.");


            _outputsManager.Save();

            _logService.AddMessage("Выполнено");
            System.Windows.Forms.MessageBox.Show("Выполнено");
        }
Пример #2
0
        public async Task <int> ParseFolderForImagesAsync(string folderPath, int folderProcessed, bool isRecursive)
        {
            _logService.AddMessage($"Parsing folder {folderPath}");
            var parseInfo = new ParseInfo();

            var items = _folderService.GetFilesForPath(folderPath);

            parseInfo.ParsingStartDate = DateTime.Now;
            parseInfo.ChildImagesCount = items.Where(c => c.IsImage).Count();
            parseInfo.ChildFolderCount = items.Where(c => c.IsFolder).Count();
            parseInfo.FolderPath       = folderPath;
            await _service.AddParseInfoAsync(parseInfo);

            var imageProcessed = 0;

            folderProcessed += 1;
            foreach (var item in items)
            {
                if (item.IsImage)
                {
                    imageProcessed = await ProcessImage(imageProcessed, item);
                }
                if (item.IsFolder && isRecursive)
                {
                    folderProcessed = await ParseFolderForImagesAsync(item.Path, folderProcessed, isRecursive);
                }
                if (!item.IsImage && !item.IsFolder)
                {
                    if (item.Path.StartsWith("$", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    var filePath    = item.Path;
                    var newFilePath = Path.Combine(_backupPath, _noExifBaseFolder, filePath.Replace(_pathToReplace, ""));
                    //  CopyFile(filePath, newFilePath, false);
                }
            }
            parseInfo.ChildImagesProcessedCount = imageProcessed;
            parseInfo.ParsingFinishDate         = DateTime.Now;
            await _service.SaveChangesAsync();

            return(folderProcessed);
        }
 private void GoForward()
 {
     // _journal.GoForward();
     if (string.IsNullOrEmpty(SelectFileViewModel.FullPath))
     {
         _logService.AddMessage("‘айл не выбран.");
         return;
     }
     _outputsManager.Read(FileType.Target, new FileInfo(SelectFileViewModel.FullPath));
     _regionManager.RequestNavigate(Constants.ContentRegion, nameof(KeysEditorView));
 }
Пример #4
0
        public void Save()
        {
            if (!CheckNames())
            {
                return;
            }

            foreach (var item in _sourceResourceReaders)
            {
                _logService.AddMessage($"Выбран файл локализации: {item.Key}");
                SaveOnceFile(item.Key, item.Value, _targetResourceReaders[item.Key], _targetResourceWriters[item.Key]);
            }
        }