static void TestSpaceSizes() { string disk = @"C:\"; int x = DriveHelper.GetVolumeAvailableSpace(disk); Console.WriteLine("Available space on " + disk + ": " + x + "MB"); }
public void RotationTest1() { var driveHelper = new DriveHelper(this.communicationHelper, this.controlSettings); driveHelper.TurboModeOn = true; int leftSpeed; int rightSpeed; driveHelper.CalculateMotorsSpeed(1, 0, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("L00FF", this.leftMotorCommand); Assert.AreEqual("R0000", this.rightMotorCommand); driveHelper.CalculateMotorsSpeed(0.5, 0, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("L00DD", this.leftMotorCommand); Assert.AreEqual("R0000", this.rightMotorCommand); driveHelper.CalculateMotorsSpeed(-1, 0, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("L0000", this.leftMotorCommand); Assert.AreEqual("R00FF", this.rightMotorCommand); driveHelper.CalculateMotorsSpeed(-0.5, 0, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("L0000", this.leftMotorCommand); Assert.AreEqual("R00DD", this.rightMotorCommand); }
public Response GenerateDeliverySchedule(APIGatewayProxyRequest request, ILambdaContext context) { var getRequestGateway = new INeedHelpGateway(new Cv19SupportDbContext(_connectionString)); var driveHelper = new DriveHelper(); var utilityHelper = new UtilityHelper(getRequestGateway); var deliveryScheduleObject = new DeliveryScheduleUseCase(getRequestGateway, driveHelper); try { var request_params = request.QueryStringParameters; var limit = Int32.Parse(request_params["limit"]); var confirmed = bool.Parse(request_params["confirmed"]); var deliveryDay = utilityHelper.GetNextWorkingDay(DateTime.Today); var resp = deliveryScheduleObject.CreateDeliverySchedule(limit, confirmed, deliveryDay); LambdaLogger.Log(("Records retrieval success: " + resp.ToString())); var response = new Response(); response.isBase64Encoded = true; response.statusCode = "200"; response.body = JsonConvert.SerializeObject(resp); return(response); } catch (Exception e) { LambdaLogger.Log("Error: " + e.Message); var response = new Response(); response.isBase64Encoded = true; response.statusCode = "500"; response.body = "Error processing request: " + ". Error Details: " + e.Message + e.StackTrace; return(response); } }
public void TurboDriveTest() { var driveHelper = new DriveHelper(this.communicationHelper, this.controlSettings); driveHelper.TurboModeOn = true; int leftSpeed; int rightSpeed; driveHelper.CalculateMotorsSpeed(0, 1, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("L00FF", this.leftMotorCommand); Assert.AreEqual("R00FF", this.rightMotorCommand); driveHelper.CalculateMotorsSpeed(0, 0.5, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("L00DD", this.leftMotorCommand); Assert.AreEqual("R00DD", this.rightMotorCommand); driveHelper.CalculateMotorsSpeed(0, -1, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("LFF01", this.leftMotorCommand); Assert.AreEqual("RFF01", this.rightMotorCommand); driveHelper.CalculateMotorsSpeed(0, -0.5, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("LFF23", this.leftMotorCommand); Assert.AreEqual("RFF23", this.rightMotorCommand); }
public void StopTest() { var driveHelper = new DriveHelper(this.communicationHelper, this.controlSettings); driveHelper.GenerateMotorCommands(0, 0, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("L0000", this.leftMotorCommand); Assert.AreEqual("R0000", this.rightMotorCommand); }
private static void OnApplicationExit(object sender, EventArgs e) { PdfReaderHelper.getInstance().unload(); DriveHelper.disconnectStorageDrive(); FileUtils.CleanUpStaging(); FileUtils.CleanUpTemp(); m.stop(); }
private void FormCopyTracksToExternalMedium_Load(object sender, EventArgs e) { // Alle externen Laufwerk ermitteln pictureBox.Image = Misc.IconToAlphaBitmap(Images.mp3device); Visible = true; Refresh(); Update(); int count = 1; foreach (string file in filesToCopy) { try { FileInfo fi = new FileInfo(file); ListViewItem item = listViewFiles.Items.Add(string.Format("{0}.", count++)); item.Tag = file; item.SubItems.Add(file); item.SubItems.Add(string.Format("{0} KB", (fi.Length + 1023) / 1024)); } catch { } } List <DriveHelper.DiskDrive> diskDrives = DriveHelper.GetAvailableDisks(); string[] drives = System.Environment.GetLogicalDrives(); foreach (DriveHelper.DiskDrive diskDrive in diskDrives) { try { if (diskDrive.InterfaceType == "USB" && diskDrive.Size > 10000000) // 10000000, damit wir keine Floppys anzeigen { comboBoxDrive.Items.Add(new ComboBoxItem(diskDrive)); } } catch { } } if (comboBoxDrive.Items.Count > 0) { comboBoxDrive.SelectedIndex = 0; } else { MessageBox.Show(StringTable.NoExternalMediumFound, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } UpdateWindowState(); }
private static void ShowSpaceInfo(SyncExecution syncExec) { string sourceVolume = DriveHelper.GetSourceVolume(syncExec.SyncConfig); string destVolume = DriveHelper.GetDestVolume(syncExec.SyncConfig); int sourceAvailableSpace; int destAvailableSpace; bool networkTransfer = false; if (sourceVolume.Contains(@"\\")) { sourceAvailableSpace = 0; networkTransfer = true; } else { sourceAvailableSpace = DriveHelper.GetVolumeAvailableSpace(sourceVolume); } if (destVolume.Contains(@"\\")) { destAvailableSpace = 0; networkTransfer = true; } else { destAvailableSpace = DriveHelper.GetVolumeAvailableSpace(destVolume); } if (!networkTransfer) { Console.WriteLine("\nRequired space on disk " + sourceVolume + ": " + syncExec.SpaceNeededInSource + "MB. Available space: " + sourceAvailableSpace + "MB"); Console.WriteLine("Required space on disk " + destVolume + ": " + syncExec.SpaceNeededInDestination + "MB. Available space: " + destAvailableSpace + "MB"); if (sourceAvailableSpace < syncExec.SpaceNeededInSource) { Console.WriteLine( "WARNING: there is not enough available space for synchronization to complete. Disk " + sourceVolume); } if (destAvailableSpace < syncExec.SpaceNeededInDestination) { Console.WriteLine( "WARNING: there is not enough available space for synchronization to complete. Disk " + destVolume); } } }
public void UpdateDrives() { StamperLiveData.ObservedDriveState.Clear(); var drives = DriveHelper.FindDrives(StamperLiveData.Project); foreach (var drive in drives) { bool done = Stamper.CheckDrive(drive, StamperLiveData.Project); bool space = Stamper.DriveHasSpace(drive, StamperLiveData.Project); eDriveState state = done ? eDriveState.Stamped : (space ? eDriveState.Ready : eDriveState.NoSpace); StamperLiveData.ObservedDriveState.Add(drive, state); } StamperLiveData.SendDrivesUpdate(); }
public void ProgressiveRetryTest() { var tries = 0; try { tries = ExecutionHelper.ProgressiveRetry(() => { var drives = DriveHelper.GetRemovableDrives(); }, 3, 10); } catch (Exception ex) { Assert.Fail($"Progressive retry failed: {ex.Message}."); } Assert.IsTrue(tries > 0); }
public void HalfRightBackward() { var driveHelper = new DriveHelper(this.communicationHelper, this.controlSettings); driveHelper.TurboModeOn = true; int leftSpeed; int rightSpeed; driveHelper.CalculateMotorsSpeed(0.7071, -0.7071, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("LFF01", this.leftMotorCommand); Assert.AreEqual("RFFB6", this.rightMotorCommand); driveHelper.CalculateMotorsSpeed(0.3536, -0.3536, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("LFF23", this.leftMotorCommand); Assert.AreEqual("RFFC9", this.rightMotorCommand); }
public void HalfRightForward() { var driveHelper = new DriveHelper(this.communicationHelper, this.controlSettings); driveHelper.TurboModeOn = true; int leftSpeed; int rightSpeed; driveHelper.CalculateMotorsSpeed(0.7071, 0.7071, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("L00FF", this.leftMotorCommand); Assert.AreEqual("R004A", this.rightMotorCommand); driveHelper.CalculateMotorsSpeed(0.3536, 0.3536, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("L00DD", this.leftMotorCommand); Assert.AreEqual("R0037", this.rightMotorCommand); }
static void Main(string[] args) { runOnce(); // Setup application icon for "Add remove programs" Application.ApplicationExit += new EventHandler(OnApplicationExit); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (args.Length > 1 && "reset".Equals(args[0])) { ReaderConfig config = ReaderConfig.getInstance(); config.ContentPath = args[1]; config.PythonPath = @"lib\WinPython\python\python.exe"; config.PdfminerPath = @"lib\WinPython\python\Scripts\pdf2txt.py"; config.UseAdobeReader = true; config.EnableOCR = false; config.GhostscriptPath = @"lib\Ghostscript\bin\gswin32.exe"; config.TesseractPath = @"lib\Tesseract-ocr\tesseract.exe"; config.DBPath = @"Y:\rsdiconversion\db\ethesis2016.db3"; config.StoragePath = @"Y:\rsdiconversion\contents"; config.SaveSettings(); } Form mainForm = new MainForm(); // Initialize PDF viewer component PdfReaderHelper.getInstance().init(ReaderConfig.getInstance().UseAdobeReader); // Map network drive DriveHelper.connectStorageDrive(); // Start file monitor thread Thread readCDThread = new Thread(new ThreadStart(m.start)); readCDThread.SetApartmentState(ApartmentState.STA); readCDThread.Start(); Application.Run(mainForm); }
public Response DeleteDeliveryBatch(APIGatewayProxyRequest request, ILambdaContext context) { var deleteBatchGateway = new INeedHelpGateway(new Cv19SupportDbContext(_connectionString)); var driveHelper = new DriveHelper(); var deleteBatchObject = new DeliveryScheduleUseCase(deleteBatchGateway, driveHelper); var requestParams = request.PathParameters; int batchId; try { batchId = Int32.Parse(requestParams["id"]); } catch { var response = new Response(); response.isBase64Encoded = true; LambdaLogger.Log("No batch id specified."); response.statusCode = "400"; return(response); } try { deleteBatchObject.DeleteDeliveryBatch(batchId); var response = new Response(); response.isBase64Encoded = true; LambdaLogger.Log("Batch successfully deleted."); response.statusCode = "200"; return(response); } catch (Exception e) { LambdaLogger.Log("Error: " + e.Message); var response = new Response(); response.isBase64Encoded = true; response.statusCode = "500"; response.body = "Error processing request: " + ". Error Details: " + e.Message + e.StackTrace; return(response); } }
public void BackwardTest() { var driveHelper = new DriveHelper(this.communicationHelper, this.controlSettings); driveHelper.TurboModeOn = false; int leftSpeed; int rightSpeed; driveHelper.CalculateMotorsSpeed(0, -1, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); Assert.AreEqual("L" + MessageHelper.IntToMessageValue(-this.controlSettings.DriveModeNormalMaxSpeed), this.leftMotorCommand); Assert.AreEqual("R" + MessageHelper.IntToMessageValue(-this.controlSettings.DriveModeNormalMaxSpeed), this.rightMotorCommand); driveHelper.CalculateMotorsSpeed(0, -0.5, out leftSpeed, out rightSpeed); driveHelper.GenerateMotorCommands(leftSpeed, rightSpeed, out this.leftMotorCommand, out this.rightMotorCommand); int speed = Convert.ToInt32(255.0 * 0.5); speed = DriveHelper.NonlinearSpeedCorrection(speed); speed = driveHelper.TurboModeOn ? speed : speed * this.controlSettings.DriveModeNormalMaxSpeed / 255; Assert.AreEqual("L" + MessageHelper.IntToMessageValue(-speed), this.leftMotorCommand); Assert.AreEqual("R" + MessageHelper.IntToMessageValue(-speed), this.rightMotorCommand); }
public void GetDriveSerialNumberTest() { var drive = DriveHelper.GetFixedDrives().First(); Assert.IsNotNull(DriveHelper.GetDriveSerialNumber(drive.Name)); }
public void GetDriveSerialNumberTest() { Assert.IsNotNull(DriveHelper.GetDriveSerialNumber(@"c:\")); }
public async void OnNavigatedTo(NavigationContext context) { var service = DriveHelper.createDriveService("client_secret.json", false) // ERROR _googleDriveFolders = await DriveHelper.getFiles(service), "trashed=false and mimeType = 'application/vnd.google-apps.folder'"); }
public void TestGetRemovableDrives() { var result = DriveHelper.GetRemovableDrives(); base.Consumer.Consume(result); }
public void TestGetFixedDrives() { var result = DriveHelper.GetFixedDrives(); base.Consumer.Consume(result); }
public void GetDriveSerialNumber() { var result = DriveHelper.GetDriveSerialNumber(DriveHelper.GetFixedDrives().PickRandom().Name); base.Consumer.Consume(result); }
protected override void WndProc(ref Message m) { DriveHelper.QueryDeviceChange(m, OnStateChanged); base.WndProc(ref m); }
public void GetRemovableDrivesTest() { var result = DriveHelper.GetRemovableDrives(); Assert.IsNotNull(result); }
public void GetFixedDrivesTest() { var result = DriveHelper.GetFixedDrives(); Assert.IsTrue(result.Count > 0); }
public void loadFolders(object parameter) { googleDriveFolders = new NotifyTaskCompletion <List <File> >(DriveHelper.getFiles(_service, "trashed=false and mimeType = 'application/vnd.google-apps.folder'")); }
public Guid SaveDrive(Drive drive) { var adaptedDrive = new DriveHelper().AdaptDrive(drive); return(_driveRepository.SaveDrive(adaptedDrive)); }
public MainWindowViewModel() { _service = DriveHelper.createDriveService("client_secret.json", false); googleDriveFolders = new NotifyTaskCompletion <List <File> >(DriveHelper.getFiles(_service, "trashed=false and mimeType = 'application/vnd.google-apps.folder'")); }