Esempio n. 1
0
 public static void ParsePayload(string topic, byte[] payload)
 {
     if (topic.StartsWith("/control"))
     {
         var controlData = topic.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
         if (controlData.Length != 4)
         {
             Console.WriteLine("Invalid topic");
             return;
         }
         if (CommonString.AreEquals(Application.MACHINE_ID.MachineUid.ToString(), controlData[1]) == true &&
             CommonString.AreEquals(Application.MACHINE_ID.PartNumber.ToString(), controlData[2]) == true &&
             CommonString.AreEquals(Application.MACHINE_ID.SerialNumber.ToString(), controlData[3]))
         {
             Console.WriteLine(string.Join(" ", payload));
             if (!COMMANDS.ContainsKey(payload))
             {
                 Console.WriteLine("Invalid command");
                 return;
             }
             Console.WriteLine("Executing command");
             Console.WriteLine(COMMANDS[payload]);
             ExecuteCommand(COMMANDS[payload]);
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Constructs a Command with the parameters it's given.
 /// </summary>
 public Command(COMMANDS mainCommand, DIRECTIONS direction, int magnitude, int id)
 {
     MainCommand = mainCommand;
     Direction = direction;
     Magnitude = magnitude;
     ID = id;
 }
Esempio n. 3
0
 public D3Header D3Cmd(COMMANDS s_header, int l_param, int m_param, int r_param, int x_param)
 {
     D3Mail.header = Convert.ToUInt16(s_header);
     D3Mail.LParam.i = l_param;
     D3Mail.MParam.i = m_param;
     D3Mail.RParam.i = r_param;
     D3Mail.XParam.i = x_param;
     return SendD3Cmd(D3Mail);
 }
Esempio n. 4
0
 public D3Header D3Cmd(COMMANDS s_header, Single p_1 = 0, Single p_2 = 0, Single p_3 = 0, Single p_4 = 0)
 {
     D3Mail.header = Convert.ToUInt16(s_header);
     D3Mail.p_1.f = p_1;
     D3Mail.p_2.f = p_2;
     D3Mail.p_3.f = p_3;
     D3Mail.p_4.f = p_4;
     return SendD3Cmd();
 }
Esempio n. 5
0
 public D3Header D3Cmd(COMMANDS s_header, Single l_param, Single m_param, Single r_param, Single x_param)
 {
     D3Mail.header = Convert.ToUInt16(s_header);
     D3Mail.LParam.f = l_param;
     D3Mail.MParam.f = m_param;
     D3Mail.RParam.f = r_param;
     D3Mail.XParam.f = x_param;
     return SendD3Cmd(D3Mail);
 }
Esempio n. 6
0
 public D3Header D3Cmd(COMMANDS s_header, Single l_param, Single m_param, Single r_param, Single x_param)
 {
     D3Mail.header   = Convert.ToUInt16(s_header);
     D3Mail.LParam.f = l_param;
     D3Mail.MParam.f = m_param;
     D3Mail.RParam.f = r_param;
     D3Mail.XParam.f = x_param;
     return(SendD3Cmd(D3Mail));
 }
Esempio n. 7
0
 public D3Header D3Cmd(COMMANDS s_header, Single p_1 = 0, Single p_2 = 0, Single p_3 = 0, Single p_4 = 0)
 {
     D3Mail.header = Convert.ToUInt16(s_header);
     D3Mail.p_1.f  = p_1;
     D3Mail.p_2.f  = p_2;
     D3Mail.p_3.f  = p_3;
     D3Mail.p_4.f  = p_4;
     return(SendD3Cmd());
 }
Esempio n. 8
0
 public D3Header D3Cmd(COMMANDS s_header, int l_param, int m_param, int r_param, int x_param)
 {
     D3Mail.header   = Convert.ToUInt16(s_header);
     D3Mail.LParam.i = l_param;
     D3Mail.MParam.i = m_param;
     D3Mail.RParam.i = r_param;
     D3Mail.XParam.i = x_param;
     return(SendD3Cmd(D3Mail));
 }
Esempio n. 9
0
 public D3Header D3Cmd(COMMANDS s_header, Int32 p_1 = 0, Int32 p_2 = 0, Int32 p_3 = 0, Int32 p_4 = 0, Int32 p_5 = 0)
 {
     D3Mail.header = Convert.ToUInt16(s_header);
     D3Mail.p_1.i  = p_1;
     D3Mail.p_2.i  = p_2;
     D3Mail.p_3.i  = p_3;
     D3Mail.p_4.i  = p_4;
     D3Mail.p_5.i  = p_5;
     return(SendD3Cmd());
 }
Esempio n. 10
0
 public D3Header D3Cmd(COMMANDS s_header, Int32 p_1 = 0, Int32 p_2 = 0, Int32 p_3 = 0, Int32 p_4 = 0, Int32 p_5 = 0)
 {
     D3Mail.header = Convert.ToUInt16(s_header);
     D3Mail.p_1.i = p_1;
     D3Mail.p_2.i = p_2;
     D3Mail.p_3.i = p_3;
     D3Mail.p_4.i = p_4;
     D3Mail.p_5.i = p_5;
     return SendD3Cmd();
 }
Esempio n. 11
0
    public static void Execute(string requestId, COMMANDS cmd, string input, Dictionary <string, object> data)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            //string file = @"c:\test.txt";
            //File.WriteAllText(file, input, Encoding.UTF8);
            //FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read);
            var buf    = Encoding.UTF8.GetBytes(input);
            var stream = new MemoryStream(buf);

            string urlFTP   = data.Get <string>("ftp");
            string username = data.Get <string>("username");
            string password = data.Get <string>("password");

            Easy easy = new Easy();

            //Easy.ReadFunction rf = new Easy.ReadFunction(OnReadData);
            //easy.SetOpt(CURLoption.CURLOPT_READFUNCTION, rf);
            //easy.SetOpt(CURLoption.CURLOPT_READDATA, stream);
            easy.SetOpt(CURLoption.CURLOPT_WRITEDATA, stream);

            Easy.DebugFunction df = new Easy.DebugFunction(OnDebug);
            easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, df);
            easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);

            Easy.ProgressFunction pf = new Easy.ProgressFunction(OnProgress);
            easy.SetOpt(CURLoption.CURLOPT_PROGRESSFUNCTION, pf);

            easy.SetOpt(CURLoption.CURLOPT_URL, urlFTP);
            easy.SetOpt(CURLoption.CURLOPT_FTPPORT, 22);
            easy.SetOpt(CURLoption.CURLOPT_USERPWD, username + ":" + password);
            easy.SetOpt(CURLoption.CURLOPT_UPLOAD, true);
            easy.SetOpt(CURLoption.CURLOPT_INFILESIZE, stream.Length);

            easy.Perform();
            //easy.Cleanup();

            stream.Close();

            Curl.GlobalCleanup();
        }
        catch (Exception ex) {
            Console.WriteLine(ex);
        }
    }
