Exemple #1
0
        static int Main(string[] args)
        {
            return(Task.Run(async() =>
            {
                try
                {
                    var file = new FileInfo(args[0]);
                    if (file.Exists)
                    {
                        var json = await File.ReadAllTextAsync(file.FullName);
                        var config = JsonConvert.DeserializeObject <Config>(json);

                        if (config != null)
                        {
                            var keyStore = KeyStore.Restore <PublicSignedKeyStore>(config.account);
                            if (await keyStore.DecryptKeyAsync(config.password, true))
                            {
                                var client = new HeleusClient(new Uri(config.nodeurl));
                                if (await client.SetServiceAccount(keyStore, config.password, true))
                                {
                                    // test
                                    await FeedReader.ReadAsync(config.feedurl);
                                    var processor = new FeedProcessor(config.feedurl, client);

                                    while (true)
                                    {
                                        await processor.CheckFeed();
                                        await Task.Delay(TimeSpan.FromMinutes(1));
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine($"File does not exist {file.FullName}.");
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }

                return 0;
            }).Result);
        }
Exemple #2
0
 public FeedProcessor(string url, HeleusClient client)
 {
     _url    = url;
     _client = client;
 }