Beispiel #1
0
 public SourceManage(SourceBuffer sb, INIOperation source, ExecuteBuffer executeBuffer)
 {
     InitializeComponent();
     _sb        = sb;
     _source    = source;
     _excBuffer = executeBuffer;
 }
Beispiel #2
0
        void TcpServer_DataReceived(object sender, AsyncEventArgs e)
        {
            TCPClientState client     = e._state as TCPClientState;
            string         remote     = client.TcpClient.Client.RemoteEndPoint.ToString();
            string         receStr    = Encoding.Default.GetString(client.Buffer, 0, client.BufferLength);
            ClientsInfo    clientinfo = null;

            foreach (var ser in ServersList)
            {
                foreach (var cle in ser.ClientsList)
                {
                    if (cle.IpEndPort.ToString() == remote)
                    {
                        clientinfo       = cle;
                        cle.ReceiveText += receStr;
                        break;
                    }
                }
            }

            string data = INIOperation.INIGetStringValue(path, section, receStr, null);

            if (data == null)
            {
                return;
            }
            byte[] aryData = Encoding.ASCII.GetBytes(data);
            clientinfo.ParentServer.TcpServer.Send(client, aryData);
            clientinfo.SendText += data;
        }
Beispiel #3
0
 public static void SaveConfig()
 {
     INIOperation.WriteValue("config.ini", "Compile", "Cpp_Compiler", Cpp_Compiler);
     INIOperation.WriteValue("config.ini", "Compile", "Cpp_CompileArgs", Cpp_Args);
     INIOperation.WriteValue("config.ini", "Compile", "C_Compiler", C_Compiler);
     INIOperation.WriteValue("config.ini", "Compile", "C_CompileArgs", C_Args);
     INIOperation.WriteValue("config.ini", "Status", "Width", MainFormWidth);
     INIOperation.WriteValue("config.ini", "Status", "Height", MainFormHeight);
     INIOperation.WriteValue("config.ini", "Status", "FormMax", MainFormMax);
     INIOperation.WriteValue("config.ini", "Editor", "EnableChineseInput", EnableChineseInput);
 }
Beispiel #4
0
        public static void LoadConfig()
        {
            Cpp_Compiler       = INIOperation.ReadValue("config.ini", "Compile", "Cpp_Compiler", Cpp_Compiler);
            Cpp_Args           = INIOperation.ReadValue("config.ini", "Compile", "Cpp_CompileArgs", Cpp_Args);
            C_Compiler         = INIOperation.ReadValue("config.ini", "Compile", "C_Compiler", C_Compiler);
            C_Args             = INIOperation.ReadValue("config.ini", "Compile", "C_CompileArgs", C_Args);
            MainFormWidth      = INIOperation.ReadValue("config.ini", "Status", "Width", MainFormWidth);
            MainFormHeight     = INIOperation.ReadValue("config.ini", "Status", "Height", MainFormHeight);
            MainFormMax        = INIOperation.ReadValue("config.ini", "Status", "FormMax", MainFormMax);
            EnableChineseInput = INIOperation.ReadValue("config.ini", "Editor", "EnableChineseInput", EnableChineseInput);
            string folder = AppDomain.CurrentDomain.BaseDirectory;

            //补全与高亮
            if (File.Exists(folder + "Cpp_AutoComplete.dat"))
            {
                Cpp_AutoComplete = FileHelper.ReadAllText(folder + "Cpp_AutoComplete.dat");
            }
            else
            {
                FileHelper.WriteAllText(folder + "Cpp_AutoComplete.dat", Cpp_AutoComplete);
            }

            if (File.Exists(folder + "Cpp_HighLighting.dat"))
            {
                Cpp_HighLighting = FileHelper.ReadAllText(folder + "Cpp_HighLighting.dat");
            }
            else
            {
                FileHelper.WriteAllText(folder + "Cpp_Highlighting.dat", Cpp_HighLighting);
            }

            if (File.Exists(folder + "C_AutoComplete.dat"))
            {
                C_AutoComplete = FileHelper.ReadAllText(folder + "C_AutoComplete.dat");
            }
            else
            {
                FileHelper.WriteAllText(folder + "C_AutoComplete.dat", C_AutoComplete);
            }

            if (File.Exists(folder + "C_HighLighting.dat"))
            {
                C_HighLighting = FileHelper.ReadAllText(folder + "C_HighLighting.dat");
            }
            else
            {
                FileHelper.WriteAllText(folder + "C_Highlighting.dat", C_HighLighting);
            }
        }