Esempio n. 12
0
        private Task Get(COMMANDS command)
        {
            return(Task.Run(async() =>
            {
                try
                {
                    byte[] ReadBuf = new byte[14];

                    _device.WriteRead(new byte[] { 1, (byte)command }, ReadBuf);
                    await ProceadResponse(ReadBuf);
                    await Task.Delay(250);
                }
                catch (Exception e)
                {
                    LogException(e, "Arduino.cs -> Get(COMMANDS command)");
                }
            }));
        }
Esempio n. 13
0
        void EnqueueFiles()
        {
            if (File.Exists(Action.path))
            {
                COMMANDS command = (COMMANDS)StringEnum.Parse(typeof(COMMANDS), Action.command);

                Worker.I.EnqueTTD(new Model_ThingsToDelete()
                {
                    FullPathName  = Action.path,
                    IsWhitelisted = false,
                    OverWrite     = false,
                    WhatKind      = THINGS_TO_DELETE.clamwin,
                    command       = command,
                    search        = SEARCH.file,
                    level         = Action.parent_option.level,
                    cleaner_name  = Action.parent_option.label
                });
            }

            ChromeDefaultPath = Environment.ExpandEnvironmentVariables("%localappdata%");
            ChromeDefaultPath = Path.Combine(ChromeDefaultPath, @"Google\Chrome\User Data\Default");
        }
