Beispiel #1
0
        private void Server_Load(object sender, EventArgs e)
        {
            int x1, y1, x2, y2;

            iniFile ini = new iniFile(@"ComServer.ini");

            x1 = int.Parse(ini.GetString("Form", "LocX", "0"));
            y1 = int.Parse(ini.GetString("Form", "LocY", "0"));
            x2 = int.Parse(ini.GetString("Form", "SizeX", "500"));
            y2 = int.Parse(ini.GetString("Form", "SizeY", "500"));

            Location = new Point(x1, y1);
            Size     = new Size(x2, y2);
        }
        private MaintenanceViewModel()
        {
            foreach (var fb in EnumHelper.GetNames(Enum.GetNames(typeof(eBaudRate))))
            {
                _flashBaudrateList.Add(fb.TrimStart(new char[] { 'B', 'a', 'u', 'd' }));
            }

            _serial_programmer_parameters = new iniFile(iniPath);
            // section, key, value, _iniFile
            pathFWtemp    = _serial_programmer_parameters.Read("Firmware Path", "Programmer");
            PathFW        = ShortenPath(pathFWtemp);
            FlashBaudRate = _serial_programmer_parameters.Read("FlashBaud", "Programmer");
            if (String.IsNullOrWhiteSpace(FlashBaudRate))
            {
                FlashBaudRate = "230400";
            }
        }
Beispiel #3
0
        private void FormServer_Load(object sender, EventArgs e)
        {
            int x1, y1, x2, y2;

            ini = new iniFile("");

            ini.ChangeFileName(".\\ComServer.ini");

            x1       = int.Parse(ini.GetString("Form", "LocX", "0"));
            y1       = int.Parse(ini.GetString("Form", "LocY", "0"));
            Location = new Point(x1, y1);

            x2   = int.Parse(ini.GetString("Form", "SizeX", "500"));
            y2   = int.Parse(ini.GetString("Form", "SizeY", "500"));
            Size = new Size(x2, y2);

            splitContainer1.SplitterDistance = int.Parse(ini.GetString("Form", "Splitter", "300"));
        }
Beispiel #4
0
        private void FormClient_Load(object sender, EventArgs e)
        {
            int x1, y1, x2, y2;

            ini = new iniFile(".\\ComClient.ini");

            Init_IP   = ini.GetString("Comm", "IP", "127.0.0.1");
            Init_Port = int.Parse(ini.GetString("Comm", "Port", "9001"));
            x1        = int.Parse(ini.GetString("Form", "LocX", $"0"));
            y1        = int.Parse(ini.GetString("Form", "LocY", $"0"));
            x2        = int.Parse(ini.GetString("Form", "SizeX", $"500"));
            y2        = int.Parse(ini.GetString("Form", "SizeY", $"500"));
            splitContainer1.SplitterDistance = int.Parse(ini.GetString("Form", "Splitter", $"300"));

            Location    = new Point(x1, y1);
            Size        = new Size(x2, y2);
            tbIP.Text   = Init_IP;
            tbPort.Text = $"{Init_Port}";
        }
