/** * 1) sort all folders by date * 2) sort all files in the oldest folder, by date * 3) delete the oldest file **/ public void AllocateMemory() { string oldestDirectory = RemoveOldestFile(); if (PathSizeMeasurer.GetPathSize(oldestDirectory) == 0) { AppCoordinator.RecordLog += MSG_EMPTY_DIR_DELETE + oldestDirectory + "\n\n"; Directory.Delete(oldestDirectory); } }
public void Coordinate() { if (Settings.Default.recordsPath.Equals("")) { MyUtils.ShowSettingsForm(); return; } HandleUnExistsRecordsDir(); double recordsDir = PathSizeMeasurer.GetPathSize(Settings.Default.recordsPath); if (recordsDir > Settings.Default.memoryAllocation) { memoryAllocator.AllocateMemory(); } string todaysDate = dateFolderCreatoer.CreateDateFolder(); soundManager.StartRecording(Settings.Default.recordsPath + "\\" + todaysDate); }