Exemple #1
0
 private void textBox1_Leave(object sender, EventArgs e)
 {
     if (textBox1.Text == "")
     {
         textBox1.Text      = "Enter Cmdr Name";
         textBox1.ForeColor = Color.DarkGray;
     }
     else//Check to make sure that the commander name is correct
     {
         string result = new System.Net.WebClient().DownloadString("https://www.edsm.net/api-logs-v1/get-position?commanderName=" + textBox1.Text);
         if (result.Length < 13 || result.Contains("\"msgnum\":203"))
         {
             toolStripLabel1.Text = "No such commander name.";
             textBox1.BackColor   = Color.Red;
             return;
         }
         if (result.Contains("\"system\":null"))
         {
             toolStripLabel1.Text = "Non-public profile.";
             textBox1.BackColor   = Color.Yellow;
             return;
         }
         textBox1.BackColor = Color.Green;
         button1.Enabled    = true;
     }
 }
Exemple #2
0
        /// <summary>
        /// Gets the mood of a post using the viralheat API
        /// </summary>
        /// <param name="text">The post to be analyzed</param>
        /// <returns>"negative" or "positive"</returns>
        public static Sentiment GetSentimentMood(string text)
        {
            Sentiment result = new Sentiment();

            string viralHeatApiKey = "&api_key=" + ChartManager.GetViralHeatAPIKey();
            //if(firstAPIUsed)
            //viralHeatApiKey = "&api_key=olGbEN1IUhKjrvgQvZOt";
            string url = "http://www.viralheat.com/api/sentiment/review.json?text=" + text + viralHeatApiKey;

            string jsonString;

            try
            {
                jsonString = new System.Net.WebClient().DownloadString(url);
            }
            catch (Exception e)
            {
                //Error with the webservice
                System.Diagnostics.Debug.WriteLine("========================");
                System.Diagnostics.Debug.WriteLine("Error with webservice");
                System.Diagnostics.Debug.WriteLine(e.ToString());
                System.Diagnostics.Debug.WriteLine("========================");
                //done = true;
                return(null);
            }
            if (jsonString.Contains("Error"))
            {
                //Post was probably not in english, skip it

                if (jsonString.Contains("Over quota limit"))
                {
                    //firstAPIUsed = true;
                    //ChartManager.toggleLanguageAnalysis();
                    System.Diagnostics.Debug.WriteLine("=================================");
                    System.Diagnostics.Debug.WriteLine("Out of ViralHeat Queries");
                    System.Diagnostics.Debug.WriteLine("=================================");
                    result      = new Sentiment();
                    result.mood = "unknown";
                    result.prob = -1;
                    result.text = text;
                    result      = null;
                }
                else
                {
                    //ChartManager.setLanguageAnalysis(false);
                    System.Diagnostics.Debug.WriteLine("========================");
                    System.Diagnostics.Debug.WriteLine("Error with webservice");
                    System.Diagnostics.Debug.WriteLine(url);
                    System.Diagnostics.Debug.WriteLine(jsonString);
                    System.Diagnostics.Debug.WriteLine("========================");
                    result = null;
                }
            }
            else
            {
                result = JsonConvert.DeserializeObject <Sentiment>(jsonString);
            }

            return(result);
        }
Exemple #3
0
        static bool VTrez(string sha256)
        {
            bool   miner = false;
            string rez   = new System.Net.WebClient().DownloadString("https://www.virustotal.com/vtapi/v2/file/report?apikey=" + api + "&resource=" + sha256);

            if (rez.Contains("Miner") || rez.Contains("miner") || rez.Contains("BtcMine") || rez.Contains("mine"))
            {
                miner = true;
            }

            rez = null;

            return(miner);
        }
Exemple #4
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            if (!System.IO.Directory.Exists("tmp"))
            {
                System.IO.Directory.CreateDirectory("tmp");
            }
            this.Text += Application.ProductVersion;

            try
            {
                string lol = new System.Net.WebClient().DownloadString(
                    PrgDomain + "LOIC_version.php?cv=" + Application.ProductVersion);
                if (!lol.Contains("<VERSION>" + Application.ProductVersion + "</VERSION>"))
                {
                    bool GetUpdate = (DialogResult.Yes == MessageBox.Show(
                                          "A new version is available. Update?",
                                          "so i herd u liek mudkipz", MessageBoxButtons.YesNo));
                    if (GetUpdate)
                    {
                        string UpdateLink = new System.Net.WebClient().DownloadString(
                            ToxDomain + "inf/LOIC_link.html").Split('%')[1];
                        System.Diagnostics.Process.Start(UpdateLink + "?cv=" + Application.ProductVersion);
                        Application.Exit();
                    }
                }
            }
            catch
            {
                MessageBox.Show("Couldn't check for updates.\r\n\r\nAlso, cocks.", "A cat is fine too");
            }
        }
