public void Start() { Manager = new DiskManager(Console.GetValue(Variables.V_camera_save_path).Value) { UsageLimit = new Percentage(50, 100) }; Program.DiskManager = Manager; }
private void DoDiskCleanup() { //Count is protected from having non numurical values so if this fails look elsewhere int count = int.Parse(Console.GetValue(Variables.V_camera_count).Value); List <FileInfo> list = new List <FileInfo>(); for (int id = 0; id < count; id++) { list.AddRange(new DirectoryInfo(string.Format(Console.GetValue(Variables.V_camera_save_path).Value, id)).GetFiles()); } if (list.Count == 0) { Debugging.DebugLog(Debugging.DebugLevel.Message, "No files to remove!"); return; } FileInfo oldest = list.OrderBy(f => f.CreationTime).First(); Debugging.DebugLog(Debugging.DebugLevel.Message, "Removing file due to disk limit reached: {0}", oldest.Name); //oldest.Delete(); }