//internal string ConnectionString; /// <summary> /// Opens and manages its own connection to the Oyster Database /// ALL Instances of the Functions Class use the same Connection /// Always returns True /// </summary> /// internal Functions() { // // TODO: Add constructor logic here // try { if (RF == null) { try { RegistryKey RK; //RK = Registry.LocalMachine.OpenSubKey("Software\\VSC\\CardVideo"); //UseExternalDatabase = 0; RK = CarverLab.Utility.Registry.DefaultProductKey; if(RK != null) { ServerAddress = Convert.ToString((object)RK.GetValue("OysterMediaServerAddr","")); ServerPort = Convert.ToInt32((object)RK.GetValue("OysterDatabasePort","")); } } catch(Exception Err) { string p = Err.Message; } try { if(chan==null) { chan = new TcpChannel(); ChannelServices.RegisterChannel(chan); } } catch(Exception Err) { string p = Err.Message; } // Create an instance of the remote object try { RF = (OysterDataBaseService.RemoteFunctions) Activator.GetObject( typeof(OysterDataBaseService.RemoteFunctions), "tcp://" + ServerAddress + ":" + ServerPort.ToString() +"/ODS_Functions" ); // Use the object if( RF.Equals(null) ) { RF = null; chan = null; throw new Exception("Unable to connect to Oyster Server"); } } catch(Exception Err) { string sErrorMessage = Err.Message; RF = null; chan = null; throw new Exception("Unable to connect to Oyster Server"); } } } catch(Exception Err) { throw new Exception(Err.Message,Err.InnerException); } }
internal static void Reset() { RF = null; }
internal static void LoadAlternateRemoteFunctions(OysterDataBaseService.RemoteFunctions AlternateRF) { RF = AlternateRF; }
internal Functions(OysterDataBaseService.RemoteFunctions AlternateRF) { RF = AlternateRF; }
internal Functions(string Server_Address,int Server_Port) { // // TODO: Add constructor logic here // try { if((RF ==null)||(Server_Address != ServerAddress)||(Server_Port != ServerPort)) { RF = null; if(chan != null) { ChannelServices.UnregisterChannel(chan); chan = null; } try { chan = new TcpChannel(); ChannelServices.RegisterChannel(chan); } catch(Exception Err) { string sPeek = Err.Message; throw new Exception("Server not located"); } // Create an instance of the remote object RF = (OysterDataBaseService.RemoteFunctions) Activator.GetObject( typeof(OysterDataBaseService.RemoteFunctions), "tcp://" + Server_Address + ":" + Server_Port.ToString() +"/ODS_Functions" ); // Use the object if( RF.Equals(null) ) { throw new Exception("Unable to connect to Oyster Database Service!"); } ServerAddress = Server_Address; ServerPort = Server_Port; } } catch(Exception Err) { RF = null; throw new Exception(Err.Message,Err.InnerException); } }
private void frmFindSession_Load(object sender, System.EventArgs e) { this.Text = CarverLabUtility.AppInfo.Title + " - " + this.Tag.ToString(); sLocalDrive = GetDiscLocation(); lblRecordingIdentifier.Text = "No Angles"; TryAgain:{} string Server = System.Net.Dns.Resolve(Environment.MachineName).HostName; //int iPort = 13075; try { // OSystem = new OCL.Oyster(); OysterDataBaseService.RemoteFunctions AlternateRF = new OysterDataBaseService.RemoteFunctions(); OSystem = new OCL.Oyster(AlternateRF); } catch(Exception Err) { string PeekError = Err.Message; if(MessageBox.Show("Do you wish to try again?","Unable to communicate with Oyster Server: " + Server,MessageBoxButtons.RetryCancel)== DialogResult.Cancel) { Application.Exit(); return; } else goto TryAgain; } try { LUser = OSystem.Login("splat","splat"); int iError = 0; if(LUser == null) /*Generate An Error*/ iError = Convert.ToInt32("HereComesAnError",10); if(iError == 0) iError = 0; } catch(Exception Err) { string PeekError = Err.Message; MessageBox.Show("Unknown error occurred. Closing Application","Unknown Error"); Application.Exit(); return; } // PreviewPlayer.IsUMPlayer = false; PreviewPlayer.CurrentPlayerType = OysterPlaybackControls.PlayerType.WindowMediaPlayer; 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; } sLocalDrive = GetDiscLocation(); frmSO = new frmSearchOptions(); }