Beispiel #5
0
 /// <summary>
 /// 添加指令到指令库
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void Add_Click(object sender, RoutedEventArgs e)
 {
     Views.ProtocolView view = new Views.ProtocolView();
     ViewModelBinder.Bind(this, view, null);
     KeyText   = SelectServer.SelectClient.ReceiveText;
     ValueText = SelectServer.SelectClient.SendText;
     if (view.ShowDialog() == true)
     {
         if (string.IsNullOrEmpty(KeyText) || string.IsNullOrEmpty(ValueText))
         {
             return;
         }
         INIOperation.INIWriteValue(path, section, KeyText, ValueText);
     }
 }
        public void ReadINI()
        {
            string iniPath         = Environment.CurrentDirectory + "\\user.ini";
            string ngImageCountTmp = null;

            string saveNgImageTmp = null;
            string saveOkImageTmp = null;
            string camearCountTmp = null;
            string cameraFlagTmp  = null;

            string windowWidthWidthTmp = null;
            string windowHeigthTmp     = null;
            string logionDelayTmp      = null;

            Password = INIOperation.GetValue(iniPath, "passWord", "admin", "123");

            CheckPassword = INIOperation.GetValue(iniPath, "passWord", "checker", "999");

            ngImageCountTmp = INIOperation.GetValue(iniPath, "setting", "ngImageCount", null);

            saveNgImageTmp = INIOperation.GetValue(iniPath, "setting", "saveNgImage", null);
            saveOkImageTmp = INIOperation.GetValue(iniPath, "setting", "saveOKImage", null);

            camearCountTmp = INIOperation.GetValue(iniPath, "setting", "camearCount", null);
            cameraFlagTmp  = INIOperation.GetValue(iniPath, "setting", "cameraFlag", null);

            logionDelayTmp = INIOperation.GetValue(iniPath, "setting", "logionDelay", null);

            windowWidthWidthTmp = INIOperation.GetValue(iniPath, "setting", "WindowsWidth", null);
            windowHeigthTmp     = INIOperation.GetValue(iniPath, "setting", "WindowsHeigth", null);

            directShowIndex      = INIOperation.GetValue(iniPath, "DirectShow", "Index", "0");
            directShowColorSpace = INIOperation.GetValue(iniPath, "DirectShow", "ColorSpace", "gray");
            directShowCameraType = INIOperation.GetValue(iniPath, "DirectShow", "CameraType", "yuv (1600x1200)");

            int number;

            if (ngImageCountTmp == null || (int.TryParse(ngImageCountTmp, out number) == false))
            {
                NgImageCount = 2000;
                INIOperation.WriteValue(iniPath, "setting", "ngImageCount", NgImageCount.ToString());
            }
            else
            {
                NgImageCount = number;
            }

            if (saveNgImageTmp == null || (int.TryParse(saveNgImageTmp, out saveNgImage) == false))
            {
                SaveNgImage = 0;
                INIOperation.WriteValue(iniPath, "setting", "saveNgImage", SaveNgImage.ToString());
            }

            if (saveOkImageTmp == null || (int.TryParse(saveOkImageTmp, out saveOkImage) == false))
            {
                SaveOkImage = 0;
                INIOperation.WriteValue(iniPath, "setting", "saveOkImage", SaveOkImage.ToString());
            }

            if (camearCountTmp == null || (int.TryParse(camearCountTmp, out camearCount) == false))
            {
                camearCount = 1;
                INIOperation.WriteValue(iniPath, "setting", "camearCount", CamearCount.ToString());
            }


            if (cameraFlagTmp == null || (int.TryParse(cameraFlagTmp, out cameraFlag) == false))
            {
                INIOperation.WriteValue(iniPath, "setting", "cameraFlag", cameraFlag.ToString());
            }


            if (logionDelayTmp == null || (int.TryParse(logionDelayTmp, out logionDelay) == false))
            {
                logionDelay = 2;
                INIOperation.WriteValue(iniPath, "setting", "logionDelay", logionDelay.ToString());
            }


            if (windowWidthWidthTmp == null || (int.TryParse(windowWidthWidthTmp, out windowWidth) == false))
            {
                windowWidth = 800;
                INIOperation.WriteValue(iniPath, "setting", "WindowsWidth", windowWidth.ToString());
            }


            if (windowHeigthTmp == null || (int.TryParse(windowHeigthTmp, out windowHeigth) == false))
            {
                windowHeigth = 600;
                INIOperation.WriteValue(iniPath, "setting", "WindowsHeigth", windowHeigth.ToString());
            }


            if (cameraFlag > 0)
            {
                //cameraFlag = 1;
                Camera.CameraManger.CameraFlag = (Camera.CameraFlag)cameraFlag;
            }
            else
            {
                INIOperation.WriteValue(iniPath, "setting", "cameraFlag",
                                        Convert.ToInt32(Camera.CameraManger.CameraFlag).ToString());
            }

            Camera.CameraManger.DirectShowIndex      = directShowIndex;
            Camera.CameraManger.DirectShowCameraType = directShowCameraType;
            Camera.CameraManger.DirectShowColorSpace = directShowColorSpace;
        }