コード例 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthorization(t => {
                t.AddPolicy("bazati", y => {
                    y.RequireClaim("niggar", "mic", "mare");
                });
            });
            SConfig config = this.Configuration.GetSection("config").Get <SConfig>();

            services.Configure <SConfig>(this.Configuration.GetSection("config"));
            services.AddControllers();
            services.AddSwaggerGen(x => {
                x.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo {
                    Title       = config.Swagger.Title,
                    Version     = config.Swagger.Version,
                    Description = config.Swagger.Description,
                    Contact     = new Microsoft.OpenApi.Models.OpenApiContact {
                        Name  = "Bercovici Adrian",
                        Email = "*****@*****.**"
                    },
                });
                x.AddSecurityRequirement(new Microsoft.OpenApi.Models.OpenApiSecurityRequirement());

                x.AddSecurityDefinition("sec", new Microsoft.OpenApi.Models.OpenApiSecurityScheme {
                    Description = "logging system for the Leplace App",
                    Flows       = new Microsoft.OpenApi.Models.OpenApiOAuthFlows {
                        Implicit = new Microsoft.OpenApi.Models.OpenApiOAuthFlow(),
                    }
                });
            });
            services.AddScoped <IConsumer, ConsumerService>();
            services.AddSingleton <IKProducer, ProducerService>();
        }
コード例 #2
0
ファイル: LogManager.cs プロジェクト: Nauja/SoGModLoader
        /// <summary>Log details for settings that don't match the default.</summary>
        /// <param name="settings">The settings to log.</param>
        public void LogSettingsHeader(SConfig settings)
        {
            // developer mode
            if (settings.DeveloperMode)
            {
                this.Monitor.Log("You enabled developer mode, so the console will be much more verbose. You can disable it by installing the non-developer version of SoGMAPI.", LogLevel.Info);
            }

            // warnings
            if (!settings.CheckForUpdates)
            {
                this.Monitor.Log("You disabled update checks, so you won't be notified of new SoGMAPI or mod updates. Running an old version of SoGMAPI is not recommended. You can undo this by reinstalling SoGMAPI.", LogLevel.Warn);
            }
            if (!settings.RewriteMods)
            {
                this.Monitor.Log("You disabled rewriting broken mods, so many older mods may fail to load. You can undo this by reinstalling SoGMAPI.", LogLevel.Info);
            }
            if (!this.Monitor.WriteToConsole)
            {
                this.Monitor.Log("Writing to the terminal is disabled because the --no-terminal argument was received. This usually means launching the terminal failed.", LogLevel.Warn);
            }

            // verbose logging
            this.Monitor.VerboseLog("Verbose logging enabled.");
        }
コード例 #3
0
ファイル: GMLanComm.cs プロジェクト: enochcheng/J2534DotNet
        /*
         * Connect to GMLan SW CAN Protocol (PIN 1)
         */
        private bool ConnectSWCan(int deviceId, ref int channelId)
        {
            m_status = m_j2534Interface.PassThruConnect(deviceId, ProtocolID.SW_CAN, ConnectFlag.CAN_ID_BOTH, BaudRate.CAN_33300, ref channelId);
            if (J2534Err.STATUS_NOERROR != m_status)
            {
                m_j2534Interface.PassThruDisconnect(channelId);
                return(false);
            }

            SConfig sConfig = new SConfig();

            sConfig.Parameter = ConfigParameter.J1962_PINS;
            sConfig.Value     = 0x0100;
            List <SConfig> sConfigs = new List <SConfig>();

            sConfigs.Add(sConfig);

            SConfigList sConfigList = new SConfigList();

            sConfigList.Count   = 1;
            sConfigList.ListPtr = sConfigs.ToIntPtr();

            m_status = m_j2534Interface.PassThruIoctl(channelId, (int)Ioctl.SET_CONFIG, sConfigList.ToIntPtr(), IntPtr.Zero);
            if (J2534Err.STATUS_NOERROR != m_status)
            {
                m_j2534Interface.PassThruDisconnect(channelId);
                return(false);
            }

            return(true);
        }
