示例#1
0
        private void btnEnviar_Click(object sender, EventArgs e)
        {
            Thread.Sleep(1);
            if (string.IsNullOrEmpty(txtMensagem.Text) && (rbMessageAndInvite.Checked || rbMessage.Checked))
            {
                MessageBox.Show("Type a message...", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var friends = steamfriends013.GetFriendCount((int)EFriendFlags.k_EFriendFlagImmediate);

            var msg = txtMensagem.Text;

            if (ads.Checked)
            {
                msg += Environment.NewLine +
                       "// Program used: Steam Basic Tools //" +
                       Environment.NewLine +
                       "// Developed by: 13 Developer ~~ //";
            }

            byte[] msgBytes = Encoding.UTF8.GetBytes(msg);
            for (int i = 0; i < friends; i++)
            {
                var friendid = steamfriends013.GetFriendByIndex(i, (int)EFriendFlags.k_EFriendFlagImmediate);
                var name     = steamfriends013.GetFriendPersonaName(friendid);
                //Console.WriteLine("Friend {0}: {1}", i, name);

                msg      = msg.Replace(@"(name)", name).Trim();
                msgBytes = Encoding.UTF8.GetBytes(msg);


                if (rbMessageAndInvite.Checked)
                {
                    //send menssage!
                    steamfriends002.SendMsgToFriend(friendid, EChatEntryType.k_EChatEntryTypeChatMsg, msgBytes, (msgBytes.Length) + 1);

                    //Invite to play!
                    steamfriends002.SendMsgToFriend(friendid, EChatEntryType.k_EChatEntryTypeInviteGame, new byte[0], 0);

                    lbStatus.Text = "Message && Invite sent to: " + name + " successfully!";
                }
                else if (rbMessage.Checked)
                {
                    //send menssage!
                    steamfriends002.SendMsgToFriend(friendid, EChatEntryType.k_EChatEntryTypeChatMsg, msgBytes, (msgBytes.Length) + 1);
                    lbStatus.Text = "Message sent to: " + name + " successfully!";
                }
                else if (rbInvite.Checked)
                {
                    //Invite to play!
                    steamfriends002.SendMsgToFriend(friendid, EChatEntryType.k_EChatEntryTypeInviteGame, new byte[0], 0);
                    lbStatus.Text = "Invite sent to: " + name + " successfully!";
                }
            }
            Thread.Sleep(0x3e8);
        }
示例#2
0
        public void SendMessage(CSteamID receiver, string message, EChatEntryType type = EChatEntryType.k_EChatEntryTypeChatMsg)
        {
            if (type == EChatEntryType.k_EChatEntryTypeEmote)
            {
                _log.Warn("Steam no longer supports sending emotes to chat");
            }
            var msgData = Encoding.UTF8.GetBytes(message);

            SteamFriends002.SendMsgToFriend(receiver, type, msgData);
        }
示例#3
0
        public static void Main()
        {
            File.WriteAllText("steam_appid.txt", "630");

            Steamworks.Load(true);

            ISteamClient006 steamclient = Steamworks.CreateInterface <ISteamClient006>();

            int pipe = steamclient.CreateSteamPipe();
            int user = steamclient.ConnectToGlobalUser(pipe); // steamclient.CreateLocalUser(ref pipe); // steamclient.ConnectToGlobalUser(pipe);

            ISteamUser004 steamuser = steamclient.GetISteamUser <ISteamUser004>(user, pipe);


            ISteam003 steam003 = Steamworks.CreateSteamInterface <ISteam003>();

            StringBuilder version = new StringBuilder();

            version.EnsureCapacity(256);

            steam003.GetVersion(version);

            TSteamError   error = new TSteamError();
            uint          sz    = 0;
            StringBuilder email = new StringBuilder();

            email.EnsureCapacity(256);

            steam003.GetCurrentEmailAddress(email, ref sz, ref error);

            CSteamID steamid = steamuser.GetSteamID();

            ISteamFriends003 friends  = steamclient.GetISteamFriends <ISteamFriends003>(user, pipe);
            ISteamFriends002 friends2 = steamclient.GetISteamFriends <ISteamFriends002>(user, pipe);

            int num = friends.GetFriendCount(EFriendFlags.k_EFriendFlagAll);

            for (int i = 0; i < num; i++)
            {
                CSteamID id   = friends.GetFriendByIndex(i, EFriendFlags.k_EFriendFlagAll);
                string   name = friends.GetFriendPersonaName(id);

                if (name == "Stan")
                {
                    byte[] buff = Encoding.ASCII.GetBytes("Oidy.");
                    friends2.SendMsgToFriend(id, EChatEntryType.k_EChatEntryTypeChatMsg, buff);
                }

                Debug.WriteLine(name);
            }
        }
示例#4
0
 /// <summary>
 /// Send a message to a client
 /// </summary>
 /// <param name="client">Client</param>
 /// <param name="msg">Message</param>
 public void Send(CSteamID client, String msg)
 {
     byte[] bMsg = Encoding.UTF8.GetBytes(msg);
     m_SteamFriends002.SendMsgToFriend(client, EChatEntryType.k_EChatEntryTypeChatMsg, bMsg);
 }