public ActiveDownloadFilelistFromUser()
        {
            UpdateBase = new FmdcEventHandler(PassiveConnectToUser_UpdateBase);

            // Creates a empty share
            Share share = new Share("Testing");

            // Port to listen for incomming connections on
            share.Port = 12345;

            incomingConnectionListener         = new TcpConnectionListener(share.Port);
            incomingConnectionListener.Update += new FmdcEventHandler(Connection_Update);
            incomingConnectionListener.Start();

            // Adds common filelist to share
            AddFilelistsToShare(share);

            HubSetting setting = new HubSetting();

            setting.Address     = "127.0.0.1";
            setting.Port        = 411;
            setting.DisplayName = "FlowLib";
            setting.Protocol    = "Auto";

            Hub hubConnection = new Hub(setting, this);

            hubConnection.ProtocolChange += new FmdcEventHandler(hubConnection_ProtocolChange);
            // Adds share to hub
            hubConnection.Share   = share;
            hubConnection.Me.Mode = FlowLib.Enums.ConnectionTypes.Direct;
            hubConnection.Connect();
        }
        public PassiveDownloadFilelistFromUserUsingTLS()
        {
            UpdateBase = new FmdcEventHandler(PassiveConnectToUser_UpdateBase);

            // Creates a empty share
            Share share = new Share("Testing");

            // Adds common filelist to share
            AddFilelistsToShare(share);

            HubSetting setting = new HubSetting();

            setting.Address     = "127.0.0.1";
            setting.Port        = 411;
            setting.DisplayName = "FlowLibPassiveTLS";
            setting.Protocol    = "Auto";

            Hub hubConnection = new Hub(setting, this);

            hubConnection.ProtocolChange += new FmdcEventHandler(hubConnection_ProtocolChange);
            // Adds share to hub
            hubConnection.Share = share;
            hubConnection.Me.Set(UserInfo.SECURE, "");
            hubConnection.Connect();
        }
        public MultiConnections()
        {
            UpdateBase = new FmdcEventHandler(PassiveConnectToUser_UpdateBase);

            // Creates a empty share
            Share share = new Share("Testing");
            // Port to listen for incomming connections on
            share.Port = 12345;

            incomingConnectionListener = new TcpConnectionListener(share.Port);
            incomingConnectionListener.Update += new FmdcEventHandler(Connection_Update);
            incomingConnectionListener.Start();

            // Adds common filelist to share
            AddFilelistsToShare(share);

            HubSetting setting = new HubSetting();
            setting.Address = "127.0.0.1";
            setting.Port = 411;
            setting.DisplayName = "FlowLib";
            setting.Protocol = "Auto";

            hub = new Hub(setting, this);
            hub.ProtocolChange += new FmdcEventHandler(hubConnection_ProtocolChange);
            // Adds share to hub
            hub.Share = share;
            hub.Me.Mode = FlowLib.Enums.ConnectionTypes.Direct;
            hub.Connect();

            last = System.DateTime.Now.Ticks;
            timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
            timer.AutoReset = true;
            timer.Interval = 1000;
            timer.Start();
        }
Exemple #4
0
        public ActiveSearch()
        {
            UpdateBase = new FmdcEventHandler(ActiveSearch_UpdateBase);

            HubSetting settings = new HubSetting();

            settings.Address     = "127.0.0.1";
            settings.Port        = 411;
            settings.DisplayName = "FlowLib";
            settings.Protocol    = "Auto";

            hubConnection = new Hub(settings, this);
            hubConnection.ProtocolChange += new FmdcEventHandler(hubConnection_ProtocolChange);
            hubConnection.Connect();

            Share share = new Share("Test");

            share.Port = 1000;

            // Telling that we are listening on port 1000 for incomming search results (Any means from everyone)
            UdpConnection udp = new UdpConnection(new IPEndPoint(IPAddress.Any, share.Port));

            udp.Protocol = new FlowLib.Protocols.UdpNmdcProtocol();
            udp.Protocol.MessageReceived += new FmdcEventHandler(Protocol_MessageReceived);
            // Enable Active searching
            hubConnection.Me.Mode = FlowLib.Enums.ConnectionTypes.Direct;
            hubConnection.Share   = share;
        }