Esempio n. 14
0
    static void __executeCommand(string requestId, COMMANDS cmd, string input, Dictionary <string, object> data)
    {
        if (data == null)
        {
            data = new Dictionary <string, object>();
        }
        switch (cmd)
        {
        case COMMANDS.PDF_SPLIT_ALL_JPG:
            PdfService.SplitAllJpeg(requestId, cmd, input, data);
            break;

        case COMMANDS.OCR_BOX_PAGE:
        case COMMANDS.OCR_TEXT_PAGE:
        case COMMANDS.OCR_TEXT_ALL_PAGE:
            OcrService.convertImage2Text_OneOrAllPage(requestId, cmd, input, data);
            break;

        case COMMANDS.CURL_FTP_UPLOAD_FILE:
            FTPUpload.Execute(requestId, cmd, input, data);
            break;
        }
    }
Esempio n. 15
0
    public static void Execute(string requestId, COMMANDS cmd, string input, Dictionary <string, object> data)
    {
        string file     = @"c:\test.txt";
        string host     = data.Get <string>("host");
        int    port     = data.Get <int>("port");
        string username = data.Get <string>("username");
        string password = data.Get <string>("password");

        try
        {
            using (var client = new SftpClient(host, port, username, password))
            {
                client.Connect();

                //var ls = client.ListDirectory("/").Select(x => x.FullName).ToArray();

                FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read);
                client.UploadFile(stream, "/root/test/" + Guid.NewGuid().ToString() + ".txt");
            }
        }
        catch (Exception ex)
        {
        }
    }
Esempio n. 16
0
    public static void SplitAllJpeg(string requestId, COMMANDS cmd, string input, Dictionary <string, object> data)
    {
        string file = input;

        if (File.Exists(file))
        {
            var  redis = new RedisBase(new RedisSetting(REDIS_TYPE.ONLY_WRITE, __CONFIG.REDIS_PORT_WRITE));
            long docId = 0;
            try
            {
                using (var doc = PdfDocument.Load(file))
                {
                    int      pageTotal = doc.PageCount;
                    DOC_TYPE docType   = DOC_TYPE.JPG_OGRINAL;
                    if (data.ContainsKey("png"))
                    {
                        docType = DOC_TYPE.PNG_OGRINAL;
                    }
                    docId = StaticDocument.BuildId(docType, pageTotal, new FileInfo(file).Length);

                    if (redis.HEXISTS(docId.ToString(), "0"))
                    {
                        App.Reply(cmd, requestId, input, new Dictionary <string, object>()
                        {
                            { "id", docId },
                            { "type", docType.ToString() },
                            { "size", 0 },
                            { "page", 0 },
                            { "page_total", pageTotal },
                        });
                        return;
                    }

                    var sizes = new Dictionary <string, string>();
                    for (int i = 0; i < pageTotal; i++)
                    {
                        byte[] buf = null;
                        int    len = 0;
                        bool   ok  = false;
                        string err = "";
                        try
                        {
                            buf = _pageAsBitmapBytes(doc, i, docType);
                            len = buf.Length;
                            ok  = redis.HSET(docId, i, buf);
                        }
                        catch (Exception ex)
                        {
                            err = ex.Message + Environment.NewLine + ex.StackTrace;
                        }
                        App.Reply(cmd, requestId, input, new Dictionary <string, object>()
                        {
                            { "id", docId },
                            { "type", docType.ToString() },
                            { "size", len },
                            { "page", i },
                            { "page_total", pageTotal },
                        });
                        sizes.Add(string.Format("{0}:{1}", docId, i), len.ToString());
                        //Thread.Sleep(100);
                    }
                    redis.HMSET("_IMG_SIZE", sizes);
                    App.Reply(cmd, requestId, input, new Dictionary <string, object>()
                    {
                        { "id", docId },
                        { "type", docType.ToString() },
                        { "size", 0 },
                        { "page", pageTotal },
                        { "page_total", pageTotal },
                    });
                }
            }
            catch (Exception exInfo)
            {
                string errInfo = cmd.ToString() + " -> " + file + Environment.NewLine + exInfo.Message + Environment.NewLine + exInfo.StackTrace;
                redis.HSET("_ERROR:PDF:" + cmd.ToString(), docId.ToString(), errInfo);
            }
        }
    }
