public static bool RegisterEmail(string userEmail, long userId, string activateCode, out string message) { string activateUrl = $"api/v1/user/ActivateEmailUser?"; string apiHost; ParseConfig.ParseInfo("DeploySystem\\ApiHost", out apiHost); string registerTemplate = File.ReadAllText(@"wwwroot/EmailTemplate/RegisterTemplate.html"); string body = registerTemplate. Replace("[UserEmail]", userEmail). Replace("[ApiHost]", apiHost). Replace("[ApiAddress]", activateUrl). Replace("[ActivateParameter]", $"userId={userId}&secret={activateCode}"). Replace("[ActivateRandom]", Guid.NewGuid().ToString()); EmailMsg msg = new EmailMsg(userEmail, "Register new account activate email", body); //同步发送邮件 bool result = msg.Send(out message); return(result); //异步邮件 //msg.SendEmailByThread(); //message = string.Empty; //return true; }
private bool IsEnableInviteCode() { string msg = ""; ParseConfig.ParseInfo("EnableInviteCode", out msg); bool result = Convert.ToBoolean(msg); return(result); }
public RedisInstance() { string redisServer, dbName; ParseConfig.ParseInfo("RedisConfig\\Redis_Default\\Connection", out redisServer); ParseConfig.ParseInfo("RedisConfig\\Redis_Default\\DataBase", out dbName); _connStr = string.Format("{0}, {1}", redisServer, dbName); _conn = ConnectionMultiplexer.Connect(_connStr); redlock = new Redlock(_conn); }
private RedisScript() { //获取配置参数 string redisHost, redisPwd, dbName; ParseConfig.ParseInfo("RedisConfig\\Redis_Engine\\Connection", out redisHost); ParseConfig.ParseInfo("RedisConfig\\Redis_Engine\\Password", out redisPwd); ParseConfig.ParseInfo("RedisConfig\\Redis_Engine\\DataBase", out dbName); Host = redisHost; Password = redisPwd; Client = ConnectionMultiplexer.Connect($"{Host}, password={Password}, allowAdmin = true"); }
public StatusUpdateJob() { logger = new Logger <CurrencyJob>(new LoggerFactory().AddConsole()); string value = ""; bool result = ParseConfig.ParseInfo("ServicesUrl\\ProjectService", out value); if (result) { var baseService = new BaseService(value); Channel = baseService.Channel; Client = new AutoJobService.AutoJobServiceClient(Channel); } else { Channel = null; } }
public static MsgConfig GetMsgConfig() { MsgConfig config = new MsgConfig(); string message = ""; bool result = false; //Enable Info if (result = ParseConfig.ParseInfo("MsgConfig\\Enable", out message)) { //config.EnableMsg = (message.Trim().ToLower() =="true") ? true : false; config.EnableMsg = Convert.ToBoolean(message); } else { config.EnableMsg = false; } //Url Info if (result = ParseConfig.ParseInfo("MsgConfig\\MsgUrl", out message)) { config.ServiceUrl = message; } //Account Info if (result = ParseConfig.ParseInfo("MsgConfig\\Account", out message)) { config.Account = message; } //Password Info if (result = ParseConfig.ParseInfo("MsgConfig\\Password", out message)) { config.Password = message; } //Sender Info if (result = ParseConfig.ParseInfo("MsgConfig\\Sender", out message)) { config.Sender = message; } //Message Count Limit if (result = ParseConfig.ParseInfo("MsgConfig\\MsgLimit", out message)) { config.MsgLimit = Int32.Parse(message); } return(config); }
public static void Main(string[] args) { string platform = ""; string portStr = ""; bool platformResult = ParseConfig.ParseInfo("DeploySystem\\Platform", out platform); bool portResult = ParseConfig.ParseInfo("DeploySystem\\Port", out portStr); var logger = new Logger <Program>(new LoggerFactory().AddConsole()); if (platformResult && portResult) { IWebHost host; if ("WIN".Equals(platform)) { host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup <Startup>() .UseApplicationInsights() .Build(); //Console.WriteLine("Api service is launched at Windows. "); logger.LogInformation("Api service is launched at Windows."); } else if ("LINUX".Equals(platform)) { if (ValidateHelper.IsInt32Value(portStr)) { int port = int.Parse(portStr); port = port == 0 ? 80 : port; host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup <Startup>() .UseUrls("http://0.0.0.0:" + port) .UseApplicationInsights() .Build(); //Console.WriteLine("Api service is launched at Linux. "); logger.LogInformation("Api service is launched at Linux."); } else { //Console.Error.WriteLine("Server config error: port config error."); logger.LogError("Server config error: port config error."); return; } } else { //Console.Error.WriteLine("Server config error: unsupported platform config."); logger.LogError("Server config error: unsupported platform config."); return; } host.Run(); } else { //Console.Error.WriteLine("Server config error: without platform config."); logger.LogError("Server config error: without platform config."); return; } }