Exemple #5
0
        public Hub(HubSetting infav, IBaseUpdater gui)
            : base(infav.Address, infav.Port)
        {
            fav = infav;    // Sets Favorites.
            me = new User(fav.DisplayName);
            me.UserInfo.Description = fav.UserDescription;
            me.Tag.Version = "FlowLib";

            UpdateRegMode();
            UpdateShare();
            #region Event(s)
            UnknownProtocolId = new FmdcEventHandler(OnUnknownProtocolId);
            RegModeUpdated += new FmdcEventHandler(Hub_RegModeUpdated);
            ProtocolChange += new FmdcEventHandler(Hub_ProtocolChange);
            #endregion
            #region Event(s)
            if (gui != null)
            {
                gui.UpdateBase += new FmdcEventHandler(OnUpdateBase);
                baseUpdater = gui;
            }
            #endregion
            //FireUpdate(Actions.Name, new HubName(HubSetting.Address + ":" + HubSetting.Port.ToString()));
            #region Keep Alive
            // For Connection Keepalive
            TimerCallback timerDelegate = new TimerCallback(OnkeepAliveTimer_Elapsed);
            keepAliveTimer = new System.Threading.Timer(timerDelegate, socket, interval * 1000, interval * 1000);
            #endregion
        }
Exemple #6
0
        public Hub()
        {
            UpdateBase = new FmdcEventHandler(Hub_UpdateBase);

            listMainchat = new ListBox(0, 2, Console.WindowWidth - 21, Console.WindowHeight - 4, ref msgList);
            listUserlist = new ListBox(Console.WindowWidth - 20, 2, 20, Console.WindowHeight - 4, ref userList);
            input = new TextField(0, Console.WindowHeight - 1, Console.WindowWidth);

            updateTimer.Interval = 1 * 1000;
            updateTimer.Elapsed += new System.Timers.ElapsedEventHandler(updateTimer_Elapsed);
            updateTimer.Start();

            // Controls
            listMainchat.BgColor = ConsoleColor.Gray;
            listMainchat.FgColor = ConsoleColor.Black;
            Controls.Add(listMainchat);

            listUserlist.BgColor = ConsoleColor.Gray;
            listUserlist.FgColor = ConsoleColor.Blue;
            Controls.Add(listUserlist);

            input.BgColor = ConsoleColor.White;
            input.FgColor = ConsoleColor.Black;
            Controls.Add(input);
        }
Exemple #7
0
        public ActiveSearch()
        {
            UpdateBase = new FmdcEventHandler(ActiveSearch_UpdateBase);

            HubSetting settings = new HubSetting();
            settings.Address = "127.0.0.1";
            settings.Port = 411;
            settings.DisplayName = "FlowLib";
            settings.Protocol = "Auto";

            hubConnection = new Hub(settings, this);
            hubConnection.ProtocolChange += new FmdcEventHandler(hubConnection_ProtocolChange);
            hubConnection.Connect();

            Share share = new Share("Test");
            share.Port = 1000;

            // Telling that we are listening on port 1000 for incomming search results (Any means from everyone)
            UdpConnection udp = new UdpConnection(new IPEndPoint(IPAddress.Any, share.Port));
            udp.Protocol = new FlowLib.Protocols.UdpNmdcProtocol();
            udp.Protocol.MessageReceived += new FmdcEventHandler(Protocol_MessageReceived);
            // Enable Active searching
            hubConnection.Me.Mode = FlowLib.Enums.ConnectionTypes.Direct;
            hubConnection.Share = share;
        }
