public VenueEditor(Venue venueToEdit) { // // Required for Windows Form Designer support // InitializeComponent(); iconInput.DefaultIcon = defaultVenueIcon; // Show the venue information in the UI this.nameInput.Text = venueToEdit.Name; this.ownerInput.Text = venueToEdit.Identifier; this.ipInput.Text = venueToEdit.IPAddress; this.portInput.Text = venueToEdit.Port.ToString(); this.iconInput.IconAsBytes = venueToEdit.Icon; this.newAccessList = venueToEdit.AccessList; this.original = venueToEdit; }
public VenueEditor(VenueState venueState) { // // Required for Windows Form Designer support // InitializeComponent(); iconInput.DefaultIcon = defaultVenueIcon; // Show the venue information in the UI Venue venueToEdit = venueState.Venue; this.nameInput.Text = venueToEdit.Name; this.ownerInput.Text = venueToEdit.Identifier; this.ipInput.Text = venueToEdit.IPAddress; this.portInput.Text = venueToEdit.Port.ToString(CultureInfo.InvariantCulture); this.iconInput.IconAsBytes = venueToEdit.Icon; this.newAccessList = venueToEdit.AccessList; this.original = venueToEdit; this.privateVenueState = venueState.PrivateVenueState; this.passwordStatus = venueToEdit.PWStatus; }
public void UpdateVenue(Venue v) { this.UpdateFromFile(); venues[v.Identifier] = v; WriteCacheToFile(); }
public Venue[] GetVenues() { this.UpdateFromFile(); ICollection vals = venues.Values; Venue[] venueArray = new Venue[vals.Count]; vals.CopyTo(venueArray, 0); return venueArray; }
public void AddVenue(Venue v) { this.UpdateFromFile(); venues.Add( v.Identifier, v ); WriteCacheToFile(); }
public VenueState(Venue venue, PrivateVenueState pvs) { this.privateVenueState = pvs; this.venue = venue; }
public VenueState() { venue = new Venue(); privateVenueState = new PrivateVenueState(); }
public void AddVenue(Venue venue, PrivateVenueState privateVenueState) { AddVenue(new VenueState(venue, privateVenueState)); }
/// <summary> /// Hide the IP Address for venues with password protection. Make a new object /// so we don't destroy the true state. /// </summary> /// <param name="venue"></param> /// <returns></returns> private Venue RemoveSensitiveState(Venue venue) { if (venue.PWStatus == PasswordStatus.NO_PASSWORD) return venue; else { Venue newVenue = new Venue(venue.Identifier, "0.0.0.0", 1, venue.Name, venue.Icon, venue.AccessList); newVenue.PWStatus = venue.PWStatus; return newVenue; } }
/// <summary> /// Returns the client-visible portion of venue state. We elide /// the IP address for password-enabled venues. /// </summary> /// <returns></returns> public Venue[] GetVenues() { this.UpdateFromFile(); ICollection vals = venues.Values; Venue[] venueArray = new Venue[vals.Count]; int i = 0; foreach (Venue venue in vals) { //venueArray[i++] = RemoveSensitiveState(venue); venueArray[i++] = venue; } return venueArray; }
private ListViewItem CreateLvi(Venue venue, int imageIndex) { string[] columns = new string[]{venue.Name, venue.Identifier, venue.IPAddress.ToString(), venue.Port.ToString()}; ListViewItem item = new ListViewItem(columns); item.ImageIndex = imageIndex; item.Tag = venue; return item; }
public Venue[] GetVenues() { SqlConnection conn = new SqlConnection( SQL_CONNECTION_STRING); SqlCommand cmd = new SqlCommand( "GetVenues", conn ); cmd.CommandType = CommandType.StoredProcedure; conn.Open(); SqlDataReader r = cmd.ExecuteReader(CommandBehavior.SingleResult); ArrayList venuesArray = new ArrayList(); while ( r.Read() ) { byte[] icon = null; if ( !r.IsDBNull(vICONLENGTH) ) { icon = new Byte[r.GetInt32(vICONLENGTH)]; r.GetBytes(vICON, 0,icon, 0, icon.Length); } Venue v = new Venue( r.GetString(vIDENTIFIER), r.GetString(vIPADDRESS), r.GetInt32(vPORT), r.GetString(vNAME), icon, null ); venuesArray.Add( v); } r.Close(); conn.Close(); return (Venue[])venuesArray.ToArray(typeof( Venue)); }
/// <summary> /// Compiles all of the data on the screen and returns it as a venue. /// </summary> public Venue GetVenue() { Venue vnu = new Venue(this.ownerInput.Text.Trim(), this.ipInput.Text.Trim(), Int32.Parse(this.portInput.Text.Trim(), CultureInfo.InvariantCulture), this.nameInput.Text.Trim(), this.iconInput.IconAsBytes, this.newAccessList); vnu.PWStatus = this.passwordStatus; return vnu; }