예제 #1
0
        protected void Start()
        {
            Log("DHCP", "Starting");
            mDhcpThread = new Thread(delegate() {
                // Need full path to boot file because it needs to get the size
                mDHCP = new DHCP(mNicIP, Path.Combine(App.PxePath, "pxelinux.0"));

                mDHCP.OnLog += delegate(DHCP aSender, string aText) {
                    Dispatcher.Invoke(DispatcherPriority.Normal, (Action) delegate() {
                        Log("DHCP", aText);
                    });
                };

                mDHCP.Execute();
            });
            mDhcpThread.Start();

            Log("TFTP", "Starting");
            mTftpThread = new Thread(delegate() {
                mTFTP = new TrivialFTP(mNicIP, App.PxePath);

                mTFTP.OnFileStart += delegate(TrivialFTP aSender, string aFilename, long aSize) {
                    Dispatcher.Invoke(DispatcherPriority.Normal, (Action) delegate() {
                        mCloseTimer.Stop();
                        Log("TFTP", "Starting file " + aFilename);
                        lablCurrentFile.Content = aFilename;
                        double xMB = (double)aSize / (1024 * 1024);
                        lablCurrentSize.Content = xMB.ToString("0.00") + " MB";
                        progFile.Value          = 0;
                        progFile.Maximum        = aSize;
                    });
                };

                mTFTP.OnFileTransfer += delegate(TrivialFTP aSender, string aFilename, long aPosition) {
                    Dispatcher.Invoke(DispatcherPriority.Normal, (Action) delegate() {
                        progFile.Value = aPosition;
                    });
                };

                mTFTP.OnFileCompleted += delegate(TrivialFTP aSender, string aFilename) {
                    Dispatcher.Invoke(DispatcherPriority.Normal, (Action) delegate() {
                        ClearFile();
                        Log("TFTP", "Completed " + aFilename);
                        mCloseTimer.Start();
                    });
                };

                mTFTP.Execute();
            });
            mTftpThread.Start();
        }
예제 #2
0
    protected void Start() {
      Log("DHCP", "Starting");
      mDhcpThread = new Thread(delegate() {
        // Need full path to boot file because it needs to get the size
        mDHCP = new DHCP(mNicIP, Path.Combine(App.PxePath, "pxelinux.0"));

        mDHCP.OnLog += delegate(DHCP aSender, string aText) {
          Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() {
            Log("DHCP", aText);
          });
        };

        mDHCP.Execute();
      });
      mDhcpThread.Start();

      Log("TFTP", "Starting");
      mTftpThread = new Thread(delegate() {
        mTFTP = new TrivialFTP(mNicIP, App.PxePath);

        mTFTP.OnFileStart += delegate(TrivialFTP aSender, string aFilename, long aSize) {
          Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() {
            mCloseTimer.Stop();
            Log("TFTP", "Starting file " + aFilename);
            lablCurrentFile.Content = aFilename;
            double xMB = (double)aSize / (1024 * 1024);
            lablCurrentSize.Content = xMB.ToString("0.00") + " MB";
            progFile.Value = 0;
            progFile.Maximum = aSize;
          });
        };

        mTFTP.OnFileTransfer += delegate(TrivialFTP aSender, string aFilename, long aPosition) {
          Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() {
            progFile.Value = aPosition;
          });
        };

        mTFTP.OnFileCompleted += delegate(TrivialFTP aSender, string aFilename) {
          Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() {
            ClearFile();
            Log("TFTP", "Completed " + aFilename);
            mCloseTimer.Start();
          });
        };

        mTFTP.Execute();
      });
      mTftpThread.Start();
    }