Exemple #8
0
        public Hub(HubSetting infav, IBaseUpdater gui)
            : base(infav.Address, infav.Port)
        {
            fav = infav;    // Sets Favorites.
            me  = new User(fav.DisplayName);
            me.UserInfo.Description = fav.UserDescription;
            me.Tag.Version          = "FlowLib";

            UpdateRegMode();
            UpdateShare();
            #region Event(s)
            UnknownProtocolId = new FmdcEventHandler(OnUnknownProtocolId);
            RegModeUpdated   += new FmdcEventHandler(Hub_RegModeUpdated);
            ProtocolChange   += new FmdcEventHandler(Hub_ProtocolChange);
            #endregion
            #region Event(s)
            if (gui != null)
            {
                gui.UpdateBase += new FmdcEventHandler(OnUpdateBase);
                baseUpdater     = gui;
            }
            #endregion
            //FireUpdate(Actions.Name, new HubName(HubSetting.Address + ":" + HubSetting.Port.ToString()));
            #region Keep Alive
            // For Connection Keepalive
            TimerCallback timerDelegate = new TimerCallback(OnkeepAliveTimer_Elapsed);
            keepAliveTimer = new System.Threading.Timer(timerDelegate, socket, interval * 1000, interval * 1000);
            #endregion
        }
        public ActiveDownloadFilelistFromUser()
        {
            UpdateBase = new FmdcEventHandler(PassiveConnectToUser_UpdateBase);

            // Creates a empty share
            Share share = new Share("Testing");
            // Port to listen for incomming connections on
            share.Port = 12345;

            incomingConnectionListener = new TcpConnectionListener(share.Port);
            incomingConnectionListener.Update += new FmdcEventHandler(Connection_Update);
            incomingConnectionListener.Start();

            // Adds common filelist to share
            AddFilelistsToShare(share);

            HubSetting setting = new HubSetting();
            setting.Address = "127.0.0.1";
            setting.Port = 411;
            setting.DisplayName = "FlowLib";
            setting.Protocol = "Auto";

            Hub hubConnection = new Hub(setting, this);
            hubConnection.ProtocolChange += new FmdcEventHandler(hubConnection_ProtocolChange);
            // Adds share to hub
            hubConnection.Share = share;
            hubConnection.Me.Mode = FlowLib.Enums.ConnectionTypes.Direct;
            hubConnection.Connect();
        }
        public CollectTransferedInformationFromFilelistDownload()
        {
            UpdateBase = new FmdcEventHandler(PassiveConnectToUser_UpdateBase);

            // Creates a empty share
            Share share = new Share("Testing");
            // Port to listen for incomming connections on
            share.Port = 12345;

            incomingConnectionListener = new TcpConnectionListener(share.Port);
            incomingConnectionListener.Update += new FmdcEventHandler(Connection_Update);
            incomingConnectionListener.Start();

            // Adds common filelist to share
            AddFilelistsToShare(share);

            HubSetting setting = new HubSetting();
            setting.Address = "127.0.0.1";
            setting.Port = 411;
            setting.DisplayName = "FlowLib";
            setting.Protocol = "Auto";

            Hub hubConnection = new Hub(setting, this);
            hubConnection.ProtocolChange += new FmdcEventHandler(hubConnection_ProtocolChange);
            // Adds share to hub
            hubConnection.Share = share;
            //hubConnection.Me.Mode = FlowLib.Enums.ConnectionTypes.Direct;
            hubConnection.Me.TagInfo.Slots = 2;
            hubConnection.Connect();

            FlowLib.Utils.Convert.General.BinaryPrefixes bp;
            Console.WriteLine("Press any key to update information");
            do
            {
                Console.ReadKey(true);
                Console.Clear();
                Console.WriteLine("Press any key to update information");
                Console.WriteLine("==================================");
                if (stats != null)
                {
                    Console.WriteLine("Total data sent: " + FlowLib.Utils.Convert.General.FormatBytes(stats.TotalBytesSent, out bp) + bp);
                    Console.WriteLine("Total data received: " + FlowLib.Utils.Convert.General.FormatBytes(stats.TotalBytesReceived, out bp) + bp);
                    Console.WriteLine("current download speed: " + FlowLib.Utils.Convert.General.FormatBytes(stats.CurrentReceiveSpeed, out bp) + bp + "/s");
                    Console.WriteLine("current upload speed: " + FlowLib.Utils.Convert.General.FormatBytes(stats.CurrentSendSpeed, out bp) + bp + "/s");
                    Decimal d = new decimal(stats.MaximumReceiveSpeed);
                    Console.WriteLine("Maximum download speed: " + FlowLib.Utils.Convert.General.FormatBytes(decimal.ToInt64(d), out bp) + bp + "/s");
                    d = new decimal(stats.MaximumSendSpeed);
                    Console.WriteLine("Maximum upload speed: " + FlowLib.Utils.Convert.General.FormatBytes(decimal.ToInt64(d), out bp) + bp + "/s");
                    d = new decimal(stats.MinimumReceiveSpeed);
                    Console.WriteLine("Minimum download speed: " + FlowLib.Utils.Convert.General.FormatBytes(decimal.ToInt64(d), out bp) + bp + "/s");
                    d = new decimal(stats.MinimumSendSpeed);
                    Console.WriteLine("Minimum upload speed: " + FlowLib.Utils.Convert.General.FormatBytes(decimal.ToInt64(d), out bp) + bp + "/s");
                }
                else
                {
                    Console.WriteLine("No transfer has started yet.");
                }
                Console.WriteLine("==================================");
            } while (true);
        }
