示例#1
0
 public WindowsList(float fps)
 {
     FPS = fps;
     //For testing only one window
     if (Program.DEBUG_FIXWINDOWHANDLES.Length > 0)
     {
         Console.WriteLine("For testing please check the FAR Handle.");
         foreach (var f in Program.DEBUG_FIXWINDOWHANDLES)
         {
             HandlesList.Add(f, HandlesList.windows);
         }
         return;
     }
     if (!Program.TEST_WINDOWSLIST)
     {
         bms = BabylonMS.BabylonMS.LaunchMiniShip(out proc_windowslist, "WindowsList.exe", UUIDWindowsList, UUIDWindowsList, Program.instanceUUID); //UUID
     }
     else
     {
     }
     Console.WriteLine("WindowsList Ship launched.");
     bms.NewInputFrame          += NewInputFrame;
     bms.ServerReadyForTransfer += ReadyForTransfer;
     bms.PrepareGate();
 }
示例#2
0
 static void Main(string[] args)
 {
     outputpack         = new BabylonMS.BMSPack();
     bms                = BabylonMS.BabylonMS.ShipDocking(shipUUID, args);
     bms.NewInputFrame += NewInputFrame;
     bms.OpenGate(true);
 }
示例#3
0
        public ImageBuffer()
        {
            if (!Program.TEST_IMAGEBUFFER)
            {
                bms = BabylonMS.BabylonMS.LaunchMiniShip(out proc_imagebuffer, "ImageBuffer.exe", ImageBufferUUID, ImageBufferUUID, Program.instanceUUID); //UUID
            }
            else
            {
                bms = BabylonMS.BabylonMS.LaunchMiniShip(ImageBufferUUID, ImageBufferUUID, Program.instanceUUID); //DEBUG because Manual start //UUID
            }
            try
            {
                bms.ChangeMiniShipToNetwork(Program.ip_imagebuffer, Program.port_imagebuffer); //started file but switchOn Radio
                bms.ServerReadyForTransfer += ReadyForTransfer;
                bms.PrepareGate();
            }
            catch (Exception) {
                Console.WriteLine(Program.ERR_IMAGEBUFFERLOAD);
                Program.terminate();
            }

            while ((bms.IsReady) || (!ready))
            {
                Thread.Sleep(100);
            }
            ;                                                //TODO Biztosan nem "!bms.IsReady" kell?
            ready = false;
            bms.ServerReadyForTransfer -= ReadyForTransfer;  //NEED!! tedd vissza a norm'l haszn'lathoz
        }
示例#4
0
 public Recv()
 {
     bms                = BabylonMS.BabylonMS.ShipDocking(Program.shipUUID, Program.Args);
     bms.Connected     += ClientConnected;
     bms.Disconnected  += Disconnected;
     bms.NewInputFrame += NewInputFrame;
     bms.OpenGate(false);//client
 }
示例#5
0
 public SendR()
 {
     bms = BabylonMS.BabylonMS.LaunchMiniShip(Program.shipUUID, Program.shipUUID, Program.instanceUUID); //UUID
     Console.WriteLine("SendR Ship launched.");
     bms.NewInputFrame          += NewInputFrame;
     bms.ServerReadyForTransfer += ReadyForTransfer;
     bms.PrepareGate();
 }
示例#6
0
 public Recv()
 {
     bms                = BabylonMS.BabylonMS.ShipDocking("127.0.0.1", 9020, Program.shipUUID);
     bms.Connected     += ClientConnected;
     bms.Disconnected  += Disconnected;
     bms.NewInputFrame += NewInputFrame;
     bms.OpenGate(false);//server
 }
