Ejemplo n.º 1
0
        //九天到票检测
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 //启动程序,检查配置文件,启动主线程
 private void Form1_Load(object sender, EventArgs e)
 {
     if (ConfigCore.InitConfig())
     {
         MainStart();
     }
 }
Ejemplo n.º 5
0
 //点击启动
 public void button1_Click(object sender, EventArgs e)
 {
     if (ConfigCore.InitConfig())
     {
         MainStart();
     }
 }
Ejemplo n.º 6
0
        protected ThingCore(IManager manager) //, ILogger<ApplicationLifetimeHostedService> logger)
        {
            this.manager = manager;
            this.logger  = manager.getLoggerFactory().CreateLogger(GetType().FullName);
            this.config  = null;
            Activated    = true;

            Initialize();
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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();
        }
Ejemplo n.º 9
0
        //HY到票检测
        public static bool OverCheck()
        {
            IntPtr hwnd = HwndUtil.FindWindow("#32770", "信息:");

            if (hwnd != IntPtr.Zero)
            {
                HwndUtil.closeHwnd(hwnd);
                ConfigCore.WriteOver();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 10
0
        //JZ到票检测
        public static bool OverCheck()
        {
            IntPtr hwnd = HwndUtil.FindWindow("TMessageForm", null);

            if (hwnd != IntPtr.Zero)
            {
                HwndUtil.closeHwnd(hwnd);
                ConfigCore.WriteOver();
                return(true);
            }

            return(false);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        //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);
        }
Ejemplo n.º 13
0
 //终止监控线程
 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();
     }
 }
Ejemplo n.º 14
0
        // 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;
        }
Ejemplo n.º 15
0
        public static ThingCore Create(ConfigCore config)
        {
            ThingCore obj = null;

            return(obj);
        }
Ejemplo n.º 16
0
 //改变延时
 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);
 }