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 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 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 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:"); }
private void ReloadDefaults() { frmHardCopyOptions PO = new frmHardCopyOptions(); bool SetDateTime = true; switch(PO.CurrentHardCopyOptions.DefaultSearchType) { case OCL.OysterRecordingSessionSearchType.Title: rbTitle.Checked = true; pnlDateSearch.Visible = false; break; case OCL.OysterRecordingSessionSearchType.People: rbPeople.Checked = true; pnlDateSearch.Visible = false; break; case OCL.OysterRecordingSessionSearchType.Notes: rbNotes.Checked = true; pnlDateSearch.Visible = false; break; case OCL.OysterRecordingSessionSearchType.Date: rbDate.Checked = true; pnlDateSearch.Visible = true; SetDateTime = false; break; } if(SetDateTime) { DateTime Tomorrow = DateTime.Now.AddDays(1); DateTime Yesterday = DateTime.Now.AddDays(-1); dtpStartTime.Value = DateTime.Parse(Yesterday.Month + "/" + Yesterday.Day + "/" + Yesterday.Year); dtpStopTime.Value = DateTime.Parse(Tomorrow.Month + "/" + Tomorrow.Day + "/" + Tomorrow.Year); } else { dtpStartTime.Value = DateTime.Parse(PO.CurrentHardCopyOptions.DefaultBeginDate); dtpStopTime.Value = DateTime.Parse(PO.CurrentHardCopyOptions.DefaultEndDate); } }
private void frmHardDisc_Load(object sender, System.EventArgs e) { frmParent = (frmFindSession)this.Owner; this.Text = "Oyster HardCopy - Select Archival Method"; TempPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + @"\Oyster\" + CarverLabUtility.AppInfo.Title + @"\Downloads"; if(!System.IO.Directory.Exists(TempPath)) { try { System.IO.Directory.CreateDirectory(TempPath); } catch(Exception Err) { MessageBox.Show("Default local download directory - " + TempPath + "\nError Message:\n" + Err.Message,"Error while attempting to create default local download directory." + TempPath,MessageBoxButtons.OK,MessageBoxIcon.Error); } } gbBurnDisc.Visible = true; tbDestination.Text = TempPath; tbDiscSpace.Text = "No disc detected"; tbDiscSpace.ForeColor = Color.Red; NOBURNERSDETECTED = true; //To Do: Insert Code to Initialize cbBurner int i; short j = 0; cbBurner.Items.Clear(); Burners = new ArrayList(); #region New MCD Code frmHardCopyOptions HO = new frmHardCopyOptions(); Device_Drive NoDrive = new Device_Drive(); NoDrive.DeviceNumber = -99; NoDrive.LongDeviceName = "No Devices Present"; NoDrive.ShortDeviceName = "No Devices Present"; for(i = 0;i < MCDB.DeviceCount; i++) { j = (short) i; string sDeviceName = MCDB.get_DeviceName(j); if(MCDB.SelectDevice(j)) { if(MCDB.DeviceIsBurner()) { Device_Drive DD = new Device_Drive(); DD.DeviceNumber = j; DD.LongDeviceName = sDeviceName; string[] sName = sDeviceName.Split(",".ToCharArray()); string[] tempName = sName[1].Split(" ".ToCharArray()); sDeviceName = "(" + tempName[0] + ") " + tempName[1] + " " + tempName[3]; DD.ShortDeviceName = sDeviceName; Burners.Add(DD); NOBURNERSDETECTED = false; } } } if(!NOBURNERSDETECTED) { cbBurner.DisplayMember = "ShortDeviceName"; cbBurner.ValueMember = "DeviceNumber"; cbBurner.DataSource = Burners; if(HO.CurrentHardCopyOptions.DefaultBurnerLongDeviceName != "No Devices Present") { bool FoundIt = false; foreach(object obj in Burners) { Device_Drive D = (Device_Drive)obj; string DName = D.LongDeviceName.ToLower(); string SName = HO.CurrentHardCopyOptions.DefaultBurnerLongDeviceName.ToLower(); if(DName == SName) { cbBurner.Text = D.ShortDeviceName; cbBurner.SelectedValue = D.DeviceNumber; MCDB.SelectDevice(D.DeviceNumber); FoundIt = true; break; } } if(!FoundIt) { cbBurner.Text = ((Device_Drive)Burners[0]).ShortDeviceName; cbBurner.SelectedValue = ((Device_Drive)Burners[0]).DeviceNumber; MCDB.SelectDevice(((Device_Drive)Burners[0]).DeviceNumber); } } else { cbBurner.Text = ((Device_Drive)Burners[0]).ShortDeviceName; cbBurner.SelectedValue = ((Device_Drive)Burners[0]).DeviceNumber; MCDB.SelectDevice(((Device_Drive)Burners[0]).DeviceNumber); } DevicesReady = true; Msg("Create an Oyster Disc"); } else { Burners.Add(NoDrive); cbBurner.Text = ((Device_Drive)Burners[0]).ShortDeviceName; cbBurner.SelectedValue = ((Device_Drive)Burners[0]).DeviceNumber; cbBurner.Enabled = false; rbOysterHardDisc.Enabled = false; rbBurnDisc.Enabled = false; rbDownload.Checked = true; Msg("No Burners detected! Defaulting to save to local drive."); rbOysterOptions_CheckedChanged(rbDownload,EventArgs.Empty); } #endregion #region OldMCD COde // // for(i = 0;i < MCDB.DeviceCount; i++) // { // j = (short) i; // string sDeviceName = MCDB.get_DeviceName(j); // if(MCDB.SelectDevice(j)) // { // if(MCDB.DeviceIsBurner()) // { // Device_Drive DD = new Device_Drive(); // DD.DeviceNumber = j; // DD.LongDeviceName = sDeviceName; // string[] sName = sDeviceName.Split(",".ToCharArray()); // // string[] tempName = sName[1].Split(" ".ToCharArray()); // sDeviceName = "(" + tempName[0] + ") " + tempName[1] + " " + tempName[3]; // DD.ShortDeviceName = sDeviceName; // // NOBURNERSDETECTED = false; // cbBurner.Items.Add(sDeviceName); // } // } // // } // // frmHardCopyOptions HO = new frmHardCopyOptions(); // // if(!NOBURNERSDETECTED) // { // short DNumber = 0; // if(m_HardCopyOptions.DefaultBurnerLongDeviceName != "No Devices Present") // { // foreach(object obj in Burners) // { // Device_Drive D = (Device_Drive)obj; // if(D.LongDeviceName.ToLower() == m_HardCopyOptions.DefaultBurnerLongDeviceName) // { // cbBurner.Text = D.ShortDeviceName; // cbBurner.SelectedValue = D.DeviceNumber; // DNumber = D.DeviceNumber; // } // } // } // else // { // cbBurner.Text = ((Device_Drive)Burners[1]).ShortDeviceName; // cbBurner.SelectedValue = ((Device_Drive)Burners[1]).DeviceNumber; // } // MCDB.SelectDevice(De); // if (MCDB.DeviceCount > 0) // cbBurner.SelectedIndex = 0; // Msg("Create an Oyster Disc"); // } // else // { // rbDownload.Checked = true; // rbOysterHardDisc.Enabled = false; // rbBurnDisc.Enabled = false; // Msg("Download to Local Storage"); // } #endregion TotalRecordingSizeInBytes = 0; TotalAttachmentSizeInBytes = 0; foreach(OCL.RecordingSession RS in SelectedRecordingSessions) { foreach(OCL.Recording Rec in RS.CurrentRecordings(frmParent.LUser)) { TotalRecordingSizeInBytes += Rec.SizeOnDisk; } if(cbFileAttachments.Checked) { foreach(OCL.Note N in RS.AllVisibleNotes(frmParent.LUser)) { foreach(OCL.Attachment A in N.FileAttachments) { TotalAttachmentSizeInBytes += A.FileSize; } } } } tmrLaunch.Enabled = true; }
public void ProcessActions() { btnOK.Enabled = false; timer1.Enabled = false; gbOptions.Enabled = false; miFile.Enabled = false; // gbBurnDisc.Enabled = false; // gbLocalDownload.Enabled = false; // rbBurnDisc.Enabled = false; // rbDownload.Enabled = false; // rbOysterHardDisc.Enabled = false; // btnCancel.Enabled = false; frmHardCopyOptions HO = new frmHardCopyOptions(); TempBurnPath = HO.CurrentHardCopyOptions.DefaultTemporaryDirectory; string SafeBurnDirectory = RenameFile(DateTime.Now.ToString(),"",TempBurnPath); TempBurnPath = TempBurnPath + @"\" + SafeBurnDirectory; string SafeDirectory = RenameFile(DateTime.Now.ToString(),"",TempPath); TempPath = TempPath +@"\" + SafeDirectory; m_ActivityAborted = false; Application.DoEvents(); if(!rbDownload.Checked) { if(!MCDB.TestUnitReady()) { MessageBox.Show("Please insert a blank DVD to continue","Blank DVD not detected"); goto RestoreAbilities; } try { System.IO.Directory.CreateDirectory(TempBurnPath); } catch(Exception Err) { MessageBox.Show(Err.Message,"Error while attempting to create temporary download directory.",MessageBoxButtons.OK,MessageBoxIcon.Error); MessageBox.Show("This download process can not continue. Aborting download...","Download aborted"); goto RestoreAbilities; } } else { try { System.IO.Directory.CreateDirectory(TempPath); } catch(Exception Err) { MessageBox.Show(Err.Message,"Error while attempting to create local download directory.",MessageBoxButtons.OK,MessageBoxIcon.Error); MessageBox.Show("This download process can not continue. Aborting download...","Download aborted"); goto RestoreAbilities; } } m_InProcess = true; //AS = new frmActivityStatus("Downloading Sessions","Contacting Server for videos..."); //Msg("Contacting Server for videos..."); //AS.StatusButtonText = "Abort Download"; //AS.Owner = this; //AS.Show(); if(rbOysterHardDisc.Checked) { PrepareOysterDirectory(); if(CheckAbortStatus()) { //AS.Hide(); //AS.Dispose(); Msg("Oyster Disc creation aborted."); goto RestoreAbilities; } } DownloadSessions(); if(CheckAbortStatus()) { //AS.Hide(); //AS.Dispose(); Msg("Download aborted."); goto RestoreAbilities; } if(rbOysterHardDisc.Checked) { string OHDPrep = "Requesting Session information from Server."; Msg(OHDPrep); //AS.StatusTitle = "Transferring data from Server. This may take up to a minute to complete."; //AS.StatusText = OHDPrep; //AS.Update(); System.Threading.Thread.SpinWait(500000); PrepareDatabase(); if(CheckAbortStatus()) { //AS.Hide(); //AS.Dispose(); Msg("Oyster Disc creation aborted."); goto RestoreAbilities; } } else { if(cbNotes.Checked) { if(rbXML.Checked) XMLNotes(); else if(rbText.Checked) TextNotes(); } if(CheckAbortStatus()) { //AS.Hide(); //AS.Dispose(); if(rbDownload.Checked) { Msg("Download aborted."); } else { Msg("Create CD/DVD Disc aborted."); } goto RestoreAbilities; } } if(!rbDownload.Checked) { string PBurn = "Closing all copied files. This may take up to 20 seconds."; Msg(PBurn); //AS.StatusText = PBurn; //AS.StatusTitle = "Creating Disc Image"; //AS.Update(); System.Threading.Thread.SpinWait(1500000); if(CheckAbortStatus()) { //AS.Hide(); //AS.Dispose(); if(rbOysterHardDisc.Checked) Msg("Oyster Disc creation aborted."); else Msg("Create CD/DVD Disc aborted."); goto RestoreAbilities; } RunBurn(); if(CheckAbortStatus()) { //AS.Hide(); //AS.Dispose(); if(rbOysterHardDisc.Checked) Msg("Oyster Disc creation aborted."); else Msg("Create CD/DVD Disc aborted."); goto RestoreAbilities; } //AS.Hide(); //AS.Dispose(); //No Need to leave a message because message will show from the //write done event of the MCDB Burn Control. this.DialogResult = DialogResult.None; } else { //AS.Hide(); //AS.Dispose(); m_InProcess = false; MessageBox.Show("Download Complete.","Oyster Download Response"); this.DialogResult = DialogResult.OK; } return; RestoreAbilities:{} miFile.Enabled = true; btnOK.Enabled = true; gbOptions.Enabled = true; m_InProcess = false; timer1.Enabled = true; // gbBurnDisc.Enabled = true; // gbLocalDownload.Enabled = true; // rbBurnDisc.Enabled = true; // rbDownload.Enabled = true; // rbOysterHardDisc.Enabled = true; // btnCancel.Enabled = true; }