private void DeleteSession(HnHMapSession session) { DirectoryInfo dirInfo = new DirectoryInfo(session.FolderPatch); var files = dirInfo.GetFiles($"ids.txt|{Properties.Settings.Default.TileFileMask}"); foreach (var file in files) { file.Delete(); } if (!dirInfo.GetFiles().Any() && !dirInfo.GetDirectories().Any()) { dirInfo.Delete(); } }
public void SessionIsSent(HnHMapSession session) { switch (_workType) { case DoneSessionsWorkType.None: MarkSessionAsSent(session); break; case DoneSessionsWorkType.Delete: DeleteSession(session); break; case DoneSessionsWorkType.Move: if (String.IsNullOrEmpty(_moveDirectory)) { MarkSessionAsSent(session); } else { MoveSession(session, _moveDirectory); } break; } }
private void MoveSession(HnHMapSession session, string destDirectory) { DirectoryInfo dirInfo = new DirectoryInfo(session.FolderPatch); dirInfo.MoveTo($"{destDirectory}\\{session.Name}"); }
private void MarkSessionAsSent(HnHMapSession session) { string previouslyUploadedSessionFile = $"{_sessionsDirectory}\\{Properties.Settings.Default.PreviouslyUploadedSessionFileName}"; File.AppendAllText(previouslyUploadedSessionFile, $"{session.Name}{FILES_COUNT_SEPARATOR}{session.FilesCount}{Environment.NewLine}"); }