Beispiel #1
0
        private void btGen_Click(object sender, EventArgs e)
        {
            if (tbID.Text.IsEmpty()) {
                new Exception("Enter Profile ID").ShowError(this);
                tbID.Focus();
                return;
            }

            if (apikey.Text.IsEmpty() && Program.OAuth2 == null) {
                new Exception("Enter your simple API key").ShowError(this);
                return;
            }

            using (var sc = new StateControl()) {
                sc.Dock = DockStyle.Fill;
                //tableLayoutPanel1.Controls.Remove(apip);
                tableLayoutPanel1.Controls.Add(sc, 1, 5);
                Application.DoEvents();

                btGen.Enabled = false;
                try {

                    Visualizers.Types flags = Visualizers.Types.None;

                    var filenames = new Dictionary<Visualizers.Types, string>();

                    var controls = groupBox1.Controls.OfType<OutFilePanel>().Where(x => x.Checked);

                    foreach (var cont in controls) {
                        if (cont.Tag is Visualizers.Types) {
                            var key = (Visualizers.Types)cont.Tag;

                            if (cont.Checked) {
                                flags = flags | key;
                                filenames[key] = cont.FileName;
                                if (File.Exists(cont.FileName))
                                    File.Delete(cont.FileName);
                            }
                        }
                    }

                    if (filenames.Count < 1)
                        return;

                    Generate(tbID.Text, sc, flags, filenames);
                }
                finally {
                    btGen.Enabled = true;
                    tableLayoutPanel1.Controls.Remove(sc);
                    //tableLayoutPanel1.Controls.Add(apip, 1, 3);
                }
            }
        }
Beispiel #2
0
        private void Generate(string idProfile, StateControl sc, Visualizers.Types flags, Dictionary<Visualizers.Types, string> filenames)
        {
            var sett = new GeneratorSetting() {
                ProfileID = /*"101113754039426612780"*/idProfile,
                Rules = rules,
                VisLogs = (Visualizers.Types)flags,
                LogFiles = filenames,
                Methods = new Dictionary<Visualizers.Types, GeneratorLogsMeth> {
                    //UD
                    {Visualizers.Code_swarm, UDGenerator.LogGen},
                    {Visualizers.Gource, Generator.LogGen},
                    {Visualizers.Logstalgia, Generator.LogGen},
                    {Visualizers.Gephi, Generator.LogGen},
                },
                MaxResults = Convert.ToInt32(nudMaxRes.Value),
                MaxComments = Convert.ToInt32(nudMaxComment.Value),
                MaxPluses = Convert.ToInt32(nudMaxPlus.Value),
                MaxReshares = Convert.ToInt32(nudMaxReshare.Value),
                Deep = checkBox1.Checked ? Convert.ToInt32(nudDeep.Value) : 0
            };

            //UD
            if (checkBox2.Checked) {
                new FollowersGenerator(apikey.Text, sc).Run(sett);
            }
            else {
                if (checkBox1.Checked)
                    (Program.OAuth2 != null ? new RGenerator(Program.OAuth2, sc) : new RGenerator(apikey.Text, sc)).Run(sett);
                else
                    (Program.OAuth2 != null ? new RGenerator(Program.OAuth2, sc) : new Generator(apikey.Text, sc)).Run(sett);
            }
        }