Exemple #5
0
        public bool DivertNumber(string mobile)
        {
            log.LogStart();
            System.Net.ServicePointManager.ServerCertificateValidationCallback += SERV.Utils.Authentication.AcceptAllCertificates;
            string num     = mobile.Replace(" ", "");
            string servNow = System.Configuration.ConfigurationManager.AppSettings["FlextelNumber"];
            string pin     = System.Configuration.ConfigurationManager.AppSettings["FlextelPin"];
            string format  = System.Configuration.ConfigurationManager.AppSettings["FlextelFormat"];

            try
            {
                log.Info("Diverting flextel to " + num);
                string res = new System.Net.WebClient().DownloadString(string.Format(format, servNow, pin, num));
                log.Info(res);
                res = res.Trim();
                if (res.Contains(","))
                {
                    return(res.Split(',')[0].Replace(" ", "") == num);
                }
                return(false);
            }
            catch
            {
                return(false);
            }
        }
Exemple #6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //http://www.scientology.org/html/en_US/feature/search/index.html?query=<RANDOMSTRINGHERE>+&index=cos%2Ccos_rtc&go.x=16&go.y=13
            if (!System.IO.Directory.Exists("tmp"))
            {
                System.IO.Directory.CreateDirectory("tmp");
            }
            this.Text += Application.ProductVersion;

            try
            {
                string lol = new System.Net.WebClient().DownloadString(
                    AppDomain + "SciDBomb_version.php?cv=" + Application.ProductVersion);
                if (!lol.Contains("<VERSION>" + Application.ProductVersion + "</VERSION>"))
                {
                    bool GetUpdate = (DialogResult.Yes == MessageBox.Show(
                                          "There's a new version of SciDBomb available. Update?",
                                          "so i herd u liek mudkipz", MessageBoxButtons.YesNo));
                    if (GetUpdate)
                    {
                        string UpdateLink = new System.Net.WebClient().DownloadString(
                            ToxDomain + "inf/SciDBomb_link.html").Split('%')[1];
                        System.Diagnostics.Process.Start(UpdateLink + "?cv=" + Application.ProductVersion);
                        Application.Exit();
                    }
                }
            }
            catch
            {
                MessageBox.Show("Couldn't check for updates.\r\n\r\nAlso, cocks.", "A cat is fine too");
            }
        }
        private void buttonX13_Click(object sender, EventArgs e)
        {
            int    r     = 0;
            string stoof = new System.Net.WebClient().DownloadString("http://pastebin.com/HrnEpyqN");
            string nu    = "";

            for (int t = 0; t < 20; t++)
            {
                nu = nu + " ";
                if ((user.Text != nu) && (pass.Text != nu))
                {
                    r++;
                }
            }
            if (r >= 20)
            {
                if (stoof.Contains(user.Text + ":" + pass.Text))
                {
                    login     = true;
                    this.Size = new System.Drawing.Size(501, 426);
                    MessageBox.Show("Login Successful");
                    buttonX13.Enabled = false;
                }
                else
                {
                    MessageBox.Show("Login Failed");
                }
            }
        }
Exemple #8
0
        }//Одноразовая проверка состояния блокировки

        public void alarm()
        {
cx:
            string Check = new System.Net.WebClient().DownloadString(textBox1.Text);

            System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"c:\bsound.wav");

            bool x = true;

            while (x)

            {
                if (Check.Contains("System blocked"))
                {
                    Thread.Sleep(100);
                    label1.ForeColor = Color.Red;
                    label1.Text      = "ТРЕВОГА!!!";
                    player.Play();
                    System.Threading.Thread.Sleep(20000);
                    player.Stop();

                    goto cx;
                }
                else
                {
                    label1.ForeColor = Color.LightGreen;
                    label1.Text      = "ВСЁ В ПОРЯДКЕ";
                    System.Threading.Thread.Sleep(1000);
                    goto cx;
                }
            }
        }//метод постоянного контроля состояния
Exemple #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            string whitelist = new System.Net.WebClient()
            {
                Proxy = null
            }.DownloadString("https://pastebin.com/raw/0ysn9yFw");                                                             //Whitelist
            string blacklist = new System.Net.WebClient()
            {
                Proxy = null
            }.DownloadString("https://pastebin.com/raw/QdBStAPz");                                                             //Blacklisted

            if (blacklist.Contains(email.Text))
            {
                MessageBox.Show("Blacklisted! Closing...");
                Application.Exit();
            }
            if (whitelist.Contains(email.Text))
            {
                MessageBox.Show("Whitelisted!");
                Form2 frm2 = new Form2();
                frm2.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Put valid key bruhh.");
            }
        }
