コード例 #1
0
ファイル: PcapSource.cs プロジェクト: marwansamaha/Screenary
        static void ThreadProc(PcapSource pcapSource)
        {
            int count = 0;
            SurfaceCommand cmd;
            MemoryStream stream;
            BinaryReader reader;

            PcapReader pcap = new PcapReader(File.OpenRead(pcapSource.filename));
            TimeSpan previousTime = new TimeSpan(0, 0, 0, 0);

            foreach (PcapRecord record in pcap)
            {
                Thread.Sleep(record.Time.Subtract(previousTime));
                previousTime = record.Time;

                stream = new MemoryStream(record.Buffer);
                reader = new BinaryReader(stream);

                cmd = SurfaceCommand.Parse(reader);
                pcapSource.iSource.OnSurfaceCommand(cmd);
            }

            pcap.Close();
        }
コード例 #2
0
        static void ThreadProc(PcapSource pcapSource)
        {
            int            count = 0;
            SurfaceCommand cmd;
            MemoryStream   stream;
            BinaryReader   reader;

            PcapReader pcap         = new PcapReader(File.OpenRead(pcapSource.filename));
            TimeSpan   previousTime = new TimeSpan(0, 0, 0, 0);

            foreach (PcapRecord record in pcap)
            {
                Thread.Sleep(record.Time.Subtract(previousTime));
                previousTime = record.Time;

                stream = new MemoryStream(record.Buffer);
                reader = new BinaryReader(stream);

                cmd = SurfaceCommand.Parse(reader);
                pcapSource.iSource.OnSurfaceCommand(cmd);
            }

            pcap.Close();
        }
コード例 #3
0
ファイル: MainWindow.cs プロジェクト: Screenary/Screenary
    public MainWindow(int m)
        : base(Gtk.WindowType.Toplevel)
    {
        Build();

        /* Instantiate client states */
        clientStates = new IClientState[7]
        {
            new StartedState(this),
            new SenderCreatedState(this),
            new ReceiverJoinedState(this),
            new ReceiverAuthenticatedState(this),
            new SenderSendingState(this),
            new ReceiverInControlState(this),
            new SenderSendingRemoteState(this)
        };

        /* Set current state to STARTED */
        currentState = clientStates[STARTED_STATE];
        currentState.refresh();

        width = 1024;
        height = 768;

        config = Config.Load();

        window = mainDrawingArea.GdkWindow;
        drawable = (Gdk.Drawable) window;

        mainDrawingArea.AddEvents(
            (int) Gdk.EventMask.ButtonPressMask |
            (int) Gdk.EventMask.ButtonReleaseMask |
            (int) Gdk.EventMask.PointerMotionMask |
            (int) Gdk.EventMask.KeyPressMask |
            (int) Gdk.EventMask.KeyReleaseMask);

        gc = new Gdk.GC(drawable);
        gc.ClipRectangle = new Gdk.Rectangle(0, 0, width, height);

        surface = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, width, height);
        window.InvalidateRect(new Gdk.Rectangle(0, 0, width, height), true);

        receiver = new SurfaceReceiver(window, surface);

        this.transport = null;

        pcapSource = new PcapSource(this);

        keyboard = new Keyboard();

        if (config.BroadcasterAutoconnect)
            OnUserConnect(config.BroadcasterHostname, config.BroadcasterPort);
    }
コード例 #4
0
ファイル: MainWindow.cs プロジェクト: marwansamaha/Screenary
    public MainWindow(int m)
        : base(Gtk.WindowType.Toplevel)
    {
        Build();

        /* Instantiate client states */
        clientStates = new IClientState[4] {
            new StartedState(this),
            new SenderCreatedState(this),
            new ReceiverJoinedState(this),
            new ReceiverAuthenticatedState(this)
        };

        /* Set current state to STARTED */
        currentState = clientStates[STARTED_STATE];

        mode = m;
        width = 1024;
        height = 768;

        config = Config.Load();

        window = mainDrawingArea.GdkWindow;
        drawable = (Gdk.Drawable) window;

        gc = new Gdk.GC(drawable);
        gc.ClipRectangle = new Gdk.Rectangle(0, 0, width, height);

        surface = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, width, height);
        window.InvalidateRect(new Gdk.Rectangle(0, 0, width, height), true);

        receiver = new SurfaceReceiver(window, surface);

        OutOfSessionWindow();

        this.transport = null;

        rdpSource = new RdpSource(this);
        pcapSource = new PcapSource(this);

        if (config.BroadcasterAutoconnect)
            OnUserConnect(config.BroadcasterHostname, config.BroadcasterPort);
    }