Пример #1
0
 /// <summary>
 /// Sets the Nexus pointer
 /// </summary>
 /// <param name="nexus"></param>
 public GraphicalInterface(Nexus.Nexus nexus)
 {
     _nexus = nexus;
     InitializeComponent();
     ListView_Search.View = View.Details;
     ListView_Search.FullRowSelect = true;
 }
Пример #2
0
 /// <summary>
 /// Sets the local variables
 /// </summary>
 /// <param name="_Port">Port to listen to</param>
 /// <param name="_FileName">Local resource to be send</param>
 /// <param name="_Interface">Pointer to the interface (for status updating)</param>
 /// <param name="_Nexus">Pointer to Nexus</param>
 public BinaryServer(int _Port, string _FileName, GraphicalInterface _Interface, Nexus.Nexus _Nexus)
 {
     Port = _Port;
     FileName = _FileName;
     Interface = _Interface;
     MainNexus = _Nexus;
 }
Пример #3
0
 /// <summary>
 /// Create Multicast object
 /// </summary>
 /// <param name="nexus">Nexus object so that multicasts from peers can be handled</param>
 /// <param name="read">Create in read mode</param>
 /// <param name="write">Create in write mode</param>
 public Multicast(Nexus.Nexus nexus, bool read, bool write)
 {
     _Nexus = nexus;
     if(write)
         CreateWriteMulticast();
     if(read)
         CreateReadMulticast();
 }
Пример #4
0
 /// <summary>
 /// Start chess server
 /// </summary>
 /// <param name="Port">Port for server</param>
 /// <param name="Nexus">Reference to Nexus object</param>
 public ChessProtocol(int Port, Nexus.Nexus Nexus)
 {
     _ListenPort = Port;
     _Nexus = Nexus;
     new Thread(new ThreadStart(Listen)).Start();
 }
Пример #5
0
 /// <summary>
 /// Sets the protocol port, and starts a new Thread with the Listen() method
 /// </summary>
 /// <param name="ProtocolPort">Port to listen to</param>
 /// <param name="PassedNexusPointer">Pointer to Nexus object</param>
 public Protocol(int ProtocolPort, Nexus.Nexus PassedNexusPointer)
 {
     _ProtocolPort = ProtocolPort;
     NexusPointer = PassedNexusPointer;
     new Thread(new ThreadStart(Listen)).Start();
 }
Пример #6
0
        static void StartWindowsProgram()
        {
            try
            {
                _nexus = new Nexus.Nexus();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                GraphicalInterface gi = new GraphicalInterface(_nexus);
                _nexus.Interface = gi;
                Application.Run(gi);
            }

            // thrown by kisp itself
            catch (BullshitException e)
            {
                MessageBox.Show(e.Message, "NO WAI!!");
            }

            // thrown by invocation targets
            catch (System.Reflection.TargetInvocationException e)
            {
                string Message = e.Message
                    + "\n"
                    + e.InnerException.Message
                    + "\n"
                    + e.StackTrace;

                string Caption = "TargetInvocationException: "
                    + e.InnerException.GetType().ToString();

                MessageBox.Show(Message, Caption);
            }

            // uncaught exceptions
            catch (Exception e)
            {
                string Message = e.Message
                    + "\n"
                    + e.StackTrace;

                string Caption = e.GetType().ToString();

                MessageBox.Show(Message, Caption);
            }
        }
Пример #7
0
 /// <summary>
 /// Test main protocol
 /// </summary>
 static void TestMainProtocol()
 {
     //Protocol.Protocol MainProtocol = new Protocol.Protocol(666);
     Nexus.Nexus TestNexus = new Nexus.Nexus();
     //TestNexus.DownloadFile(IPAddress.Parse("127.0.0.1"), @"c:\finish.log", 800);
 }
Пример #8
0
 /// <summary>
 /// Sets the ProtocolSocket
 /// </summary>
 /// <param name="PassedSocket">The socket to handle</param>
 /// <param name="IP">IP that is handled</param>
 /// <param name="PassedNexusPointer">Pointer to the Nexus</param>
 public ProtocolHandler(Socket PassedSocket, Nexus.Nexus PassedNexusPointer, IPAddress IP)
 {
     NexusPointer = PassedNexusPointer;
     ProtocolSocket = PassedSocket;
     RemoteIP = IP;
 }