Exemplo n.º 1
0
 public SkypeExample()
 {
     _skype = new SkypeClass();
     _skype.MessageStatus += OnMessage;
     _skype._ISkypeEvents_Event_AttachmentStatus += OnAttach;
     _skype.Attach(7, false);
 }
Exemplo n.º 2
0
        public static void Init()
        {
            if ( Skype == null )
            {
                Skype = new SkypeClass();
                Skype._ISkypeEvents_Event_AttachmentStatus += Skype_AttachmentStatus;
            }

            Skype.Attach( Skype.Protocol, false );
        }
Exemplo n.º 3
0
        //傳送手機簡訊:
//
//這兩個事件SmsTargetStatusChangedEventHandler及SmsMessageStatusChangedEventHandler可以好好觀察一下,用來確認簡訊發送狀況


        private void button5_Click(object sender, EventArgs e)
        {
            SKYPE4COMLib.SkypeClass skype = new SkypeClass();
            skype.SmsTargetStatusChanged  += new _ISkypeEvents_SmsTargetStatusChangedEventHandler(skype_SmsTargetStatusChanged);
            skype.SmsMessageStatusChanged += new _ISkypeEvents_SmsMessageStatusChangedEventHandler(skype_SmsMessageStatusChanged);
            SmsMessage message = skype.CreateSms(TSmsMessageType.smsMessageTypeOutgoing, "輸入電話號碼");

            message.Body = "測試內容";
            message.Send();
        }
Exemplo n.º 4
0
        public static void Init()
        {
            if (Skype == null)
            {
                Skype = new SkypeClass();
                Skype._ISkypeEvents_Event_AttachmentStatus += Skype_AttachmentStatus;
            }

            Skype.Attach(Skype.Protocol, false);
        }
Exemplo n.º 5
0
        //  撥打電話


        private void button7_Click(object sender, EventArgs e)
        {
            SkypeClass   skype = new SkypeClass();
            CommandClass cmd   = new CommandClass();

            skype._ISkypeEvents_Event_Command += new _ISkypeEvents_CommandEventHandler(skype__ISkypeEvents_Event_Command);
            cmd.Command = "OPEN IM " + "撥號";//打開Skype視窗;
            skype.SendCommand(cmd);

            cmd.Command = "CALL " + "撥號";//撥號
            skype.SendCommand(cmd);
        }
Exemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            ISkype skype = new SkypeClass();

            skype.Attach(5, true);
            int count = skype.Chats.Count;

            textBox1.Text = "Count: " + count + "\r\n";
            foreach (IChat chat in skype.Chats)
            {
                textBox1.Text += "\r\n" + chat.FriendlyName;
            }
        }
Exemplo n.º 7
0
        //取消拨号

        private void button8_Click(object sender, EventArgs e)
        {
            SkypeClass   skype = new SkypeClass();
            CommandClass cmd   = new CommandClass();

            cmd.Command = "SEARCH ACTIVECALLS";//搜尋ID
            skype.SendCommand(cmd);

            int id = skype.ActiveCalls[1].Id;

            cmd.Command = "SET CALL " + id + " STATUS FINISHED";//根據ID掛斷電話
            skype.SendCommand(cmd);
        }