Exemple #11
0
        public Hub()
        {
            UpdateBase = new FmdcEventHandler(Hub_UpdateBase);

            listMainchat = new ListBox(0, 2, Console.WindowWidth - 21, Console.WindowHeight - 4, ref msgList);
            listUserlist = new ListBox(Console.WindowWidth - 20, 2, 20, Console.WindowHeight - 4, ref userList);
            input        = new TextField(0, Console.WindowHeight - 1, Console.WindowWidth);

            updateTimer.Interval = 1 * 1000;
            updateTimer.Elapsed += new System.Timers.ElapsedEventHandler(updateTimer_Elapsed);
            updateTimer.Start();

            // Controls
            listMainchat.BgColor = ConsoleColor.Gray;
            listMainchat.FgColor = ConsoleColor.Black;
            Controls.Add(listMainchat);

            listUserlist.BgColor = ConsoleColor.Gray;
            listUserlist.FgColor = ConsoleColor.Blue;
            Controls.Add(listUserlist);

            input.BgColor = ConsoleColor.White;
            input.FgColor = ConsoleColor.Black;
            Controls.Add(input);
        }
Exemple #12
0
 public Detect()
 {
     ProgressChanged           = new ProgressChange(OnProgressChanged);
     SuccessChanged            = new ProgressChange(OnSuccessChanged);
     UpdateBase                = new FmdcEventHandler(OnUpdateBase);
     upnp                      = new UPnP(this);
     upnp.ProtocolUPnP.Update += new FmdcEventHandler(OnUPnPUpdate);
     Port                      = 31173;
 }
Exemple #13
0
 public Detect()
 {
     ProgressChanged = new ProgressChange(OnProgressChanged);
     SuccessChanged = new ProgressChange(OnSuccessChanged);
     UpdateBase = new FmdcEventHandler(OnUpdateBase);
     upnp = new UPnP(this);
     upnp.ProtocolUPnP.Update += new FmdcEventHandler(OnUPnPUpdate);
     Port = 31173;
 }
Exemple #14
0
 /// <summary>
 /// Creating Transfer with s as the underlaying socket
 /// </summary>
 /// <param name="s">Socket you want to have as underlaying connection</param>
 public Transfer(System.Net.Sockets.Socket s)
     : base(s)
 {
     DownloadItemChanged = new FmdcEventHandler(OnDownloadItemChanged);
     if (socket.Connected)
     {
         localAddress = (System.Net.IPEndPoint)socket.LocalEndPoint;
         remoteAddress = (System.Net.IPEndPoint)socket.RemoteEndPoint;
     }
 }
