当前位置: 首页>>代码示例>>C#>>正文


C# Config.Read方法代码示例

本文整理汇总了C#中Config.Read方法的典型用法代码示例。如果您正苦于以下问题:C# Config.Read方法的具体用法?C# Config.Read怎么用?C# Config.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Config的用法示例。


在下文中一共展示了Config.Read方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

        public static void Initialize(string file)
        {
            config = new Config(file);

            if (config != null)
            {
                LogDirectory   = config.Read("Log.Directory", "Logs/StsServer");
                LogConsoleFile = config.Read("Log.Console.File", "");
                LogPacketFile  = config.Read("Log.Packet.File", "");

                LogWriter fl = null;

                if (LogConsoleFile != "")
                {
                    if (!Directory.Exists(LogDirectory))
                        Directory.CreateDirectory(LogDirectory);

                    fl = new LogWriter(LogDirectory, LogConsoleFile);
                }

                if (LogPacketFile != "")
                    PacketLog.Initialize(LogDirectory, LogPacketFile);
            }

            ReadConfig();
        }
开发者ID:Captain-Ice,项目名称:Project-WildStar,代码行数:26,代码来源:StsConfig.cs

示例2: Initialize

        public static void Initialize(string file)
        {
            config = new Config(file);

            if (config != null)
            {
                IsInitialized = true;

                LogLevel       = (LogType)config.Read("Log.Level", 0x7, true);
                LogDirectory   = config.Read("Log.Directory", "Logs/World");
                LogConsoleFile = config.Read("Log.Console.File", "");
                LogPacketFile  = config.Read("Log.Packet.File", "");

                LogWriter fl = null;

                if (LogConsoleFile != "")
                {
                    if (!Directory.Exists(LogDirectory))
                        Directory.CreateDirectory(LogDirectory);

                    fl = new LogWriter(LogDirectory, LogConsoleFile);
                }

                Log.Initialize(LogLevel, fl);

                if (LogPacketFile != "")
                    PacketLog.Initialize(LogDirectory, LogPacketFile);
            }

            ReadConfig();
        }
开发者ID:GlassFace,项目名称:Arctium-WoW,代码行数:31,代码来源:WorldConfig.cs

示例3: Initialize

        public static void Initialize(string file)
        {
            config = new Config(file, true);

            if (config != null)
            {
                LogLevel        = config.Read("Log.Level", LogTypes.Success | LogTypes.Info);
                LogDirectory    = config.Read("Log.Directory", "Logs/Manager");
                LogConsoleFile  = config.Read("Log.Console.File", "");
                LogDatabaseFile = config.Read("Log.Database.File", "");
                LogPacketFile   = config.Read("Log.Packet.File", "");

                LogFile fl = null;

                if (LogConsoleFile != "")
                {
                    if (!Directory.Exists(LogDirectory))
                        Directory.CreateDirectory(LogDirectory);

                    fl = new LogFile(LogDirectory, LogConsoleFile);
                }

                Log.Initialize(LogLevel, fl);

                initialized = true;
            }

            if (initialized)
                ReadConfig();
        }
开发者ID:Arctium-Emulation,项目名称:Project-WoW,代码行数:30,代码来源:ManagerConfig.cs

示例4: Initialize

        public static void Initialize(string file)
        {
            // Initialize exception logger
            if (!Directory.Exists("Crashes"))
                Directory.CreateDirectory("Crashes");

            var el = new LogWriter("Crashes", "RemoteServer.log");

            ExceptionLog.Initialize(el);

            // Initialize unhandled exception handler/logger
            AppDomain.CurrentDomain.UnhandledException += (o, e) =>
            {
                var ex = (Exception)e.ExceptionObject;

                ExceptionLog.Write(ex);
            };

            config = new Config(file);

            if (config != null)
            {
                IsInitialized = true;

                LogLevel       = (LogType)config.Read("Log.Level", 0x7, true);
                LogDirectory   = config.Read("Log.Directory", "Logs/Remote");
                LogConsoleFile = config.Read("Log.Console.File", "");
                LogPacketFile  = config.Read("Log.Packet.File", "");

                LogWriter fl = null;

                if (LogConsoleFile != "")
                {
                    if (!Directory.Exists(LogDirectory))
                        Directory.CreateDirectory(LogDirectory);

                    fl = new LogWriter(LogDirectory, LogConsoleFile);
                }

                Log.Initialize(LogLevel, fl);

                if (LogPacketFile != "")
                    PacketLog.Initialize(LogDirectory, LogPacketFile);
            }

            ReadConfig();
        }