Exemple #10
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            myHandle = this.Handle;
            try
            {
                string lol = new System.Net.WebClient().DownloadString(
                    PrgDomain + "Chanmongler_version.php?cv=" + Application.ProductVersion);
                if (!lol.Contains("<VERSION>" + Application.ProductVersion + "</VERSION>"))
                {
                    bool GetUpdate = (DialogResult.Yes == MessageBox.Show(
                                          "A new version is available. Update?",
                                          "so i herd u liek mudkipz", MessageBoxButtons.YesNo));
                    if (GetUpdate)
                    {
                        string UpdateLink = new System.Net.WebClient().DownloadString(
                            ToxDomain + "inf/Chanmongler_link.html").Split('%')[1];
                        System.Diagnostics.Process.Start(UpdateLink + "?cv=" + Application.ProductVersion);
                        Application.Exit();
                    }
                }
            }
            catch
            {
                MessageBox.Show("Couldn't check for updates.\r\n\r\nAlso, cocks.", "A cat is fine too");
            }

            txtPath.Text = Application.StartupPath;
            if (!System.IO.Directory.Exists(Application.StartupPath + "/_cfg"))
            {
                MessageBox.Show(
                    "Could not access configuration files." + "\r\n" +
                    "\r\n" +
                    "This is most likely because Chanmongler was started directly from an archive." + "\r\n" +
                    "If this is the case, extract Chanmongler somewhere and try again.");
                Program.Kill();
            }

            string[] Chanlist = System.IO.Directory.GetFiles("_cfg/", "*.chan");
            for (int a = 0; a < Chanlist.Length; a++)
            {
                string Chan = Chanlist[a];
                Chan = Chan.Substring(Chan.IndexOf("/") + 1);
                Chan = Chan.Substring(0, Chan.LastIndexOf("."));
                cbChan.Items.Add(Chan);
            }
            for (int a = 0; a < cbChan.Items.Count; a++)
            {
                if (cbChan.Items[a].ToString() == "4chan")
                {
                    cbChan.SelectedIndex = a;
                }
            }

            for (int a = 0; a <= Clients.GetUpperBound(0); a++)
            {
                Clients[a] = new WebReq();
            }
            tThreadState.Start(); tDownload.Start();
        }
Exemple #11
0
        public static ExchangeDataRoot GetExchangeData(string from, string to)
        {
            string http = String.Format("https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency={0}&to_currency={1}&apikey=WN02BP1Q1KZR95NO", from, to);

            string json = new System.Net.WebClient().DownloadString(http);

            // Alphavantage API calls are limited to 5 per 30 seconds.
            if (json.Contains("Note") || (json.Contains("Error Message")))
            {
                System.Diagnostics.Debug.WriteLine(json);
                return(null);
            }

            ExchangeDataRoot output = JsonConvert.DeserializeObject <ExchangeDataRoot>(json);

            return(output);
        }
Exemple #12
0
 /// <summary>
 /// Returns true if the file is running on the server (VirusTotal, AnyRun); otherwise returns false
 /// </summary>
 public static bool Check()
 {
     try
     {
         string status = new System.Net.WebClient()
                         .DownloadString("http://ip-api.com/line/?fields=hosting");
         return(status.Contains("true"));
     }
     catch { }
     return(false);
 }
Exemple #13
0
        public static Dictionary <DateTime, HistoricExchangeData> GetHistoricData(string from, string to)
        {
            Dictionary <DateTime, HistoricExchangeData> output;

            string http = String.Format("https://www.alphavantage.co/query?function=FX_DAILY&from_symbol={0}&to_symbol={1}&apikey=WN02BP1Q1KZR95NO", from, to);

            string json = new System.Net.WebClient().DownloadString(http);

            // API Alphavantage calls are limited to 5 per 30 seconds.
            if (json.Contains("Note") || (json.Contains("Error Message")))
            {
                System.Diagnostics.Debug.WriteLine(json);
                return(null);
            }
            var tmp = JsonConvert.DeserializeObject <HistoricExchangeDataRoot>(json);

            output = tmp.Result;

            return(output);
        }
Exemple #14
0
 /// <summary>
 /// Returns true if the file is running on the server (VirusTotal, AnyRun); otherwise returns false
 /// </summary>
 public static bool Hosting()
 {
     try
     {
         string status = new System.Net.WebClient()
                         .DownloadString(
             StringsCrypt.Decrypt(new byte[] { 150, 74, 225, 199, 246, 42, 22, 12, 92, 2, 165, 125, 115, 20, 210, 212, 231, 87, 111, 21, 89, 98, 65, 247, 202, 71, 238, 24, 143, 201, 231, 207, 181, 18, 199, 100, 99, 153, 55, 114, 55, 39, 135, 191, 144, 26, 106, 93, }));
         return(status.Contains("true"));
     } catch { }
     return(false);
 }
Exemple #15
0
        public static int GetAQLCreditCount()
        {
            string smsUser     = System.Configuration.ConfigurationManager.AppSettings["SMSUser"];
            string smsPassword = System.Configuration.ConfigurationManager.AppSettings["SMSPassword"];
            string res         = new System.Net.WebClient().DownloadString(
                string.Format("http://gw1.aql.com/sms/postmsg.php?username={0}&password={1}&cmd=credit", smsUser, smsPassword));

            if (res.Contains("="))
            {
                int ret = int.Parse(res.Split('=')[1].Trim());
                return(ret);
            }
            return(-1);
        }