Exemple #15
0
 public Detect()
 {
     ProgressChanged = new ProgressChange(OnProgressChanged);
     SuccessChanged  = new ProgressChange(OnSuccessChanged);
     UpdateBase      = new FmdcEventHandler(OnUpdateBase);
     // We are only interested to find the IGD device.
     upnp = new UPnP(this, "urn:schemas-upnp-org:service:WANIPConnection:1");
     upnp.ProtocolUPnP.Update += new FmdcEventHandler(OnUPnPUpdate);
     Port = 31173;
 }
Exemple #16
0
 public Detect()
 {
     ProgressChanged = new ProgressChange(OnProgressChanged);
     SuccessChanged = new ProgressChange(OnSuccessChanged);
     UpdateBase = new FmdcEventHandler(OnUpdateBase);
     // We are only interested to find the IGD device.
     upnp = new UPnP(this, "urn:schemas-upnp-org:service:WANIPConnection:1");
     upnp.ProtocolUPnP.Update += new FmdcEventHandler(OnUPnPUpdate);
     Port = 31173;
 }
Exemple #17
0
 /// <summary>
 /// Creating Transfer with s as the underlaying socket
 /// </summary>
 /// <param name="s">Socket you want to have as underlaying connection</param>
 public Transfer(System.Net.Sockets.Socket s)
     : base(s)
 {
     DownloadItemChanged = new FmdcEventHandler(OnDownloadItemChanged);
     if (socket.Connected)
     {
         localAddress  = (System.Net.IPEndPoint)socket.LocalEndPoint;
         remoteAddress = (System.Net.IPEndPoint)socket.RemoteEndPoint;
     }
 }
Exemple #18
0
        /// <summary>
        /// Creating TcpConnection
        /// </summary>
        public TcpConnection()
        {
            #region Event(s)
            ProtocolChange         = new FmdcEventHandler(OnProtocolChanged);
            ConnectionStatusChange = new FmdcEventHandler(OnConnectionStatusChanged);
#if !COMPACT_FRAMEWORK
// Security
            SecureUpdate = new FmdcEventHandler(OnSecureUpdate);
#endif
            #endregion
        }
        /// <summary>
        /// Init listeners for this static class
        /// </summary>
        public DownloadManager()
        {
            FileName = "Downloads";

            SegmentCanceled   = new FmdcEventHandler(DownloadManager_SegmentCanceled);
            SegmentCompleted  = new FmdcEventHandler(DownloadManager_SegmentCompleted);
            SegmentStarted    = new FmdcEventHandler(DownloadManager_SegmentStarted);
            DownloadCompleted = new FmdcEventHandler(DownloadManager_DownloadCompleted);

            DownloadAdded   = new FmdcEventHandler(DownloadManager_DownloadAdded);
            DownloadRemoved = new FmdcEventHandler(DownloadManager_DownloadRemoved);
            SourceAdded     = new FmdcEventHandler(DownloadManager_SourceAdded);
            SourceRemoved   = new FmdcEventHandler(DownloadManager_SourceRemoved);
        }
Exemple #20
0
        /// <summary>
        /// Init listeners for this static class
        /// </summary>
        public DownloadManager()
        {
            FileName = "Downloads";

            SegmentCanceled = new FmdcEventHandler(DownloadManager_SegmentCanceled);
            SegmentCompleted = new FmdcEventHandler(DownloadManager_SegmentCompleted);
            SegmentStarted = new FmdcEventHandler(DownloadManager_SegmentStarted);
            DownloadCompleted = new FmdcEventHandler(DownloadManager_DownloadCompleted);

            DownloadAdded = new FmdcEventHandler(DownloadManager_DownloadAdded);
            DownloadRemoved = new FmdcEventHandler(DownloadManager_DownloadRemoved);
            SourceAdded = new FmdcEventHandler(DownloadManager_SourceAdded);
            SourceRemoved = new FmdcEventHandler(DownloadManager_SourceRemoved);
        }