开发者ID:GlassFace,项目名称:Arctium-WoW,代码行数:47,代码来源:RemoteConfig.cs

示例5: Process

        private static void Process()
        {
            //Read configuration
            _config = new Config();
            _config.Read();

            //Init
            Functions.Zabbix = new ZabbixSender(_config.ZabbixServer, _config.ZabbixPort);
            Crm.ConnectionString = _config.CrmConnection;
            MailWH.ConnectionString = _config.MailWhConnection;
            var timer = new Timer(GetStatus, null, 0, _config.NotifyPeriod * 1000);

            //Create monitoring counters
            Functions.ProcessedCounters.Add(MailboxType.Crm, new Counter());
            Functions.ProcessedCounters.Add(MailboxType.Fbl, new Counter());
            Functions.ProcessedCounters.Add(MailboxType.Bounce, new Counter());
            Functions.ErrorsCounters.Add(MailboxType.Crm, new Counter());
            Functions.ErrorsCounters.Add(MailboxType.Fbl, new Counter());
            Functions.ErrorsCounters.Add(MailboxType.Bounce, new Counter());
            LastProcessedCount.Add(MailboxType.Crm, 0);
            LastProcessedCount.Add(MailboxType.Fbl, 0);
            LastProcessedCount.Add(MailboxType.Bounce, 0);
            LastErrorsCount.Add(MailboxType.Crm, 0);
            LastErrorsCount.Add(MailboxType.Fbl, 0);
            LastErrorsCount.Add(MailboxType.Bounce, 0);

            //Process
            _crawler = new Crawler(_config);
            _crawler.Init();
            _crawler.Start();

            timer.Dispose();
        }
开发者ID:risedphantom,项目名称:TopCrawler,代码行数:33,代码来源:CrawlerService.cs