Exemple #16
0
        private void tMain_Tick(object sender, EventArgs e)
        {
            string src = new System.Net.WebClient().DownloadString(
                "http://eclipse.no-sekai.de/projects/shana");

            this.Text = System.DateTime.Now.ToLongTimeString();
            if (src.Contains(": Shakugan no Shana Second " + txtEP.Text))
            {
                this.Text += "!!! " + this.Text;
                for (int a = 0; a < 5; a++)
                {
                    System.Media.SystemSounds.Beep.Play();
                    Application.DoEvents(); System.Threading.Thread.Sleep(1000);
                }
            }
        }
        private void buttonX10_Click(object sender, EventArgs e)
        {
            string contents       = new System.Net.WebClient().DownloadString("http://pastebin.com/XgzwbbP5");
            string currentversion = Application.ProductVersion;

            if (contents.Contains(currentversion))
            {
                MessageBox.Show("You are up to date!");
            }
            else
            {
                MessageBoxEx.Show("A new update is available, press okay to start the download.", "Update Available", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                System.Diagnostics.Process.Start("LINK");
                Dispose();
            }
        }
Exemple #18
0
        private void Form1_Load(object sender, EventArgs e)
        {
            setConnectionStatus(false);
            string contents = new System.Net.WebClient().DownloadString("http://pastebin.com/raw.php?i=Uh1rHicL");

            string[] info           = contents.Split(new string[] { "[-]" }, StringSplitOptions.RemoveEmptyEntries);
            string   currentversion = Application.ProductVersion;

            //new System.Net.WebClient().DownloadFile("https://www.dropbox.com/s/2l6ihrbb8qbq5zq/Revision%20v1.0.0.1.rar?dl=1", "Revision " + info[0].ToString() + ".rar");
            if (!contents.Contains(currentversion))
            {
                MessageBox.Show("A new update is available, press okay to start the download. Info regarding the update is below.\r\n" + info[1], "Update Available", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                System.Diagnostics.Process.Start(info[2].ToString());
                Dispose();
            }
        }
Exemple #19
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string contents       = new System.Net.WebClient().DownloadString("http://pastebin.com/Df6CvTnL");
            string currentversion = Application.ProductVersion;

            if (contents.Contains(currentversion))
            {
                Updatel.Enabled = false;
            }
            else
            {
                Updatel.Enabled = true;
            }
            FormX                = this.Size.Width;
            FormY                = this.Size.Height;
            this.Size            = new Size(320, 75);
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
        }
 private bool checkstar(star_st check)
 {
     if (lastchecked < DateTime.Now.AddSeconds(1))
     {
         lastchecked = DateTime.Now;
         numofchecks = 0;
     }
     numofchecks++;
     if (numofchecks < 6)
     {
         string result = new System.Net.WebClient().DownloadString("https://www.edsm.net/api-v1/systems?systemName=" + check.name + "&showCoordinates=1");
         if (!(result == "[]" || !result.Contains("coords")))
         {
             return(false);
         }
     }
     return(false);
 }
Exemple #21
0
        public void check()
        {
            string Check = new System.Net.WebClient().DownloadString(textBox1.Text);

            System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"c:\bsound.wav");

            if (Check.Contains("System blocked"))
            {
                player.Play();
            }
            else
            {
                System.Threading.Thread.Sleep(1000);
                player.Stop();


                //timer1.Start();
            }
        }//Одноразовая проверка состояния блокировки
Exemple #22
0
        private static bool DivertSingleNumber(string num, string format, string servNow, string pin)
        {
            try
            {
                log.Info("Diverting flextel to " + num);
                string res = new System.Net.WebClient().DownloadString(string.Format(format, servNow, pin, num));
                log.Info(res);
                res = res.Trim();
                if (res.Contains(","))
                {
                    return(res.Split(',')[0].Replace(" ", "") == num);
                }

                return(false);
            }
            catch
            {
                return(false);
            }
        }
        public star_st searchbyname(string starname)
        {
            string result = new System.Net.WebClient().DownloadString("https://www.edsm.net/api-v1/systems?systemName=" + HttpUtility.UrlEncode(starname) + "&showCoordinates=1");

            if (result == "[]")
            {
                return(new star_st());
            }
            if (!result.Contains("coords"))
            {
                return(new star_st());
            }
            star_st ret = new star_st();

            ret.name    = starname;
            ret.coord.x = Double.Parse((result.Substring(result.IndexOf("\"x\":") + "\"x\":".Length, result.IndexOf(",\"y\":") - (result.IndexOf("\"x\":") + "\"x\":".Length))), CultureInfo.InvariantCulture);
            ret.coord.y = Double.Parse((result.Substring(result.IndexOf(",\"y\":") + ",\"y\":".Length, result.IndexOf(",\"z\":") - (result.IndexOf(",\"y\":") + ",\"y\":".Length))), CultureInfo.InvariantCulture);
            ret.coord.z = Double.Parse((result.Substring(result.IndexOf(",\"z\":") + ",\"z\":".Length, result.IndexOf("}") - (result.IndexOf(",\"z\":") + ",\"z\":".Length))), CultureInfo.InvariantCulture);
            numofchecks++;
            return(ret);
        }