Exemple #21
0
        public HubNmdcProtocol(Hub hub)
        {
            this.hub = hub;
            hub.ConnectionStatusChange += new FmdcEventHandler(hub_ConnectionStatusChange);
            if (hub.Share != null)
                hub.Share.LastModifiedChanged += new FmdcEventHandler(Share_LastModifiedChanged);
            Hub.RegModeUpdated += new FmdcEventHandler(Hub_RegModeUpdated);

            TimerCallback updateCallback = new TimerCallback(OnUpdateMyInfo);
            updateMyInfoTimer = new Timer(updateCallback, this, Timeout.Infinite, Timeout.Infinite);

            MessageReceived = new FmdcEventHandler(OnMessageReceived);
            MessageToSend = new FmdcEventHandler(OnMessageToSend);
        }
Exemple #22
0
        public HubNmdcProtocol(Hub hub)
        {
            this.hub = hub;
            hub.ConnectionStatusChange += new FmdcEventHandler(hub_ConnectionStatusChange);
            if (hub.Share != null)
            {
                hub.Share.LastModifiedChanged += new FmdcEventHandler(Share_LastModifiedChanged);
            }
            Hub.RegModeUpdated += new FmdcEventHandler(Hub_RegModeUpdated);

            TimerCallback updateCallback = new TimerCallback(OnUpdateMyInfo);

            updateMyInfoTimer = new Timer(updateCallback, this, Timeout.Infinite, Timeout.Infinite);

            MessageReceived = new FmdcEventHandler(OnMessageReceived);
            MessageToSend   = new FmdcEventHandler(OnMessageToSend);
        }
        public PassiveDownloadFilelistFromUser()
        {
            UpdateBase = new FmdcEventHandler(PassiveConnectToUser_UpdateBase);

            // Creates a empty share
            Share share = new Share("Testing");
            // Adds common filelist to share
            AddFilelistsToShare(share);

            HubSetting setting = new HubSetting();
            setting.Address = "127.0.0.1";
            setting.Port = 411;
            setting.DisplayName = "FlowLib";
            setting.Protocol = "Auto";

            Hub hubConnection = new Hub(setting, this);
            hubConnection.ProtocolChange += new FmdcEventHandler(hubConnection_ProtocolChange);
            // Adds share to hub
            hubConnection.Share = share;
            hubConnection.Connect();
        }
        public MultiConnections()
        {
            UpdateBase = new FmdcEventHandler(PassiveConnectToUser_UpdateBase);

            // Creates a empty share
            Share share = new Share("Testing");

            // Port to listen for incomming connections on
            share.Port = 12345;

            incomingConnectionListener         = new TcpConnectionListener(share.Port);
            incomingConnectionListener.Update += new FmdcEventHandler(Connection_Update);
            incomingConnectionListener.Start();

            // Adds common filelist to share
            AddFilelistsToShare(share);

            HubSetting setting = new HubSetting();

            setting.Address     = "127.0.0.1";
            setting.Port        = 411;
            setting.DisplayName = "FlowLib";
            setting.Protocol    = "Auto";

            hub = new Hub(setting, this);
            hub.ProtocolChange += new FmdcEventHandler(hubConnection_ProtocolChange);
            // Adds share to hub
            hub.Share   = share;
            hub.Me.Mode = FlowLib.Enums.ConnectionTypes.Direct;
            hub.Connect();


            last            = System.DateTime.Now.Ticks;
            timer.Elapsed  += new System.Timers.ElapsedEventHandler(timer_Elapsed);
            timer.AutoReset = true;
            timer.Interval  = 1000;
            timer.Start();
        }
 /// <summary>
 /// This should not be used. It is needed for xml handling.
 /// </summary>
 public SettingItem()
 {
     UpdatedSetting = new FmdcEventHandler(OnUpdateSetting);
 }
Exemple #26
0
 public UdpProtocol()
 {
     MessageReceived = new FmdcEventHandler(UdpNmdcProtocol_MessageReceived);
     MessageToSend   = new FmdcEventHandler(UdpNmdcProtocol_MessageToSend);
     Update          = new FmdcEventHandler(UdpNmdcProtocol_Update);
 }
