//九天到票检测 public static bool OverCheck(ref int s) { IntPtr hwnd = HwndUtil.FindWindow("WTWindow", null); if (hwnd == IntPtr.Zero) { s++; } else { s = 0; } if (s > 5) { if (MonitorCore.GetTaskCore().IsAutoVote) { AutoVote.AddVoteProjectNameDropedTemp(); } ConfigCore.WriteOver(); return(true); } return(false); }
public static TaskInfo Get() { Dictionary <int, TaskInfo> taskInfoDict = new Dictionary <int, TaskInfo>(); try { string taskInfos = ConfigCore.GetAutoVote("TaskInfos").Trim(); if (taskInfos.Length > 0) { string[] taskInfoArray = taskInfos.Split('|'); foreach (string taskInfo in taskInfoArray) { int key = int.Parse(taskInfo.Substring(0, taskInfo.IndexOf(":"))); string[] task = taskInfo.Substring(taskInfo.IndexOf(":") + 1).Split('-'); taskInfoDict.Add(key, new TaskInfo(task[0], double.Parse(task[1]))); } } } catch (Exception) { } if (taskInfoDict.ContainsKey(ConfigCore.Sort)) { return(taskInfoDict[ConfigCore.Sort]); } return(null); }
public static T CreateThingFromDAL <T>(ThingDAL thing) { Dictionary <string, string> parameters = new Dictionary <string, string>(); T configObj; foreach (ThingParameterDAL tpc in thing.Parameters) { parameters[tpc.Name] = tpc.Value; } //Set Node Identifier //TODO:: NODE parameters[ConfigCore.PARAMETER_NODE_ID] = thing.Node.UniqueIdentifier.ToString(); string configClassName = parameters[ConfigCore.PARAMETER_CONFIG_CLASS]; // String name = myType.FullName; // ServiceCore serviceObj = null; // new ServiceMQ(); //myObject = (MyAbstractClass)Activator.CreateInstance("AssemblyName", "TypeName"); //Type cls = Assembly.GetExecutingAssembly().GetType("HomeManager2.Shared.Config." + configClassName); Type cls = ConfigCore.GetConfigAssembly().GetType("ZoneGuard.Shared.Config." + configClassName); configObj = (T)Activator.CreateInstance(cls, parameters); /*if (configObj.GetType() == typeof(ConfigSensor)) * { * * * }*/ //configObj = new ConfigSensor(parameters); return(configObj); }
//启动程序,检查配置文件,启动主线程 private void Form1_Load(object sender, EventArgs e) { if (ConfigCore.InitConfig()) { MainStart(); } }
//点击启动 public void button1_Click(object sender, EventArgs e) { if (ConfigCore.InitConfig()) { MainStart(); } }
protected ThingCore(IManager manager) //, ILogger<ApplicationLifetimeHostedService> logger) { this.manager = manager; this.logger = manager.getLoggerFactory().CreateLogger(GetType().FullName); this.config = null; Activated = true; Initialize(); }
public async Task RodarOBotAsync() { _config = ConfigCore.LoadFromFile(EntrarPasta("") + "config.json"); if (_config == null) { Console.WriteLine("O arquivo config.json não existe!"); Console.WriteLine("Coloque as informações necessarias no arquivo gerado!"); Console.WriteLine("Aperte qualquer botão para sair..."); Console.ReadKey(); Environment.Exit(0); } DiscordConfiguration cfg = new DiscordConfiguration { #if DEBUG Token = _config.TokenTeste, #else Token = _config.Token, #endif TokenType = TokenType.Bot, ReconnectIndefinitely = true, GatewayCompressionLevel = GatewayCompressionLevel.Stream, AutoReconnect = true, #if DEBUG LogLevel = LogLevel.Debug, #else LogLevel = LogLevel.Info, #endif UseInternalLogHandler = true, }; ModuloCliente cliente = new ModuloCliente(cfg); string[] prefix = new string[1]; #if DEBUG prefix[0] = _config.PrefixTeste; #else prefix[0] = _config.Prefix; #endif ModuloComandos todosOsComandos = new ModuloComandos(new CommandsNextConfiguration { StringPrefixes = prefix, EnableDms = false, CaseSensitive = false, EnableDefaultHelp = false, EnableMentionPrefix = true, IgnoreExtraArguments = true, PrefixResolver = PrefixResolverCustomizado, }, ModuloCliente.Client); new ModuloBanco(); await ModuloBanco.CarregarItensAsync(); // await ModuloBanco.CarregarRegioesTrizbortAsync(); await ModuloCliente.Client.ConnectAsync(); await Task.Delay(-1); }
public ThingCore(ConfigCore config, IManager manager) //, ILogger<ApplicationLifetimeHostedService> logger) { this.manager = manager; this.logger = manager.getLoggerFactory().CreateLogger(GetType().FullName); this.config = config; Id = config.Id; Activated = true; Initialize(); }
//HY到票检测 public static bool OverCheck() { IntPtr hwnd = HwndUtil.FindWindow("#32770", "信息:"); if (hwnd != IntPtr.Zero) { HwndUtil.closeHwnd(hwnd); ConfigCore.WriteOver(); return(true); } return(false); }
//JZ到票检测 public static bool OverCheck() { IntPtr hwnd = HwndUtil.FindWindow("TMessageForm", null); if (hwnd != IntPtr.Zero) { HwndUtil.closeHwnd(hwnd); ConfigCore.WriteOver(); return(true); } return(false); }
public static void Set(Dictionary <int, TaskInfo> taskInfoDict) { string taskInfos = ""; foreach (int key in taskInfoDict.Keys) { taskInfos += string.Format("{0}:{1}-{2}|", key.ToString(), taskInfoDict[key].ProjectName, taskInfoDict[key].Price.ToString()); } if (taskInfos.Length > 0) { taskInfos = taskInfos.Substring(0, taskInfos.Length - 1); } ConfigCore.WriteAutoVote("TaskInfos", taskInfos); }
//MM到票检测 public static bool OverCheck() { IntPtr hwnd = HwndUtil.FindWindow(null, "投票软件提示"); if (hwnd != IntPtr.Zero) { if (MonitorCore.GetTaskCore().IsAutoVote) { AutoVote.AddVoteProjectNameDropedTemp(); } HwndUtil.closeHwnd(hwnd); ConfigCore.WriteOver(); return(true); } return(false); }
//终止监控线程 public static void MainClose() { if (This.InvokeRequired) { MainCloseDelegate d = new MainCloseDelegate(MainClose); This.Invoke(d, new object[] { }); } else { This.notifyIcon1.Icon = (Icon)Properties.Resources.ResourceManager.GetObject("stop"); ConfigCore.Cache(); This.timer1.Enabled = false; This.button2.Enabled = false; This.button1.Enabled = true; MonitorCore.Stop(); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //cors services.AddCors(options => { options.AddPolicy("AllowAllOrigin", builder => { builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().AllowCredentials(); }); }); services.AddMvc( options => { options.Filters.Add <ModelValidationActionFilter>(); } ).SetCompatibilityVersion(CompatibilityVersion.Version_2_1).AddJsonOptions(options => options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()); services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new Info { Version = "v1", Title = "PuppetCat.Sample.API" }); //Determine base path for the application. //var basePath = PlatformServices.Default.Application.ApplicationBasePath; //Set the comments path for the swagger json and ui. //var xmlPath = Path.Combine(basePath, "PuppetCat.Sample.API.xml"); //options.IncludeXmlComments(xmlPath); }); //context connection SampleDbContext.ConStr = Configuration.GetConnectionString("SampleConnection"); //AppSettings Section ConfigCore.SetAppSettings(Configuration.GetSection("AppSettings").Get <AppSettingsModel>()); //路由分发配置 DistributeRoute.DistributeRoutePath = ConfigCore.AppSettings.DistributeRoutePath; DistributeRoute.DistributeRouteIgnorePath = ConfigCore.AppSettings.DistributeRouteIgnorePath; }
public static ThingCore Create(ConfigCore config) { ThingCore obj = null; return(obj); }
//改变延时 private void textBox3_TextChanged(object sender, EventArgs e) { IniReadWriter.WriteIniKeys("Command", "gongxiang", textBox3.Text, ConfigCore.BaseConfig); ConfigCore.InitPathShare(); IniReadWriter.WriteIniKeys("Command", "gongxiang", textBox3.Text, ConfigCore.PathShareConfig); }