コード例 #1
0
ファイル: Settings.cs プロジェクト: heiswayi/Termie2
        /// <summary>
        ///   Write the settings to disk. </summary>
        public static void Write()
        {
            INIFile ini = new INIFile(Application.StartupPath + "\\Termie2.ini");
            ini.WriteValue("Port", "PortName", Port.PortName);
            ini.WriteValue("Port", "BaudRate", Port.BaudRate);
            ini.WriteValue("Port", "DataBits", Port.DataBits);
            ini.WriteValue("Port", "Parity", Port.Parity.ToString());
            ini.WriteValue("Port", "StopBits", Port.StopBits.ToString());
            ini.WriteValue("Port", "Handshake", Port.Handshake.ToString());

            ini.WriteValue("Option", "AppendToSend", Option.AppendToSend.ToString());
            ini.WriteValue("Option", "HexOutput", Option.HexOutput.ToString());
            ini.WriteValue("Option", "LocalEcho", Option.LocalEcho.ToString());
            ini.WriteValue("Option", "StayOnTop", Option.StayOnTop.ToString());
            ini.WriteValue("Option", "FilterUseCase", Option.FilterUseCase.ToString());
        }
コード例 #2
0
ファイル: Settings.cs プロジェクト: heiswayi/Termie2
        /// <summary>
        ///   Read the settings from disk. </summary>
        public static void Read()
        {
            INIFile ini = new INIFile(Application.StartupPath + "\\Termie2.ini");
            Port.PortName = ini.ReadValue("Port", "PortName", Port.PortName);
            Port.BaudRate = ini.ReadValue("Port", "BaudRate", Port.BaudRate);
            Port.DataBits = ini.ReadValue("Port", "DataBits", Port.DataBits);
            Port.Parity = (Parity)Enum.Parse(typeof(Parity), ini.ReadValue("Port", "Parity", Port.Parity.ToString()));
            Port.StopBits = (StopBits)Enum.Parse(typeof(StopBits), ini.ReadValue("Port", "StopBits", Port.StopBits.ToString()));
            Port.Handshake = (Handshake)Enum.Parse(typeof(Handshake), ini.ReadValue("Port", "Handshake", Port.Handshake.ToString()));

            Option.AppendToSend = (Option.AppendType)Enum.Parse(typeof(Option.AppendType), ini.ReadValue("Option", "AppendToSend", Option.AppendToSend.ToString()));
            Option.HexOutput = bool.Parse(ini.ReadValue("Option", "HexOutput", Option.HexOutput.ToString()));
            Option.LocalEcho = bool.Parse(ini.ReadValue("Option", "LocalEcho", Option.LocalEcho.ToString()));
            Option.StayOnTop = bool.Parse(ini.ReadValue("Option", "StayOnTop", Option.StayOnTop.ToString()));
            Option.FilterUseCase = bool.Parse(ini.ReadValue("Option", "FilterUseCase", Option.FilterUseCase.ToString()));
        }
コード例 #3
0
ファイル: Settings.cs プロジェクト: shenfahsu/Termie2
        /// <summary>
        ///   Write the settings to disk. </summary>
        public static void Write()
        {
            INIFile ini = new INIFile(Application.StartupPath + "\\Termie2.ini");

            ini.WriteValue("Port", "PortName", Port.PortName);
            ini.WriteValue("Port", "BaudRate", Port.BaudRate);
            ini.WriteValue("Port", "DataBits", Port.DataBits);
            ini.WriteValue("Port", "Parity", Port.Parity.ToString());
            ini.WriteValue("Port", "StopBits", Port.StopBits.ToString());
            ini.WriteValue("Port", "Handshake", Port.Handshake.ToString());

            ini.WriteValue("Option", "AppendToSend", Option.AppendToSend.ToString());
            ini.WriteValue("Option", "HexOutput", Option.HexOutput.ToString());
            ini.WriteValue("Option", "LocalEcho", Option.LocalEcho.ToString());
            ini.WriteValue("Option", "StayOnTop", Option.StayOnTop.ToString());
            ini.WriteValue("Option", "FilterUseCase", Option.FilterUseCase.ToString());
        }
コード例 #4
0
ファイル: Settings.cs プロジェクト: shenfahsu/Termie2
        /// <summary>
        ///   Read the settings from disk. </summary>
        public static void Read()
        {
            INIFile ini = new INIFile(Application.StartupPath + "\\Termie2.ini");

            Port.PortName  = ini.ReadValue("Port", "PortName", Port.PortName);
            Port.BaudRate  = ini.ReadValue("Port", "BaudRate", Port.BaudRate);
            Port.DataBits  = ini.ReadValue("Port", "DataBits", Port.DataBits);
            Port.Parity    = (Parity)Enum.Parse(typeof(Parity), ini.ReadValue("Port", "Parity", Port.Parity.ToString()));
            Port.StopBits  = (StopBits)Enum.Parse(typeof(StopBits), ini.ReadValue("Port", "StopBits", Port.StopBits.ToString()));
            Port.Handshake = (Handshake)Enum.Parse(typeof(Handshake), ini.ReadValue("Port", "Handshake", Port.Handshake.ToString()));

            Option.AppendToSend  = (Option.AppendType)Enum.Parse(typeof(Option.AppendType), ini.ReadValue("Option", "AppendToSend", Option.AppendToSend.ToString()));
            Option.HexOutput     = bool.Parse(ini.ReadValue("Option", "HexOutput", Option.HexOutput.ToString()));
            Option.LocalEcho     = bool.Parse(ini.ReadValue("Option", "LocalEcho", Option.LocalEcho.ToString()));
            Option.StayOnTop     = bool.Parse(ini.ReadValue("Option", "StayOnTop", Option.StayOnTop.ToString()));
            Option.FilterUseCase = bool.Parse(ini.ReadValue("Option", "FilterUseCase", Option.FilterUseCase.ToString()));
        }