Exemple #1
0
        public void LoadTest()
        {
            var config = new LocalFileConfig();

            config.Load();

            Assert.AreEqual(true, config.ShowSquareLine);
            Assert.AreEqual("TestValue1", config.GetItem("TestSection1", "TestName1"));
            Assert.AreEqual("TestValue2", config.GetItem("TestSection1", "TestName2"));
            Assert.AreEqual("", config.GetItem("TestSection1", "TestName3"));
            Assert.AreEqual("", config.GetItem("TestSection2", "TestName1"));
        }
Exemple #2
0
        public RootForm()
        {
            InitializeComponent();

            var config = new LocalFileConfig();

            try
            {
                config.Load();
            }
            catch
            {
                config.Save();
            }
            var fileSystem  = new LocalFileSystem();
            var soundPlayer = new WindowsManagedPlayer();

            // TODO 設定の反映処理を設ける
            // XXX 単位変更をこんな感じでやるのは下策だなー
            soundPlayer.SoundVolume = config.SoundVolume / 100f;

            // TODO ログの設定
            Program.LoggerFactory.AddProvider(new SerilogLoggerProvider(
                                                  new LoggerConfiguration().MinimumLevel.Information()
                                                  .WriteTo.File("logs\\srcsform..log", rollingInterval: RollingInterval.Day)
                                                  .CreateLogger()));
            Program.UpdateLogger();

            SRC = new SRCCore.SRC(Program.LoggerFactory);
            SRC.SystemConfig = config;
            SRC.FileSystem   = fileSystem;
            SRC.Sound.Player = soundPlayer;

            // XXX ファイルシステムへのエントリー追加はお試し中
            try
            {
                fileSystem.AddAchive(SRC.AppPath, "assets.zip");
                fileSystem.AddPath(SRC.AppPath);
                fileSystem.AddPath(SRC.ExtDataPath2);
                fileSystem.AddPath(SRC.ExtDataPath);
            }
            catch (Exception ex)
            {
                // ignore
                SRC.LogError(ex);
            }

            SRC.GUI             = new SRCSharpFormGUI(SRC);
            SRC.GUI.MessageWait = 700;
        }