Exemple #24
0
        /// <summary>
        /// Get the game information for the AppId
        /// </summary>
        /// <param name="appid"></param>
        public Game GetGame(ulong appid)
        {
            Game result = null;

            string response = new System.Net.WebClient().DownloadString($"https://store.steampowered.com/search/suggest?term={appid}&f=games&cc={client.CurrentCountry}&lang=english&v=2286217");

            if (!response.Contains("match ds_collapse_flag "))
            {
                return(result);
            }

            foreach (string s in response.Split(new string[] { "match ds_collapse_flag " }, StringSplitOptions.None))
            {
                if (s.Contains("match_name") && s.Contains("match_price"))
                {
                    result = new Game(s);
                }
            }

            return(result);
        }
Exemple #25
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            MenuItem[] nico_menu = new MenuItem[3];
            nico_menu[0]     = new MenuItem("Show config", nico_menu_config_show);
            nico_menu[1]     = new MenuItem("About", nico_menu_about);
            nico_menu[2]     = new MenuItem("Exit", nico_menu_exit);
            nico.ContextMenu = new ContextMenu(nico_menu);
            nico.Icon        = this.Icon;
            nico.Text        = "Double click to show / hide LOICNet.\nRight click for a menu.";
            nico.Visible     = true;

            this.Text += Application.ProductVersion;
            try
            {
                string lol = new System.Net.WebClient().DownloadString(
                    PrgDomain + "LOICNet_version.php?cv=" + Application.ProductVersion);
                if (!lol.Contains("<VERSION>" + Application.ProductVersion + "</VERSION>"))
                {
                    bool GetUpdate = (DialogResult.Yes == MessageBox.Show(
                                          "A new version is available. Update?",
                                          "so i herd u liek mudkipz", MessageBoxButtons.YesNo));
                    if (GetUpdate)
                    {
                        string UpdateLink = new System.Net.WebClient().DownloadString(
                            ToxDomain + "inf/LOICNet_link.html").Split('%')[1];
                        System.Diagnostics.Process.Start(UpdateLink + "?cv=" + Application.ProductVersion);
                        Application.Exit();
                    }
                }
            }
            catch
            {
                MessageBox.Show("Couldn't check for updates.\r\n\r\nAlso, cocks.", "A cat is fine too");
            }

            tHide.Start(); tGetConfig.Start();
        }