示例#7
0
        static void Main(string[] args)
        {
            mediaserver    = new MediaServer();
            IDGenerator    = new ObjectIDGenerator();
            clientFollower = new ClientFollower();

            tcp                = BabylonMS.BabylonMS.ShipDocking(ip_imagebuffer, port_imagebuffer, shipUUID);
            tcp.Connected     += TCPClientConnected;
            tcp.Disconnected  += TCPDisconnected;
            tcp.NewInputFrame += TCPNewInputFrame;
            tcp.OpenGate(true);//NET Server
        }
示例#8
0
 public InputController()
 {
     if (!Program.TEST_INPUTCONTROLLER)
     {
         bms = BabylonMS.BabylonMS.LaunchMiniShip(out proc_inputcontroller, "InputController.exe", InputControllerUUID, InputControllerUUID, Program.instanceUUID); //UUID
     }
     else
     {
         bms = BabylonMS.BabylonMS.LaunchMiniShip(InputControllerUUID, InputControllerUUID, Program.instanceUUID); //UUID
     }
     bms.Connected     += Connected;
     bms.NewInputFrame += NewInputFrame;
     bms.PrepareGate();
 }
示例#9
0
 //public BabylonMS.BabylonMS req;
 public Androids(string[] args)
 {
     AndroidsList = new List <AndroidDescriptor>();
     try {
         tcp                = BabylonMS.BabylonMS.ShipDocking(Program.ip_partner, Program.port_partner, UUIDAndroid); //server
         tcp.Connected     += NewAndroidConnected;
         tcp.Disconnected  += AndroidDisconnected;
         tcp.NewInputFrame += InputFrame_fromAnAndroid;
         tcp.OpenGate(false); //Server
     }
     catch (Exception) {
         Console.WriteLine(Program.ERR_ANDROIDLOAD);
         Program.terminate();
     }
 }
示例#10
0
 public ImageBufferInterface()
 {
     androidReady = false;
     tcp          = BabylonMS.BabylonMS.LaunchMiniShip(Program.ip_imagebuffer, Program.port_imagebuffer, ImageBuffer.ImageBufferUUID, ImageBuffer.ImageBufferUUID, Program.instanceUUID); //UUID
     //tcp = Program.imagebuffer.bms;
     tcp.IsReady        = false;
     tcp.Connected     += Connected;
     tcp.NewInputFrame += NewInputFrame;
     tcp.Disconnected  += Disconnect;
     tcp.Waitbytes     += Waitbytes;
     tcp.PrepareGate();//Nonblocking   net Client
     while ((!tcp.IsReady))
     {
         Thread.Sleep(100);
     }
     ;
     Console.WriteLine("Connected ImageBuffer");
 }
示例#11
0
 public ScreenCapture(Int64 hwnd, float fps)
 {
     focused   = null;
     this.Hwnd = hwnd;
     FPS       = fps;
     if (!Program.TEST_SCREENCAPTURE)
     {
         bms = BabylonMS.BabylonMS.LaunchMiniShip("ScreenContentExporter.exe", UUIDScreenCapture + hwnd.ToString(), UUIDScreenCapture, Program.instanceUUID); //UUID
     }
     else
     {
         bms = BabylonMS.BabylonMS.LaunchMiniShip(UUIDScreenCapture, UUIDScreenCapture, Program.instanceUUID);
         //bms = BabylonMS.BabylonMS.LaunchMiniShip("192.168.1.102",9000, UUIDScreenCapture + hwnd.ToString(), UUIDScreenCapture, Program.UUID);
     }
     Console.WriteLine("ScreenCapture Ship launched.");
     bms.NewInputFrame          += NewInputFrame;
     bms.ServerReadyForTransfer += ReadyForTransfer;
     bms.Disconnected           += Disconnect;
     bms.PrepareGate();//Nonblocking
 }
