示例#1
0
        internal SystemTray(KyruApplication app)
        {
            this.app = app;

            trayMenu = new ContextMenu();
            trayMenu.MenuItems.Add("Log in", OnLogin);
            trayMenu.MenuItems.Add("Connect", OnRegisterNode);
            trayMenu.MenuItems.Add("-");
            trayMenu.MenuItems.Add("System status", OnSystemStatus);
            trayMenu.MenuItems.Add("-");
            trayMenu.MenuItems.Add("Exit", OnExit);

            trayIcon = new NotifyIcon();

            nodesIcon = new List<Icon>();

            for (int i = 0; i < 4; i++){
                nodesIcon.Add(new Icon("Icons/kyru"+ i.ToString() + ".ico"));
            }
            //TimerElapsed();
            trayIcon.MouseDoubleClick += OnLogin;

            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible = true;

            TimerElapsed();
            KyruTimer.Register(this, 2);
        }
示例#2
0
        private void CreateNodes()
        {
            nodes = new List<Node>();

            for (int i = 0; i < NodeCount; i++)
            {
                var port = (ushort) (12000 + i);

                var node = new KyruApplication(port).Node;
                node.Start();
                nodes.Add(node);

                if (i != 0)
                {
                    node.Kademlia.AddNode(new IPEndPoint(IPAddress.Loopback, port - 1));
                }

                Thread.Sleep(TestParameters.LocalhostCommunicationTimeout * 5);
            }

            KyruTimer.Start();

            this.Warn("Waiting for the node initialization dust to settle...\n\n\n\n");

            Thread.Sleep(TestParameters.LocalhostCommunicationTimeout * 160);

            this.Warn("Continuing...\n\n\n\n");
        }
示例#3
0
 internal StoreObjectClient(KyruApplication app, NodeInformation targetNode, KademliaId objectId, byte[] bytes, Action<Error> done)
     : base(app, targetNode)
 {
     this.objectId = objectId;
     this.bytes = bytes;
     this.done = done;
 }
示例#4
0
文件: Node.cs 项目: zr40/kyru-dotnet
        internal Node(ushort port, KyruApplication app)
        {
            Port = port;
            this.app = app;
            MetadataStorage = new MetadataStorage(this);
            Kademlia = new Kademlia(this);

            udp = new UdpClient(port);
            tcp = new TcpListener(IPAddress.Any, port);
            KyruTimer.Register(this, 1);
        }
示例#5
0
        private static void Main()
        {
            Console.WriteLine("Kyru debug console");
            Console.WriteLine();

            KyruTimer.Start();

            app = new KyruApplication();

            app.Start();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            tray = new SystemTray(app);

            Application.Run();
        }
示例#6
0
 protected ClientBase(KyruApplication app, NodeInformation targetNode)
 {
     App = app;
     TargetNode = targetNode;
 }
示例#7
0
 internal StoreObjectState(NetworkStream stream, KyruApplication app, StoreObjectRequest storeObjectRequest)
 {
     this.stream = stream;
     this.app = app;
     this.storeObjectRequest = storeObjectRequest;
 }
示例#8
0
 internal HandshakeState(TcpClient client, NetworkStream stream, KyruApplication app)
 {
     this.client = client;
     this.stream = stream;
     this.app = app;
 }
示例#9
0
 internal GetObjectState(NetworkStream stream, KyruApplication app, GetObjectRequest getObjectRequest)
 {
     this.stream = stream;
     this.app = app;
     this.getObjectRequest = getObjectRequest;
 }
示例#10
0
 internal GetObjectClient(KyruApplication app, NodeInformation targetNode, KademliaId objectId, Action<Error, byte[]> done)
     : base(app, targetNode)
 {
     this.objectId = objectId;
     this.done = done;
 }
示例#11
0
文件: Node.cs 项目: zr40/kyru-dotnet
 internal Node(KyruApplication app)
     : this(12045, app)
 {
 }
示例#12
0
 internal SystemStatusForm(KyruApplication app)
 {
     this.app = app;
     InitializeComponent();
     timer1_Tick(null, null);
 }