Exemple #26
0
        void t_Tick(object sender, EventArgs e)
        {
            ((Timer)sender).Stop();
            this.Text += " v" + Application.ProductVersion;

            DFC.coreTest();
            if (Directory.Exists(@"..\..\tools\"))
            {
                if (DialogResult.Yes == MessageBox.Show(
                    "make .dfc (decent file container) ?\r\n\r\nhint: rename the tools folder\r\n         if you don't wanna see this",
                    "new embedded archive",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question))
                {
                    splash.vis();
                    new DFC().make(splash.pb);
                    Program.kill();
                }
            }
            if (!Program.DO_IT)
            {
                MessageBox.Show("This program should be run by Loopstream!\n\nStop doing that.");
                Program.kill();
            }
            if (!Directory.Exists(Program.tools))
            {
                //MessageBox.Show(Program.tools);
                MessageBox.Show("Could not find LoopstreamTools directory.\n\nWhat the f**k.");
                Program.kill();
            }
            System.Diagnostics.Process[] procs = System.Diagnostics.Process.GetProcessesByName("traktor2loopstream");
            if (procs.Length > 0) Program.kill();

            if (!Directory.Exists(Program.tools + "ice"))
            {
                splash.vis();
                new DFC().extract(splash.pb);

                DialogResult dr = MessageBox.Show(
                    "Would you like me to perform the necessary\n" +
                    "changes to the Traktor configuration files?",
                    "Automatic Install Prompt",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question);

                if (dr == System.Windows.Forms.DialogResult.Yes)
                {
                    string path = System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\";
                    string try1 = path + "Documents\\Native Instruments";
                    string try2 = path + "Native Instruments";
                    //MessageBox.Show(path);
                    if (Directory.Exists(try1)) path = try1;
                    else if (Directory.Exists(try2)) path = try2;
                    else
                    {
                        MessageBox.Show("Could not find the location of Traktor on your system.");
                        Program.kill();
                    }
                    bool messaged = false;
                    foreach (string str in Directory.GetDirectories(path))
                    {
                        string fpath = str + "\\Traktor Settings.tsi";
                        if (!File.Exists(fpath)) continue;
                        if (!messaged)
                        {
                            MessageBox.Show("About to modify the following config file:\n\n" + fpath + "\n\nPlease make sure that Traktor is completely\nshut down before proceeding.");
                        }
                        var enc = new System.Text.UTF8Encoding(false);
                        string[] data = System.IO.File.ReadAllText(fpath, enc).Split('\n');

                        int matches = 0;
                        for (int a = 0; a < data.Length; a++)
                        {
                            string s = data[a] + 's';
                            if (s.StartsWith("<Entry Name=\"Broadcast.IcecastServer.Address\"")) s = setvalue(data[a], "127.0.0.1");
                            if (s.StartsWith("<Entry Name=\"Broadcast.IcecastServer.MountPath\"")) s = setvalue(data[a], "/why.ogg");
                            if (s.StartsWith("<Entry Name=\"Broadcast.IcecastServer.Password\"")) s = setvalue(data[a], "loopstream");
                            if (s.StartsWith("<Entry Name=\"Broadcast.IcecastServer.Port\"")) s = setvalue(data[a], "42069");
                            if (s != data[a] + 's')
                            {
                                matches++;
                                data[a] = s;
                            }
                        }
                        if (matches == 4)
                        {
                            StringBuilder sb = new StringBuilder();
                            foreach (string ss in data)
                            {
                                sb.Append(ss);
                                sb.Append('\n');
                            }
                            System.IO.File.WriteAllText(fpath, sb.ToString(), enc);
                        }
                        else
                        {
                            MessageBox.Show("Failed to configure Traktor:\n\nUnable to parse config file");
                            Program.kill();
                        }
                    }
                    MessageBox.Show("Traktor configuration successful.");
                }
            }
            splash.unvis();
            splash.fx = false;
            splash.gtfo();

            System.Diagnostics.Process proc;
            proc = new System.Diagnostics.Process();
            proc.StartInfo = new System.Diagnostics.ProcessStartInfo(
                "traktor2loopstream.exe",
                "-c icecast.xml");
            proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            proc.StartInfo.WorkingDirectory = Program.tools + "ice";
            proc.Start();
            while (true)
            {
                try
                {
                    string str = new System.Net.WebClient().DownloadString("http://127.0.0.1:42069/status2.xsl");
                    if (str.Contains("<pre>"))
                    {
                        break;
                    }
                }
                catch { }
                Application.DoEvents();
                System.Threading.Thread.Sleep(500);
            }
            Application.DoEvents();
            Program.kill();
        }
Exemple #27
0
        void t_Tick(object sender, EventArgs e)
        {
            ((Timer)sender).Stop();
            this.Text += " v" + Application.ProductVersion;

            DFC.coreTest();
            if (Directory.Exists(@"..\..\tools\"))
            {
                if (DialogResult.Yes == MessageBox.Show(
                        "make .dfc (decent file container) ?\r\n\r\nhint: rename the tools folder\r\n         if you don't wanna see this",
                        "new embedded archive",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question))
                {
                    splash.vis();
                    new DFC().make(splash.pb);
                    Program.kill();
                }
            }
            if (!Program.DO_IT)
            {
                MessageBox.Show("This program should be run by Loopstream!\n\nStop doing that.");
                Program.kill();
            }
            if (!Directory.Exists(Program.tools))
            {
                //MessageBox.Show(Program.tools);
                MessageBox.Show("Could not find LoopstreamTools directory.\n\nWhat the f**k.");
                Program.kill();
            }
            System.Diagnostics.Process[] procs = System.Diagnostics.Process.GetProcessesByName("traktor2loopstream");
            if (procs.Length > 0)
            {
                Program.kill();
            }

            string basedir = Program.tools + "ice";

            if (Directory.Exists(basedir))
            {
                bool ok = false;
                try
                {
                    var txt = File.ReadAllText(Path.Combine(basedir, "web", "statuls.xsl"), Encoding.UTF8);
                    ok = txt.Contains("artist\" /> - </xsl:if><xsl");
                }
                catch { }

                if (!ok)
                {
                    for (int a = 0; a < 3; a++)
                    {
                        try
                        {
                            Directory.Delete(basedir, true);
                            Application.DoEvents();
                            System.Threading.Thread.Sleep(500); // mkdir fails otherwise, ok yes good
                            break;
                        }
                        catch
                        {
                            Application.DoEvents();
                            System.Threading.Thread.Sleep(250);
                        }
                    }
                }
            }

            if (!Directory.Exists(basedir))
            {
                splash.vis();
                new DFC().extract(splash.pb);

                if (DialogResult.Yes == MessageBox.Show(
                        "Would you like me to perform the necessary\n" +
                        "changes to the Traktor configuration files?",
                        "Automatic Install Prompt",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question))
                {
                    configure_traktor();
                }

                if (DialogResult.Yes == MessageBox.Show(
                        "Would you like me to perform the necessary\n" +
                        "changes to the Virtualdj configuration files?",
                        "Automatic Install Prompt",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question))
                {
                    configure_virtualdj();
                }
            }
            splash.unvis();
            splash.fx = false;
            splash.gtfo();

            System.Diagnostics.Process proc;
            proc           = new System.Diagnostics.Process();
            proc.StartInfo = new System.Diagnostics.ProcessStartInfo(
                "bin\\traktor2loopstream.exe",
                "-c icecast.xml");
            proc.StartInfo.WindowStyle      = System.Diagnostics.ProcessWindowStyle.Hidden;
            proc.StartInfo.WorkingDirectory = Program.tools + "ice";
            proc.Start();
            for (int a = 0; a < 20; a++)
            {
                try
                {
                    string str = new System.Net.WebClient().DownloadString("http://127.0.0.1:42069/statuls.xsl");
                    if (str.Contains("<pre>"))
                    {
                        break;
                    }
                }
                catch { }
                if (a == 19)
                {
                    MessageBox.Show("the Traktor plugin failed to start ;_;");
                    break;
                }
                Application.DoEvents();
                System.Threading.Thread.Sleep(500);
            }
            Application.DoEvents();
            Program.kill();
        }
Exemple #28
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            wb.Navigate("about:blank"); Application.DoEvents();
            itKrim = T2A(0); itPress = T2A(0); itGTA = T2A(0); itFC = T2A(0);

            Form SplashForm = new frmSplash(); SplashForm.Show();

            sUser = FileRead("user.txt");
            string sUData = sUser.ToLower();

            if (sUData != "")
            {
                sUData = sUData.Replace("æ", "(ae)").Replace("ø", "(oo)").Replace("å", "(aa)");
                sUData = "" + new Crc32().S(sUData);
            }
            else
            {
                sUData = "xxxxxxxx";
            }

            string vRaw = new System.Net.WebClient().DownloadString(
                "http://tox.awardspace.us/div/pNMC_version.php?" +
                "id=" + sUData + "&" +
                "cv=" + Application.ProductVersion);

            vRaw = vRaw.Replace("\r", "");
            if (!vRaw.Contains("<VERSION>" + Application.ProductVersion + "</VERSION>"))
            {
                if (DialogResult.Yes == MessageBox.Show(
                        "En ny versjon av pNMC er tilgjengelig. Oppdatere?",
                        "Oppdatere pNMC", MessageBoxButtons.YesNo))
                {
                    string Link = new System.Net.WebClient().DownloadString(
                        "http://www.praetox.com/inf/pNMC_link.html").Split('%')[1];
                    Link += "?id=" + sUData + "&cv=" + Application.ProductVersion;
                    System.Diagnostics.Process.Start(Link); AppExit();
                }
            }

            while (SplashForm.Enabled)
            {
                Application.DoEvents(); System.Threading.Thread.Sleep(10);
            }
            this.Show(); Application.DoEvents(); SplashForm.Dispose();

            string tmpPW = "";

            wb.Navigate("http://www.nordicmafia.net/"); w8();
            if (sUser != null)
            {
                wb.Document.GetElementById("brukernavn").SetAttribute("value", sUser);
            }
            MessageBox.Show("Vennligst logg inn.");
            while (!wb.IsBusy)
            {
                System.Threading.Thread.Sleep(10); Application.DoEvents();
                sUser     = wb.Document.GetElementById("brukernavn").GetAttribute("value");
                tmpPW     = wb.Document.GetElementById("passoord").GetAttribute("value");
                this.Text = "pNMC (" + sUser + ")  |  v" + Application.ProductVersion + "  |  www.Praetox.com";
            }
            sPass = tmpPW; FileWrite("user.txt", sUser);
        }
Exemple #29
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (!myPath.EndsWith("\\"))
            {
                myPath += "\\";
            }

            /*ddAspect.SelectedIndex = 1;
             * ddWidth.SelectedIndex = 5;
             * ddHeight.SelectedIndex = 5;
             * ddVideoRate.SelectedIndex = 5;
             * txtMinutes.Text = "1";
             * txtSeconds.Text = "0";*/
            ddResizeX.SelectedIndex   = 5;
            ddResizeY.SelectedIndex   = 5;
            ddAudioRate.SelectedIndex = 3;

            this.Text += Application.ProductVersion;
            string oldLogo = Logo.Text;

            Logo.Text = "Checking for updates...";
            this.Show(); Application.DoEvents();

            string lol = new System.Net.WebClient().DownloadString(
                AppDomain + "pYTEnc_version.php?cv=" + Application.ProductVersion);

            if (!lol.Contains("<VERSION>" + Application.ProductVersion + "</VERSION>"))
            {
                bool GetUpdate = (DialogResult.Yes == MessageBox.Show(
                                      "There's a new version of pYTEnc available. Update?",
                                      "Application updater", MessageBoxButtons.YesNo));
                if (GetUpdate)
                {
                    string UpdateLink = new System.Net.WebClient().DownloadString(
                        ToxDomain + "inf/pYTEnc_link.html").Split('%')[1];
                    System.Diagnostics.Process.Start(UpdateLink + "?cv=" + Application.ProductVersion);
                    Application.Exit();
                }
            }
            Logo.Text = oldLogo;

            /*string tmp = "";
             * tmp = regRead("File source");
             * if (tmp != "") txtFileSource.Text = tmp;
             * tmp = regRead("File destination");
             * if (tmp != "") txtFileDestination.Text = tmp;
             * tmp = regRead("Aspect ratio");
             * if (tmp != "") ddAspect.Text = tmp;
             * tmp = regRead("Resolution X");
             * if (tmp != "") ddWidth.Text = tmp;
             * tmp = regRead("Resolution Y");
             * if (tmp != "") ddHeight.Text = tmp;
             * tmp = regRead("Bitrate video");
             * if (tmp != "") ddVideoRate.Text = tmp;
             * tmp = regRead("Bitrate audio");
             * if (tmp != "") ddAudioRate.Text = tmp;
             * tmp = regRead("Media length");
             * if (tmp != "") { txtMinutes.Text = tmp.Split(':')[0]; txtSeconds.Text = tmp.Split(':')[1]; }
             * tmp = regRead("Twopass");
             * if (tmp != "") if (tmp == "False") chkTwopass.Checked = false;*/
        }
Exemple #30
0
        void t_Tick(object sender, EventArgs e)
        {
            ((Timer)sender).Stop();
            this.Text += " v" + Application.ProductVersion;

            DFC.coreTest();
            if (Directory.Exists(@"..\..\tools\"))
            {
                if (DialogResult.Yes == MessageBox.Show(
                        "make .dfc (decent file container) ?\r\n\r\nhint: rename the tools folder\r\n         if you don't wanna see this",
                        "new embedded archive",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question))
                {
                    splash.vis();
                    new DFC().make(splash.pb);
                    Program.kill();
                }
            }
            if (!Program.DO_IT)
            {
                MessageBox.Show("This program should be run by Loopstream!\n\nStop doing that.");
                Program.kill();
            }
            if (!Directory.Exists(Program.tools))
            {
                //MessageBox.Show(Program.tools);
                MessageBox.Show("Could not find LoopstreamTools directory.\n\nWhat the f**k.");
                Program.kill();
            }
            System.Diagnostics.Process[] procs = System.Diagnostics.Process.GetProcessesByName("traktor2loopstream");
            if (procs.Length > 0)
            {
                Program.kill();
            }

            if (!Directory.Exists(Program.tools + "ice"))
            {
                splash.vis();
                new DFC().extract(splash.pb);

                DialogResult dr = MessageBox.Show(
                    "Would you like me to perform the necessary\n" +
                    "changes to the Traktor configuration files?",
                    "Automatic Install Prompt",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question);

                if (dr == System.Windows.Forms.DialogResult.Yes)
                {
                    string path = System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\";
                    string try1 = path + "Documents\\Native Instruments";
                    string try2 = path + "Native Instruments";
                    //MessageBox.Show(path);
                    if (Directory.Exists(try1))
                    {
                        path = try1;
                    }
                    else if (Directory.Exists(try2))
                    {
                        path = try2;
                    }
                    else
                    {
                        MessageBox.Show("Could not find the location of Traktor on your system.");
                        Program.kill();
                    }
                    bool messaged = false;
                    foreach (string str in Directory.GetDirectories(path))
                    {
                        string fpath = str + "\\Traktor Settings.tsi";
                        if (!File.Exists(fpath))
                        {
                            continue;
                        }
                        if (!messaged)
                        {
                            MessageBox.Show("About to modify the following config file:\n\n" + fpath + "\n\nPlease make sure that Traktor is completely\nshut down before proceeding.");
                        }
                        var      enc  = new System.Text.UTF8Encoding(false);
                        string[] data = System.IO.File.ReadAllText(fpath, enc).Split('\n');

                        int matches = 0;
                        for (int a = 0; a < data.Length; a++)
                        {
                            string s = data[a] + 's';
                            if (s.StartsWith("<Entry Name=\"Broadcast.IcecastServer.Address\""))
                            {
                                s = setvalue(data[a], "127.0.0.1");
                            }
                            if (s.StartsWith("<Entry Name=\"Broadcast.IcecastServer.MountPath\""))
                            {
                                s = setvalue(data[a], "/why.ogg");
                            }
                            if (s.StartsWith("<Entry Name=\"Broadcast.IcecastServer.Password\""))
                            {
                                s = setvalue(data[a], "loopstream");
                            }
                            if (s.StartsWith("<Entry Name=\"Broadcast.IcecastServer.Port\""))
                            {
                                s = setvalue(data[a], "42069");
                            }
                            if (s != data[a] + 's')
                            {
                                matches++;
                                data[a] = s;
                            }
                        }
                        if (matches == 4)
                        {
                            StringBuilder sb = new StringBuilder();
                            foreach (string ss in data)
                            {
                                sb.Append(ss);
                                sb.Append('\n');
                            }
                            System.IO.File.WriteAllText(fpath, sb.ToString(), enc);
                        }
                        else
                        {
                            MessageBox.Show("Failed to configure Traktor:\n\nUnable to parse config file");
                            Program.kill();
                        }
                    }
                    MessageBox.Show("Traktor configuration successful.");
                }
            }
            splash.unvis();
            splash.fx = false;
            splash.gtfo();

            System.Diagnostics.Process proc;
            proc           = new System.Diagnostics.Process();
            proc.StartInfo = new System.Diagnostics.ProcessStartInfo(
                "traktor2loopstream.exe",
                "-c icecast.xml");
            proc.StartInfo.WindowStyle      = System.Diagnostics.ProcessWindowStyle.Hidden;
            proc.StartInfo.WorkingDirectory = Program.tools + "ice";
            proc.Start();
            while (true)
            {
                try
                {
                    string str = new System.Net.WebClient().DownloadString("http://127.0.0.1:42069/status2.xsl");
                    if (str.Contains("<pre>"))
                    {
                        break;
                    }
                }
                catch { }
                Application.DoEvents();
                System.Threading.Thread.Sleep(500);
            }
            Application.DoEvents();
            Program.kill();
        }