示例#12
0
        static void Main(string[] args)
        {
            _handler += new EventHandler(Handler);
            SetConsoleCtrlHandler(_handler, true);

            Application.EnableVisualStyles();
            User32.HideMouse();
            User32.ShowMouse();

            bms                = BabylonMS.BabylonMS.ShipDocking(shipUUID, args);
            bms.Connected     += Connected;
            bms.Disconnected  += Disconnected;
            bms.NewInputFrame += NewInputFrame;
            bms.Waitbytes     += WaitBytes;
            bms.WaitBytesMS    = 5;
            bms.OpenGate(false); //Client
                                 //BabylonMS.Util.setPriorityUp();

            if (TEST_INPUTCONTROLLER)
            {
                hook = new MouseHooker(); //for test because the Connect activate the Mousehooker
            }

            Application.Run();
            //Application.Run(new Form1());

            while (true)
            {
                try
                {
                    Thread.Sleep(5);
                    for (int i = 0; i < 4; i++)
                    {
                        Application.DoEvents();
                    }
                }
                catch (Exception) { }
            }
        }
        static void Main(string[] args)
        {
            hwnd               = IntPtr.Zero;
            datavalid          = false;
            bms                = BabylonMS.BabylonMS.ShipDocking(shipUUID, args);
            bms.Connected     += ClientConnected;
            bms.Disconnected  += Disconnected;
            bms.NewInputFrame += NewInputFrame;
            bms.OpenGate(false);//client


            stopWatch = Stopwatch.StartNew();
            while (true)
            {
                if (datavalid)
                {
                    if (stopWatch.ElapsedMilliseconds > mintime)
                    {
                        stopWatch.Restart();
                        try
                        {
                            ContentCapture.User32.RECT r = new ContentCapture.User32.RECT();
                            ContentCapture.User32.GetWindowRect(hwnd, ref r);
                            MemoryStream zmem = new BabylonMS.zipper(ContentCapture.CaptureWindowToStream(hwnd, JPEGQuality)).GetZip(false);

                            BabylonMS.BMSField data  = screensession.outputPack.GetFieldByName("DATA");
                            BabylonMS.BMSField recta = screensession.outputPack.GetFieldByName("RECT");
                            if (data != null)
                            {
                                data.Value(zmem.ToArray());
                            }
                            if (recta != null)
                            {
                                recta.Value((Int16)r.left);
                                recta.Value((Int16)r.top);
                                recta.Value((Int16)r.right);
                                recta.Value((Int16)r.bottom);
                            }
                            if (!screensession.TransferPacket(true))
                            {
                                Disconnected(null);
                            }
                            if (data != null)
                            {
                                data.clearValue();
                            }
                            if (recta != null)
                            {
                                recta.clearValue();
                            }
                        }
                        catch (Exception) {
                            Disconnected(null);
                        };
                    }
                    else
                    {
                        Thread.Sleep(10);
                    }
                }
                else
                {
                    Thread.Sleep(300);
                    live--;
                    if (live < 0)
                    {
                        Disconnected(null); //exit
                    }
                }
            }
        }
