Exemple #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);
        }
Exemple #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");
        }
 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;
 }
Exemple #4
0
        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);
        }
Exemple #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();
        }
Exemple #6
0
 protected ClientBase(KyruApplication app, NodeInformation targetNode)
 {
     App = app;
     TargetNode = targetNode;
 }
Exemple #7
0
 internal StoreObjectState(NetworkStream stream, KyruApplication app, StoreObjectRequest storeObjectRequest)
 {
     this.stream = stream;
     this.app = app;
     this.storeObjectRequest = storeObjectRequest;
 }
Exemple #8
0
 internal HandshakeState(TcpClient client, NetworkStream stream, KyruApplication app)
 {
     this.client = client;
     this.stream = stream;
     this.app = app;
 }
Exemple #9
0
 internal GetObjectState(NetworkStream stream, KyruApplication app, GetObjectRequest getObjectRequest)
 {
     this.stream = stream;
     this.app = app;
     this.getObjectRequest = getObjectRequest;
 }
Exemple #10
0
 internal GetObjectClient(KyruApplication app, NodeInformation targetNode, KademliaId objectId, Action<Error, byte[]> done)
     : base(app, targetNode)
 {
     this.objectId = objectId;
     this.done = done;
 }
Exemple #11
0
 internal Node(KyruApplication app)
     : this(12045, app)
 {
 }
Exemple #12
0
 internal SystemStatusForm(KyruApplication app)
 {
     this.app = app;
     InitializeComponent();
     timer1_Tick(null, null);
 }