Example #1
0
        public static PSettings GetSettings(string file, bool files = true)
        {
            dynamic json = "";

            if (files)
            {
                json = JsonConvert.DeserializeObject(File.ReadAllText(file));
            }
            else
            {
                json = JsonConvert.DeserializeObject(file);
            }
            PSettings p = new PSettings
            {
                Name         = json.Name,
                Author       = json.Author,
                Threads      = json.Threads,
                Capture      = json.Capture,
                FileName     = json.FileName,
                FileOutput   = json.FileOutput,
                ConsoleColor = json.Color,
                requests     = ConfigPasser(json)
            };

            return(p);
        }
Example #2
0
        public List <IPlugin> GetPlugins()
        {
            List <IPlugin>  plug = new List <IPlugin>();
            WebClient       wc   = new WebClient();
            MatchCollection mc   = Regex.Matches(wc.DownloadString("http://auth.xpolish.pl/MailRefresher/configs/"), "unknown\"> <a href=\"([^\"]*)");

            foreach (Match m in mc)
            {
                try
                {
                    var plugin = new Container(PSettings.GetSettings(wc.DownloadString("http://auth.xpolish.pl" + m.Groups[1].Value), false));
                    plug.Add(plugin);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error parsing config:\r\n============================\r\n" +
                                    "Mesage:\r\n" + ex.Message + "\r\n============================\r\n" +
                                    "StackTrace:\r\n" + ex.StackTrace + "\r\n============================\r\n" +
                                    "Source:\r\n" + ex.Source + "\r\n============================\r\n", $"[CLOUD] Error parsing config {m.Groups[1].Value.Split('/').Last()}");
                }
            }
            var files = Directory.GetFiles(Directory.GetCurrentDirectory() + @"\configs", "*.json");

            foreach (var file in files)
            {
                try
                {
                    var plugin = new Container(PSettings.GetSettings(file));
                    plug.Add(plugin);
                }
                catch (Exception ex) {
                    MessageBox.Show("Error parsing config:\r\n============================\r\n" +
                                    "Mesage:\r\n" + ex.Message + "\r\n============================\r\n" +
                                    "StackTrace:\r\n" + ex.StackTrace + "\r\n============================\r\n" +
                                    "Source:\r\n" + ex.Source + "\r\n============================\r\n", $"[LOCAL] Error parsing config {file.Split('\\').Last()}");
                }
            }
            return(plug);
        }
Example #3
0
 public Container(PSettings settings)
 {
     IsWorked   = false;
     _pSettings = settings;
 }