Beispiel #5
0
        private void saveWizardParams()
        {
            string path = "\\MotorController\\Wizard\\";

            path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + path;
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string  _file_name = "WizardParameters.ini";
            iniFile _wizard_parameters_file = new iniFile(path + _file_name);


            string _section = "Wizard";

            #region Save_Parameters
            _wizard_parameters_file.Write("Motor Type", MotorType, _section);

            #endregion Save_Parameters
            #region Advanced_Configuration

            #endregion Advanced_Configuration
            for (int i = 0; i < GetInstance.OperationList.Count; i++)
            {
                if (GetInstance.OperationList.ElementAt(i).Value.CommandName != "Load Default" &&
                    GetInstance.OperationList.ElementAt(i).Value.CommandName != "Save" &&
                    GetInstance.OperationList.ElementAt(i).Value.CommandName != "Reset" &&
                    GetInstance.OperationList.ElementAt(i).Value.CommandName != "Synchronisation Command")
                {
                    _wizard_parameters_file.Write(GetInstance.OperationList.ElementAt(i).Value.CommandName, GetInstance.OperationList.ElementAt(i).Value.CommandValue, _section);
                }
            }
            for (int i = 0; i < GetInstance.OperationList.Count; i++)
            {
                if (GetInstance.OperationList.ElementAt(i).Value.CommandName != "Load Default" &&
                    GetInstance.OperationList.ElementAt(i).Value.CommandName != "Save" &&
                    GetInstance.OperationList.ElementAt(i).Value.CommandName != "Reset" &&
                    GetInstance.OperationList.ElementAt(i).Value.CommandName != "Synchronisation Command")
                {
                    Debug.WriteLine(GetInstance.OperationList.ElementAt(i).Value.CommandName + ": " + _wizard_parameters_file.Read(GetInstance.OperationList.ElementAt(i).Value.CommandName, _section));
                }
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            ini            = new iniFile(".\\Emulator.ini");
            tbEqcode.Text  = ini.GetString("Equipment", "Code", "00001");           //장비 코드 5
            tbEqModel.Text = ini.GetString("Equipment", "Model", "      ");         //장비 모델 6
            tbEqLine.Text  = ini.GetString("Equipment", "Line", "00001");           //라인 번호 5
            tbEqBatt.Text  = ini.GetString("Equipment", "Battery", "00001");        //배터리 잔량 5
            tbEqState.Text = ini.GetString("Equipment", "State", "0");              //현재 상태 1
            tbEqCount.Text = ini.GetString("Equipment", "Count", "00000");          //사용 횟수 5

            tbEqCelsius.Text = ini.GetString("Environment", "Temperature", "0000"); //온도 4
            tbEqHumi.Text    = ini.GetString("Environment", "Humidity", "0000");    //습도 4
            tbEqWind.Text    = ini.GetString("Environment", "Wind_Speed", "0000");  //풍속 4
            tbEqAtmos.Text   = ini.GetString("Environment", "Atmosphere", "0000");  //대기 1
            tbEqOz.Text      = ini.GetString("Environment", "Ozone", "0000");       //오존 4
            tbEqTotal.Text   = ini.GetString("Environment", "Total", "0000");       //종합 4 : total 48bytes

            dtStart_Days.Value = new DateTime(long.Parse(ini.GetString("Operation", "Start_Time_Days", "0")));
            dtStart_HMS.Value  = new DateTime(long.Parse(ini.GetString("Operation", "Start_Time_HMS", "0")));
            dtEnd_Days.Value   = new DateTime(long.Parse(ini.GetString("Operation", "End_Time_Days", "0")));
            dtEnd_HMS.Value    = new DateTime(long.Parse(ini.GetString("Operation", "End_Time_HMS", "0")));

            tbInterval.Text = ini.GetString("Operation", "Interval", "5");

            sb_IP.Text   = ini.GetString("Connection", "IP", "127.0.0.1");
            sb_Port.Text = ini.GetString("Connection", "Port", "8080");

            int x1, x2, y1, y2;

            x1            = int.Parse(ini.GetString("Form", "LocationX", "0"));
            y1            = int.Parse(ini.GetString("Form", "LocationY", "0"));
            this.Location = new Point(x1, y1);
            x2            = int.Parse(ini.GetString("Form", "SizeX", "500"));
            y2            = int.Parse(ini.GetString("Form", "SizeY", "500"));
            this.Size     = new Size(x2, y2);
        }
Beispiel #7
0
        private string lData(string kname, string dlocal)
        {
            try
            {
                //utf8Bytes = Encoding.UTF8.GetBytes(gVars.ovs_local);
                //path = Encoding.Unicode.GetString(utf8Bytes);
                iF_S = new iniFile(gVars.ovs_local);

                return iF_S.Read(kname, dlocal);

                //MessageBox.Show(null, sClasses, "Test", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);                    
            }

            catch (NullReferenceException err)
            {
                MessageBox.Show(null, err.ToString(), "No File Loaded", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return "";
            }

            catch (FileNotFoundException err)
            {
                MessageBox.Show(null, err.ToString(), "File Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return "";
            }
        }
Beispiel #8
0
        private void saveSettings(string flag1, string flag2)
        {
            iF_S = new iniFile(gVars.ovs_local);

            data = "";
            i1 = 0;
            i2 = 0;

            if (flag1 == "singular")
            {
                if (flag2 == "mlaser_ids")
                {
                    foreach (GroupBox gb1 in gBoxes)
                    {
                        foreach (GroupBox gb2 in gb1.Controls)
                        {
                            foreach (Control con in gb2.Controls)
                            {
                                if (con is TextBox)
                                {
                                    if (i1 == 1)
                                    {
                                        data = data + "-" + con.Text;
                                    }

                                    else
                                    {
                                        data = data + con.Text;
                                        i1++;
                                    }
                                }
                            }

                            if (i2 < gb2.Controls.Count)
                            {
                                data = data + ",";
                                i1 = 0;
                                i2++;
                            }

                            if (i2 == gb2.Controls.Count)
                            {
                                data = data + ";";
                                i2 = 0;
                            }
                        }
                    }

                    MessageBox.Show(null, data, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //iF_S.Write("mlidrstr", data, "itemid");
                }
                    
                else if (flag2 == "ship_ids")
                {
                    //Reform the ID string from group box elements
                    foreach (GroupBox gb in gBoxes)
                    {
                        foreach (Control con in gb.Controls)
                        {
                            if (con is TextBox)
                            {
                                if (i1 == 1)
                                {
                                    data = data + "-" + con.Text;
                                }

                                else
                                {
                                    data = data + con.Text;
                                    i1++;
                                }
                            }
                        }

                        if (i2 < gb.Controls.Count)
                        {
                            data = data + ",";
                            i1 = 0;
                            i2++;
                        }
                    }

                    //MessageBox.Show(null, data, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    
                    iF_S.Write("sidrstr", data, "itemid");
                }

                else if (flag2 == "sship_ids")
                {
                    //Reform the ID string from group box elements
                    foreach (GroupBox gb in gBoxes)
                    {
                        foreach (Control con in gb.Controls)
                        {
                            if (con is TextBox)
                            {
                                if (i1 == 1)
                                {
                                    data = data + "-" + con.Text;
                                }

                                else
                                {
                                    data = data + con.Text;
                                    i1 += 1;
                                }
                            }
                        }
                    }

                    //MessageBox.Show(null, data, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    iF_S.Write("ssrstr", data, "itemid");
                }

                else if (flag2 == "weap_ids")
                {
                    foreach (GroupBox gb1 in gBoxes)
                    {
                        foreach (GroupBox gb2 in gb1.Controls)
                        {
                            foreach (Control con in gb2.Controls)
                            {
                                if (con is TextBox)
                                {
                                    if (i1 == 1)
                                    {
                                        data = data + "-" + con.Text;
                                    }

                                    else
                                    {
                                        data = data + con.Text;
                                        i1++;
                                    }
                                }
                            }

                            if (i2 < gb2.Controls.Count)
                            {
                                data = data + ",";
                                i1 = 0;
                                i2++;
                            }

                            if (i2 == gb2.Controls.Count)
                            {
                                data = data + ";";
                                i2 = 0;
                            }
                        }
                    }

                    MessageBox.Show(null, data, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //iF_S.Write("widrstr", data, "itemid");
                }
            }

            else if (flag1 == "compact")
            {
                if (flag2 == "mlaser_ids")
                {
                    iF_S.Write("mlidrstr", tb_SESC_C.Text, "itemid");
                }
                
                else if (flag2 == "ship_ids")
                {
                    iF_S.Write("sidrstr", tb_SESC_C.Text, "itemid");
                }

                else if (flag2 == "sship_ids")
                {
                    iF_S.Write("ssrstr", tb_SESC_C.Text, "itemid");
                }

                if (flag2 == "weap_ids")
                {
                    iF_S.Write("widrstr", tb_SESC_C.Text, "itemid");
                }
            }
        }
Beispiel #9
0
        //读取助手配置文件
        public string GetYjzSconfig(string section, string key)
        {
            var _ini = new iniFile(tools.AppSetting.GetAppSettings("HardwareAssistantPath") + "\\AnnSrv.ini");

            return(_ini.IniReadValue(section, key));
        }