コード例 #1
0
        public static bool Write()
        {
            try
            {
                var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

                config.AppSettings.Settings["StartRoutingServiceOnStartup"].Value = StartRoutingServiceOnStartup.ToString();

                config.AppSettings.Settings["ColorStyle"].Value = ColorStyle.ToString();

                config.AppSettings.Settings["ScanSendInterval"].Value = ScanSendInterval.ToString();
                config.AppSettings.Settings["ScanReplyTimeout"].Value = ScanReplyTimeout.ToString();

                config.AppSettings.Settings["SpoofSendInterval"].Value        = SpoofSendInterval.ToString();
                config.AppSettings.Settings["SpoofRestoreSendCount"].Value    = SpoofRestoreSendCount.ToString();
                config.AppSettings.Settings["SpoofRestoreSendInterval"].Value = SpoofRestoreSendInterval.ToString();

                config.AppSettings.Settings["BandwidthMonitorUpdateInterval"].Value = BandwidthMonitorUpdateInterval.ToString();

                config.Save();

                return(true);
            }
            catch (ConfigurationErrorsException)
            {
                return(false);
            }
        }
コード例 #2
0
        public static void Main_8_4_4()//Main_8_4_4
        {
            ColorStyle mycs = ColorStyle.Red | ColorStyle.Yellow | ColorStyle.Blue;

            Console.WriteLine(mycs.ToString());


            //对位标记执行IsDefined方法
            //Enum.IsDefined(typeof(ColorStyle), 0x15);
            //Enum.IsDefined(typeof(ColorStyle), "Red, Yellow, Blue");
            //if(Enum.IsDefined(typeof(ColorStyle), "Red, Yellow, Blue"))
            if (Enum.IsDefined(typeof(ColorStyle), 0x15))
            {
                Console.WriteLine(ColorStyle.All);
            }

            if ((mycs & ColorStyle.Red) != 0)
            {
                Console.WriteLine(ColorStyle.Red + " is in ColorStyle");
            }
        }