protected virtual BaseLogger CreateLoggers() { var ldcConfig = new StringConfig(Args, 0); var xmlConfig = new XmlConfig(ConfigFile, 1); Configuration = new ConfigPackage(); Configuration.AddSource(ldcConfig); Configuration.AddSource(xmlConfig); var log = new MultiLogger(); ConsoleLogger = new ConsoleLogger(CfgConsole, Configuration); FileLogger = new FileLogger(CfgFile, Configuration); log.AddLogger(ConsoleLogger); log.AddLogger(FileLogger); return(log); }
protected override BaseLogger CreateLoggers() { var ldcConfig = new StringConfig(Args, 0); var xmlConfig = new XmlConfig(ConfigFile, 1); Configuration = new ConfigPackage(); Configuration.AddSource(ldcConfig); Configuration.AddSource(xmlConfig); var log = new MultiLogger(); ConsoleLogger = new NotifyIconLogger(CfgConsole, Configuration, this, GetType().Assembly.GetName().Name, 1); FileLogger = new FileLogger(CfgFile, Configuration); log.AddLogger(ConsoleLogger); log.AddLogger(FileLogger); return(log); }
/// ----------------------------------------------------------------------------- /// <summary> /// Initialisation des loggers /// </summary> /// <returns>un MultiLogger lié à une source fichier et console</returns> /// ----------------------------------------------------------------------------- protected override BaseLogger CreateLoggers() { var ldcConfig = new StringConfig(Args, 0); var xmlConfig = new XMLConfig(ConfigFile, 1); Configuration = new ConfigPackage(); Configuration.AddSource(ldcConfig); Configuration.AddSource(xmlConfig); var log = new MultiLogger(); // on utilise le référence d'un BdtGuiClient au lieu de passer directement un NotifyIcon car à ce stade // on ne peut pas créer de formulaire, car la Culture serait incorrecte, le fichier de configuration // n'étant pas déjà parsé ConsoleLogger = new NotifyIconLogger(CfgConsole, Configuration, this, GetType().Assembly.GetName().Name, 1); FileLogger = new FileLogger(CfgFile, Configuration); log.AddLogger(ConsoleLogger); log.AddLogger(FileLogger); return(log); }
/// <summary> /// 为窗体载入数据 /// </summary> private void GlobalConfigForm_Load(object sender, EventArgs e) { ConfigPackage config = Halation.project.Config; // 工程页 this.textBox1.Text = Halation.projectFolder; this.textBox2.Text = config.GameProjName; this.textBox3.Text = config.GameProjVersion; this.textBox4.Text = config.GameProjKey; // 可视页 this.numericUpDown1.Value = config.GameViewWindowWidth; this.numericUpDown2.Value = config.GameViewWindowHeight; this.checkBox1.Checked = config.GameViewWindowResizeable; this.checkBox3.Checked = config.Game3DStage; if (this.checkBox3.Checked) { this.groupBox2.Enabled = false; } this.numericUpDown3.Value = config.GameViewCStandLeftX; this.numericUpDown4.Value = config.GameViewCStandLeftY; this.numericUpDown5.Value = config.GameViewCStandMidleftY; this.numericUpDown6.Value = config.GameViewCStandMidleftX; this.numericUpDown7.Value = config.GameViewCStandMidY; this.numericUpDown8.Value = config.GameViewCStandMidX; this.numericUpDown9.Value = config.GameViewCStandMidrightY; this.numericUpDown10.Value = config.GameViewCStandMidrightX; this.numericUpDown11.Value = config.GameViewCStandRightY; this.numericUpDown12.Value = config.GameViewCStandRightX; this.numericUpDown13.Value = config.GameViewPicturesCount; this.numericUpDown14.Value = config.GameViewPicturesZ; this.numericUpDown15.Value = config.GameViewButtonZ; this.numericUpDown16.Value = config.GameViewButtonCount; this.numericUpDown17.Value = config.GameViewBackgroundZ; this.numericUpDown18.Value = config.GameViewCStandZ; // 文本层 this.numericUpDown19.Value = config.GameMsgLayerCount; this.numericUpDown20.Value = config.GameMsgLayerY; this.numericUpDown21.Value = config.GameMsgLayerX; this.numericUpDown22.Value = config.GameMsgLayerH; this.numericUpDown23.Value = config.GameMsgLayerW; this.numericUpDown24.Value = config.GameMsgLayerU; this.numericUpDown25.Value = config.GameMsgLayerL; this.numericUpDown26.Value = config.GameMsgLayerR; this.numericUpDown27.Value = config.GameMsgLayerB; this.textBox5.Text = config.GameMsgLayerTriaName; this.numericUpDown28.Value = config.GameMsgLayerTriaY; this.numericUpDown29.Value = config.GameMsgLayerTriaX; this.numericUpDown30.Value = config.GameMsgLayerFontSize; this.numericUpDown31.Value = config.GameMsgLayerFontLineheight; this.textBox7.Text = config.GameMsgLayerFontName; this.numericUpDown32.Value = Convert.ToInt32(config.GameMsgLayerFontColor.Split(',')[0]); this.numericUpDown33.Value = Convert.ToInt32(config.GameMsgLayerFontColor.Split(',')[1]); this.numericUpDown34.Value = Convert.ToInt32(config.GameMsgLayerFontColor.Split(',')[2]); this.checkBox2.Checked = config.GameMsgLayerFontShadow; this.numericUpDown35.Value = config.GameMsgLayerTypeSpeed; this.textBox6.Text = config.GameMsgLayerBackgroundName; this.numericUpDown36.Value = config.GameMsgLayerZ; // 选项页 this.textBox9.Text = config.GameBranchBackgroundNormal; this.textBox10.Text = config.GameBranchBackgroundOver; this.numericUpDown42.Value = config.GameBranchH; this.numericUpDown43.Value = config.GameBranchW; this.numericUpDown44.Value = config.GameBranchFontSize; this.textBox11.Text = config.GameBranchFontName; this.numericUpDown45.Value = Convert.ToInt32(config.GameBranchFontColor.Split(',')[2]); this.numericUpDown46.Value = Convert.ToInt32(config.GameBranchFontColor.Split(',')[1]); this.numericUpDown47.Value = Convert.ToInt32(config.GameBranchFontColor.Split(',')[0]); this.numericUpDown48.Value = config.GameBranchPadTop; this.numericUpDown49.Value = config.GameBranchCount; this.numericUpDown50.Value = config.GameBranchZ; // 音频页 this.numericUpDown37.Value = config.GameMusicBGMVol; this.numericUpDown38.Value = config.GameMusicBGSVol; this.numericUpDown39.Value = config.GameMusicSEVol; this.numericUpDown40.Value = config.GameMusicVocalVol; this.numericUpDown41.Value = config.GameMusicBgsCount; this.comboBox1.SelectedIndex = config.GameMusicVocalPostfix == ".mp3" ? 0 : 1; // 杂项页 this.numericUpDown51.Value = config.GameMaxSwitchCount; // 角色页 List <string> charaList = Halation.project.CharacterList; for (int i = 0; i < charaList.Count; i++) { this.switchDataGridView.Rows.Add(); this.switchDataGridView.Rows[i].Cells[0].Value = charaList[i]; } }
/// <summary> /// 按钮:确定 /// </summary> private void button1_Click(object sender, EventArgs e) { if (!Regex.IsMatch(this.textBox4.Text, "^[a-zA-Z]{8}$")) { MessageBox.Show("工程密钥必须是半角英文字母,8位长度"); return; } ConfigPackage config = Halation.project.Config; // 工程页 config.GameProjName = this.textBox2.Text; config.GameProjVersion = this.textBox3.Text; config.GameProjKey = this.textBox4.Text; // 可视页 config.GameViewWindowWidth = (int)this.numericUpDown1.Value; config.GameViewWindowHeight = (int)this.numericUpDown2.Value; config.GameViewWindowResizeable = this.checkBox1.Checked; config.Game3DStage = this.checkBox3.Checked; config.GameViewCStandLeftX = (int)this.numericUpDown3.Value; config.GameViewCStandLeftY = (int)this.numericUpDown4.Value; config.GameViewCStandMidleftY = (int)this.numericUpDown5.Value; config.GameViewCStandMidleftX = (int)this.numericUpDown6.Value; config.GameViewCStandMidY = (int)this.numericUpDown7.Value; config.GameViewCStandMidX = (int)this.numericUpDown8.Value; config.GameViewCStandMidrightY = (int)this.numericUpDown9.Value; config.GameViewCStandMidrightX = (int)this.numericUpDown10.Value; config.GameViewCStandRightY = (int)this.numericUpDown11.Value; config.GameViewCStandRightX = (int)this.numericUpDown12.Value; config.GameViewPicturesCount = (int)this.numericUpDown13.Value; config.GameViewPicturesZ = (int)this.numericUpDown14.Value; config.GameViewButtonZ = (int)this.numericUpDown15.Value; config.GameViewButtonCount = (int)this.numericUpDown16.Value; config.GameViewBackgroundZ = (int)this.numericUpDown17.Value; config.GameViewCStandZ = (int)this.numericUpDown18.Value; // 文本层 config.GameMsgLayerCount = (int)this.numericUpDown19.Value; config.GameMsgLayerY = (int)this.numericUpDown20.Value; config.GameMsgLayerX = (int)this.numericUpDown21.Value; config.GameMsgLayerH = (int)this.numericUpDown22.Value; config.GameMsgLayerW = (int)this.numericUpDown23.Value; config.GameMsgLayerU = (int)this.numericUpDown24.Value; config.GameMsgLayerL = (int)this.numericUpDown25.Value; config.GameMsgLayerR = (int)this.numericUpDown26.Value; config.GameMsgLayerB = (int)this.numericUpDown27.Value; config.GameMsgLayerTriaName = this.textBox5.Text; config.GameMsgLayerTriaY = (int)this.numericUpDown28.Value; config.GameMsgLayerTriaX = (int)this.numericUpDown29.Value; config.GameMsgLayerFontSize = (int)this.numericUpDown30.Value; config.GameMsgLayerFontLineheight = (int)this.numericUpDown31.Value; config.GameMsgLayerFontName = this.textBox7.Text; config.GameMsgLayerFontColor = String.Format("{0},{1},{2}", this.numericUpDown32.Value, this.numericUpDown33.Value, this.numericUpDown34.Value); config.GameMsgLayerFontShadow = this.checkBox2.Checked; config.GameMsgLayerTypeSpeed = (int)this.numericUpDown35.Value; config.GameMsgLayerBackgroundName = this.textBox6.Text; config.GameMsgLayerZ = (int)this.numericUpDown36.Value; // 选项页 config.GameBranchBackgroundNormal = this.textBox9.Text; config.GameBranchBackgroundOver = this.textBox10.Text; config.GameBranchH = (int)this.numericUpDown42.Value; config.GameBranchW = (int)this.numericUpDown43.Value; config.GameBranchFontSize = (int)this.numericUpDown44.Value; config.GameBranchFontName = this.textBox11.Text; config.GameBranchFontColor = String.Format("{0},{1},{2}", this.numericUpDown47.Value, this.numericUpDown46.Value, this.numericUpDown45.Value); config.GameBranchPadTop = (int)this.numericUpDown48.Value; config.GameBranchCount = (int)this.numericUpDown49.Value; config.GameBranchZ = (int)this.numericUpDown50.Value; // 音频页 config.GameMusicBGMVol = (int)this.numericUpDown37.Value; config.GameMusicBGSVol = (int)this.numericUpDown38.Value; config.GameMusicSEVol = (int)this.numericUpDown39.Value; config.GameMusicVocalVol = (int)this.numericUpDown40.Value; config.GameMusicBgsCount = (int)this.numericUpDown41.Value; config.GameMusicVocalPostfix = this.comboBox1.SelectedItem.ToString(); // 杂项页 config.GameMaxSwitchCount = (int)this.numericUpDown51.Value; // 角色页 List <string> charaList = new List <string>(); for (int i = 0; i < this.switchDataGridView.Rows.Count - 1; i++) { charaList.Add((string)this.switchDataGridView.Rows[i].Cells[0].Value); } Halation.project.CharacterList = charaList; // 关闭窗体 this.Close(); }
public ConsoleLogger(string prefix, ConfigPackage config) : base(System.Console.Out, prefix, config) { }
public TestClient(TestContext context, ConfigPackage config) { _context = context; ClientConfig = new ClientConfig(config, null, null); Configuration = config; }
public TestServer(TestContext context, ConfigPackage config) { _context = context; _servercfg = new SharedConfig(config); Configuration = config; }
/// ----------------------------------------------------------------------------- /// <summary> /// Constructeur /// </summary> /// <param name="config">la configuration</param> /// ----------------------------------------------------------------------------- public SharedConfig (ConfigPackage config) { if (config == null) return; ServiceUserName = config.Value(CfgServiceUsername, string.Empty); ServicePassword = config.Value(CfgServicePassword, string.Empty); ServiceProtocol = config.Value(CfgServiceProtocol, string.Empty); ServiceName = config.Value(CfgServiceName, string.Empty); ServicePort = config.ValueInt(CfgServicePort, 0); ServiceAddress = config.Value(CfgServiceAddress, string.Empty); ServiceCulture = config.Value(CfgServiceCulture, string.Empty); }