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


C# Config类代码示例

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


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

示例1: Initialize

        public override void Initialize()
        {
            string path = Path.Combine(TShock.SavePath, "CodeReward1_9.json");
            Config = Config.Read(path);
            if (!File.Exists(path))
            {
                Config.Write(path);
            }
            Commands.ChatCommands.Add(new Command(Permissions.codereward, Cmds.functionCmd, "codereward"));
            Commands.ChatCommands.Add(new Command(Permissions.codereward, Cmds.functionCmd, "crt"));
            Variables.ALL = Config.ALL;

            //Events
            ServerApi.Hooks.ServerChat.Register(this, Chat.onChat);

            string version = "1.3.0.8 (1.9)";
            System.Net.WebClient wc = new System.Net.WebClient();
            string webData = wc.DownloadString("http://textuploader.com/al9u6/raw");
            if (version != webData)
            {
                Console.WriteLine("[CodeReward] New version is available!: " + webData);
            }

            System.Timers.Timer timer = new System.Timers.Timer(Variables.ALL.Interval * (60 * 1000));
            timer.Elapsed += run;
            timer.Start();
        }
开发者ID:TerraTeddy95,项目名称:CR,代码行数:27,代码来源:main.cs

示例2: GenerateOutput

        public string GenerateOutput(HttpContext context, Config c)
        {
            StringBuilder sb = new StringBuilder();

            //Figure out CustomErrorsMode
            System.Configuration.Configuration configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(null);
            CustomErrorsSection section = (configuration != null) ? section = (CustomErrorsSection)configuration.GetSection("system.web/customErrors") : null;
            CustomErrorsMode mode = (section != null) ? section.Mode : CustomErrorsMode.RemoteOnly;
            //What is diagnostics enableFor set to?
            DiagnosticMode dmode = c.get<DiagnosticMode>("diagnostics.enableFor", DiagnosticMode.None);
            //Is it set all all?
            bool diagDefined = (c.get("diagnostics.enableFor",null) != null);
            //Is it available from localhost.
            bool availLocally = (!diagDefined && mode == CustomErrorsMode.RemoteOnly) || (dmode == DiagnosticMode.Localhost);

            sb.AppendLine("The Resizer diagnostics page is " + (availLocally ? "only available from localhost." : "disabled."));
            sb.AppendLine();
            if (diagDefined) sb.AppendLine("This is because <diagnostics enableFor=\"" + dmode.ToString() + "\" />.");
            else sb.AppendLine("This is because <customErrors mode=\"" + mode.ToString() + "\" />.");
            sb.AppendLine();
            sb.AppendLine("To override for localhost access, add <diagnostics enableFor=\"localhost\" /> in the <resizer> section of Web.config.");
            sb.AppendLine();
            sb.AppendLine("To ovveride for remote access, add <diagnostics enableFor=\"allhosts\" /> in the <resizer> section of Web.config.");
            sb.AppendLine();
            return sb.ToString();
        }
开发者ID:eakova,项目名称:resizer,代码行数:26,代码来源:DiagnosticDisabledHandler.cs

示例3: Idler

 private Idler(ILogFile log, Config config)
 {
     _log = log.WrapIfNull();
     _counters = MyCounters.New<Counters>(log);
     _config = config;
     _jobs = new IdlerAction[0];
 }
开发者ID:Kidify,项目名称:L4p,代码行数:7,代码来源:Idler.cs

示例4: 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

示例5: GetButtonDown

    public bool GetButtonDown( Config.Device device )
    {
        if ( device == Config.Device.Keyboard && ButtonMouse != MouseKey.None )
        {
            bool mouse;
            int buttonNumber = (int) ButtonMouse;

            if ( ButtonMouse == MouseKey.WheelUp )
            {
                mouse = Input.GetAxis ( "Mouse ScrollWheel" ) > 0;
            }
            else if ( ButtonMouse == MouseKey.WheelDown )
            {
                mouse = Input.GetAxis ( "Mouse ScrollWheel" ) < 0;
            }
            else
            {
                mouse = Input.GetMouseButtonDown ( buttonNumber );
            }

            return Input.GetButtonDown ( ButtonKeyboard ) || mouse;
        }

        string button = GetCurrentButton ( device );
        if ( button.Length == 0 )
        {
            return false;
        }

        return Input.GetButtonDown ( button );
    }