Exemple #27
0
 /// <summary>
 /// Creating Transfer with address and prt.
 /// </summary>
 /// <param name="addy">string representation of a IP/DNS address</param>
 /// <param name="prt">int port representation</param>
 /// <param name="protocol">Protocol to be used by this connection</param>
 public Transfer(string addy, int port, IProtocolTransfer protocol)
     : base(addy, port)
 {
     DownloadItemChanged = new FmdcEventHandler(OnDownloadItemChanged);
     this.Protocol       = protocol;
 }
Exemple #28
0
 /// <summary>
 /// Creating Transfer with addy as the remote address.
 /// </summary>
 /// <param name="addy">IPEndPoint that we want as our remote address</param>
 public Transfer(System.Net.IPEndPoint addy)
     : base(addy)
 {
     DownloadItemChanged = new FmdcEventHandler(OnDownloadItemChanged);
 }
 protected TcpConnectionListener()
 {
     Update = new FmdcEventHandler(TcpConnectionListener_Update);
 }
 /// <summary>
 /// This should not be used. It is needed for xml handling.
 /// </summary>
 public SettingItem()
 {
     UpdatedSetting = new FmdcEventHandler(OnUpdateSetting);
 }
Exemple #31
0
 /// <summary>
 /// Creating TcpConnection
 /// </summary>
 public TcpConnection()
 {
     #region Event(s)
     ProtocolChange = new FmdcEventHandler(OnProtocolChanged);
     ConnectionStatusChange = new FmdcEventHandler(OnConnectionStatusChanged);
     #if !COMPACT_FRAMEWORK
     // Security
     SecureUpdate = new FmdcEventHandler(OnSecureUpdate);
     #endif
     #endregion
 }
 public SettingsGroup()
 {
     UpdatedSetting = new FmdcEventHandler(SettingsGroup_UpdatedSetting);
 }
 public UdpProtocol()
 {
     MessageReceived = new FmdcEventHandler(UdpNmdcProtocol_MessageReceived);
     MessageToSend = new FmdcEventHandler(UdpNmdcProtocol_MessageToSend);
     Update = new FmdcEventHandler(UdpNmdcProtocol_Update);
 }
 public SettingsGroup()
 {
     UpdatedSetting = new FmdcEventHandler(SettingsGroup_UpdatedSetting);
 }
Exemple #35
0
        public AdcProtocol()
        {
            MessageReceived = new FmdcEventHandler(OnMessageReceived);
            MessageToSend = new FmdcEventHandler(OnMessageToSend);
            Update = new FmdcEventHandler(OnUpdate);
            ChangeDownloadItem = new FmdcEventHandler(AdcProtocol_ChangeDownloadItem);
            RequestTransfer = new FmdcEventHandler(AdcProtocol_RequestTransfer);
            Error = new FmdcEventHandler(AdcProtocol_Error);

            TimerCallback updateCallback = new TimerCallback(OnUpdateInf);
            updateInfTimer = new Timer(updateCallback, this, Timeout.Infinite, Timeout.Infinite);
        }
 protected TcpConnectionListener()
 {
     Update = new FmdcEventHandler(TcpConnectionListener_Update);
 }
Exemple #37
0
 /// <summary>
 /// Creating Transfer with address and prt.
 /// </summary>
 /// <param name="addy">string representation of a IP/DNS address</param>
 /// <param name="prt">int port representation</param>
 /// <param name="protocol">Protocol to be used by this connection</param>
 public Transfer(string addy, int port, IProtocolTransfer protocol)
     : base(addy, port)
 {
     DownloadItemChanged = new FmdcEventHandler(OnDownloadItemChanged);
     this.Protocol = protocol;
 }