示例6: configInit

    private void configInit()
    {
        //trying new Config class
        Config config = new Config();
        config.Read();
        LogB.Information("Config:\n" + config.ToString());

        /*
         * TODO: do an else to any option
         * is good to do the else here because user can import a configuration at any time
         * and things need to be restored to default position in glade
         *
         * But note this has to be executed only if it has changed!!
         */

        if(config.Maximized)
            app1.Maximize();
        if(config.CustomButtons) {

            //---- capture tab ----

            hbox_encoder_capture_extra_mass_no_raspberry.Visible = false;
            hbox_encoder_capture_extra_mass_raspberry.Visible = true;

            button_encoder_select.HeightRequest = 40;
            //this will make all encoder capture controls taller
            button_encoder_capture.SetSizeRequest(125,60);

            spin_encoder_im_weights_n.Visible = false;
            hbox_encoder_im_weights_n.Visible = true;

            //---- analyze tab ----

            hbox_encoder_analyze_signal_or_curves.HeightRequest = 40;
            button_encoder_analyze.SetSizeRequest(120,40);
        }
        if(! config.UseVideo) {
            useVideo = false;
            alignment_video_encoder.Visible = false;
        }

        //Auto-detect stuff
        configAutodetectPort = config.AutodetectPort;

        autodetectSignalEnabled = false; //do not raise signals that could rewrite the config file (loop)

        if(configAutodetectPort == Config.AutodetectPortEnum.ACTIVE)
            radio_autodetect_active.Active = true;
        else if(configAutodetectPort == Config.AutodetectPortEnum.INACTIVE)
            radio_autodetect_inactive.Active = true;
        else // (configAutodetectPort == Config.AutodetectPortEnum.DISCARDFIRST)
            radio_autodetect_discard_first.Active = true;

        autodetectSignalEnabled = true; //activate signals again

        //show only power
        if(config.OnlyEncoderGravitatory)
            select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERGRAVITATORY);
        else if(config.OnlyEncoderInertial)
            select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERINERTIAL);

        if(config.EncoderCaptureShowOnlyBars)
        {
            //attention: this makes encoder_capture_signal_drawingarea == null
            vpaned_encoder_capture_video_and_set_graph.Visible = false;

            vpaned_encoder_main.Remove(alignment_treeview_encoder_capture_curves);
            vbox_treeview_encoder_at_second_page.PackStart(alignment_treeview_encoder_capture_curves);
            notebook_encoder_capture_main.ShowTabs = true;
        } else {
            /*
             * is good to do the else here because user can import a configuration at any time
             * and things need to be restored to default position in glade
             *
             * But note this has to be executed only if it has changed!!
             */
            /*
            notebook_encoder_capture_main.ShowTabs = false;
            vbox_treeview_encoder_at_second_page.Remove(alignment_treeview_encoder_capture_curves);
            vpaned_encoder_main.PackStart(alignment_treeview_encoder_capture_curves);
            */
        }

        encoderUpdateTreeViewWhileCapturing = config.EncoderUpdateTreeViewWhileCapturing;

        if(config.PersonWinHide) {
            //vbox_persons.Visible = false;
            notebook_session_person.Visible = false;
            hbox_encoder_person.Visible = true;
        }

        if(config.EncoderAnalyzeHide) {
            hbox_encoder_sup_capture_analyze_two_buttons.Visible = false;
        }

        if(config.Econf != null) {
            encoderConfigurationDefinedFromFile = true;
            encoderConfigurationCurrent = config.Econf;
            encoderConfigurationGUIUpdate();
            //TODO: allow to see full data, but don't allow to change it (Open window content as unsensitive)
//.........这里部分代码省略.........
开发者ID:GNOME,项目名称:chronojump,代码行数:101,代码来源:networks.cs

示例7: Setup

        public static void Setup()
        {
            save = Path.Combine(TShock.SavePath, @"TicketSystem\Tickets.json");
            banned = Path.Combine(TShock.SavePath, @"TicketSystem\Banned.txt");
            TicketReader Reader = new TicketReader();
            Config = new Config();

            if (File.Exists(save))
            {
                try
                {
                    ticketlist = Reader.readFile(save);
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    if (ticketlist.Tickets.Count != 0)
                        Console.WriteLine(ticketlist.Tickets.Count + " tickets have been loaded.");
                    else
                        Console.WriteLine("There are no tickets.");
                    Console.ResetColor();
                    try
                    {
                        if (File.Exists(ConfigPath))
                            Config = Config.Read(ConfigPath);
                        Config.Write(ConfigPath);
                    }
                    catch (Exception e)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Error in TicketSystem Config.json file! Check log for more details.");
                        Console.WriteLine(e.Message);
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Log.Error("Config Exception");
                        Log.Error(e.ToString());
                    }
                }
                catch (Exception e)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Error in Tickets.json file! Check log for more details.");
                    Console.WriteLine(e.Message);
                    Console.ResetColor();
                    Log.Error("------------- Config Exception in Ticket List file (Tickets.json) -------------");
                    Log.Error(e.Message);
                    Log.Error("---------------------------------- Error End ----------------------------------");
                    Console.ForegroundColor = ConsoleColor.Red;
                }
            }
            else
            {
                Directory.CreateDirectory(Path.Combine(TShock.SavePath, "TicketSystem"));
                ticketlist = Reader.writeFile(save);
                using (StreamWriter writer = new StreamWriter(tagpath, true))
                {
                    writer.WriteLine("Default");
                    writer.WriteLine("Grief");
                    writer.WriteLine("Report");
                    writer.WriteLine("High-Importance");
                }
                using (StreamWriter writer = new StreamWriter(Path.Combine(TShock.SavePath, @"TicketSystem\loginmsg.txt"), true))
                {
                    writer.WriteLine("To write a complaint, use \"/ticket [-t:<tag>] <Message>\"");
                    writer.WriteLine("NOTE: Tags are optional. To view a list of tags, use \"/ticket tags\"");
                }
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("There are no tickets.");
                Console.ResetColor();
                Log.Info("No tickets submitted.");
            }
        }
开发者ID:Spectrewiz,项目名称:Ticket-System,代码行数:68,代码来源:PluginMain.cs


注:本文中的Config.Read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。