Exemplo n.º 8
0
        private void AttackProcess()
        {
            var skype = new SkypeClass(); //skype

            string target = "", message = "";
            int delay = 0, floodType = 0, protocol = 0;
            Invoke((Action) (() =>
            {
                target = txt_target.Text;
                message = txt_flood_text.Text;
                delay = Convert.ToInt32(nud_delay.Value)*1000;
                floodType = rb_infinite_messages.Checked ? 0 : rb_timeout_messages.Checked ? 1 : 2;
                protocol = Convert.ToInt32(skype_protokol.Value);
            }));
            if (message.Length == 0)
            {
                Invoke((Action) (() => Attacking = false));
                return;
            }
            skype.Attach(protocol, false);
            if (floodType == 2)
            {
                try
                {
                    skype.SendMessage(target, message);
                    Invoke((Action) (() => Attacking = false));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
                return;
            }

            while (Attacking)
            {
                try
                {
                    skype.SendMessage(target, message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
                if (floodType == 1 && delay > 0)
                    Thread.Sleep(delay);
            }
        }
        static void Main(string[] args)
        {
            SkypeClass _skype = new SkypeClass();

            _skype.Attach(7, false);

            IEnumerable <SKYPE4COMLib.User> users = _skype.Friends.OfType <SKYPE4COMLib.User>();

            users
            .Where(u => u.OnlineStatus == TOnlineStatus.olsOnline)
            .OrderBy(u => u.FullName)
            .ToList()
            .ForEach(u => Console.WriteLine("'{0}' is an online friend.", u.FullName));

            Console.ReadKey();
        }
Exemplo n.º 10
0
        public Skype4ComWrapper()
        {
            // Start up our application
            WriteToLog("Starting SafeSkype plugin v1.0");
            WriteToLog();

            // Attach to Skype
            WriteToLog("Attaching to Skype");
            this._objSkype = new Skype();

            // Set up the event handlers
            WriteToLog("Attaching to Skype events");
            _clsSkype = new SkypeClass();
            _clsSkype._ISkypeEvents_Event_AttachmentStatus += new _ISkypeEvents_AttachmentStatusEventHandler(Skype_AttachmentStatus);
            _clsSkype._ISkypeEvents_Event_ConnectionStatus += new _ISkypeEvents_ConnectionStatusEventHandler(Skype_ConnectionStatus);

            _objSkype.MessageStatus             += new _ISkypeEvents_MessageStatusEventHandler(Skype_MessageStatus);
            _objSkype.CallStatus                += new _ISkypeEvents_CallStatusEventHandler(Skype_CallStatus);
            _objSkype.FileTransferStatusChanged += new _ISkypeEvents_FileTransferStatusChangedEventHandler(Skype_FileTransferStatusChanged);

            //_objSkype.Client.CreateMenuItem("menu1", TPluginContext.pluginContextChat, "Example menu", "Example menu hint", "", true, TPluginContactType.pluginContactTypeAll, false);
            //_objSkype.Client.CreateEvent("event1", "example plugin is running", "click here to stop the example");

            try
            {
                // Attach to Skype4COM
                _clsSkype.Attach(7, false);
            }
            catch (Exception)
            {
                // All Skype Logic uses TRY for safety
            }

            try
            {
                if (!_objSkype.Client.IsRunning)
                {
                    _objSkype.Client.Start(false, true);
                }
            }
            catch (Exception)
            {
                // All Skype Logic uses TRY for safety
            }
        }
Exemplo n.º 11
0
        private static bool CreateSkypeObject()
        {
            if (SkypeObj != null)
            {
                return(true);
            }

            try
            {
                SkypeObj = new SkypeClass();
                SkypeObj._ISkypeEvents_Event_CallStatus += new _ISkypeEvents_CallStatusEventHandler(SkypeObj__ISkypeEvents_Event_CallStatus);
                SkypeObj._ISkypeEvents_Event_Command    += new _ISkypeEvents_CommandEventHandler(skype__ISkypeEvents_Event_Command);
                StartSkype();
                return(true);
            }
            catch (Exception ex)
            {
                log.Info("创建Skype对象出错!" + ex.ToString());
            }

            if (SkypeObj == null)
            {
                try
                {
                    RegisterComObject(System.Windows.Forms.Application.StartupPath + "\\Skype4COM");
                    SkypeObj = new SkypeClass();
                    SkypeObj._ISkypeEvents_Event_CallStatus += new _ISkypeEvents_CallStatusEventHandler(SkypeObj__ISkypeEvents_Event_CallStatus);
                    SkypeObj._ISkypeEvents_Event_Command    += new _ISkypeEvents_CommandEventHandler(skype__ISkypeEvents_Event_Command);
                    StartSkype();
                    return(true);
                }
                catch (Exception ex)
                {
                    string msg = "Skype4COM.dll is not registered as COM DLL.\n" + ex.ToString();
                    log.Info(msg);
                    return(false);
                    // MessageBox.Show(msg, WF.Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            return(false);
        }
 public SkypeController()
 {
     this.skype = new SkypeClass { Timeout = 10 };
 }
Exemplo n.º 13
0
 private void btn_flooding_Click(object sender, EventArgs e)
 {
     if (!chk_status_flooding.Checked) return;
     var skype = new SkypeClass(); //skype
     switch (comboStatus.SelectedIndex)
     {
         case 0:
         {
             skype.CurrentUserStatus = TUserStatus.cusOnline;
         }
             break;
         case 1:
         {
             skype.CurrentUserStatus = TUserStatus.cusAway;
         }
             break;
         case 2:
         {
             skype.CurrentUserStatus = TUserStatus.cusDoNotDisturb;
         }
             break;
         case 3:
         {
             skype.CurrentUserStatus = TUserStatus.cusInvisible;
         }
             break;
     }
 }
Exemplo n.º 14
0
 public SkypeController()
 {
     this.skype = new SkypeClass {
         Timeout = 10
     };
 }
Exemplo n.º 15
0
        //  發送聊天訊息


        private void button6_Click(object sender, EventArgs e)
        {
            SKYPE4COMLib.SkypeClass skype = new SkypeClass();
            skype.MessageStatus += new _ISkypeEvents_MessageStatusEventHandler(skype_MessageStatus);
            ChatMessage message = skype.SendMessage("帳號", "內容");
        }
Exemplo n.º 16
0
 private void on_load(object sender, EventArgs e)
 {
     try
     {
         Skype skype = new SkypeClass(); //skype
         skype.Attach(Convert.ToInt32(skype_protokol.Value), false);
         var r = new Regex(@"xmpp\:.*");
         foreach (var friend in skype.Friends.Cast<User>().Where(friend => !r.IsMatch(friend.Handle)))
         {
             list_users.Items.Add(new SkypeFriends
             {
                 SUser = friend
             });
         }
     }
     catch
     {
         new FrmMessage().ShowDialog();
     }
 }
Exemplo n.º 17
0
        private static bool CreateSkypeObject()
        {
            if (SkypeObj != null)
            {
                return true;
            }

            try
            {
                SkypeObj = new SkypeClass();
                SkypeObj._ISkypeEvents_Event_CallStatus += new _ISkypeEvents_CallStatusEventHandler(SkypeObj__ISkypeEvents_Event_CallStatus);
                SkypeObj._ISkypeEvents_Event_Command += new _ISkypeEvents_CommandEventHandler(skype__ISkypeEvents_Event_Command);
                StartSkype();
                return true;
            }
            catch (Exception ex)
            {

                log.Info("创建Skype对象出错!" + ex.ToString());

            }

            if (SkypeObj == null)
            {
                try
                {
                    RegisterComObject(System.Windows.Forms.Application.StartupPath + "\\Skype4COM");
                    SkypeObj = new SkypeClass();
                    SkypeObj._ISkypeEvents_Event_CallStatus += new _ISkypeEvents_CallStatusEventHandler(SkypeObj__ISkypeEvents_Event_CallStatus);
                    SkypeObj._ISkypeEvents_Event_Command += new _ISkypeEvents_CommandEventHandler(skype__ISkypeEvents_Event_Command);
                    StartSkype();
                    return true;
                }
                catch (Exception ex)
                {
                    string msg = "Skype4COM.dll is not registered as COM DLL.\n" + ex.ToString();
                    log.Info(msg);
                    return false;
                    // MessageBox.Show(msg, WF.Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            return false;
        }