コード例 #4
0
    ///<summary>
    /// Load a config file, look for CLI overrides and starts with --file if given.
    ///</summary>
    public void LoadConfig()
    {
        config = LoadConfigFile(out string fileType);
        OverrideConfig();
        ApplyConfig();
        GameManager.gm.AppendLogLine($"Load {fileType} config file", true, eLogtype.success);

        string startFile = GetArg("--file");

        if (!string.IsNullOrEmpty(startFile))
        {
            GameManager.gm.consoleController.RunCommandString($".cmds:{startFile}");
        }
    }
コード例 #5
0
ファイル: Program.cs プロジェクト: Shanksyue/SMAPI
        /// <summary>Construct an instance.</summary>
        /// <param name="writeToConsole">Whether to output log messages to the console.</param>
        /// <param name="logPath">The full file path to which to write log messages.</param>
        internal Program(bool writeToConsole, string logPath)
        {
            // load settings
            this.Settings = JsonConvert.DeserializeObject <SConfig>(File.ReadAllText(Constants.ApiConfigPath));

            // initialise
            this.LogFile = new LogFileManager(logPath);
            this.Monitor = new Monitor("SMAPI", this.ConsoleManager, this.LogFile, this.ExitGameImmediately)
            {
                WriteToConsole = writeToConsole
            };
            this.ModRegistry        = new ModRegistry(this.Settings.ModCompatibility);
            this.DeprecationManager = new DeprecationManager(this.Monitor, this.ModRegistry);
        }
