Beispiel #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            counter = int.Parse(SavingPlugin.GetVariable("counter", TypeCode.Int16, "awwdad").ToString());
            counter++;
            SavingPlugin.SaveVariable("counter", TypeCode.Int16, counter, "awwdad");

            string randomname = "code" + counter;

            Console.WriteLine(counter);
            SavingPlugin.SaveVariable(randomname, TypeCode.String, RandomString(6), "awwdad");
            // write lines of text to the file
            MessageBox.Show(SavingPlugin.GetVariable(randomname, TypeCode.String, "awwdad").ToString());
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                counters = int.Parse(SavingPlugin.GetVariable("counter", TypeCode.Int16, "awwdad").ToString());
            }
            catch
            {
                counters = 0;
                SavingPlugin.SaveVariable("counter", TypeCode.Int16, counters, "awwdad");
            }
            counters++;
            SavingPlugin.SaveVariable("counter", TypeCode.Int16, counters, "awwdad");

            string randomname = "code" + counters;

            SavingPlugin.SaveVariable(randomname, TypeCode.String, RandomString(6), "awwdad");
            // write lines of text to the file
            MessageBox.Show(SavingPlugin.GetVariable(randomname, TypeCode.String, "awwdad").ToString());
        }
Beispiel #3
0
        private void button9_Click(object sender, EventArgs e)
        {
            counter = int.Parse(SavingPlugin.GetVariable("counter", TypeCode.Int16, "awwdad").ToString());

            string varsovia = boxvf.Text;//"YVE4RS";
            int    default1 = 1;

            for (int i = 1; i <= counter; i++)
            {
                randomname = "code" + i;
                try
                {
                    if (varsovia == SavingPlugin.GetVariable(randomname, TypeCode.String, "awwdad").ToString() || varsovia == allowed)
                    {
                        default1          = 0;
                        boxvf.Text        = "";
                        button9.Visible   = false;
                        boxvf.Visible     = false;
                        numevf.Visible    = false;
                        button10.Visible  = true;
                        label4.Visible    = true;
                        label5.Visible    = true;
                        label6.Visible    = true;
                        textBox1.Visible  = true;
                        textBox2.Visible  = true;
                        textBox3.Visible  = true;
                        this.AcceptButton = button10;
                        break;
                    }
                }
                catch { }
            }
            if (default1 == 1)
            {
                MessageBox.Show("Incorect.");
            }
        }
Beispiel #4
0
        internal void Run()
        {
            // load configuration
            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.yml");
            var yaml = new YamlStream();

            yaml.Load(new StreamReader(path));
            var config = yaml.Documents[0].RootNode as YamlMappingNode;

            // use console logger temporarily while loading plugins
            Log = new Logger
            {
                Loggers = new[] { new ConsoleLogger() }
            };

            // load plugins
            var loader = new PluginLoader(config, Log, this);

            _loggingPlugins    = loader.GetPlugins <LoggingPlugin>();
            _postingPlugins    = loader.GetPlugins <PostingPlugin>();
            _publishingPlugins = loader.GetPlugins <PublishingPlugin>();
            _processingPlugins = loader.GetPlugins <ProcessingPlugin>();

            var saving = loader.GetPlugins <SavingPlugin>();

            if (saving.Length != 1)
            {
                throw new Exception("Must specify exactly one SavingPlugin");
            }
            _savingPlugin = saving.Single();

            // replace temporary console logger with actual logging plugins
            Log.Loggers = _loggingPlugins;

            // set up pings for posting plugins
            _timers = new Dictionary <Guid, Timer>();
            foreach (var plugin in _postingPlugins)
            {
                var id = Guid.NewGuid();
                if (plugin.PingInterval > 0)
                {
                    var timer = new Timer((s) =>
                    {
                        lock (_timerLock)
                        {
                            try
                            {
                                Log.Info(string.Format("Pinging plugin {0}", plugin.Name));
                                plugin.Ping();
                            }
                            catch (Exception ex)
                            {
                                Log.Error(string.Format("Error while pinging plugin {0}", plugin.Name), ex);
                            }
                        }
                        _timers[id].Change(plugin.PingInterval * 1000, Timeout.Infinite);
                    }, null, 0, Timeout.Infinite);
                    _timers.Add(id, timer);
                }
            }

            Log.Debug("Loaded plugins", new
            {
                posters    = _postingPlugins.Select(p => p.Name).ToArray(),
                publishers = _publishingPlugins.Select(p => p.Name).ToArray(),
                processors = _processingPlugins.Select(p => p.Name).ToArray(),
                saver      = _savingPlugin.Name,
                loggers    = _loggingPlugins.Select(p => p.Name).ToArray()
            });

            var forcePublish = Environment.GetEnvironmentVariable("PUBLISH");

            if (!string.IsNullOrEmpty(forcePublish))
            {
                Publish();
            }
        }