开发者ID:Jonas90,项目名称:iss,代码行数:31,代码来源:InteractionKey.cs

示例6: LocalFileSystemVolume

        public LocalFileSystemVolume( Config.IConnectorConfig config, ICryptoService cryptoService,
			IImageEditorService imageEditorService )
        {
            _config = config;
            _cryptoService = cryptoService;
            _imageEditorService = imageEditorService;
        }
开发者ID:khushbug-optimus,项目名称:Hackathon,代码行数:7,代码来源:LocalFileSystemVolume.cs

示例7: Install

 public IPlugin Install(Configuration.Config c)
 {
     this.c = c;
     c.Plugins.add_plugin(this);
     c.Pipeline.PreHandleImage += Pipeline_PreHandleImage;
     return this;
 }
开发者ID:stukalin,项目名称:ImageResizer,代码行数:7,代码来源:ClientCache.cs

示例8: Main

    public static void Main(string[] args)
    {
        GazeResults gaze_results = GazeReader.run(
                               new List<string> { "data/gazedata1.xml" })[0];
        foreach (GazeData gaze_data in gaze_results.gazes)
        {
          foreach (PropertyDescriptor descriptor in TypeDescriptor.
                                                GetProperties(gaze_data))
          {
        Console.Write("{0}={1}; ", descriptor.Name,
                      descriptor.GetValue(gaze_data));
          }
          Console.WriteLine("");
        }

        Config config = new Config();
        SourceCodeEntitiesFileCollection collection = SrcMLCodeReader.run(
          config.src2srcml_path, "data/java/");
        foreach (SourceCodeEntitiesFile file in collection)
        {
          Console.WriteLine(file.FileName  + ":");
          foreach (SourceCodeEntity entity in file)
          {
        Console.Write(" - ");
        foreach (PropertyDescriptor descriptor in TypeDescriptor.
                                                  GetProperties(entity))
        {
          Console.Write("{0}={1}; ", descriptor.Name,
                        descriptor.GetValue(entity));
        }
        Console.WriteLine("");
          }
        }
    }
开发者ID:jmeinken,项目名称:itrace-pilot,代码行数:34,代码来源:UtilsTest.cs

示例9: RunCompilerProcess

        private void RunCompilerProcess(Config config, FileInfo info)
        {
            string arguments = ConstructArguments(config);

            ProcessStartInfo start = new ProcessStartInfo
            {
                WorkingDirectory = info.Directory.FullName,
                UseShellExecute = false,
                WindowStyle = ProcessWindowStyle.Hidden,
                CreateNoWindow = true,
                FileName = "cmd.exe",
                Arguments = $"/c \"\"{Path.Combine(_path, "node_modules\\.bin\\stylus.cmd")}\" {arguments} \"{info.FullName}\"\"",
                StandardOutputEncoding = Encoding.UTF8,
                StandardErrorEncoding = Encoding.UTF8,
                RedirectStandardOutput = true,
                RedirectStandardError = true,
            };

            start.EnvironmentVariables["PATH"] = _path + ";" + start.EnvironmentVariables["PATH"];

            using (Process p = Process.Start(start))
            {
                var stdout = p.StandardOutput.ReadToEndAsync();
                var stderr = p.StandardError.ReadToEndAsync();
                p.WaitForExit();

                _output = stdout.Result.Trim();
                _error = stderr.Result.Trim();
            }
        }
开发者ID:PaulVrugt,项目名称:WebCompiler,代码行数:30,代码来源:StylusCompiler.cs

示例10: TestBackoffStrategyCoerce

        public void TestBackoffStrategyCoerce()
        {
            var c = new Config();

            c.Set("backoff_strategy", "exponential");
            Assert.AreEqual(typeof(ExponentialStrategy), c.BackoffStrategy.GetType());

            c.Set("backoff_strategy", "");
            Assert.AreEqual(typeof(ExponentialStrategy), c.BackoffStrategy.GetType());

            c.Set("backoff_strategy", null);
            Assert.IsNull(c.BackoffStrategy);

            c.Set("backoff_strategy", "full_jitter");
            Assert.AreEqual(typeof(FullJitterStrategy), c.BackoffStrategy.GetType());

            Assert.Throws<Exception>(() => c.Set("backoff_strategy", "invalid"));

            var fullJitterStrategy = new FullJitterStrategy();
            c.Set("backoff_strategy", fullJitterStrategy);
            Assert.AreEqual(fullJitterStrategy, c.BackoffStrategy);

            var exponentialStrategy = new ExponentialStrategy();
            c.Set("backoff_strategy", exponentialStrategy);
            Assert.AreEqual(exponentialStrategy, c.BackoffStrategy);

            Assert.Throws<Exception>(() => c.Set("backoff_strategy", new object()));
        }
