static void testFileSystem(Camera cam) { Console.WriteLine($"################################ TEST File System ################################"); List <StorageInfo> info = cam.storageInfo; foreach (StorageInfo sinfo in info) { Console.WriteLine($"{sinfo.label}\n\tStorage type: {sinfo.desc}\n\tRoot: {sinfo.root.path}\n\tAccess rights: {sinfo.accessRights}\n\tType: {sinfo.type}\n\tFile system type: {sinfo.fileSystemType}\n\tCapacity: {Utilities.GetKBytesReadable(sinfo.capacity)}\n\tFree space: {Utilities.GetKBytesReadable(sinfo.free)}"); } CameraFile fi = CameraFile.Find(cam.storageInfo[0].root.fs[0], cam.captureImage()[0]); Console.WriteLine($"Captured {fi.filename}"); if (CameraFile.Exists(cam, fi.path)) { Console.WriteLine($"{fi.filename} exists"); } else { Console.WriteLine($"{fi.filename} does not exist, but should!?"); } cam.DownloadFile(fi.path, $"{Environment.CurrentDirectory}/{Path.GetFileName(fi.filename)}"); Console.WriteLine($"File downloaded from {fi.path} to {Environment.CurrentDirectory}/{Path.GetFileName(fi.filename)}"); fi.Delete(); if (!CameraFile.Exists(cam, fi.path)) { Console.WriteLine($"{fi.filename} has been deleted"); } else { Console.WriteLine($"{fi.filename} still exists?!"); } if (CameraFile.Exists(cam, $"{fi.pathWithoutExtension}.JPG")) { Console.WriteLine("JPG Found, deleting that aswell..."); CameraFile.Delete(cam, $"{fi.pathWithoutExtension}.JPG"); } Console.WriteLine($"################################ TEST File System ################################\n\n"); }
static void testCapture(Camera cam) { Console.WriteLine($"################################ TEST Capture ################################"); Console.WriteLine($"################### FAST 1/4000 ###################"); cam.shutterSpeed = "1/4000"; for (int i = 0; i < 5; i++) { var watch = System.Diagnostics.Stopwatch.StartNew(); List <string> files = cam.captureImage(); watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; CameraFile file = CameraFile.Find(cam.storageInfo[0].root.fs[0], files[0]); Console.WriteLine($"Capture {i+1} {file.filename} " + (files.Count > 1 ? file.filename : "") + $" took {elapsedMs}ms"); } Console.WriteLine($"################### BULB 5s ###################"); cam.shutterSpeed = "bulb"; for (int i = 0; i < 5; i++) { var watch = System.Diagnostics.Stopwatch.StartNew(); List <string> files = cam.captureImage(5); watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; CameraFile file = CameraFile.Find(cam.storageInfo[0].root.fs[0], files[0]); Console.WriteLine($"Capture {i+1} {file.filename} " + (files.Count > 1 ? file.filename : "") + $" took {elapsedMs}ms"); } Console.WriteLine($"################################ TEST Capture ################################"); }