示例#14
0
        static void InputFrame(BabylonMS.BabylonMS bms, BabylonMS.BMSEventSessionParameter session) //newinput frame or continuous
        {
            String partnerUUID = session.shipUUID;


            bool  isFirstTime;
            Int64 ID = IDGenerator.GetId(session.reader, out isFirstTime); //The client ID from reader instance unique ID

            try
            {
                /*
                 * //Az inputpack paramétermintázatának ellenőrzésére szolgál (nem szükséges)
                 * //Elválasztva egymás után a paramétermintázatok.
                 * session.inputPack.AcceptedEnergyPattern(new byte[] {
                 *  BabylonMS.BabylonMS.CONST_FT_INT8,BabylonMS.BabylonMS.CONST_FT_INT64,BabylonMS.BabylonMS.CONST_FT_BYTE,BabylonMS.BabylonMS.CONST_FT_END,
                 *  BabylonMS.BabylonMS.CONST_FT_INT8,BabylonMS.BabylonMS.CONST_FT_INT64,BabylonMS.BabylonMS.CONST_FT_END
                 * }
                 * );
                 */

                byte command = (byte)session.inputPack.GetField(0).getValue(0);
                BabylonMS.BMSPack outputpack = new BabylonMS.BMSPack();
                Int64             hwnd;
                String            group;
                String            key;
                MediaBuffer       buf;
                //String owner = partnerUUID;
                switch (command)
                {
                case VRMainContentExporter.VRCEShared.CONST_COMMAND_GETBUFFER:
                    //TODO : NOT TESTED
                    outputpack.AddField("CMD", BabylonMS.BabylonMS.CONST_FT_INT8).Value(command);
                    //bool first = true;
                    BabylonMS.BMSField f1 = null;
                    BabylonMS.BMSField f2 = null;
                    BabylonMS.BMSField f3 = null;
                    BabylonMS.BMSField f4 = null;
                    BabylonMS.BMSField f5 = null;
                    int  cnt = mediaserver.SIBuffer.Count();
                    byte idx = 0;
                    for ( ; idx < cnt; idx++)
                    {
                        buf = mediaserver.SIBuffer[idx];
                        if (idx == 0)
                        {
                            f1 = outputpack.AddField("IDX", BabylonMS.BabylonMS.CONST_FT_INT8);
                            f2 = outputpack.AddField("HWND", BabylonMS.BabylonMS.CONST_FT_INT64);
                            f3 = outputpack.AddField("GROUP", BabylonMS.BabylonMS.CONST_FT_UUID);     //UUID length string array
                            f4 = outputpack.AddField("DATE", BabylonMS.BabylonMS.CONST_FT_INT64);
                            f5 = outputpack.AddField("USAGE", BabylonMS.BabylonMS.CONST_FT_INT32);
                        }
                        f1.Value(idx);
                        f2.Value(buf.hwnd);
                        f3.ValueAsUUID(buf.owner);     //mivel owner = UUID
                        f4.Value(buf.created.Ticks);
                        f5.Value(buf.usage);
                    }
                    if (idx > 0)
                    {
                        bms.TransferPacket(session.writer, outputpack, true);
                    }
                    break;

                case VRMainContentExporter.VRCEShared.CONST_COMMAND_EXIST:
                    //TODO : NOT TESTED
                    hwnd  = session.inputPack.GetFieldByName("HWND").getValue(0);
                    group = session.inputPack.GetFieldByName("GROUP").GetUUIDValue(0);
                    key   = System.Text.Encoding.ASCII.GetString(session.inputPack.GetField(2).getValue());
                    outputpack.AddField("CMD", BabylonMS.BabylonMS.CONST_FT_INT8).Value(command);
                    outputpack.AddField("HWND", BabylonMS.BabylonMS.CONST_FT_INT64).Value(hwnd);
                    outputpack.AddField("GROUP", BabylonMS.BabylonMS.CONST_FT_UUID).ValueAsUUID(group);
                    sema1.WaitOne();
                    outputpack.AddField("EXISTS", BabylonMS.BabylonMS.CONST_FT_INT8).Value(mediaserver.Exists(group, key, hwnd));
                    sema1.Release();
                    bms.TransferPacket(session.writer, outputpack, true);
                    break;

                case VRMainContentExporter.VRCEShared.CONST_COMMAND_STORE:
                    hwnd  = session.inputPack.GetFieldByName("HWND").getValue(0);
                    group = session.inputPack.GetFieldByName("GROUP").GetUUIDValue(0);
                    byte[] image = session.inputPack.GetFieldByName("IMAGE").getValue();
                    sema1.WaitOne();
                    byte[] res     = mediaserver.indexOfBufferAndStore(group, MediaServer.md5(image), image, hwnd);
                    bool   refresh = clientFollower.IsNeedRefresh(ID, res[0], res[1]);
                    sema1.Release();
                    outputpack.AddField("CMD", BabylonMS.BabylonMS.CONST_FT_INT8).Value(command);
                    outputpack.AddField("HWND", BabylonMS.BabylonMS.CONST_FT_INT64).Value(hwnd);
                    outputpack.AddField("GROUP", BabylonMS.BabylonMS.CONST_FT_UUID).ValueAsUUID(group);
                    outputpack.AddField("MODE", BabylonMS.BabylonMS.CONST_FT_INT8).Value(res[0]);
                    outputpack.AddField("IDX", BabylonMS.BabylonMS.CONST_FT_INT8).Value(res[1]);
                    outputpack.AddField("REFRESH", BabylonMS.BabylonMS.CONST_FT_INT8).Value(refresh);
                    if ((refresh) && (res[0] != VRMainContentExporter.VRCEShared.CONST_MODE_BFFOUND))
                    {
                        MediaBuffer buf2 = mediaserver.Retrieve(res[1]);
                        if (buf2 != null)
                        {
                            outputpack.AddField("IMAGE", BabylonMS.BabylonMS.CONST_FT_BYTE).Value(buf2.buffer);
                        }
                    }
                    bms.TransferPacket(session.writer, outputpack, true);
                    //Console.WriteLine();
                    break;

                case VRMainContentExporter.VRCEShared.CONST_COMMAND_RETRIEVE:
                    outputpack.AddField("CMD", BabylonMS.BabylonMS.CONST_FT_INT8).Value(command);
                    Int64 androidReqID = session.inputPack.GetFieldByName("REQID").getValue(0);
                    outputpack.AddField("REQID", BabylonMS.BabylonMS.CONST_FT_INT64).Value(androidReqID);
                    if (session.inputPack.FieldsCount() > 2)
                    {
                        //TODO mert nem ellenőriztem ;s mert lehet hogy a UUID+HWND parost kellene lek;rdezni!!!!
                        for (int i = 2; i < session.inputPack.FieldsCount(); i += 2)   //CMD in first position
                        {
                            hwnd  = session.inputPack.GetField(i).getValue(0);
                            group = session.inputPack.GetField(i + 1).GetUUIDValue(0);
                            sema1.WaitOne();
                            buf = mediaserver.Retrieve(group, hwnd);
                            outputpack.AddField("IDX", BabylonMS.BabylonMS.CONST_FT_INT8).Value((byte)buf.position_in_buffer);
                            outputpack.AddField("HWND", BabylonMS.BabylonMS.CONST_FT_INT64).Value(hwnd);
                            outputpack.AddField("GROUP", BabylonMS.BabylonMS.CONST_FT_UUID).ValueAsUUID(group);
                            outputpack.AddField("IMAGE", BabylonMS.BabylonMS.CONST_FT_BYTE).Value(buf.buffer);
                            sema1.Release();
                        }
                    }
                    else
                    {
                        //All uptodate element from buffer because no specified sent HWND
                        List <string> owners = mediaserver.GetOwners();
                        foreach (var o in owners)
                        {
                            List <Int64> hwnds = mediaserver.GetOwnerHwnds(o);
                            foreach (var h in hwnds)
                            {
                                sema1.WaitOne();
                                buf = mediaserver.Retrieve(o, h);
                                if (buf != null)
                                {
                                    outputpack.AddField("IDX", BabylonMS.BabylonMS.CONST_FT_INT8).Value((byte)buf.position_in_buffer);
                                    BabylonMS.BMSField fi = outputpack.AddField("HWND", BabylonMS.BabylonMS.CONST_FT_INT64);
                                    fi.Value(h);
                                    outputpack.AddField("GROUP", BabylonMS.BabylonMS.CONST_FT_UUID).ValueAsUUID(o);
                                    outputpack.AddField("IMAGE", BabylonMS.BabylonMS.CONST_FT_BYTE).Value(buf.buffer);
                                }
                                sema1.Release();
                            }
                        }
                    }
                    bms.TransferPacket(session.writer, outputpack, true);
                    break;
                }
            }
            catch (Exception) {
            };
        }