开发者ID:yonglehou,项目名称:NsqSharp,代码行数:28,代码来源:ConfigTest.cs

示例11: CreateMailboxManager

        public IMailboxManager CreateMailboxManager(Config.EmailSettings emailSettings)
        {
            var credentials = new EWSConnectionManger.Credentials
            {
                EmailAddress = emailSettings.EWSMailboxAddress,
                UserName = emailSettings.EWSUsername,
                Password = DPAPIHelper.ReadDataFromFile(emailSettings.EWSPasswordFile)
            };

            var exchangeService = _connectionManger.GetConnection(credentials);
            var postProcessor = GetPostProcesor(emailSettings, exchangeService.Service);

            switch (emailSettings.ServiceType)
            {
                case Config.EmailSettings.MailboxServiceType.EWSByFolder:
                    return new FolderMailboxManager(
                        exchangeService.Service, 
                        emailSettings.IncomingFolder,
                        postProcessor);

                case Config.EmailSettings.MailboxServiceType.EWSByRecipients:

                    return new RecipientsMailboxManager(
                        exchangeService.Router,
                        ParseDelimitedList(emailSettings.Recipients, ';'),
                        postProcessor);

                default:
                    throw new BadConfigException(
                        "EmailSettings.ServiceType",
                        string.Format("Invalid mailbox service type defined in config ({0})", emailSettings.ServiceType));
            }
        }
开发者ID:modulexcite,项目名称:mail2bug,代码行数:33,代码来源:MailboxManagerFactory.cs

示例12: CopyClient

        public CopyClient(Config config, OAuthToken authToken)
        {
            Config = config;
            AuthToken = authToken;

            InitManagers();
        }
开发者ID:nagyistge,项目名称:Copy-.Net-SDK,代码行数:7,代码来源:CopyClient.cs

示例13: BranchCreatedAfterFastForwardMergeShouldInheritCorrectly

    public void BranchCreatedAfterFastForwardMergeShouldInheritCorrectly()
    {
        var config = new Config();
        config.Branches.Add("unstable", config.Branches["develop"]);

        using (var fixture = new EmptyRepositoryFixture(config))
        {
            fixture.Repository.MakeATaggedCommit("1.0.0");
            fixture.Repository.CreateBranch("unstable");
            fixture.Repository.Checkout("unstable");

            //Create an initial feature branch
            var feature123 = fixture.Repository.CreateBranch("feature/JIRA-123");
            fixture.Repository.Checkout("feature/JIRA-123");
            fixture.Repository.MakeCommits(1);

            //Merge it
            fixture.Repository.Checkout("unstable");
            fixture.Repository.Merge(feature123, SignatureBuilder.SignatureNow());

            //Create a second feature branch
            fixture.Repository.CreateBranch("feature/JIRA-124");
            fixture.Repository.Checkout("feature/JIRA-124");
            fixture.Repository.MakeCommits(1);

            fixture.AssertFullSemver("1.1.0-JIRA-124.1+2");
        }
    }
开发者ID:nakioman,项目名称:GitVersion,代码行数:28,代码来源:FeatureBranchScenarios.cs

示例14: DataModel

 public DataModel(string name, string caption, DataType type)
 {
     this.Name = name;
     this.Caption = string.IsNullOrEmpty(caption) ? name: caption;
     this.Type = type;
     Config = new Config();
 }
开发者ID:jdash-net,项目名称:In-Memory-Analytics,代码行数:7,代码来源:DataModel.cs

示例15: ConnectToBrokerAsClient

 public void ConnectToBrokerAsClient(Config nbConfig)
 {
     subscriber = new Subscriber(nbConfig);
     subscriber.NotificationHandlers = new BrokerConnectionNotifier.NotificationEventHandler[]{
         OnNotification
                     };
 }
开发者ID:BrianGoff,项目名称:BITS,代码行数:7,代码来源:RtYieldCurve.cs


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