Esempio n. 17
0
    public static void convertImage2Text_OneOrAllPage(string requestId, COMMANDS cmd, string input, Dictionary <string, object> data)
    {
        var redis = new RedisBase(new RedisSetting(REDIS_TYPE.ONLY_WRITE, __CONFIG.REDIS_PORT_READ));

        long docId = 0;
        int  page  = -1;

        string[] a = input.Split('.');
        long.TryParse(a[0], out docId);
        if (a.Length > 1)
        {
            int.TryParse(a[1], out page);
        }

        var ocr_lang  = data.Get <string>("ocr_lang", "vie");
        var ocr_mode  = data.Get <EngineMode>("ocr_mode", EngineMode.Default);
        var ocr_level = data.Get <PageIteratorLevel>("ocr_level", PageIteratorLevel.Word);

        try
        {
            if (redis.HEXISTS(docId.ToString(), page.ToString()))
            {
                var bitmap = redis.HGET_BITMAP(docId, page);
                if (bitmap != null)
                {
                    var dic = new Dictionary <string, object>()
                    {
                        { "id", docId },
                        { "page", page },
                    };

                    using (var engine = new TesseractEngine("tessdata", ocr_lang, ocr_mode))
                        using (var pix = new BitmapToPixConverter().Convert(bitmap))
                        {
                            using (var tes = engine.Process(pix))
                            {
                                switch (cmd)
                                {
                                case COMMANDS.OCR_TEXT_PAGE:
                                    string s = tes.GetText().Trim();
                                    dic.Add("ocr_text", s);
                                    break;

                                case COMMANDS.OCR_BOX_PAGE:
                                    var boxes = tes.GetSegmentedRegions(ocr_level).Select(x =>
                                                                                          string.Format("{0}_{1}_{2}_{3}", x.X, x.Y, x.Width, x.Height)).ToArray();
                                    dic.Add("box_format", "x_y_width_height");
                                    dic.Add("box_text", string.Join("|", boxes.Select(x => x.ToString()).ToArray()));
                                    dic.Add("box_count", boxes.Length);
                                    break;
                                }
                            }
                        }

                    App.Reply(cmd, requestId, input, dic);
                }
            }
        }
        catch (Exception exInfo)
        {
            //string errInfo = cmd.ToString() + " -> " + file + Environment.NewLine + exInfo.Message + Environment.NewLine + exInfo.StackTrace;
            //redis.HSET("_ERROR:PDF:" + cmd.ToString(), docId.ToString(), errInfo);
        }
    }
        public async Task <bool> Start()
        {
            TotalSpaceCanBeRecoveredSafe       = "..";
            TotalSpaceCanBeRecoveredMorderate  = "..";
            TotalSpaceCanBeRecoveredAggressive = "..";

            CommandLogic_Delete_CalculateSpace.ApplicationCache_SafeCleaning_Space            = 0;
            CommandLogic_Delete_CalculateSpace.ApplicationCache_SafeCleaning_FilesCount       = 0;
            CommandLogic_Delete_CalculateSpace.WindowsTemp_SafeCleaning_Space                 = 0;
            CommandLogic_Delete_CalculateSpace.WindowsTemp_SafeCleaning_FilesCount            = 0;
            CommandLogic_Delete_CalculateSpace.BrowserCache_SafeCleaning_Space                = 0;
            CommandLogic_Delete_CalculateSpace.BrowserCache_SafeCleaning_FilesCount           = 0;
            CommandLogic_Delete_CalculateSpace.ApplicationCache_MordrateCleaning_Space        = 0;
            CommandLogic_Delete_CalculateSpace.ApplicationCache_MordrateCleaning_FilesCount   = 0;
            CommandLogic_Delete_CalculateSpace.WindowsTemp_MordrateCleaning_Space             = 0;
            CommandLogic_Delete_CalculateSpace.WindowsTemp_MordrateCleaning_FilesCount        = 0;
            CommandLogic_Delete_CalculateSpace.BrowserCache_MordrateCleaning_Space            = 0;
            CommandLogic_Delete_CalculateSpace.BrowserCache_MordrateCleaning_FilesCount       = 0;
            CommandLogic_Delete_CalculateSpace.ApplicationCache_AggressiveCleaning_Space      = 0;
            CommandLogic_Delete_CalculateSpace.ApplicationCache_AggressiveCleaning_FilesCount = 0;
            CommandLogic_Delete_CalculateSpace.WindowsTemp_AggressiveCleaning_Space           = 0;
            CommandLogic_Delete_CalculateSpace.WindowsTemp_AggressiveCleaning_FilesCount      = 0;
            CommandLogic_Delete_CalculateSpace.BrowserCache_AggressiveCleaning_Space          = 0;
            CommandLogic_Delete_CalculateSpace.BrowserCache_AggressiveCleaning_FilesCount     = 0;
            CommandLogic_Delete_CalculateSpace.RecycleBin_FileCount = 0;
            CommandLogic_Delete_CalculateSpace.RecycleBin_Space     = 0;

            foreach (string file in Directory.EnumerateFiles("C:\\$RECYCLE.BIN", "*.*", SearchOption.AllDirectories))
            {
                FileInfo fi = new FileInfo(file);
                CommandLogic_Delete_CalculateSpace.RecycleBin_Space += fi.Length;
                CommandLogic_Delete_CalculateSpace.RecycleBin_FileCount++;
                bgWorker.ReportProgress(1);
            }

            foreach (TreeNode node in CleanerML.CleanersCollection)
            {
                if (node.Name == "Deep Scan")
                {
                    continue;
                }

                foreach (TreeNode child in node.Children)
                {
                    option o = (option)child.Tag;

                    string last_Log = string.Empty;

                    foreach (action _a in o.action)
                    {
                        COMMANDS cmd = (COMMANDS)StringEnum.Parse(typeof(COMMANDS), _a.command);

                        iActions axn = null;

                        switch (cmd)
                        {
                        case COMMANDS.delete:
                            axn = new CommandLogic_Delete_CalculateSpace();
                            break;
                        }

                        if (axn != null)
                        {
                            axn.Action = _a;
                            axn.Enqueue(); // execute for queueing
                        }
                        bgWorker.ReportProgress(1);
                    }
                }
            }

            return(true);
        }
