public MessageForm( SteamContext context, Friend friendId, Settings sets) { InitializeComponent(); this.context = context; this.FriendID = friendId; this.Text = friendId.PersonaName; settings = sets; foreach ( BeeKeeper bk in settings.BeeKeeper ) { if ( bk.SteamID == ( ulong )FriendID.SteamID ) { foreach ( string str in bk.Entries ) { txtResponses.Text += str + "\r\n"; } checkBeeKeeper.Checked = bk.Enabled; continue; } } }
public MainForm( SteamContext context ) { try { sets = Settings.Load( "settings.xml" ); if ( sets == null ) { sets = new Settings(); sets.Save( "settings.xml" ); } } catch ( Exception ex ) { MessageBox.Show( "Unable to load settings!\n\n" + ex.ToString() ); sets = new Settings(); } InitializeComponent(); foreach ( string str in sets.NameChanger ) { txtNameChanger.Text += str + "\r\n"; } chkNoEscape.Checked = sets.NoEscape; awayMessageBox.Text = sets.NoEscapeString; nameEntries = new List<NameEntry>(); this.context = context; friendsList.SteamContext = context; txtPersonaName.Text = context.SteamFriends.GetPersonaName(); for ( int x = -2 ; x < ( int )( EPersonaState.k_EPersonaStateMax + 2 ) ; x++ ) cmbState.Items.Add( ( EPersonaState )x ); cmbState.SelectedIndex = ( int )( context.SteamFriends.GetPersonaState() + 2 ); for ( int i = 0 ; i < context.SteamFriends.GetFriendCount( ( int )EFriendFlags.k_EFriendFlagImmediate ) ; ++i ) { Friend friend = new Friend(); CSteamID steamId = context.SteamFriends.GetFriendByIndex( i, ( int )EFriendFlags.k_EFriendFlagImmediate ); string friendName = context.SteamFriends.GetFriendPersonaName( steamId ); friend.SteamID = steamId; friend.PersonaName = friendName; friendsList.Items.Add( friend ); } friendsList.Sorted = true; }
void FriendChatMsg_OnRun( FriendChatMsg_t param ) { if ( context.SteamUser.GetSteamID() == param.m_ulSender ) return; EChatEntryType type = EChatEntryType.k_EChatEntryTypeChatMsg; context.SteamFriends.GetChatMessage( param.m_ulSender, ( int )param.m_iChatID, new byte[ 0 ], 0, ref type ); foreach ( MessageForm msgForm in this.OwnedForms ) { if ( msgForm.FriendID.SteamID == param.m_ulSender ) { msgForm.RecievedMessage( param ); if ( chkNoEscape.Checked ) { if ( type == ( EChatEntryType )6 ) { msgForm.AwayMsg( param, awayMessageBox.Text ); return; } } if ( isAway && type != EChatEntryType.k_EChatEntryTypeTyping && type != ( EChatEntryType )6 ) { msgForm.AwayMsg( param, awayMessageBox.Text ); return; } return; } } if ( type == EChatEntryType.k_EChatEntryTypeTyping || type == ( EChatEntryType )6 ) return; Friend friend = new Friend(); friend.SteamID = param.m_ulSender; friend.PersonaName = context.SteamFriends.GetFriendPersonaName( friend.SteamID ); MessageForm mf = new MessageForm( context, friend, sets ); this.Invoke( ( MethodInvoker )delegate { mf.Show( this ); mf.RecievedMessage( param ); if ( isAway ) mf.AwayMsg( param, awayMessageBox.Text ); } ); }