static public bool SetupConfigSystem(string configFilePath) { ModManager.ApplicationExit += ModManagerApplicationExit; LoggingManager.SendMessage("ConfigManager - Setting up config system..."); if (!File.Exists(configFilePath)) LoggingManager.SendMessage("ConfingManager - No plugins.config found, creating one from scratch"); s_sConfigFilePath = configFilePath; FileStream config = null; try { config = File.Open(configFilePath, FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read); s_pluginsConfig = XmlConfigReader.Read(config); } catch (Exception e) { LoggingManager.SendMessage("ConfigManager - Failed to set up config system from file: " + configFilePath); LoggingManager.HandleException(e); return false; } finally { if (config != null) config.Close(); } LoggingManager.SendMessage("ConfigManager - Config system set up successfully!"); return true; }
/// <summary> /// Create a IExitHook list from a class names list using the provided configuration and service /// </summary> /// <param name="hookClassNames"></param> /// <param name="settings"></param> /// <param name="service"></param> public HookRepository(String hookClassNames, XmlConfig.XmlConfig settings, IRunAsService service) { _hookClassNames = hookClassNames; _settings = settings; _service = service; Reset(); }
public RunAsService(XmlConfig.XmlConfig settings, HookRepository repository, CommandBuilder builder) { _repository = repository; _builder = builder; _settings = settings; InitProperties(); }
protected override void OnBeforeBuild() { XmlConfig = ResourceUtil.LoadAsXml(_resourceType, _resourcePath); XmlNsManager = new XmlNamespaceManager(XmlConfig.NameTable); XmlNsManager.AddNamespace(CONFIG_PREFIX, SMART_SQL_CONFIG_NAMESPACE); XmlConfigRoot = XmlConfig.SelectSingleNode($"/{CONFIG_PREFIX}:SmartSqlMapConfig", XmlNsManager); if (Logger.IsEnabled(LogLevel.Debug)) { Logger.LogDebug($"XmlConfigBuilder Build ->> ResourceType:[{_resourceType}] , Path :[{_resourcePath}] Starting."); } }
private XmlConfig loadXmlConfig(string file, XmlConfigMaker c, bool add = true) { string fullfile = Path.Combine(m_path, file); XmlConfig xml = c.loadFromFile(fullfile); if (xml != null && add) { m_allRes.Add(file, xml); } return(xml); }
public void TestNewPath() { Action act = () => XmlConfig.From(@"TestFileNewPath.xml"); act.Should().NotThrow(); var config = XmlConfig.From(@"TestFileNewPath.xml"); config.Write("Ajuste:Prueba", "Valor"); config.Read("Ajuste:Prueba").Should().Be("Valor"); }
public override void OnLevelLoaded(LoadMode mode) { if (mode == LoadMode.NewGame || mode == LoadMode.LoadGame) { XmlConfig.SafeLoad(); Debug.PrintMessage("Successfully loaded mod v" + Debug.GetVersion()); Debug.PrintMessage("The config file can be found at: " + Path.Combine(DataLocation.applicationBase, "EnhancedBuildingCapacityConfig.xml")); Patch.PatchEveryBuildingAI(); } }
private void DoCodeGen(string pdbFile, bool singleFileExport = true, bool compileWithRoslyn = true, bool transformations = true) { XmlConfig xmlConfig = GetXmlConfig(pdbFile); xmlConfig.SingleFileExport = singleFileExport; xmlConfig.GenerateAssemblyWithRoslyn = compileWithRoslyn; if (!transformations) { xmlConfig.Transformations = new XmlTypeTransformation[0]; } DoCodeGen(xmlConfig); }
public XmlConfig loadXmlConfig(string file, bool save = true) { XmlConfigMaker c = new XmlConfigMaker(); string fullfile = Path.Combine(m_path, file); XmlConfig xml = c.loadFromFile(fullfile); if (xml != null && save) { m_allRes.Add(file, xml); } return(xml); }
private static string SerializeXmlConfig() { var xmlConfig = new XmlConfig(); xmlConfig.Settings.Add(new ConfigSetting { Name = "Item1", Value = "Value1" }); xmlConfig.Settings.Add(new ConfigSetting { Name = "Item2", Value = "Value2" }); return(XmlConfig.Serialize(xmlConfig)); }
private void Login_Load(object sender, EventArgs e) { XmlConfig.getInstance().LoadConfig("ServerInfo.xml"); this.checkBoxSSL.Checked = (Convert.ToInt32(XmlConfig.getInstance().GetParam("server", "ssl", "1")) > 0); this.textBoxServerIP.Text = XmlConfig.getInstance().GetParam("server", "host", "localhost"); // "localhost"; this.textBoxPort.Text = XmlConfig.getInstance().GetParam("server", "port", "9443"); //"9443"; this.textBoxUser.Text = XmlConfig.getInstance().GetParam("server", "user", "admin"); //"admin"; this.textBoxPass.Text = XmlConfig.getInstance().GetParam("server", "pass", ""); //""; _reqSession = new WebRequestSession(); }
public void InitCompiler() { XmlConfig runSourceConfig = GetRunSourceConfig(); CompilerManager.Current.Init(runSourceConfig.GetConfigElementExplicit("CompilerConfig")); CompilerManager.Current.AddCompiler("CSharp1", () => new CSharp1Compiler()); CompilerManager.Current.AddCompiler("CSharp5", () => new CSharp5Compiler(CompilerManager.Current.FrameworkDirectories, CompilerManager.Current.MessageFilter)); CompilerManager.Current.AddCompiler("JScript", () => new JScriptCompiler()); //_resourceCompiler = new ResourceCompiler(CompilerManager.Current.ResourceCompiler); //RunSourceInitEndMethods_v2.TraceRunOnce = runSourceConfig.Get("TraceInitEndOnceMethods").zTryParseAs(false); //RunSourceInitEndMethods_v2.TraceRunAlways = runSourceConfig.Get("TraceInitEndAlwaysMethods").zTryParseAs(false); }
public XmlConfigBuilder(ResourceType resourceType, string resourcePath, ILoggerFactory loggerFactory = null) { _resourceType = resourceType; _resourcePath = resourcePath; _loggerFactory = loggerFactory ?? NullLoggerFactory.Instance; Logger = _loggerFactory.CreateLogger <XmlConfigBuilder>(); XmlConfig = ResourceUtil.LoadAsXml(resourceType, resourcePath); XmlNsManager = new XmlNamespaceManager(XmlConfig.NameTable); XmlNsManager.AddNamespace(CONFIG_PREFIX, SMART_SQL_CONFIG_NAMESPACE); XmlConfigRoot = XmlConfig.SelectSingleNode($"/{CONFIG_PREFIX}:SmartSqlMapConfig", XmlNsManager); SmartSqlConfig = new SmartSqlConfig(); }
/// <seealso cref="Parser.GetInstallSteps()" /> public override IList <InstallStep> GetInstallSteps() { var xndGroups = XmlConfig.SelectSingleNode("/config/optionalFileGroups"); var lstGroups = loadGroupedPlugins(xndGroups); var lstSteps = new List <InstallStep>(); if (lstGroups.Count > 0) { lstSteps.Add(new InstallStep(null, null, lstGroups)); } return(lstSteps); }
public void InvalidFileTransfer() { var iniCio = IniConfig.From("TestFile.ini"); Action act = () => iniCio.TransferTo(HJsonConfig.From("Incorrecto.json")); //act.Should().Throw<InvalidFileFormatException>(); New version allows any file format act.Should().NotThrow(); act = () => iniCio.TransferTo(XmlConfig.From("Incorrecto.txt")); //act.Should().Throw<InvalidFileFormatException>(); New version allows any file format act.Should().NotThrow(); }
private static DebridLinkFr_v3 CreateDebridLinkFr(XmlConfig config) { DebridLinkFr_v3 debrider = new DebridLinkFr_v3(); XmlConfig localConfig = config.GetConfig("LocalConfig"); debrider.Login = localConfig.GetExplicit("DownloadAutomateManager/DebridLink/Login"); debrider.Password = localConfig.GetExplicit("DownloadAutomateManager/DebridLink/Password"); debrider.PublicKey = localConfig.GetExplicit("DownloadAutomateManager/DebridLink/PublicKey"); debrider.ConnexionLifetime = DebridLinkFr_v3.GetConnexionLifetime(localConfig.GetExplicit("DownloadAutomateManager/DebridLink/ConnexionLifetime")); debrider.ConnexionFile = config.GetExplicit("DebridLink/ConnexionFile"); //debrider.ServerTimeFile = XmlConfig.CurrentConfig.GetExplicit("DebridLink/ServerTimeFile"); return(debrider); }
public Backup() { gTaskName = "Backup"; gTaskTrace = Trace.CurrentTrace; gConfig = new XmlConfig(); //string sPath = gConfig.Get("Backup/Log"); //if (sPath != null) // gTaskTrace.SetLogFile(sPath, LogOptions.IndexedFile); gTaskTrace.SetWriter(gConfig.Get("Backup/Log"), gConfig.Get("Backup/Log/@option").zTextDeserialize(FileOption.None)); gTaskProgress = new Progress(); gTaskProgressDetail = new Progress(); }
public XmlConfig GetProjectConfig() { if (_projectConfig == null && _projectFile != null && zFile.Exists(_projectFile)) { _projectConfig = new XmlConfig(_projectFile); } else if (_projectConfig != null && _refreshProjectConfig) { _projectConfig.Refresh(); } _refreshProjectConfig = false; return(_projectConfig); }
/// <summary> /// 获取配置文件(Wbm.TencV2.config)的api节点 /// </summary> /// <param name="cfgApiNodeName">api子节点的Name</param> /// <returns></returns> public static string GetConfigAPI(string cfgApiNodeName) { string xpath = CONFIG_ROOT + CONFIG_API + "/" + cfgApiNodeName.Trim('/'); if (XmlConfig.IsExists(xpath) && !string.IsNullOrEmpty(XmlConfig.SelectSingleNodeText(xpath))) { return(XmlConfig.SelectSingleNodeText(xpath)); } else { throw new ArgumentNullException(string.Format("{0}节点:找不到该节点或该值为空", xpath)); } }
private Dictionary <string, string> GetSettings() { Dictionary <string, string> retVal = new Dictionary <string, string>(); foreach (XmlAttribute attr in XmlConfig.SelectSingleNode("/autoNode").Attributes) { retVal.Add(attr.Name, attr.Value); } _settings = retVal; return(retVal); }
public void ActivateProfile(Profile profile) { DefaultProfileId = profile.ProfileId; CurrentProfile = profile; foreach (Profile otherProfile in Profiles) { otherProfile.Active = false; } profile.Active = true; XmlConfig.Save(PROFILES_XML); }
public CompilerProjectReader GetProjectCompilerProject() { XmlConfig config = GetProjectConfig(); if (config != null) { return(CompilerProjectReader.Create(GetProjectConfig().GetConfigElementExplicit("/AssemblyProject"))); } else { return(null); } }
internal static IEnumerable <string> AllUsers() { var path = Path.Combine(DressingRoom.AppDirectory, "Vestis"); path = Path.Combine(path, "GlobalSettings.xml"); var config = XmlConfig.From(path); foreach (var profile in config.SettingsIn("UserProfiles")) { yield return(profile.Key); } }
public static QpConnectionInfo GetConnectionInfo(string customerCode, string appName = "QP8Backend") { if (!String.IsNullOrWhiteSpace(customerCode)) { string connectionString; DatabaseType dbType = default(DatabaseType); if (ConfigServiceUrl != null && ConfigServiceToken != null) { var service = new CachedQPConfigurationService(ConfigServiceUrl, ConfigServiceToken, Options.QpConfigPollingInterval); var customer = AsyncHelper.RunSync(() => service.GetCustomer(customerCode)); // TODO: handle 404 if (customer == null) { throw new Exception($"Данный customer code: {customerCode} - отсутствует в конфиге"); } connectionString = customer.ConnectionString; dbType = (DatabaseType)(int)customer.DbType; } else { XElement customerElement = XmlConfig .Descendants("customer") .SingleOrDefault(n => n.Attribute("customer_name")?.Value == customerCode); if (customerElement == null) { throw new Exception($"Данный customer code: {customerCode} - отсутствует в конфиге"); } connectionString = customerElement.Element("db")?.Value; var dbTypeString = customerElement.Attribute("db_type")?.Value; if (!string.IsNullOrEmpty(dbTypeString) && Enum.TryParse(dbTypeString, true, out DatabaseType parsed)) { dbType = parsed; } } if (!String.IsNullOrEmpty(connectionString)) { connectionString = TuneConnectionString(connectionString, appName, dbType); return(new QpConnectionInfo(connectionString, dbType)); } } return(null); }
public override void saveClickData() { RFCLICK click = new RFCLICK(); click.tm = Time.DateTime2DbTime(System.DateTime.Now); if (0 == g_nRecords) { click.numJmp = click.contJmp = 1; clickPoint.Clear(); contAndDailyTime.contJumpTime = click.tm; XmlConfig.writeContStartTime(contAndDailyTime.contJumpTime.ToString()); //初始化配置参数 } else { if (!IsSameWorkDay(click.tm, g_pList[g_nRecords - 1].tm)) { click.numJmp = 1; contAndDailyTime.numJumpTime = click.tm; XmlConfig.writeDailyStartTime(click.tm.ToString()); if (difftime(click.tm, g_pList[g_nRecords - 1].tm) > 24 * 3600) { contAndDailyTime.numJumpTime = click.tm; XmlConfig.writeDailyStartTime(click.tm.ToString()); contAndDailyTime.contJumpTime = click.tm; XmlConfig.writeContStartTime(contAndDailyTime.contJumpTime.ToString()); click.contJmp = 1; clickPoint.Clear(); //清空配置文件 } else { click.contJmp = g_pList[g_nRecords - 1].contJmp + 1; } } else { click.numJmp = g_pList[g_nRecords - 1].numJmp + 1; click.contJmp = g_pList[g_nRecords - 1].contJmp + 1; } } g_pList[g_nRecords].tm = click.tm; g_pList[g_nRecords].numJmp = click.numJmp; g_pList[g_nRecords].contJmp = click.contJmp; ++g_nRecords; //写入数据库 CSQLite.G_CSQLite.InertRainToDB(click); OneMinuteIsThan40(click.tm); }
public static void LoadSettings() { m_config = new XmlConfig(ConfigPath); m_config.AddAssembly(typeof(Settings).Assembly); if (!File.Exists(ConfigPath)) { m_config.Create(); } else { m_config.Load(); } }
public override void initService() { XmlConfig xml = ResMgr.getInstance().getRes("dbserver.xml"); m_httpMonitor = xml.getString("httpMonitor", ""); initState(); m_orderMgr = new OrderMgr(); m_orderMgr.init(); m_threadWork = new Thread(new ThreadStart(run)); m_threadWork.Start(); }
public void StartAssemblyResolve() { XmlConfig config = GetRunSourceConfig(); if (config != null) { AssemblyResolve.TraceAssemblyResolve = config.Get("TraceAssemblyResolve").zTryParseAs(false); //AssemblyResolve.TraceAssemblyLoad = config.Get("TraceAssemblyLoad").zTryParseAs(false); //AssemblyResolve.UpdateAssembly = config.Get("UpdateAssembly").zTryParseAs(false); ; //AssemblyResolve.UpdateSubDirectory = config.Get("UpdateAssemblySubDirectory", AssemblyResolve.UpdateSubDirectory); ; //AssemblyResolve.TraceUpdateAssembly = config.Get("TraceUpdateAssembly").zTryParseAs(false); } AssemblyResolve.Start(); }
public void TestDeleteSectionNewFormat() { var config = XmlConfig.From(@"TestNewFormat.xml"); config.Write("SectionToDelete:Key1", "Foo"); config.Write("SectionToDelete:Key2", "Bar"); Action act = () => config.DeleteSection("SectionToDelete"); act.Should().NotThrow(); config.Read("SectionToDelete:Key1").Should().Be(null); config.Read("SectionToDelete:Key2").Should().Be(null); }
public void TestSettingsInSectionNewFormat() { var config = XmlConfig.From(@"TestNewFormat.xml"); IDictionary <string, string> settings = null; Action act = () => settings = config.SettingsIn("Categoria"); act.Should().NotThrow(); settings.Should().HaveCountGreaterOrEqualTo(2); settings.Should().ContainKeys("SubClave", "Comentada"); settings.Should().ContainValue("1"); settings.Should().NotContainKeys("ClaveSinCategoria", "Doble"); }
public void PatternConverterProperties() { XmlDocument log4netConfig = new XmlDocument(); log4netConfig.LoadXml(@" <Soyo.Base.Log> <appender name=""PatternStringAppender"" type=""UnitTest.Base.Log.PatternStringAppender""> <layout type=""Soyo.Base.Text.LayoutLoggerSimple"" /> <setting> <converter> <name value=""propertyKeyCount"" /> <type value=""UnitTest.Base.Log.PropertyKeyCountPatternConverter"" /> <property> <key value=""one-plus-one"" /> <value value=""2"" /> </property> <property> <key value=""two-plus-two"" /> <value value=""4"" /> </property> </converter> <pattern value=""%propertyKeyCount"" /> </setting> </appender> <root> <level value=""ALL"" /> <appender-ref ref=""PatternStringAppender"" /> </root> </Soyo.Base.Log>"); ILoggerController rep = LogManager.CreateController(Guid.NewGuid().ToString()); XmlConfig.Config(rep, log4netConfig["Soyo.Base.Log"]); ILog log = LogManager.Get(rep.Name, "PatternConverterProperties"); log.Debug("Message"); PropertyKeyCountPatternConverter converter = PropertyKeyCountPatternConverter.MostRecentInstance; Assert.AreEqual(2, converter.PropertySet.Count); Assert.AreEqual("4", converter.PropertySet["two-plus-two"]); PatternStringAppender appender = (PatternStringAppender)LogManager.GetController(rep.Name).AppenderSet[0]; Assert.AreEqual("2", appender.Setting.Format()); }
protected void Page_Load(object sender, EventArgs e) { RightMgr.getInstance().opCheck("", Session, Response); if (!IsPostBack) { m_queryWay.Items.Add("通过账号查询"); m_queryWay.Items.Add("通过玩家id查询"); XmlConfig xml = ResMgr.getInstance().getRes("money_reason.xml"); if (xml != null) { m_filter.Items.Add(new ListItem("全部", "0")); m_filter.Items.Add(new ListItem(xml.getString(36.ToString(), ""), "36")); m_filter.Items.Add(new ListItem(xml.getString(21.ToString(), ""), "21")); /*int i = 1; * for (; i < (int)PropertyReasonType.type_max; i++) * { * m_filter.Items.Add(xml.getString(i.ToString(), "")); * }*/ } // m_property.Items.Add("全部"); //m_property.Items.Add("金币"); // m_property.Items.Add("礼券"); m_whichGame.Items.Add(new ListItem("全部", ((int)GameId.gameMax).ToString())); for (int i = 0; i < StrName.s_gameList.Count; i++) { GameInfo info = StrName.s_gameList[i]; m_whichGame.Items.Add(new ListItem(info.m_gameName, info.m_gameId.ToString())); } // m_whichGame.SelectedIndex = m_whichGame.Items.Count - 1; if (m_gen.parse(Request)) { m_param.Text = m_gen.m_param; m_queryWay.SelectedIndex = m_gen.m_way; __time__.Text = m_gen.m_time; m_filter.SelectedIndex = m_gen.m_filter; // m_property.SelectedIndex = m_gen.m_property; // m_range.Text = m_gen.m_range; m_whichGame.SelectedIndex = m_gen.m_gameId; onQuery(null, null); } } }
private static async Task <IHostBuilder> ConfigureServicesAsync(IConfiguration configuration, string[] args) { var connectionstring = configuration.GetConnectionString("ContractConnectionString"); // Run with console or service var asService = !(Debugger.IsAttached || args.Contains("--console")); var builder = new HostBuilder() .ConfigureServices((hostContext, services) => { services.AddHostedService <XmlService>(); var serviceCollection = services.AddDbContext <ContractDbContext>(options => options.UseDatabase(SupportedDatabase.SqlServer, connectionstring)); services.AddSingleton <IContractRepository, ContractRepository>(); var config = new XmlConfig(); configuration.GetSection("XmlConfiguration").Bind(config); services.AddSingleton(config); var serviceProvider = services.BuildServiceProvider(); using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { var contextService = serviceScope.ServiceProvider.GetService <ContractDbContext>(); if (contextService.AllMigrationsApplied()) { contextService.EnsureMigrated(); } } }); builder.UseEnvironment(asService ? EnvironmentName.Production : EnvironmentName.Development); if (asService) { Console.WriteLine("as Service"); await builder.RunAsServiceAsync(); } else { Console.WriteLine("as Console"); await builder.RunConsoleAsync(); } return(builder); }
protected override bool Configure(XmlConfig.XmlConfig settings) { String timesStr = settings.GetItem("restart/times").Value; if (!String.IsNullOrEmpty(timesStr)) { if (!Int32.TryParse(timesStr, out _remainingTimes)) { Log.Warn("Cannot limit the number of restart: the times property is not well defined."); return false; } } return true; }
public XmlConfigNode(XmlConfigNode parent, string name) { _parent = parent; _name = name; if (parent == null) { _fullpath = string.Empty; _doc = (this as XmlConfig); } else { _doc = parent._doc; parent._nodes.Add (this); if (_parent._fullpath.Length > 0) _fullpath = _parent._fullpath + PathSeparatorChar + name; else _fullpath = name; } }
public bool Init(XmlConfig.XmlConfig settings, IRunAsService service) { if (settings == null) { throw new ArgumentNullException("settings"); } if (service == null) { throw new ArgumentNullException("service"); } Service = service; Initialized = Configure(settings); return Initialized; }
static void LoadConfig(XmlConfig config, out ECKeyPair privateKey) { bool saveFlag = false; config.Define<int> (CONFIG_BIND_PORT, IntParser.Instance, new IntRangeValidator (1, ushort.MaxValue), 8080); config.Define<byte[]> (CONFIG_PRIVATE_KEY, BinaryParser.Instance, null, null); config.Define<string> (CONFIG_HOST, StringParser.Instance, null, string.Empty); try { if (File.Exists (CONFIG_PATH)) config.Load (CONFIG_PATH); } catch { saveFlag = true; } byte[] raw = config.GetValue<byte[]> (CONFIG_PRIVATE_KEY); while (true) { if (raw == null || raw.Length == 0) { privateKey = ECKeyPair.Create (DefaultAlgorithm.ECDomainName); config.SetValue<byte[]> (CONFIG_PRIVATE_KEY, privateKey.PrivateKey, false); saveFlag = true; } else { privateKey = ECKeyPairExtensions.CreatePrivate (raw); if (privateKey.DomainName != DefaultAlgorithm.ECDomainName) { raw = null; continue; } } break; } if (config.GetValue<string> (CONFIG_HOST).Length == 0) { config.SetValue<string> (CONFIG_HOST, "localhost", false); saveFlag = true; } if (saveFlag) config.Save (CONFIG_PATH); }
public static void LoadFromConfig(WorkItem workItem, ToolStripPanel toolStripPanel, XmlDocument doc) { XmlConfig xcfg = new XmlConfig(doc); ConfigSetting newplugin = xcfg.Settings["toolstrips"]; foreach (ConfigSetting setting in newplugin.Children()) { if (setting.Name.Contains("comment")) continue; MenuItemElement menuItem = new MenuItemElement(); menuItem.CommandName = setting["commandname"].Value; menuItem.Icon = setting["icon"].Value; menuItem.Label = setting["label"].Value; menuItem.ID = setting["id"].Value == "" ? 0 : Convert.ToInt32(setting["id"].Value); menuItem.Key = setting["key"].Value; menuItem.IsContainer = setting["iscontainer"].Value == "" ? false : true; menuItem.Site = setting["site"].Value; ProcessConfigItem(workItem, toolStripPanel, menuItem); } }
protected override bool Configure(XmlConfig.XmlConfig settings) { String rootXPath = string.Format("email{0}smtp{0}", XmlConfig.XmlConfig.XPathSeparator); String host = settings.GetItem(rootXPath + "host").Value; String port = settings.GetItem(rootXPath + "port").Value; String login = settings.GetItem(rootXPath + "login").Value; String password = settings.GetItem(rootXPath + "password").Value; // smtp client is mandatory! if (!CreateSmtpClient(host, port, login, password)) { return false; } rootXPath = string.Format("email{0}address{0}", XmlConfig.XmlConfig.XPathSeparator); String toAddress = settings.GetItem(rootXPath + "to").Value; String fromAddress = settings.GetItem(rootXPath + "from").Value; rootXPath = string.Format("email{0}subject", XmlConfig.XmlConfig.XPathSeparator); String subject = settings.GetItem(rootXPath).Value; String executable = settings.GetItem("executable").Value; // message is mandatory too! return PrepareMessage(toAddress, fromAddress, subject, executable, Service.DisplayName); }
private void DoCodeGen(XmlConfig xmlConfig) { TextWriter error = Console.Error; try { using (StringWriter writer = new StringWriter()) { Console.SetError(writer); Task mtaTask = new Task(() => { Generator.Generate(xmlConfig); }); mtaTask.Start(); mtaTask.Wait(); writer.Flush(); string errorText = writer.GetStringBuilder().ToString(); if (!string.IsNullOrEmpty(errorText)) throw new Exception(errorText); } } finally { Console.SetError(error); } }
public void ImportXml(string xmlFile, XmlConfig xmlCfg) { _SqlEngine.ImportXml(xmlFile, xmlCfg); }
public int ImportXml(string xmlFile, XmlConfig xmlCfg) { return 0; }
public static bool LoadConfig(XmlConfig config) { bool exists = false; config.Define<int> (ConfigFields.NetBindUdp, IntParser.Instance, new IntRangeValidator (1, ushort.MaxValue), new Random ().Next (49152, ushort.MaxValue)); config.Define<int> (ConfigFields.NetBindTcp, IntParser.Instance, new IntRangeValidator (1, ushort.MaxValue), config.GetValue<int> (ConfigFields.NetBindUdp)); config.Define<int> (ConfigFields.GwBindTcp, IntParser.Instance, new IntRangeValidator (1, ushort.MaxValue), 8080); config.Define<bool> (ConfigFields.GwBindAny, BooleanParser.Instance, null, false); try { exists = File.Exists (CONFIG_PATH); if (exists) config.Load (CONFIG_PATH); } catch {} config.Save (CONFIG_PATH); return exists; }
static void Main(string[] args) { XmlConfig config = new XmlConfig (); ECKeyPair privateKey; LoadConfig (config, out privateKey); SimpleCaptcha captcha = new SimpleCaptcha (new ECDSA (privateKey), 4); CaptchaApp app = new CaptchaApp (captcha, privateKey, config.GetValue<string> (CONFIG_HOST), (ushort)config.GetValue<int> (CONFIG_BIND_PORT), "templates/captcha-server.xsl"); using (IHttpServer server = HttpServer.CreateEmbedHttpServer (app, null, true, false, true, config.GetValue<int> (CONFIG_BIND_PORT), 64)) { Console.WriteLine ("Captcha Authentication Server is Running..."); Console.WriteLine ("Press enter key to exit"); Console.ReadLine (); } }
/// <summary> /// Configure the hook with available settings /// </summary> /// <param name="settings">the available settings (can't be null)</param> /// <returns>true if the hook is well configured, false is probably due to a missing/Wrong setting</returns> protected abstract bool Configure(XmlConfig.XmlConfig settings);
protected override bool Configure(XmlConfig.XmlConfig settings) { return true; }