Example #1
0
        public FileWatcher()
        {
            Logger.LogInfo(this, "FileWatcher()");

            ConfigModule = ConfigurationContainer.Instance.GetConfigurationByModule("FileWatcher");
            int.TryParse(ConfigModule.GetValue("SLEEP_TIME_MS", "1000"), out TimerSleepTime);
            FolderToMonitor = ConfigModule.GetValue("PATH_MONITORED_FOLDER", AppDomain.CurrentDomain.BaseDirectory + "EVT");
        }
        static void Main(string[] args)
        {
            //Dictionary<string, string> data = new Dictionary<string, string>();
            //data.Add("Item1", "valor1");
            //data.Add("Item2", "valor2");
            //Console.WriteLine(JsonConvert.SerializeObject(data, Formatting.Indented));
            ////Console.WriteLine(Directory.GetCurrentDirectory());

            ConfigurationModule mod = ConfigurationContainer.Instance.GetConfigurationByModule("ConfigurationBase");
            string value1           = mod.GetValue("X", "0.5");
            string value2           = mod.GetValue("Y", "0.7");

            Console.WriteLine(Assembly.GetExecutingAssembly().CodeBase);
            Console.WriteLine(Assembly.GetExecutingAssembly().Location);
            Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory);

            Console.ReadKey();
        }
        public void Start()
        {
            Logger.LogInfo(this, "Start()");

            int.TryParse(ConfigModule.GetValue("BEAT_TIME_MS", "1000"), out int sleepTime);

            TickCount      = 0;
            ComponentTimer = new Timer(sleepTime)
            {
                AutoReset = true
            };
            ComponentTimer.Elapsed += new ElapsedEventHandler(TimerElapsed);
            ComponentTimer.Start();

            //OnNewComponentEvent(this, new ComponentEventArgs("Start()"));
        }
        //private static HttpWebRequest Request;
        //private static HttpClient Client = new HttpClient();

        //var client = new ClientWebSocket();

        public MessageSender()
        {
            ConfigModule   = ConfigurationContainer.Instance.GetConfigurationByModule("MessageSender");
            ServerEndPoint = ConfigModule.GetValue("ServerEndPoint");
            //await client.ConnectAsync(new Uri("ws://localhost:5000/ws"), CancellationToken.None);
        }