Exemple #38
0
 /// <summary>
 /// Creating Transfer with addy as the remote address.
 /// </summary>
 /// <param name="addy">IPEndPoint that we want as our remote address</param>
 public Transfer(System.Net.IPEndPoint addy)
     : base(addy)
 {
     DownloadItemChanged = new FmdcEventHandler(OnDownloadItemChanged);
 }
        public TransferNmdcProtocol(ITransfer trans, string dir)
        {
            directory = dir;
            this.trans = trans;
            MessageReceived = new FmdcEventHandler(OnMessageReceived);
            MessageToSend = new FmdcEventHandler(OnMessageToSend);
            ChangeDownloadItem = new FmdcEventHandler(OnChangeDownloadItem);
            RequestTransfer = new FmdcEventHandler(OnRequestTransfer);
            Error = new FmdcEventHandler(OnError);
            Update = new FmdcEventHandler(OnUpdate);

            TimerCallback timerDelegate = new TimerCallback(OnTimer);
            long interval = 10 * 1000; // 10 seconds
            timer = new System.Threading.Timer(timerDelegate, trans, interval, interval);

            trans.ConnectionStatusChange += new FmdcEventHandler(trans_ConnectionStatusChange);
        }
Exemple #40
0
        public CollectTransferedInformationFromFilelistDownload()
        {
            UpdateBase = new FmdcEventHandler(PassiveConnectToUser_UpdateBase);

            // Creates a empty share
            Share share = new Share("Testing");

            // Port to listen for incomming connections on
            share.Port = 12345;

            incomingConnectionListener         = new TcpConnectionListener(share.Port);
            incomingConnectionListener.Update += new FmdcEventHandler(Connection_Update);
            incomingConnectionListener.Start();

            // Adds common filelist to share
            AddFilelistsToShare(share);

            HubSetting setting = new HubSetting();

            setting.Address     = "127.0.0.1";
            setting.Port        = 411;
            setting.DisplayName = "FlowLib";
            setting.Protocol    = "Auto";

            Hub hubConnection = new Hub(setting, this);

            hubConnection.ProtocolChange += new FmdcEventHandler(hubConnection_ProtocolChange);
            // Adds share to hub
            hubConnection.Share = share;
            //hubConnection.Me.Mode = FlowLib.Enums.ConnectionTypes.Direct;
            hubConnection.Me.TagInfo.Slots = 2;
            hubConnection.Connect();


            FlowLib.Utils.Convert.General.BinaryPrefixes bp;
            Console.WriteLine("Press any key to update information");
            do
            {
                Console.ReadKey(true);
                Console.Clear();
                Console.WriteLine("Press any key to update information");
                Console.WriteLine("==================================");
                if (stats != null)
                {
                    Console.WriteLine("Total data sent: " + FlowLib.Utils.Convert.General.FormatBytes(stats.TotalBytesSent, out bp) + bp);
                    Console.WriteLine("Total data received: " + FlowLib.Utils.Convert.General.FormatBytes(stats.TotalBytesReceived, out bp) + bp);
                    Console.WriteLine("current download speed: " + FlowLib.Utils.Convert.General.FormatBytes(stats.CurrentReceiveSpeed, out bp) + bp + "/s");
                    Console.WriteLine("current upload speed: " + FlowLib.Utils.Convert.General.FormatBytes(stats.CurrentSendSpeed, out bp) + bp + "/s");
                    Decimal d = new decimal(stats.MaximumReceiveSpeed);
                    Console.WriteLine("Maximum download speed: " + FlowLib.Utils.Convert.General.FormatBytes(decimal.ToInt64(d), out bp) + bp + "/s");
                    d = new decimal(stats.MaximumSendSpeed);
                    Console.WriteLine("Maximum upload speed: " + FlowLib.Utils.Convert.General.FormatBytes(decimal.ToInt64(d), out bp) + bp + "/s");
                    d = new decimal(stats.MinimumReceiveSpeed);
                    Console.WriteLine("Minimum download speed: " + FlowLib.Utils.Convert.General.FormatBytes(decimal.ToInt64(d), out bp) + bp + "/s");
                    d = new decimal(stats.MinimumSendSpeed);
                    Console.WriteLine("Minimum upload speed: " + FlowLib.Utils.Convert.General.FormatBytes(decimal.ToInt64(d), out bp) + bp + "/s");
                }
                else
                {
                    Console.WriteLine("No transfer has started yet.");
                }
                Console.WriteLine("==================================");
            } while (true);
        }