Esempio n. 19
0
 public D3Header D3Cmd(COMMANDS s_header, int LParam, int MParam, int RParam)
 {
     return(D3Cmd(s_header, LParam, MParam, RParam, 0));
 }
Esempio n. 20
0
 public D3Header D3Cmd(COMMANDS s_header)
 {
     D3Mail.header = Convert.ToUInt16(s_header);
     return(SendD3Cmd());
 }
Esempio n. 21
0
 public D3Header D3Cmd(COMMANDS s_header, String sBuffer)
 {
     D3Mail.header       = Convert.ToUInt16(s_header);
     D3Mail.StringBuffer = sBuffer;
     return(SendD3Cmd());
 }
Esempio n. 22
0
 public D3Header D3Cmd(COMMANDS s_header)
 {
     return(D3Cmd(s_header, 0, 0, 0, 0));
 }
Esempio n. 23
0
 public static void Reply(COMMANDS cmd, string requestId, string input, string message, Dictionary <string, object> data = null)
 => _reply(new NetPacket(cmd, requestId, input, message, data));
Esempio n. 24
0
        public async void CallCommand(COMMANDS cmd, string str = "", int num = 0)
        {
            switch (cmd)
            {
            case COMMANDS.Enter:
                if (this.action == ACTION.inVehicle)
                {
                    await this.ExitVehicle();
                }
                if (this.action != ACTION.Search)
                {
                    await this.EnterVehicle(num);
                }
                return;

            case COMMANDS.Exit:
                if (this.action != ACTION.Search)
                {
                    await this.ExitVehicle();
                }
                return;

            case COMMANDS.Follow:
                if (this.action == ACTION.inVehicle)
                {
                    await this.ExitVehicle();
                }
                if (this.action != ACTION.Search)
                {
                    await this.Follow();
                }
                return;

            case COMMANDS.Stay:
                if (this.action == ACTION.inVehicle)
                {
                    await this.ExitVehicle();
                }
                if (this.action != ACTION.Search)
                {
                    await this.Stay();
                }
                return;

            case COMMANDS.Attack:
                if (this.action == ACTION.inVehicle)
                {
                    await this.ExitVehicle();
                }
                await this.Attack(str, num);

                return;

            case COMMANDS.SearchVehicle:
                if (this.action == ACTION.inVehicle)
                {
                    await this.ExitVehicle();
                }
                if (this.action != ACTION.Search)
                {
                    await this.SearchVehicle();
                }
                return;

            case COMMANDS.SearchPlayer:
                if (this.action == ACTION.inVehicle)
                {
                    await this.ExitVehicle();
                }
                if (this.action != ACTION.Search)
                {
                    await this.SearchPlayer();
                }
                return;

            case COMMANDS.Spawn:
                await this.Spawn();

                return;

            case COMMANDS.Delete:
                this.dog.Delete();
                return;
            }
        }
