示例#1
0
        public LinkIDForm(Settings sets)
        {
            InitializeComponent();

            settings = sets;

            foreach (LinkEntry le in settings.Links)
            {
                LinkViewItem lvi = new LinkViewItem(le);

                linkView.Items.Add(lvi);
            }
        }
示例#2
0
        public LinkIDForm( Settings sets )
        {
            InitializeComponent();

            settings = sets;

            foreach ( LinkEntry le in settings.Links )
            {
                LinkViewItem lvi = new LinkViewItem( le );
                
                linkView.Items.Add( lvi );
            }

        }
示例#3
0
        private void addButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(steamIdBox.Text) || string.IsNullOrEmpty(displayBox.Text))
            {
                return;
            }

            ulong commId = 0;

            if (steamIdBox.Text.StartsWith("STEAM_"))
            {
                // parse steam id
                string[] parts = steamIdBox.Text.Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

                if (parts.Length < 3)
                {
                    Util.ShowError(this, "Invalid SteamID.");
                    return;
                }

                int y, z;

                if (!int.TryParse(parts[1], out y))
                {
                    Util.ShowError(this, "Invalid SteamID.");
                    return;
                }

                if (!int.TryParse(parts[2], out z))
                {
                    Util.ShowError(this, "Invalid SteamID.");
                    return;
                }

                commId = (ulong)((z * 2) + 76561197960265728L + y);
            }

            if (commId == 0)
            {
                if (!ulong.TryParse(steamIdBox.Text, out commId))
                {
                    Util.ShowError(this, "Invalid SteamID or Community ID.");
                    return;
                }
            }

            LinkEntry le = new LinkEntry();

            le.SteamID = commId;
            le.Name    = displayBox.Text;

            if (IndexOfEntry(le) != -1)
            {
                Util.ShowError(this, "LinkID already present.");
                return;
            }

            LinkViewItem lvi = new LinkViewItem(le);

            linkView.Items.Add(lvi);
        }
示例#4
0
        private void addButton_Click( object sender, EventArgs e )
        {
            if ( string.IsNullOrEmpty( steamIdBox.Text ) || string.IsNullOrEmpty( displayBox.Text ) )
                return;

            ulong commId = 0;

            if ( steamIdBox.Text.StartsWith( "STEAM_" ) )
            {
                // parse steam id
                string[] parts = steamIdBox.Text.Split( ":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries );

                if ( parts.Length < 3 )
                {
                    Util.ShowError( this, "Invalid SteamID." );
                    return;
                }

                int y, z;

                if ( !int.TryParse( parts[ 1 ], out y ) )
                {
                    Util.ShowError( this, "Invalid SteamID." );
                    return;
                }

                if ( !int.TryParse( parts[ 2 ], out z ) )
                {
                    Util.ShowError( this, "Invalid SteamID." );
                    return;
                }

                commId = (ulong)( ( z * 2 ) + 76561197960265728L + y );

            }

            if ( commId == 0 )
            {
                if ( !ulong.TryParse( steamIdBox.Text, out commId ) )
                {
                    Util.ShowError( this, "Invalid SteamID or Community ID." );
                    return;
                }
            }

            LinkEntry le = new LinkEntry();

            le.SteamID = commId;
            le.Name = displayBox.Text;

            if ( IndexOfEntry( le ) != -1 )
            {
                Util.ShowError( this, "LinkID already present." );
                return;
            }

            LinkViewItem lvi = new LinkViewItem( le );

            linkView.Items.Add( lvi );

        }