Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        public void UpdateVenue(Venue v)
        {
            this.UpdateFromFile();

            venues[v.Identifier] = v;

            WriteCacheToFile();
        }
Esempio n. 4
0
        public Venue[] GetVenues()
        {
            this.UpdateFromFile();

            ICollection vals = venues.Values;
            Venue[] venueArray = new Venue[vals.Count];
            vals.CopyTo(venueArray, 0);
            return venueArray;
        }
Esempio n. 5
0
        public void AddVenue(Venue v)
        {
            this.UpdateFromFile();

            venues.Add( v.Identifier, v );

            WriteCacheToFile();
        }
Esempio n. 6
0
 public VenueState(Venue venue, PrivateVenueState pvs)
 {
     this.privateVenueState = pvs;
     this.venue = venue;
 }
Esempio n. 7
0
 public VenueState() 
 {
     venue = new Venue();
     privateVenueState = new PrivateVenueState();
 }
Esempio n. 8
0
 public void AddVenue(Venue venue, PrivateVenueState privateVenueState)
 {
     AddVenue(new VenueState(venue, privateVenueState));
 }
Esempio n. 9
0
        /// <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;
            }

        }
Esempio n. 10
0
        /// <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;
        }
Esempio n. 11
0
        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;
        }
Esempio n. 12
0
        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));
        }
Esempio n. 13
0
        /// <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;
        }