Esempio n. 25
0
        private object handler(object indata)
        {
            ReturnPacket ret = new ReturnPacket();

            ret.OK = false;
            try
            {
                Packet   request = (Packet)indata;
                COMMANDS c       = (COMMANDS)Enum.Parse(typeof(COMMANDS), request.Command);
                object[] p       = null;
                switch (c)
                {
                case COMMANDS.Download:
                    p        = (object[])request.Data;
                    ret.Data = ServerCommands.Download((string)p[0], (string)p[1], (SyncFile)p[2], (long)p[3], (int)p[4]);
                    ret.OK   = true;
                    break;

                case COMMANDS.GetServerInfo:
                    ret.Data = ServerCommands.GetServerInfo();
                    ret.OK   = true;
                    break;

                case COMMANDS.isConfirmed:
                    p        = (object[])request.Data;
                    ret.Data = ServerCommands.isConfirmed((string)p[0], (string)p[1], (string)p[2]);
                    ret.OK   = true;
                    break;

                case COMMANDS.RegisterMachine:
                    p        = (object[])request.Data;
                    ret.Data = ServerCommands.RegisterMachine((string)p[0], (string)p[1], (string)p[2], StartQue);
                    ret.OK   = true;
                    break;

                case COMMANDS.SyncReadOnly:
                    p        = (object[])request.Data;
                    ret.Data = ServerCommands.SyncReadOnly(_queprocessors, (string)p[0], (string)p[1], (string)p[2], (State)p[3]);
                    ret.OK   = true;
                    break;

                case COMMANDS.SyncReadWrite:
                    p        = (object[])request.Data;
                    ret.Data = ServerCommands.SyncReadWrite(_queprocessors, (string)p[0], (string)p[1], (string)p[2], (State)p[3], (Delta)p[4]);
                    ret.OK   = true;
                    break;

                case COMMANDS.isChanged:
                    p        = (object[])request.Data;
                    ret.Data = isChanged((string)p[0], (string)p[1]);
                    ret.OK   = true;
                    break;

                case COMMANDS.CreateZip:
                    p        = (object[])request.Data;
                    ret.Data = ServerCommands.CreateZip((string)p[0], (string)p[1], (object[])p[2]);
                    ret.OK   = true;
                    break;

                case COMMANDS.DownloadZip:
                    p        = (object[])request.Data;
                    ret.Data = ServerCommands.DownloadZip((string)p[0], (string)p[1], (SyncFile)p[2], (long)p[3], (int)p[4]);
                    ret.OK   = true;
                    break;

                case COMMANDS.DeleteZip:
                    p = (object[])request.Data;
                    ServerCommands.DeleteZip((string)p[0], (string)p[1], (SyncFile)p[2]);
                    ret.OK = true;
                    break;

                case COMMANDS.CanConnect:
                    ret.Data = ServerCommands.CanConnect((string)request.Data);
                    ret.OK   = true;
                    break;
                }
            }
            catch (Exception ex)
            {
                ret.OK    = false;
                ret.Error = ex.ToString();
            }
            return(ret);
        }
Esempio n. 26
0
 public byte[] SendCommand(COMMANDS command, int responseLength)
 {
     return SendCommand(new byte[] { (byte)command }, responseLength);
 }
