private void miTempFolder_Popup(object sender, System.EventArgs e) { frmHardCopyOptions HO = new frmHardCopyOptions(); System.IO.DirectoryInfo DI = new System.IO.DirectoryInfo(HO.CurrentHardCopyOptions.DefaultTemporaryDirectory); miEmptyTempFolder.Enabled = false; System.IO.FileInfo[] FIS = DI.GetFiles(); if(FIS.Length > 0) { miEmptyTempFolder.Enabled = true; } System.IO.DirectoryInfo[] DIS = DI.GetDirectories(); if(DIS.Length > 0) { miEmptyTempFolder.Enabled = true; } HO.Dispose(); }
private void miOpenTempFolder_Click(object sender, System.EventArgs e) { frmHardCopyOptions HO = new frmHardCopyOptions(); System.Diagnostics.Process P = new System.Diagnostics.Process(); P.StartInfo.FileName = HO.CurrentHardCopyOptions.DefaultTemporaryDirectory; P.StartInfo.UseShellExecute = true; P.Start(); HO.Dispose(); }
private void miConfiguration_Click(object sender, System.EventArgs e) { frmHardCopyOptions PO = new frmHardCopyOptions(); string sAddress = PO.CurrentHardCopyOptions.DefaultOysterAddress; int iCPort = PO.CurrentHardCopyOptions.DefaultOysterConnectionPort; int iFPort = PO.CurrentHardCopyOptions.DefaultOysterFilePort; if(PO.ShowDialog()== DialogResult.OK) { if((sAddress.ToLower() != PO.CurrentHardCopyOptions.DefaultOysterAddress.ToLower())|| (iCPort != PO.CurrentHardCopyOptions.DefaultOysterConnectionPort)|| (iFPort != PO.CurrentHardCopyOptions.DefaultOysterFilePort)) { PO.Dispose(); this.Visible = false; InitializeHardCopy(); this.Visible = true; } else { PO.Dispose(); } } else { PO.Dispose(); } }
private void miEmptyTempFolder_Click(object sender, System.EventArgs e) { if(MessageBox.Show("All files and folders in this directory will be deleted. Do you wish to continue?","Do you wish to empty the Oyster Temp Directory?",MessageBoxButtons.YesNoCancel) != DialogResult.Yes) { return; } frmHardCopyOptions HO = new frmHardCopyOptions(); System.IO.DirectoryInfo DI = new System.IO.DirectoryInfo(HO.CurrentHardCopyOptions.DefaultTemporaryDirectory); try { System.IO.DirectoryInfo[] DIS = DI.GetDirectories(); foreach(System.IO.DirectoryInfo CDI in DIS) { CDI.Delete(true); } System.IO.FileInfo[] FIS = DI.GetFiles(); foreach(System.IO.FileInfo FI in FIS) { FI.Delete(); } } catch(Exception Err) { MessageBox.Show("Empty Temp Folder failed with Error Message: " + Err.Message,"Empty Temp Folder Failed",MessageBoxButtons.OK,MessageBoxIcon.Error); return; } finally { HO.Dispose(); } }
private void InitializeHardCopy() { string ErrorString = ""; frmHardCopyOptions PO = new frmHardCopyOptions(); if(!PO.CurrentHardCopyOptions.HasBeenSaved) { if(PO.ShowDialog() != DialogResult.OK) { Application.Exit(); return; } } /// Check Temporary Path Exist string UserTemperoraryPath = PO.CurrentHardCopyOptions.DefaultTemporaryDirectory; System.IO.DirectoryInfo DI = null; miEmptyTempFolder.Enabled = false; try { if(!System.IO.Directory.Exists(UserTemperoraryPath)) { DI = System.IO.Directory.CreateDirectory(UserTemperoraryPath); } else { DI = new System.IO.DirectoryInfo(UserTemperoraryPath); } System.IO.FileInfo[] FIS = DI.GetFiles(); if(FIS.Length > 0) { miEmptyTempFolder.Enabled = true; } System.IO.DirectoryInfo[] DIS = DI.GetDirectories(); if(DIS.Length > 0) { miEmptyTempFolder.Enabled = true; } } catch(Exception Err) { string perror = Err.Message; } TryItAgain:{} // string Server = "o-prototype"; // int iPort = 13075; try { OSystem = new OCL.Oyster(PO.CurrentHardCopyOptions.DefaultOysterAddress,PO.CurrentHardCopyOptions.DefaultOysterConnectionPort); } catch(Exception Err) { ErrorString = Err.Message; if(MessageBox.Show("Do you wish to open Player Configuration?","Unable to communicate with Oyster Server",MessageBoxButtons.RetryCancel)== DialogResult.Cancel) { Application.Exit(); return; } else { if(PO.ShowDialog() == DialogResult.OK) { goto TryItAgain; } else { Application.Exit(); return; } } } frmLogin fL = new frmLogin(ref OSystem); if(fL.ShowDialog(this)!= DialogResult.OK) { Application.Exit(); return; } LUser = fL.Me; fL.Dispose(); // OCL.RecordingSessions ARS = LUser.AllVisibleRecordingSessions(LUser); // foreach(OCL.RecordingSession RS in ARS) // { // ListViewItem LVI = lvSearchResults.Items.Add(RS.Description); // LVI.SubItems.Add(RS.CreatedDate.ToString()); // OCL.User Owner = OSystem.GetUserById(RS.OwnerID); // LVI.SubItems.Add(Owner.Description); // LVI.SubItems.Add(RS.IsPresentation.ToString()); // LVI.SubItems.Add(RS.CurrentRecordings(LUser).Count.ToString()); // LVI.Tag = RS; // } frmSO = new frmSearchOptions(); PO.Dispose(); //sLocalDrive = GetRegistryValue(MAJORSECTION,MINORSECTION,MINISECTION,KEYSECTION,"D:"); }