コード例 #6
0
 public void Create(SConfig model)
 {
     using (var db = new IEDEntities())
     {
         try
         {
             CheckDefault(model.IsDefault, model.TableName, db);
             model.CreatedDate = DateTime.Now;
             db.SConfigs.Add(model);
             db.SaveChanges();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
コード例 #7
0
            static public SConfig CreateDummy()
            {
                SConfig pDummy = new SConfig();

                pDummy.strBotToken       = "토큰";
                pDummy.strCall_ID        = "호출 명령어";
                pDummy.strCall_Channel   = "제한 채널";
                pDummy.strLobbyChannelID = 0;
                pDummy.strBootingMessage = "부팅메세지";

                pDummy.pTutorial.strTitle = "로봇이름 - 튜토리얼";
                pDummy.pTutorial.arrField = new STutorial_Field[1]
                {
                    new STutorial_Field("기능", "설명")
                };

                return(pDummy);
            }
コード例 #8
0
            private SConfig createTestConfig()
            {
                var testConfig = new SConfig();

                // - apps
                testConfig.apps.Add(new RemoteApp {
                    name   = "Hotels",
                    layers = new List <string> {
                        "/Housing"
                    },
                    secret = Constants.Apps.APP_SECRET
                });
                testConfig.apps.Add(new RemoteApp {
                    name   = "Salt",
                    layers = new List <string> {
                        "/Food"
                    },
                    secret = Constants.Apps.APP_SECRET
                });

                // - groups
                testConfig.groups.Add(new Group {
                    name        = "Luxurious",
                    permissions =
                    {
                        new Permission("/Housing")
                    }
                });
                testConfig.groups.Add(new Group {
                    name        = "Friends",
                    permissions =
                    {
                        new Permission("/Food")
                    }
                });

                testConfig.users.defaultGroups = new List <string> {
                    "Friends"
                };

                return(testConfig);
            }
コード例 #9
0
 public void CreateConfig(string tableName, int ObjectId, bool IsDefault, bool IsShow, int companyId, int actionUser)
 {
     using (var db = new IEDEntities())
     {
         try
         {
             if (IsDefault)
             {
                 var listConfig = (from x in db.SConfigs
                                   where x.ConpanyId == companyId && x.TableName.Equals(tableName) && x.IsDefault && !x.IsDeleted
                                   select x);
                 if (listConfig != null)
                 {
                     foreach (var config in listConfig)
                     {
                         config.IsDefault   = false;
                         config.UpdatedUser = actionUser;
                         config.UpdatedDate = DateTime.Now;
                         db.Entry <SConfig>(config).State = System.Data.Entity.EntityState.Modified;
                     }
                 }
             }
             var confi = new SConfig();
             confi.ConpanyId   = companyId;
             confi.TableName   = tableName;
             confi.ObjectId    = ObjectId;
             confi.IsHidden    = IsShow;
             confi.IsDefault   = IsDefault;
             confi.CreatedUser = actionUser;
             confi.CreatedDate = DateTime.Now;
             db.SConfigs.Add(confi);
             db.SaveChanges();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
コード例 #10
0
        private void SpiderConfig_Load(object sender, EventArgs e)
        {
            _dbHelper = new MysqlDBHelper();
            if (!_dbHelper.OpenDb())
            {
                MessageBox.Show("");
                return;
            }

            Thread productThread = new Thread(() =>
            {
                _scList   = SConfig.FetchObject(DbHelper);
                _attrList = SUrlAttribute.FetchObject(DbHelper);

                _suList = SUrl.FetchObject(DbHelper);

                SUrl.buildAttribute(_suList, _attrList);

                updateUi();
            });

            productThread.Start();
        }
コード例 #11
0
 public void Update(SConfig modelConfig)
 {
     using (var db = new IEDEntities())
     {
         try
         {
             CheckDefault(modelConfig.IsDefault, modelConfig.TableName, db);
             var config = db.SConfigs.FirstOrDefault(c => c.TableName == modelConfig.TableName && !c.IsDeleted && c.ObjectId == modelConfig.ObjectId && c.ConpanyId == modelConfig.ConpanyId);
             if (config != null)
             {
                 config.IsDefault   = modelConfig.IsDefault;
                 config.IsHidden    = modelConfig.IsHidden;
                 config.UpdatedDate = modelConfig.UpdatedDate;
                 config.UpdatedUser = modelConfig.UpdatedUser;
                 db.Entry <SConfig>(config).State = System.Data.Entity.EntityState.Modified;
                 db.SaveChanges();
             }
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
コード例 #12
0
 static public SConfig Load()
 {
     pConfig = Strix.CManagerXMLParser.LoadXML("Config.xml", SConfig.CreateDummy);
     return(pConfig);
 }
コード例 #13
0
ファイル: AdminService.cs プロジェクト: sanzor/KafkaSharp
 public AdminService(IOptions<SConfig>config) {
     this.config = config.Value;
 }
コード例 #14
0
ファイル: Program.cs プロジェクト: MaTheHandsome/SMAPI
        /// <summary>Initialise SMAPI and mods after the game starts.</summary>
        private void InitialiseAfterGameStart()
        {
            // load settings
            this.Settings = JsonConvert.DeserializeObject <SConfig>(File.ReadAllText(Constants.ApiConfigPath));
            this.GameInstance.VerboseLogging = this.Settings.VerboseLogging;

            // load core components
            this.ModRegistry        = new ModRegistry();
            this.DeprecationManager = new DeprecationManager(this.Monitor, this.ModRegistry);
            this.CommandManager     = new CommandManager();

#if SMAPI_1_x
            // inject compatibility shims
#pragma warning disable 618
            Command.Shim(this.CommandManager, this.DeprecationManager, this.ModRegistry);
            Config.Shim(this.DeprecationManager);
            Log.Shim(this.DeprecationManager, this.GetSecondaryMonitor("legacy mod"), this.ModRegistry);
            Mod.Shim(this.DeprecationManager);
            GameEvents.Shim(this.DeprecationManager);
            PlayerEvents.Shim(this.DeprecationManager);
            TimeEvents.Shim(this.DeprecationManager);
#pragma warning restore 618
#endif

            // redirect direct console output
            {
                Monitor monitor = this.GetSecondaryMonitor("Console.Out");
                if (monitor.WriteToConsole)
                {
                    this.ConsoleManager.OnMessageIntercepted += message => this.HandleConsoleMessage(monitor, message);
                }
            }

            // add headers
            if (this.Settings.DeveloperMode)
            {
                this.Monitor.ShowTraceInConsole = true;
#if !SMAPI_1_x
                this.Monitor.ShowFullStampInConsole = true;
#endif
                this.Monitor.Log($"You configured SMAPI to run in developer mode. The console may be much more verbose. You can disable developer mode by installing the non-developer version of SMAPI, or by editing {Constants.ApiConfigPath}.", LogLevel.Info);
            }
            if (!this.Settings.CheckForUpdates)
            {
                this.Monitor.Log($"You configured SMAPI to not check for updates. Running an old version of SMAPI is not recommended. You can enable update checks by reinstalling SMAPI or editing {Constants.ApiConfigPath}.", LogLevel.Warn);
            }
            if (!this.Monitor.WriteToConsole)
            {
                this.Monitor.Log("Writing to the terminal is disabled because the --no-terminal argument was received. This usually means launching the terminal failed.", LogLevel.Warn);
            }
            if (this.Settings.VerboseLogging)
            {
                this.Monitor.Log("Verbose logging enabled.", LogLevel.Trace);
            }

            // validate XNB integrity
            if (!this.ValidateContentIntegrity())
            {
                this.Monitor.Log("SMAPI found problems in your game's content files which are likely to cause errors or crashes. Consider uninstalling XNB mods or reinstalling the game.", LogLevel.Error);
            }

            // load mods
            {
#if SMAPI_1_x
                this.Monitor.Log("Loading mod metadata...");
#else
                this.Monitor.Log("Loading mod metadata...", LogLevel.Trace);
#endif
                ModResolver resolver = new ModResolver();

                // load manifests
                IModMetadata[] mods = resolver.ReadManifests(Constants.ModPath, new JsonHelper(), this.Settings.ModCompatibility, this.Settings.DisabledMods).ToArray();
                resolver.ValidateManifests(mods, Constants.ApiVersion);

                // check for deprecated metadata
#if SMAPI_1_x
                IList <Action> deprecationWarnings = new List <Action>();
                foreach (IModMetadata mod in mods.Where(m => m.Status != ModMetadataStatus.Failed))
                {
                    // missing fields that will be required in SMAPI 2.0
                    {
                        List <string> missingFields = new List <string>(3);

                        if (string.IsNullOrWhiteSpace(mod.Manifest.Name))
                        {
                            missingFields.Add(nameof(IManifest.Name));
                        }
                        if (mod.Manifest.Version == null || mod.Manifest.Version.ToString() == "0.0")
                        {
                            missingFields.Add(nameof(IManifest.Version));
                        }
                        if (string.IsNullOrWhiteSpace(mod.Manifest.UniqueID))
                        {
                            missingFields.Add(nameof(IManifest.UniqueID));
                        }

                        if (missingFields.Any())
                        {
                            deprecationWarnings.Add(() => this.Monitor.Log($"{mod.DisplayName} is missing some manifest fields ({string.Join(", ", missingFields)}) which will be required in an upcoming SMAPI version.", LogLevel.Warn));
                        }
                    }

                    // per-save directories
                    if ((mod.Manifest as Manifest)?.PerSaveConfigs == true)
                    {
                        deprecationWarnings.Add(() => this.DeprecationManager.Warn(mod.DisplayName, $"{nameof(Manifest)}.{nameof(Manifest.PerSaveConfigs)}", "1.0", DeprecationLevel.PendingRemoval));
                        try
                        {
                            string psDir = Path.Combine(mod.DirectoryPath, "psconfigs");
                            Directory.CreateDirectory(psDir);
                            if (!Directory.Exists(psDir))
                            {
                                mod.SetStatus(ModMetadataStatus.Failed, "it requires per-save configuration files ('psconfigs') which couldn't be created for some reason.");
                            }
                        }
                        catch (Exception ex)
                        {
                            mod.SetStatus(ModMetadataStatus.Failed, $"it requires per-save configuration files ('psconfigs') which couldn't be created: {ex.GetLogSummary()}");
                        }
                    }
                }
#endif

                // process dependencies
                mods = resolver.ProcessDependencies(mods).ToArray();

                // load mods
#if SMAPI_1_x
                this.LoadMods(mods, new JsonHelper(), this.ContentManager, deprecationWarnings);
                foreach (Action warning in deprecationWarnings)
                {
                    warning();
                }
#else
                this.LoadMods(mods, new JsonHelper(), this.ContentManager);
#endif
            }
            if (this.Monitor.IsExiting)
            {
                this.Monitor.Log("SMAPI shutting down: aborting initialisation.", LogLevel.Warn);
                return;
            }

            // update window titles
            int modsLoaded = this.ModRegistry.GetMods().Count();
            this.GameInstance.Window.Title = $"Stardew Valley {Constants.GameVersion} - running SMAPI {Constants.ApiVersion} with {modsLoaded} mods";
            Console.Title = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Constants.GameVersion} with {modsLoaded} mods";

            // start SMAPI console
            new Thread(this.RunConsoleLoop).Start();
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: badeliaa/SMAPI
        /*********
        ** Private methods
        *********/
        /// <summary>Initialise SMAPI and mods after the game starts.</summary>
        private void InitialiseAfterGameStart()
        {
            // load settings
            this.Settings = JsonConvert.DeserializeObject <SConfig>(File.ReadAllText(Constants.ApiConfigPath));
            this.GameInstance.VerboseLogging = this.Settings.VerboseLogging;

            // load core components
            this.ModRegistry        = new ModRegistry(this.Settings.ModCompatibility);
            this.DeprecationManager = new DeprecationManager(this.Monitor, this.ModRegistry);
            this.CommandManager     = new CommandManager();

            // inject compatibility shims
#pragma warning disable 618
            Command.Shim(this.CommandManager, this.DeprecationManager, this.ModRegistry);
            Config.Shim(this.DeprecationManager);
            InternalExtensions.Shim(this.ModRegistry);
            Log.Shim(this.DeprecationManager, this.GetSecondaryMonitor("legacy mod"), this.ModRegistry);
            Mod.Shim(this.DeprecationManager);
            ContentEvents.Shim(this.ModRegistry, this.Monitor);
            GameEvents.Shim(this.DeprecationManager);
            PlayerEvents.Shim(this.DeprecationManager);
            TimeEvents.Shim(this.DeprecationManager);
#pragma warning restore 618

            // redirect direct console output
            {
                Monitor monitor = this.GetSecondaryMonitor("Console.Out");
                if (monitor.WriteToConsole)
                {
                    this.ConsoleManager.OnMessageIntercepted += message => this.HandleConsoleMessage(monitor, message);
                }
            }

            // add headers
            if (this.Settings.DeveloperMode)
            {
                this.Monitor.ShowTraceInConsole = true;
                this.Monitor.Log($"You configured SMAPI to run in developer mode. The console may be much more verbose. You can disable developer mode by installing the non-developer version of SMAPI, or by editing {Constants.ApiConfigPath}.", LogLevel.Info);
            }
            if (!this.Settings.CheckForUpdates)
            {
                this.Monitor.Log($"You configured SMAPI to not check for updates. Running an old version of SMAPI is not recommended. You can enable update checks by reinstalling SMAPI or editing {Constants.ApiConfigPath}.", LogLevel.Warn);
            }
            if (!this.Monitor.WriteToConsole)
            {
                this.Monitor.Log("Writing to the terminal is disabled because the --no-terminal argument was received. This usually means launching the terminal failed.", LogLevel.Warn);
            }
            if (this.Settings.VerboseLogging)
            {
                this.Monitor.Log("Verbose logging enabled.", LogLevel.Trace);
            }

            // validate XNB integrity
            if (!this.ValidateContentIntegrity())
            {
                this.Monitor.Log("SMAPI found problems in the game's XNB files which may cause errors or crashes while you're playing. Consider uninstalling XNB mods or reinstalling the game.", LogLevel.Warn);
            }

            // load mods
            int modsLoaded;
            {
                // load mods
                JsonHelper     jsonHelper          = new JsonHelper();
                IList <Action> deprecationWarnings = new List <Action>();
                ModMetadata[]  mods = this.FindMods(Constants.ModPath, new JsonHelper(), deprecationWarnings);
                modsLoaded = this.LoadMods(mods, jsonHelper, (SContentManager)Game1.content, deprecationWarnings);

                // log deprecation warnings together
                foreach (Action warning in deprecationWarnings)
                {
                    warning();
                }
            }
            if (this.Monitor.IsExiting)
            {
                this.Monitor.Log("SMAPI shutting down: aborting initialisation.", LogLevel.Warn);
                return;
            }

            // update window titles
            this.GameInstance.Window.Title = $"Stardew Valley {Constants.GetGameDisplayVersion(Constants.GameVersion)} - running SMAPI {Constants.ApiVersion} with {modsLoaded} mods";
            Console.Title = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Constants.GetGameDisplayVersion(Constants.GameVersion)} with {modsLoaded} mods";

            // start SMAPI console
            new Thread(this.RunConsoleLoop).Start();
        }
コード例 #16
0
ファイル: Startup.cs プロジェクト: xdrie/gatekeeper
        public void ConfigureServices(IServiceCollection services)
        {
            // Adds services required for using options.
            services.AddOptions();

            // Adds services required for using CORS
            services.AddCors();

            // enable Razor Pages
            services.AddRazorPages()
            .AddRazorRuntimeCompilation();

            // install Carter
            services.AddCarter(options => {
                options.OpenApi.DocumentTitle = SConfig.SERVER_NAME;
                options.OpenApi.ServerUrls    = new[] { "http://localhost:5000" };
                options.OpenApi.Securities    = new Dictionary <string, OpenApiSecurity> {
                    {
                        GateApiConstants.Security.USER_BEARER_AUTH,
                        new OpenApiSecurity {
                            Type = OpenApiSecurityType.http, Scheme = "bearer"
                        }
                    }, {
                        GateApiConstants.Security.REMOTE_APP_APIKEY,
                        new OpenApiSecurity
                        {
                            Type = OpenApiSecurityType.apiKey, In = OpenApiIn.header, Name = "X-App-Secret"
                        }
                    },
                    // { "ApiKey", new OpenApiSecurity { Type = OpenApiSecurityType.apiKey, Name = "X-API-KEY", In = OpenApiIn.header } }
                };
                options.OpenApi.GlobalSecurityDefinitions = new[] {
                    GateApiConstants.Security.USER_BEARER_AUTH,
                    GateApiConstants.Security.REMOTE_APP_APIKEY
                };
            });

            var serverConfig     = default(SConfig);
            var configDescriptor = services.SingleOrDefault(d => d.ServiceType == typeof(SConfig));

            if (configDescriptor == null)
            {
                // load configuration
                serverConfig = new SConfig(); // default configuration
                if (File.Exists(CONFIG_FILE))
                {
                    var configTxt = File.ReadAllText(CONFIG_FILE);
                    serverConfig.load(configTxt);
                }
            }
            else
            {
                serverConfig = (SConfig)configDescriptor.ImplementationInstance;
            }

            var context = new SContext(services, serverConfig);

            // register server context
            services.AddSingleton(context);

            // set up database
            services.AddDbContext <AppDbContext>(options => {
                switch (serverConfig.server.databaseBackend)
                {
                case SConfig.Server.DatabaseBackend.InMemory:
                    options.UseInMemoryDatabase(context.config.server.databaseConnection);
                    break;

                case SConfig.Server.DatabaseBackend.Sqlite:
                    options.UseSqlite(context.config.server.databaseConnection);
                    break;

                case SConfig.Server.DatabaseBackend.Postgres:
                    options.UseNpgsql(context.config.server.databaseConnection);
                    break;
                }
                if (context.config.logging.databaseLogging)
                {
                    options.EnableDetailedErrors();
                    options.EnableSensitiveDataLogging();
                }
            });

            // server context start signal
            context.start();
        }
コード例 #17
0
        /// <summary>Initialise SMAPI and mods after the game starts.</summary>
        private void InitialiseAfterGameStart()
        {
            // load settings
            this.Settings = JsonConvert.DeserializeObject <SConfig>(File.ReadAllText(Constants.ApiConfigPath));
            this.GameInstance.VerboseLogging = this.Settings.VerboseLogging;

            // load core components
            this.ModRegistry        = new ModRegistry();
            this.DeprecationManager = new DeprecationManager(this.Monitor, this.ModRegistry);
            this.CommandManager     = new CommandManager();

            // redirect direct console output
            {
                Monitor monitor = this.GetSecondaryMonitor("Console.Out");
                if (monitor.WriteToConsole)
                {
                    this.ConsoleManager.OnMessageIntercepted += message => this.HandleConsoleMessage(monitor, message);
                }
            }

            // add headers
            if (this.Settings.DeveloperMode)
            {
                this.Monitor.ShowTraceInConsole     = true;
                this.Monitor.ShowFullStampInConsole = true;
                this.Monitor.Log($"You configured SMAPI to run in developer mode. The console may be much more verbose. You can disable developer mode by installing the non-developer version of SMAPI, or by editing {Constants.ApiConfigPath}.", LogLevel.Info);
            }
            if (!this.Settings.CheckForUpdates)
            {
                this.Monitor.Log($"You configured SMAPI to not check for updates. Running an old version of SMAPI is not recommended. You can enable update checks by reinstalling SMAPI or editing {Constants.ApiConfigPath}.", LogLevel.Warn);
            }
            if (!this.Monitor.WriteToConsole)
            {
                this.Monitor.Log("Writing to the terminal is disabled because the --no-terminal argument was received. This usually means launching the terminal failed.", LogLevel.Warn);
            }
            this.VerboseLog("Verbose logging enabled.");

            // validate XNB integrity
            if (!this.ValidateContentIntegrity())
            {
                this.Monitor.Log("SMAPI found problems in your game's content files which are likely to cause errors or crashes. Consider uninstalling XNB mods or reinstalling the game.", LogLevel.Error);
            }

            // load mods
            {
                this.Monitor.Log("Loading mod metadata...", LogLevel.Trace);
                ModResolver resolver = new ModResolver();

                // load manifests
                IModMetadata[] mods = resolver.ReadManifests(Constants.ModPath, new JsonHelper(), this.Settings.ModData).ToArray();
                resolver.ValidateManifests(mods, Constants.ApiVersion, Constants.VendorModUrls);

                // process dependencies
                mods = resolver.ProcessDependencies(mods).ToArray();

                // load mods
                this.LoadMods(mods, new JsonHelper(), this.ContentManager);

                // check for updates
                this.CheckForUpdatesAsync(mods);
            }
            if (this.Monitor.IsExiting)
            {
                this.Monitor.Log("SMAPI shutting down: aborting initialisation.", LogLevel.Warn);
                return;
            }

            // update window titles
            int modsLoaded = this.ModRegistry.GetMods().Count();

            this.GameInstance.Window.Title = $"Stardew Valley {Constants.GameVersion} - running SMAPI {Constants.ApiVersion} with {modsLoaded} mods";
            Console.Title = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Constants.GameVersion} with {modsLoaded} mods";

            // start SMAPI console
            new Thread(this.RunConsoleLoop).Start();
        }
コード例 #18
0
ファイル: frmLogin.cs プロジェクト: snowleung/TitiSinaweibo
 private void GetAccessToken_Click(object sender, EventArgs e)
 {
     oauth.Verifier = this.pinBox.Text.Trim();
     oauth.AccessTokenGet();
     SConfig s = new SConfig();
     s.SetConfig(oauth.token, oauth.tokenSecret, "1");
     flag = true;
     this.Close();
 }