internal Venue (VenueData venueData) { identifier = null; this.name = venueData.Name; this.endPoint = venueData.IPEndPoint; this.ttl = venueData.TTL; this.type = venueData.VenueType; this.icon = venueData.Icon; }
internal Venue(VenueData venueData) { identifier = null; this.name = venueData.Name; this.endPoint = venueData.IPEndPoint; this.ttl = venueData.TTL; this.type = venueData.VenueType; this.icon = venueData.Icon; }
public Venue AddCustomVenue(VenueData venueData) { if (venues.ContainsKey(venueData.Name)) { throw new Exception("Trying to add custom venue '" + venueData.Name + "', but that name is already in use."); } venueData.VenueType = VenueType.Custom; Venue newVen = new Venue(venueData); venues.Add(newVen); return(newVen); }
public Venue AddCustomVenue(VenueData venueData) { if (venues.ContainsKey(venueData.Name)) { throw new Exception(string.Format(CultureInfo.CurrentCulture, Strings.TryingToAddCustomVenue, venueData.Name)); } venueData.VenueType = VenueType.Custom; Venue newVen = new Venue(venueData); venues.Add(newVen); return(newVen); }
/// <summary> /// Creates a venue with IPAddress 234.*.*.* where each * is randomly generated. Extremely useful /// in the case where a venue server is inaccessible. /// </summary> public Venue CreateRandomMulticastVenue(string name, Image icon) { IPEndPoint endPoint = null; bool trafficInVenue = true; while (trafficInVenue) { #region Randomly choose the Venue's IP address Random rnd = new Random(); int randomaddr = 234; randomaddr = randomaddr * 256 + rnd.Next(1, 2 ^ 8 - 1); randomaddr = randomaddr * 256 + rnd.Next(1, 2 ^ 8 - 1); randomaddr = randomaddr * 256 + rnd.Next(1, 2 ^ 8 - 1); endPoint = new IPEndPoint(IPAddress.HostToNetworkOrder(randomaddr), 5004); #endregion #region Detect whether there is already traffic in the venue, if so change the IP address BufferChunk bc = new BufferChunk(MSR.LST.Net.Rtp.Rtp.MAX_PACKET_SIZE); UdpListener udpListener = new UdpListener(endPoint, venueInUseTimeout); try { udpListener.Receive(bc); } catch (System.Net.Sockets.SocketException e) { if (e.ErrorCode == 10060) { trafficInVenue = false; } else { throw; } } finally { udpListener.Dispose(); } #endregion } VenueData venueData = new VenueData(name, endPoint, 5, VenueType.Custom, icon); return(AddCustomVenue(venueData)); }
/// <summary> /// Create a custom Local venue. The TTL parameter doesn't matter since currently the only way to overide the default of ttl=255 is through app.config /// </summary> private static Venue AddLocalVenue() { if (!Conference.VenueServiceWrapper.Venues.ContainsKey("Local Venue")) { VenueData vd = new VenueData("Local Venue", new IPEndPoint(IPAddress.Parse("234.9.8.7"), 5004), 255, VenueType.Custom, null); Conference.VenueServiceWrapper.AddCustomVenue(vd); } return Conference.VenueServiceWrapper.Venues["Local Venue"]; }
private void menuActionsUnicast_Click(object sender, System.EventArgs e) { frmNetworkUnicast unicastSession = new frmNetworkUnicast(); if (unicastSession.ShowDialog() == DialogResult.OK) { try { VenueData vd = new VenueData("Unicast Venue", new System.Net.IPEndPoint(remoteIP, Convert.ToInt32("5004")), 127, VenueType.Custom, null, null, null); Venue v = Conference.VenueServiceWrapper.AddCustomVenue(vd); JoinVenue(v, true); twoWayUnicast = true; SetArchiverMenuStatus(); } catch (Exception ex) { MessageBox.Show(ex.Message); twoWayUnicast = false; SetArchiverMenuStatus(); } } }
private void InvokeActionArguments(StringDictionary parameters) { #region Show Help if (parameters.ContainsKey("help")) { MessageBox.Show( " By using one or more command line parameters, you can specify or change\n" + " ConferenceXP configuration options. The name of venues and capabilities\n" + " are case sensitive. For a venue or capability name that includes a space,\n" + " use quotation marks around the name.\n" + " \n" + " -help\t\t\t\tView help\n" + " \n" + " -venue VenueName\t\tJoin a venue\n" + " -v VenueName\n" + " \n" + " -capability CapabilityName\t\tStart a capability\n" + " -c CapabilityName\n" + " \n" + " -venueservice http://server/web \t\tSpecify a different Venue Service\n" + " -vs http://server/web\n" + " \n" + " -venueservice none\t\tUse no Venue Service\n" + " -vs none\n" + " \n" + " -ip x.x.x.x -port xxxx\t\tJoin a custom venue\n" + " \n" + " -recordnotify false\t\t\tDisable Recording Notification\n" + " -rn false\n" + " \n" + " -email [email protected]\t\tSpecify a different identifier\n" + " -e [email protected]", "ConferenceXP Command Line Parameters"); return; } #endregion #region Join Venue if (parameters.ContainsKey("venue") || parameters.ContainsKey("v")) { string venueName = parameters["venue"]; if (parameters.ContainsKey("v")) { venueName = parameters["v"]; } if (!Conference.VenueServiceWrapper.Venues.ContainsKey(venueName)) { string dialogText = "Available venues are:\n\n"; foreach (Venue v in Conference.VenueServiceWrapper.Venues) { dialogText += " " + v.Name + "\n"; } MessageBox.Show(dialogText, "Venue '" + venueName + "' not found.", MessageBoxButtons.OK, MessageBoxIcon.Stop); Application.Exit(); } Conference.JoinVenue(Conference.VenueServiceWrapper.Venues[venueName]); AutoSendAV(); } if (parameters.ContainsKey("ip")) { if (parameters.ContainsKey("port")) { VenueData vd = new VenueData("Custom Venue", new IPEndPoint(IPAddress.Parse(parameters["ip"]), int.Parse(parameters["port"])), 127, VenueType.Custom, null, null, null); Venue v = Conference.VenueServiceWrapper.AddCustomVenue(vd); Conference.JoinVenue(v); AutoSendAV(); } else { MessageBox.Show("If you specify the -ip parameter, you must also specify the -port parameter."); } } #endregion #region Play Capability if (parameters.ContainsKey("capability") || parameters.ContainsKey("c")) { if (Conference.ActiveVenue == null) { MessageBox.Show("If you specify -capability, you must also specify -venue"); } string capabilityName = parameters["capability"]; if (parameters.ContainsKey("c")) { capabilityName = parameters["c"]; } ArrayList alOtherCapabilitySenders = new ArrayList(Conference.OtherCapabilitySenders); if (alOtherCapabilitySenders.Contains(capabilityName)) { ICapabilitySender cs = Conference.CreateCapabilitySender(capabilityName); } else { string dialogText = "Available OtherCapabilitySenders are:\n\n"; foreach (string s in Conference.OtherCapabilitySenders) { dialogText += " " + s + "\n"; } dialogText += "\n\nNote that Capability names are case sensitive."; MessageBox.Show(dialogText, "CapabilitySender '" + capabilityName + "' not found.", MessageBoxButtons.OK, MessageBoxIcon.Stop); Application.Exit(); } } #endregion }
/// <summary> /// Find a playback venue to join. /// </summary> /// <returns>The venue</returns> private Venue GetPlayBackVenue() { Venue playbackVenue; // Check to make sure we aren't playing back from our machine to our machine Uri archiverUri = new Uri(GetArchiveUri()); if (archiverUri.IsLoopback) { // In the odd case that we're trying to play back from a local archiver, do a multicast playback // (becasue unicast isn't technically possible), in a random venue playbackVenue = Conference.VenueServiceWrapper.CreateRandomMulticastVenue("Playback Venue", null); } else { // Get the Archiver's IPAddress IPHostEntry archiverHE = Dns.GetHostEntry(archiverUri.Host); IPAddress archiverIP = archiverHE.AddressList[0]; // Get the port to playback on int playbackPort = archiverUnicastPort; string portOverrideStr = ConfigurationManager.AppSettings["MSR.LST.ConferenceXP.ArchiveService.UnicastPort"]; if (portOverrideStr != null) playbackPort = Int32.Parse(portOverrideStr); // Join to the Archiver's IPAddress as a "venue" VenueData ven = new VenueData("Playback Venue", new IPEndPoint(archiverIP, playbackPort), ushort.MaxValue, VenueType.PrivateVenue, null); playbackVenue = Conference.VenueServiceWrapper.AddCustomVenue(ven); } return playbackVenue; }
private void InvokeActionArguments(StringDictionary parameters) { #region Show Help if (parameters.ContainsKey("help")) { RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Strings.CmdLineParametersInstructions, " -help ", " -venue VenueName ", " -v VenueName ", " -capability CapabilityName ", " -c CapabilityName ", " -venueservice http://server/web ", " -vs http://server/web ", " -venueservice none ", " -vs none ", " -ip x.x.x.x -port xxxx ", " -recordnotify false ", " -rn false ", " -email [email protected] ", " -e [email protected] ", " -password Password ", " -p Password "), Strings.CmdLineParametersTitle, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); return; } #endregion #region Join Venue if (parameters.ContainsKey("venue") || parameters.ContainsKey("v")) { string venueName = parameters["venue"]; if (parameters.ContainsKey("v")) { venueName = parameters["v"]; } if (!Conference.VenueServiceWrapper.Venues.ContainsKey(venueName)) { string dialogText = Strings.AvailableVenues + "\n\n"; foreach (Venue v in Conference.VenueServiceWrapper.Venues) { dialogText += " " + v.Name + "\n"; } RtlAwareMessageBox.Show(this, dialogText, string.Format(CultureInfo.CurrentCulture, Strings.VenueNotFound, venueName), MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); Application.Exit(); } if (Conference.VenueServiceWrapper.Venues[venueName].PWStatus != PasswordStatus.NO_PASSWORD) { if (parameters.ContainsKey("password") || parameters.ContainsKey("p")) { string password = parameters["password"]; if (parameters.ContainsKey("p")) { password = parameters["p"]; } Venue validatedVenue = null; try { validatedVenue = Conference.VenueServiceWrapper. ResolvePassword(Conference.VenueServiceWrapper.Venues[venueName].Identifier, password); } catch { } if (validatedVenue != null) { if (Conference.VenueServiceWrapper.Venues[venueName].PWStatus != PasswordStatus.WEAK_PASSWORD) { Conference.JoinVenue(validatedVenue); AutoSendAV(); } else if (Conference.VenueServiceWrapper.Venues[venueName].PWStatus != PasswordStatus.STRONG_PASSWORD) { Conference.JoinVenue(validatedVenue, password); AutoSendAV(); } } else { //The password supplied is invalid RtlAwareMessageBox.Show(this, Strings.InvalidPassword, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } } else { //No password was provided RtlAwareMessageBox.Show(this, Strings.PasswordRequired, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } } else { //No password required Conference.JoinVenue(Conference.VenueServiceWrapper.Venues[venueName]); AutoSendAV(); } } if (parameters.ContainsKey("ip")) { if (parameters.ContainsKey("port")) { VenueData vd = new VenueData("Custom Venue", new IPEndPoint(IPAddress.Parse(parameters["ip"]), int.Parse(parameters["port"], CultureInfo.InvariantCulture)), 127, VenueType.Custom, null, null, null); Venue v = Conference.VenueServiceWrapper.AddCustomVenue(vd); Conference.JoinVenue(v); AutoSendAV(); } else { RtlAwareMessageBox.Show(this, Strings.IPParameterError, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } } #endregion #region Play Capability if (parameters.ContainsKey("capability") || parameters.ContainsKey("c")) { if (Conference.ActiveVenue == null) { RtlAwareMessageBox.Show(this, Strings.CapabilityError, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } string capabilityName = parameters["capability"]; if (parameters.ContainsKey("c")) { capabilityName = parameters["c"]; } ArrayList alOtherCapabilitySenders = new ArrayList(Conference.OtherCapabilitySenders); if (alOtherCapabilitySenders.Contains(capabilityName)) { ICapabilitySender cs = Conference.CreateCapabilitySender(capabilityName); } else { string dialogText = Strings.AvailableOtherCapabilitySenders + "\n\n"; foreach (string s in Conference.OtherCapabilitySenders) { dialogText += " " + s + "\n"; } dialogText += "\n\n" + Strings.CaseSensitiveReminder; RtlAwareMessageBox.Show(this, dialogText, string.Format(CultureInfo.CurrentCulture, Strings.CapabilitySenderNotFound, capabilityName), MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); Application.Exit(); } } #endregion }
private void menuActionsUnicast_Click(object sender, System.EventArgs e) { frmNetworkUnicast unicastSession = new frmNetworkUnicast(); if (unicastSession.ShowDialog() == DialogResult.OK) { try { VenueData vd = new VenueData("Unicast Venue", new System.Net.IPEndPoint(remoteIP, Convert.ToInt32("5004", CultureInfo.InvariantCulture)), 127, VenueType.Custom, null, null, null); Venue v = Conference.VenueServiceWrapper.AddCustomVenue(vd); JoinVenue(v, true); twoWayUnicast = true; SetArchiverMenuStatus(); } catch (Exception ex) { RtlAwareMessageBox.Show(this, ex.Message, Strings.UnableToJoinUnicastVenue, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); twoWayUnicast = false; SetArchiverMenuStatus(); } } }
/// <summary> /// Load a set of venue mappings from a "venues.txt" file. /// </summary> private void LoadManualVenues() { try { using (StreamReader sr = new StreamReader("venues.txt")) { String line; // Read and display lines from the file until the end of // the file is reached. while ((line = sr.ReadLine()) != null) { if (line.StartsWith("#")) continue; // comment; String[] toks = line.Split(new char[] { ':' }); if (toks.Length != 2) continue; String venueStr = toks[0].Trim(); if (venueStr.Length == 0) continue; String ipstr = toks[1].Trim(); if (ipstr.Length == 0) continue; VenueData vd = new VenueData(venueStr,new IPEndPoint(IPAddress.Parse(ipstr), 5004), 255, VenueType.Custom, null); Conference.VenueServiceWrapper.AddCustomVenue(vd); } } } catch (Exception e) { // Let the user know what went wrong. Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } }
public Venue AddCustomVenue( VenueData venueData ) { if (venues.ContainsKey(venueData.Name)) { throw new Exception("Trying to add custom venue '" + venueData.Name + "', but that name is already in use."); } venueData.VenueType = VenueType.Custom; Venue newVen = new Venue(venueData); venues.Add( newVen ); return newVen; }
/// <summary> /// Creates a venue with IPAddress 234.*.*.* where each * is randomly generated. Extremely useful /// in the case where a venue server is inaccessible. /// </summary> public Venue CreateRandomMulticastVenue( string name, Image icon ) { IPEndPoint endPoint = null; bool trafficInVenue = true; while (trafficInVenue) { #region Randomly choose the Venue's IP address Random rnd = new Random(); int randomaddr = 234; randomaddr = randomaddr * 256 + rnd.Next(1, 2^8 - 1); randomaddr = randomaddr * 256 + rnd.Next(1, 2^8 - 1); randomaddr = randomaddr * 256 + rnd.Next(1, 2^8 - 1); endPoint = new IPEndPoint(IPAddress.HostToNetworkOrder(randomaddr), 5004); #endregion #region Detect whether there is already traffic in the venue, if so change the IP address BufferChunk bc = new BufferChunk(MSR.LST.Net.Rtp.Rtp.MAX_PACKET_SIZE); UdpListener udpListener = new UdpListener(endPoint, venueInUseTimeout); try { udpListener.Receive(bc); } catch (System.Net.Sockets.SocketException e) { if (e.ErrorCode == 10060) { trafficInVenue = false; } else { throw; } } finally { udpListener.Dispose(); } #endregion } VenueData venueData = new VenueData( name, endPoint, 5, VenueType.Custom, icon ); return AddCustomVenue(venueData); }
public Venue AddCustomVenue( VenueData venueData ) { if (venues.ContainsKey(venueData.Name)) { throw new Exception(string.Format(CultureInfo.CurrentCulture, Strings.TryingToAddCustomVenue, venueData.Name)); } venueData.VenueType = VenueType.Custom; Venue newVen = new Venue(venueData); venues.Add( newVen ); return newVen; }