Esempio n. 27
0
 public D3Header D3Cmd(COMMANDS s_header, Single l_param, Single m_param)
 {
     return D3Cmd(s_header, l_param, m_param, 0, 0);
 }
Esempio n. 28
0
 public D3Header D3Cmd(COMMANDS s_header, String sBuffer)
 {
     D3Mail.header = Convert.ToUInt16(s_header);
     D3Mail.StringBuffer = sBuffer;
     return SendD3Cmd();
 }
Esempio n. 29
0
 public D3Header D3Cmd(COMMANDS s_header)
 {
     D3Mail.header = Convert.ToUInt16(s_header);
     return SendD3Cmd();
 }
Esempio n. 30
0
        void timer_Tick(object sender, EventArgs e)
        {
            c = COMMANDS.NONE;


            if (isHold)
            {
                panel.Cursor = System.Windows.Forms.Cursors.Hand;
            }
            if (host.IsKeyboardFocused)
            {
                if (Keyboard.IsKeyDown(Key.W))
                {
                    c = COMMANDS.EDITOR_MOVE_FORWARD;
                }
                if (Keyboard.IsKeyDown(Key.S))
                {
                    c = COMMANDS.EDITOR_MOVE_BACKWARD;
                }

                if (Keyboard.IsKeyDown(Key.A))
                {
                    c = COMMANDS.EDITOR_MOVE_LEFT;
                }

                if (Keyboard.IsKeyDown(Key.D))
                {
                    c = COMMANDS.EDITOR_MOVE_RIGHT;
                }

                if (Keyboard.IsKeyDown(Key.LeftAlt))
                {
                    p = GetMousePositionWindowsForms();

                    c = COMMANDS.EDITOR_ALT;

                    //box.Text += 2 * p.X / (panel.Width) + " " + 2 * p.Y / (panel.Height)  + "\n";
                }

                if (Keyboard.IsKeyDown(Key.Q))
                {
                    c = COMMANDS.EDITOR_ROTATE_LEFT;
                }

                if (Keyboard.IsKeyDown(Key.E))
                {
                    c = COMMANDS.EDITOR_ROTATE_RIGHT;
                }

                if (Keyboard.IsKeyDown(Key.Z))
                {
                    c = COMMANDS.EDITOR_ROTATE_UP;
                }

                if (Keyboard.IsKeyDown(Key.X))
                {
                    c = COMMANDS.EDITOR_ROTATE_DOWN;
                }

                if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyToggled(Key.T))
                {
                    c = COMMANDS.EDITOR_ROTATE_TOP;
                }
            }



            if (host.IsFocused)
            {
                UnrealScienceScripting.TestUpdate((int)c, (float)difference.X, (float)difference.Y);
            }



            //Update();
            UnrealScienceScripting.Render();



            //Update();
        }
Esempio n. 31
0
 public D3Header D3Cmd(COMMANDS s_header)
 {
     return D3Cmd(s_header, 0, 0, 0, 0);
 }
Esempio n. 32
0
 public static void Reply(COMMANDS cmd, string requestId, string input, string message)
 => _reply(new NetPacket(cmd, requestId, input, message, null));
Esempio n. 33
0
 public TextCommand(COMMANDS cIn, PRIORITY pIn, string tIn)
 {
     commandType = cIn;
     priority    = pIn;
     text        = tIn;
 }
Esempio n. 34
0
 public D3Header D3Cmd(COMMANDS s_header, Single l_param, Single m_param)
 {
     return(D3Cmd(s_header, l_param, m_param, 0, 0));
 }
Esempio n. 35
0
 /// <summary>
 /// 发送数据
 /// </summary>
 private void SendCommand(COMMANDS command)
 {
     new Thread(() =>
     {
         if (workStream != null)
         {
             BinaryWriter writer = new BinaryWriter(workStream);
             writer.Write((Int32)1);
             writer.Write((Int32)1);
             writer.Write((Int32)command);
             writer.Write((Int32)0);
         }
     }).Start();
 }
Esempio n. 36
0
 public D3Header D3Cmd(COMMANDS s_header, int LParam, int MParam, int RParam)
 {
     return D3Cmd(s_header, LParam, MParam, RParam, 0);
 }