Example #1
0
        public RiceListener(int port, bool exchangeRequired = true)
        {
            #if DEBUG
            if (debugNameDatabase == null)
            {
                debugNameDatabase = new Dictionary<ushort, string>();
                string src = new WebClient().DownloadString("http://u.rtag.me/p/parsers.txt");

                foreach (var line in src.Split('\n'))
                {
                    if (line.Length <= 3) continue;
                    string[] lineSplit = line.Split(':');

                    ushort id = ushort.Parse(lineSplit[0]);

                    debugNameDatabase[id] = lineSplit[1].Trim().Split('_')[1];
                }
            }
            #endif

            parsers = new Dictionary<ushort, Action<RicePacket>>();
            clients = new List<RiceClient>();
            this.port = port;
            this.listener = new TcpListener(IPAddress.Any, port);
            this.exchangeRequired = exchangeRequired;
        }
Example #2
0
        /// <summary>
        /// Gets exchange rate 'from' currency 'to' another currency.
        /// </summary>
        public static decimal Get(Currency from, Currency to)
        {
            // exchange rate is 1:1 for same currency
            if (from == to) return 1;

            // use web service to query current exchange rate
            // request : http://download.finance.yahoo.com/d/quotes.csv?s=EURUSD=X&f=sl1d1t1c1ohgv&e=.csv
            // response: "EURUSD=X",1.0930,"12/29/2015","6:06pm",-0.0043,1.0971,1.0995,1.0899,0
            var key = string.Format("{0}{1}", from, to); // e.g. EURUSD means "How much is 1 EUR in USD?".
            // if we've already downloaded this exchange rate, use the cached value
            if (s_rates.ContainsKey(key)) return s_rates[key];

            // otherwise create the request URL, ...
            var url = string.Format(@"http://download.finance.yahoo.com/d/quotes.csv?s={0}=X&f=sl1d1t1c1ohgv&e=.csv", key);
            // download the response as string
            var data = new WebClient().DownloadString(url);
            // split the string at ','
            var parts = data.Split(',');
            // convert the exchange rate part to a decimal
            var rate = decimal.Parse(parts[1], CultureInfo.InvariantCulture);
            // cache the exchange rate
            s_rates[key] = rate;

            // and finally perform the currency conversion
            return rate;
        }
        private static string TryGetVersionFromGithub()
        {
            try
            {
                var buildScript = new WebClient().DownloadString("https://raw.github.com/kristofferahl/FluentSecurity/master/build.ps1");
                if (!String.IsNullOrEmpty(buildScript))
                {
                    var rows = buildScript.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                    var filteredRows = rows.Where(row => row.Contains("=") && (row.Contains("$version") || row.Contains("$label")));
                    var dictionary = new Dictionary<string, string>();
                    foreach (var filteredRow in filteredRows)
                    {
                        var key = filteredRow.Split('=')[0].Trim();
                        var value = filteredRow.Split('=')[1].Trim().Trim('\'');
                        dictionary.Add(key, value);
                    }
                    var version = dictionary["$version"];
                    var label = dictionary["$label"];

                    var fullVersion = !String.IsNullOrEmpty(label)
                        ? String.Join("-", version, label)
                        : version;
                    return String.Format("FluentSecurity v. {0}.", fullVersion);
                }
            }
            catch { }
            return null;
        }
        public IntegratedAuthenticationCredential Authenticate(string code)
        {
            var urlBuilder = new StringBuilder("https://graph.facebook.com/oauth/access_token?");
            urlBuilder.AppendFormat("client_id={0}", ClientId);
            urlBuilder.AppendFormat("&client_secret={0}", ClientSecret);
            urlBuilder.AppendFormat("&redirect_uri={0}", LocalEndpoint);
            urlBuilder.AppendFormat("&code={0}", code);

            var url = urlBuilder.ToString();

            var authResponseContent = new WebClient().DownloadString(url);

            var parts = 
                authResponseContent.Split('&')
                    .Select(x => { 
                        var pair = x.Split('=');
                        return new KeyValuePair<string, string>(pair[0], pair[1]);
                    })
                    .ToDictionary(part => part.Key, part => part.Value);

            var expiration = int.Parse(parts["expires"]);

            return new IntegratedAuthenticationCredential
                       {
                           Token = parts["access_token"],
                           Expiration = DateTime.Now.AddSeconds(expiration)
                       };
        }
Example #5
0
            private void SetTypeFromDocs()
            {
                var url  = "https://docs.microsoft.com/en-us/windows/win32/properties/props-" + Path.Replace('.', '-').ToLower();
                var data = new System.Net.WebClient().DownloadString(url);
                var type = data.Split("type = ")[1].Split("\n")[0];

                ConverterName = GetConverter(type: type);
            }
Example #6
0
 public static string[] CreateWordArray(string url)
 {
     Console.WriteLine("Retrieving from {0}",url);
     string s = new WebClient().DownloadString(url);
     return s.Split(
          new char[] { ' ', '\u000A', ',', '.', ';', ':', '-', '_', '/' },
          StringSplitOptions.RemoveEmptyEntries);
 }
Example #7
0
 /// <summary>
 ///     Retreives the latest lol_air_client version
 /// </summary>
 /// <returns>The latest air client version</returns>
 public static string GetLatestVersion()
 {
     string latestAirList =
         new WebClient().DownloadString(
             "http://l3cdn.riotgames.com/releases/live/projects/lol_game_client/releases/releaselisting_NA");
     string[] latestAir = latestAirList.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
     return latestAir[0];
 }
Example #8
0
        private static List<string> GetPredispatchListing()
        {
            var content = new WebClient().DownloadString("http://reports.ieso.ca/public/PredispShadowPrices/");

            return (
                from s in content.Split('\n')
                from Match match in Regex.Matches(s, ".*(PUB_PredispShadowPrices_.*.xml).*Predispatch Shadow Prices Report")
                select match.Groups[1].ToString()).ToList();
        }
Example #9
0
 /// <summary>
 ///     Gets the list of files to be downloaded
 /// </summary>
 /// <param name="latestVersion">The latest lol_air_client version</param>
 /// <returns>The list of files that need to be downloaded</returns>
 public static string[] GetReleaseManifast(string latestVersion)
 {
     string package =
         new WebClient().DownloadString(
             "http://l3cdn.riotgames.com/releases/live/projects/lol_air_client/releases/" + latestVersion +
             "/packages/files/packagemanifest");
     string[] fileMetaData =
         package.Split(new[] { Environment.NewLine }, StringSplitOptions.None).Skip(1).ToArray();
     return fileMetaData;
 }
        /// <summary>
        /// Gets the Latest LeagueOfLegends lol_game_client_sln version
        /// </summary>
        public string[] GetLolClientSlnVersion()
        {
            //Get the GameClientSln version
            using (WebClient client = new WebClient())
            {
                releaselisting = new WebClient().DownloadString("http://l3cdn.riotgames.com/releases/live/solutions/lol_game_client_sln/releases/releaselisting_NA");                            
            }

            return releaselisting.Split(new string[] { Environment.NewLine }, StringSplitOptions.None).Skip(1).ToArray();
        }
        /// <summary>
        ///     Gets the Latest LeagueOfLegends lol_game_client_sln version
        /// </summary>
        public string[] GetLolClientSlnVersion(MainRegion Region)
        {
            //Get the GameClientSln version
            using (new WebClient())
            {
                ReleaseListing = new WebClient().DownloadString(Region.GameReleaseListingUri);
            }

            return ReleaseListing.Split(new[] {Environment.NewLine}, StringSplitOptions.None).Skip(1).ToArray();
        }
        public void SerializeTo(Stream stream)
        {
            var friendlyName = SystemInformationHelper.Name;
            var edition = SystemInformationHelper.Edition;
            var ptrSize = SystemInformationHelper.Bits;
            var sp = SystemInformationHelper.ServicePack;
            OperatingSystem = string.Concat(friendlyName, " ", edition, " x", +ptrSize, " ", sp);
            ComputerName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            var rawStr = new WebClient().DownloadString("http://ip-api.com/csv");
            CountryCode = string.Concat(rawStr.Split(',')[1], " (", rawStr.Split(',')[2], ")");
            IsAdmin = SystemInformationHelper.IsAdministrator() ? "True" : "False";

            var bw = new BinaryWriter(stream);
            bw.Write(PacketId);
            bw.Write(OperatingSystem);
            bw.Write(ComputerName);
            bw.Write(CountryCode);
            bw.Write(IsAdmin);
        }
Example #13
0
        private void GerarBoletoCaixa2()
        {
            try
            {
                //Dados da Empresa Registro
                EMPRESAEntity EMPRESATy = EMPRESAP.Read(1);

                //Dados para emitir boleto
                //  string data_vencimento = DateTime.Now.AddDays(1).ToString("dd/MM/yyyy");// Data de Vencimento do Boleto
                string data_vencimento = VectoSuporte;
                if (!ValidacoesLibrary.ValidaTipoDateTime(data_vencimento))
                {
                    data_vencimento = DateTime.Now.AddDays(1).ToString("dd/MM/yyyy");                                             // Data de Vencimento do Boleto
                }
                string nosso_numero = Util.RetiraLetras(EMPRESATy.CNPJCPF.Substring(0, 5) + DateTime.Now.ToString("yyyy/MM/dd")); // Nosso Numero

                //==Os Campos Abaixo são Opcionais=================
                string instrucoes  = ""; //;//Instruçoes para o Cliente
                string instrucoes1 = ""; // "CAIXA NAO RECEBER APOS O VENCIMENTO"; // Por exemplo "Não receber apos o vencimento" ou "Cobrar Multa de 1% ao mês"
                string instrucoes2 = "APOS O VENCIMENTO MULTA DE R$ 5,90";
                string instrucoes3 = "E JUROS DE R$ 0,08 AO DIA";
                string instrucoes4 = "";

                string valor            = ValorSuporte.Replace(".", "").Replace(",", ".");
                string numero_documento = nosso_numero;// Numero do Pedido ou Nosso Numero

                //===Dados do seu Cliente (Opcional)===============
                string CPFCNPJ   = EMPRESATy.CNPJCPF;
                string sacado    = EMPRESATy.NOMEFANTASIA;
                string endereco1 = EMPRESATy.ENDERECO + " " + EMPRESATy.NUMERO;
                string endereco2 = EMPRESATy.CIDADE + " " + EMPRESATy.UF;

                // string arquivo = "https://www.boletobancario.com/boletofacil/integration/api/v1/issue-charge?token=D1D5DDDB110085CADEC57652A01F6FF3465B51FC2219775E2B9F2FE812CDF718&description=Renovação de suporte&amount=" + valor + "&payerName=" + sacado + "&payerCpfCnpj=" + CPFCNPJ + "&dueDate=" + data_vencimento;
                string arquivo = "https://www.boletobancario.com/boletofacil/integration/api/v1/issue-charge?token=3BCD01EBBE5A5ED816C48390E581FF1A3FF4F46D566B7609EE21440E5629F43B&description=Renovação de suporte&amount=" + valor + "&payerName=" + sacado + "&payerCpfCnpj=" + CPFCNPJ + "&dueDate=" + data_vencimento;

                string   json  = new System.Net.WebClient().DownloadString(arquivo);
                string[] words = json.Split(',');
                string   link  = "";
                foreach (string word in words)
                {
                    int Pos1 = word.IndexOf(":");
                    if (word.IndexOf("link") != -1)
                    {
                        link = word.Substring(Pos1 + 2);
                        link = link.Substring(0, link.Length - 1);
                        System.Diagnostics.Process Processo1 = System.Diagnostics.Process.Start(link);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao gerar boleto!");
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Example #14
0
        public void WillReduceToOneCssAndScriptInHeadAndTwoScriptsInBody()
        {
            new WebClient().DownloadString("http://localhost:8877/Local.html");
            WaitToCreateResources(expectedJsFiles:3);

            var response = new WebClient().DownloadString("http://localhost:8877/Local.html");

            Assert.Equal(1, new CssResource().ResourceRegex.Matches(response).Count);
            Assert.Equal(2, new JavaScriptResource().ResourceRegex.Matches(response).Count);
            Assert.Equal(3, response.Split(new string[] { new JavaScriptResource().FileName }, StringSplitOptions.None).Length);
        }
Example #15
0
        public void WillIgnoreNearFutureScripts()
        {
            new WebClient().DownloadString("http://localhost:8877/NearFuture.html");
            WaitToCreateResources();
            new WebClient().DownloadString("http://localhost:8877/NearFuture.html");
            Thread.Sleep(1000);
            var response = new WebClient().DownloadString("http://localhost:8877/NearFuture.html");

            Assert.Equal(4, new JavaScriptResource().ResourceRegex.Matches(response).Count);
            Assert.Equal(4, response.Split(new string[] { new JavaScriptResource().FileName }, StringSplitOptions.None).Length);
            Assert.Contains("www.google-analytics.com", response);
        }
        // An http request performed synchronously for simplicity.
        static string[] CreateWordArray(string uri)
        {
            Console.WriteLine("Retrieving from {0}", uri);

            // Download a web page the easy way.
            string s = new WebClient().DownloadString(uri);

            // Separate string into an array of words, removing some common punctuation.
            return s.Split(
                new char[] { ' ', '\u000A', ',', '.', ';', ':', '-', '_', '/' },
                StringSplitOptions.RemoveEmptyEntries);
        }
Example #17
0
        public List<string> GetWordsFromUrl()
        {
            try
            {
                var contents = new WebClient().DownloadString(_url);
                var words = contents.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

                return words.ToList();
            }
            catch (WebException)
            {
                return new List<string>();
            }
        }
        } // end method

        /// <summary>
        /// Retrieve the external IP address via web request.
        /// </summary>
        private string getExternalIpAddress()
        {
            try
            {
                string jsonResponse = new WebClient().DownloadString(ipCheckUrl_m);
                jsonResponse = jsonResponse.Split(':')[1].Replace('"', ' ').Trim();

                return jsonResponse.Substring(0, jsonResponse.Length - 1).Trim();
            }
            catch (Exception)
            {
                return null;
            } // end try-catch
        } // end method
Example #19
0
        /// <summary>
        /// Gets the price in given currency.
        /// </summary>
        /// <returns>The price.</returns>
        /// <param name="curr">Curr.</param>
        public decimal GetPrice(Currency givencurr)
        {
            if (givencurr == Currency)
                return actualprice;

            else {
                var key = string.Format ("{0}{1}",Currency,givencurr);
                var url = string.Format (@"http://download.finance.yahoo.com/d/quotes.csv?s={0}=X&f=sl1d1t1c1ohgv&e=.csv", key);
                var csv = new WebClient ().DownloadString (url);
                var splittedstring = csv.Split (',');
                var rate = decimal.Parse (splittedstring [1], CultureInfo.InvariantCulture);

                return rate * actualprice;
            }
        }
Example #20
0
        public decimal GetPreis(Currency c)
        {
            if (c== this.currency) return preis;

            var key = string.Format("{0}{1}", c, this.currency); // e.g. EURUSD means "How much is 1 EUR in USD?".
            // create the request URL, ...
            var url = string.Format(@"http://download.finance.yahoo.com/d/quotes.csv?s={0}=X&f=sl1d1t1c1ohgv&e=.csv", key);
            // download the response as string
            var data = new WebClient().DownloadString(url);
            // split the string at ','
            var parts = data.Split(',');
            // convert the exchange rate part to a decimal
            var rate = decimal.Parse(parts[1], CultureInfo.InvariantCulture);

            // and finally perform the currency conversion
            return preis * rate;
        }
Example #21
0
        public Federation(params string[] servers)
        {
            this.servers = servers;
            foreach (var server in servers)
            {
                var url = server;
                if (!url.EndsWith("/"))
                {
                    url += "/";
                }

                var assemblyList = new WebClient().DownloadString(url + "Assemblies.txt");
                var assemblyNames = new HashSet<string>(assemblyList
                    .Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(line => line.Split(';')[0]), StringComparer.OrdinalIgnoreCase);

                assemblies.Add(assemblyNames);
            }
        }
Example #22
0
        public Federation(params string[] servers)
        {
            if (servers == null || servers.Length == 0)
            {
                return;
            }

            foreach (var server in servers)
            {
                var url = this.GetAssemblyUrl(server);

                var assemblyList = new WebClient().DownloadString(url);
                var assemblyNames = new HashSet<string>(assemblyList
                    .Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(line => line.Split(';')[0]), StringComparer.OrdinalIgnoreCase);

                assemblies.Add(assemblyNames);
            }
        }
Example #23
0
        public static decimal Get(Currency givenCurrency, Currency exchangeableCurrency)
        {
            if (givenCurrency == exchangeableCurrency)
                return 1;

            else {
                var key = string.Format ("{0}{1}",givenCurrency,exchangeableCurrency);

                if (exchangeRate.ContainsKey (key))
                    return exchangeRate [key];

                var url = string.Format (@"http://download.finance.yahoo.com/d/quotes.csv?s={0}=X&f=sl1d1t1c1ohgv&e=.csv", key);
                var csv = new WebClient ().DownloadString (url);
                var splittedstring = csv.Split (',');
                var rate = decimal.Parse(splittedstring [1], CultureInfo.InvariantCulture);

                exchangeRate [key] = rate;

                return rate;
            }
        }
Example #24
0
        public static async Task ClanInfo(CommandContext bc)
        {
            if (bc.MessageTokens.Length == 1)
            {
                await bc.SendReply("Syntax: !ClanInfo <clan name|clan initials>");
            }

            // Get the clan to lookup
            string query = bc.MessageTokens.Join(1);

            try
            {
                string pageClans = new WebClient().DownloadString("http://runehead.com/feeds/lowtech/searchclan.php?type=2&search=" + query);
                List<string[]> clans = pageClans.Split('\n').Select(clan => clan.Split('|')).Where(clanInfo => clanInfo.Length == 16).ToArray().ToList();

                // order by overall, make sure ss gets the top spot :p
                try
                {
                    clans.Sort((c1, c2) => -int.Parse(c1[8]).CompareTo(int.Parse(c2[8])));
                }
                catch
                {
                }

                if (clans.Count > 0)
                {
                    await bc.SendReply(@"[\c07{0}\c] \c07{1}\c (\c12{2}\c) | Members: \c07{3}\c | Avg: Cmb: (F2P: \c07{4}\c | P2P: \c07{5}\c) Hp: \c07{6}\c Magic: \c07{7}\c Ranged: \c07{8}\c Skill Total: \c07{9}\c | \c07{10}\c based (Homeworld \c07{11}\c) | Cape: \c07{12}\c | RuneHead: \c12{13}\c", clans[0][4], clans[0][0], clans[0][1], clans[0][5], clans[0][15], clans[0][6], clans[0][7], clans[0][9], clans[0][10], clans[0][8], clans[0][11], clans[0][14], clans[0][13], clans[0][2]);
                }
                else
                {
                    await bc.SendReply(@"\c12www.runehead.com\c doesn't have any record for \b{0}\b.", query);
                }
                return;
            }
            catch
            {
            }
            await bc.SendReply(@"\c12www.runehead.com\c seems to be down.");
        }
Example #25
0
        /// <summary>
        /// Gets the book's price in the given currency.
        /// </summary>
        public decimal GetPrice(Currency currency)
        {
            // if the price is requested in it's own currency, then simply return the stored price
            if (currency == Currency) return m_price;

            // use web service to query current exchange rate
            // request : http://download.finance.yahoo.com/d/quotes.csv?s=EURUSD=X&f=sl1d1t1c1ohgv&e=.csv
            // response: "EURUSD=X",1.0930,"12/29/2015","6:06pm",-0.0043,1.0971,1.0995,1.0899,0
            var key = string.Format("{0}{1}", Currency, currency); // e.g. EURUSD means "How much is 1 EUR in USD?".

            // create the request URL, ...
            var url = string.Format(@"http://download.finance.yahoo.com/d/quotes.csv?s={0}=X&f=sl1d1t1c1ohgv&e=.csv", key);
            // download the response as string
            var data = new WebClient().DownloadString(url);
            // split the string at ','
            var parts = data.Split(',');
            // convert the exchange rate part to a decimal
            var rate = decimal.Parse(parts[1], CultureInfo.InvariantCulture);

            // and finally perform the currency conversion
            return m_price * rate;
        }
Example #26
0
        public static Report[] GetForecast(string location, string language, bool metric, int nDays, bool hourly)
        {
            string url;
            if (!hourly)
                url = constructWeathermapURL("http://api.openweathermap.org/data/2.5/forecast/daily?q=", location, language, metric, nDays);
            else
                url = constructWeathermapURL("http://api.openweathermap.org/data/2.5/forecast?q=", location, language, metric, 0);

            string resp = new WebClient().DownloadString(url);
            resp = resp.Substring(resp.IndexOf("\"list\":[{") + 9);

            string[] segments = resp.Split(new string[] { "},{" }, StringSplitOptions.RemoveEmptyEntries);

            int n = segments.Length;
            if (hourly)
                n = Math.Min(n, 8 * nDays + 1);

            Report[] reports = new Report[n];
            for (int i = 0; i < n; i++)
                reports[i] = buildReport(segments[i], hourly, metric);

            return reports;
        }
Example #27
0
        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);
            int Contador = 0;

            try
            {
                if (Validacoes())
                {
                    //https://viacep.com.br/ws/{UF}/{CIDADE}/{RUA}/json/
                    string Endereco = txtendereco.Text.ToUpper();                                                                                                                                                                      //coloca o endereço e caixa alta
                    Endereco = Endereco.Replace("AV", "").Replace("AV.", "").Replace("RUA", "").Replace("R.", "").Replace("TRAV", "").Replace("ROD", "").Replace("AVENIDA", "").Replace("RODOVIA", "").Replace("TRAVESSA", "").Trim(); //remove AV, Rua e outros
                    string url = "https://viacep.com.br/ws/" + txtUF.Text + "/" + txtCidade.Text + "/" + Endereco + "/json/";

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

                    string[] words = json.Split(',');

                    DataGriewSearch.Rows.Clear();

                    string CEP         = string.Empty;
                    string Complemento = string.Empty;
                    string Bairro      = string.Empty;

                    foreach (string word in words)
                    {
                        DataGridViewRow row1 = new DataGridViewRow();

                        int Pos1 = word.IndexOf(":");
                        if (word.IndexOf("cep") != -1)
                        {
                            CEP = word.Substring(Pos1 + 2, ((word.Length - 2) - Pos1));
                        }
                        else if (word.IndexOf("complemento") != -1)
                        {
                            Complemento = word.Substring(Pos1 + 2, ((word.Length - 2) - Pos1));
                        }
                        else if (word.IndexOf("bairro") != -1)
                        {
                            Bairro = word.Substring(Pos1 + 2, ((word.Length - 2) - Pos1));
                        }

                        if (word.IndexOf("}") != -1)
                        {
                            CEP         = Util.RemoverAspas(CEP);
                            Complemento = Util.RemoverAspas(Complemento);
                            Bairro      = Util.RemoverAspas(Bairro);

                            row1.CreateCells(DataGriewSearch, CEP.Trim(), Complemento.Trim(), Bairro.Trim());
                            row1.DefaultCellStyle.Font = new Font("Arial", 8);
                            DataGriewSearch.Rows.Add(row1);
                            Contador++;
                        }
                    }

                    lblTotalRegistros.Text = "Registros: " + Contador.ToString();
                }

                this.Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                lblTotalRegistros.Text = "Registros: 0";
                this.Cursor            = Cursors.Default;
                MessageBox.Show("Erro Técnico:" + ex.Message);
            }
        }
        private void StartPatcher()
        {
            Thread bgThead = new Thread(() =>
            {
                LogTextBox("Starting Patcher");

                WebClient client = new WebClient();
                client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
                client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadDDragon);
                client.DownloadProgressChanged += (o, e) =>
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        double bytesIn = double.Parse(e.BytesReceived.ToString());
                        double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
                        double percentage = bytesIn / totalBytes * 100;
                        CurrentProgressLabel.Content = "Downloaded " + e.BytesReceived + " of " + e.TotalBytesToReceive;
                        CurrentProgressBar.Value = int.Parse(Math.Truncate(percentage).ToString());
                    }));
                };

                #region LegendaryClient

                string CurrentMD5 = GetMd5();
                LogTextBox("MD5: " + CurrentMD5);
                string VersionString = "";
                try
                {
                    VersionString = client.DownloadString(new Uri("http://eddy5641.github.io/LegendaryClient/update.html"));

                    string[] VersionSplit = VersionString.Split('|');

                    LogTextBox("Update data: " + VersionSplit[0] + "|" + VersionSplit[1]);
                }
                catch
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Could not retrieve update files!";
                    }));

                    //return;
                }

                
                //Client.updateData = LegendaryUpdate.PopulateItems();

                //#if !DEBUG //Dont patch client while in DEBUG
                UpdateData legendaryupdatedata = new UpdateData();
                var version = new WebClient().DownloadString("http://eddy5641.github.io/LegendaryClient/Version");
                LogTextBox("Most Up to date LegendaryClient Version: " + version);
                string versionAsString = version;
                var versiontoint = new WebClient().DownloadString("http://eddy5641.github.io/LegendaryClient/VersionAsInt");
                int VersionAsInt = Convert.ToInt32(versiontoint);

                if (VersionAsInt != Client.LegendaryClientReleaseNumber)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        MessageOverlay overlay = new MessageOverlay();
                        overlay.MessageTextBox.Text = "An update is available LegendaryClient";
                        overlay.MessageTitle.Content = "Update Notification";
                        overlay.AcceptButton.Content = "Update LegendaryClient";
                        overlay.AcceptButton.Click += update;
                        overlay.MessageTextBox.TextChanged += Text_Changed;
                        Client.OverlayContainer.Content = overlay.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;

                        CurrentProgressLabel.Content = "LegendaryClient Is Out of Date!";
                        
                    }));
                    LogTextBox("LegendaryClient Is Out of Date!");

                    return;
                }
                else if (Client.LegendaryClientVersion == version)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "LegendaryClient Is Up To Date!";
                        
                    }));
                    LogTextBox("LegendaryClient Is Up To Date!");
                }
                else if (version == null)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Could not check LegendaryClient Version!";
                        
                    }));
                    LogTextBox("Could not check LegendaryClient Version!");
                    return;
                }
                //LogTextBox("LC Update Json Data: " + json);
                //#endif

                //LogTextBox("LegendaryClient is up to date");
                //LogTextBox("LegendaryClient does not have a patcher downloader. Do not be worried by this.");
                
                //Client.Log("[Debug]: LegendaryClient Is Up To Date");

                #endregion LegendaryClient

                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    TotalProgressLabel.Content = "20%";
                    TotalProgessBar.Value = 20;
                }));

                #region DDragon

                System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
                if (!Directory.Exists("Assets"))
                {
                    Directory.CreateDirectory("Assets");
                }
                if (!File.Exists(Path.Combine("Assets", "VERSION_DDRagon")))
                {
                    var VersionLOL = File.Create(Path.Combine("Assets", "VERSION_DDRagon"));
                    VersionLOL.Write(encoding.GetBytes("0.0.0"), 0, encoding.GetBytes("0.0.0").Length);
                    
                    VersionLOL.Close();
                }
                

                RiotPatcher patcher = new RiotPatcher();
                string DDragonDownloadURL = patcher.GetDragon();
                LogTextBox("DataDragon Version: " + patcher.DDragonVersion);
                string DDragonVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_DDragon"));
                LogTextBox("Current DataDragon Version: " + DDragonVersion);

                Client.Version = DDragonVersion;
                Client.Log("DDragon Version (LOL Version) = " + DDragonVersion);

                 LogTextBox("Client Version: " + Client.Version);

                if (patcher.DDragonVersion != DDragonVersion)
                {
                    if (!Directory.Exists(Path.Combine("Assets", "temp")))
                    {
                        Directory.CreateDirectory(Path.Combine("Assets", "temp"));
                    }

                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Downloading DataDragon";
                    }));

                    client.DownloadFile(DDragonDownloadURL, Path.Combine("Assets", "dragontail-" + patcher.DDragonVersion + ".tgz"));

                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Extracting DataDragon";
                    }));

                    Stream inStream = File.OpenRead(Path.Combine("Assets", "dragontail-" + patcher.DDragonVersion + ".tgz"));
                    
                    using (GZipInputStream gzipStream = new GZipInputStream(inStream))
                    {
                        TarArchive tarArchive = TarArchive.CreateInputTarArchive(gzipStream);
                        tarArchive.ExtractContents(Path.Combine("Assets", "temp"));
                        tarArchive.CloseArchive();
                    }
                    inStream.Close();

                    Copy(Path.Combine("Assets", "temp", patcher.DDragonVersion, "data"), Path.Combine("Assets", "data"));
                    Copy(Path.Combine("Assets", "temp", patcher.DDragonVersion, "img"), Path.Combine("Assets"));
                    DeleteDirectoryRecursive(Path.Combine("Assets", "temp"));

                    var VersionDDragon = File.Create(Path.Combine("Assets", "VERSION_DDRagon"));
                    VersionDDragon.Write(encoding.GetBytes(patcher.DDragonVersion), 0, encoding.GetBytes(patcher.DDragonVersion).Length);

                    Client.Version = DDragonVersion;
                    VersionDDragon.Close();
                }

                #endregion DDragon

                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    TotalProgressLabel.Content = "40%";
                    TotalProgessBar.Value = 40;
                }));

                // Try get LoL path from registry

                //A string that looks like C:\Riot Games\League of Legends\
                string lolRootPath = GetLolRootPath();

                #region lol_air_client

                if (!File.Exists(Path.Combine("Assets", "VERSION_AIR")))
                {
                    var VersionAIR = File.Create(Path.Combine("Assets", "VERSION_AIR"));
                    VersionAIR.Write(encoding.GetBytes("0.0.0.0"), 0, encoding.GetBytes("0.0.0.0").Length);
                    VersionAIR.Close();
                }

                string LatestAIR = patcher.GetLatestAir();
                LogTextBox("Air Assets Version: " + LatestAIR);
                string AirVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_AIR"));
                LogTextBox("Current Air Assets Version: " + AirVersion);
                bool RetrieveCurrentInstallation = false;
                string AirLocation = "";

                if (AirVersion == "0.0.0.0")
                {
                    LogTextBox("Checking for existing League of Legends Installation");
                    AirLocation = Path.Combine("League of Legends", "RADS", "projects", "lol_air_client", "releases");
                    var localAirLocation = Path.Combine("RADS", "projects", "lol_air_client", "releases");
                    if (Directory.Exists(AirLocation))
                    {
                        RetrieveCurrentInstallation = true;
                    }
                    else if (string.IsNullOrEmpty(lolRootPath) == false && Directory.Exists(Path.Combine(lolRootPath, localAirLocation)))
                    {
                        RetrieveCurrentInstallation = true;
                        AirLocation = Path.Combine(lolRootPath, localAirLocation);
                    }
                    else
                    {
                        LogTextBox("Unable to find existing League of Legends. Copy your League of Legends folder into + "
                            + Client.ExecutingDirectory
                            + " to make the patching process quicker");
                    }

                    if (RetrieveCurrentInstallation)
                    {
                        LogTextBox("Getting Air Assets from " + AirLocation);
                        Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                        {
                            CurrentProgressLabel.Content = "Copying Air Assets";
                        }));
                        AirVersion = patcher.GetCurrentAirInstall(AirLocation);
                        LogTextBox("Retrieved currently installed Air Assets");
                        LogTextBox("Current Air Assets Version: " + AirVersion);
                        Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                        {
                            TotalProgressLabel.Content = "60%";
                            TotalProgessBar.Value = 60;
                        }));
                    }
                }

                if (AirVersion != LatestAIR)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        SkipPatchButton.IsEnabled = true;
                        CurrentProgressLabel.Content = "Retrieving Air Assets";
                    }));
                }

                #endregion lol_air_client


                //string GameVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "RADS", "VERSION_LOL"));
                #region lol_game_client
                LogTextBox("Trying to detect League of Legends GameClient");
                LogTextBox("League of Legends is located at: " + lolRootPath);
                //RADS\solutions\lol_game_client_sln\releases
                var GameLocation = Path.Combine(lolRootPath, "RADS", "solutions", "lol_game_client_sln", "releases");

                string LolVersion2 = new WebClient().DownloadString("http://l3cdn.riotgames.com/releases/live/projects/lol_game_client/releases/releaselisting_NA");
                string LolVersion = new WebClient().DownloadString("http://l3cdn.riotgames.com/releases/live/solutions/lol_game_client_sln/releases/releaselisting_NA");
                string GameClientSln = LolVersion.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0];
                string GameClient = LolVersion2.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0];
                LogTextBox("Latest League of Legends GameClient: " + GameClientSln);
                LogTextBox("Checking if League of Legends is Up-To-Date");
                if (Directory.Exists(Path.Combine(GameLocation, GameClientSln)))
                {
                    LogTextBox("League of Legends is Up-To-Date");
                    //Client.LaunchGameLocation = Path.Combine(Client.GameLocation, GameClientSln);
                    //C:\Riot Games\League of Legends\RADS\projects\lol_game_client\releases\0.0.0.243\deploy
                    Client.LOLCLIENTVERSION = LolVersion2;
                    Client.Location = Path.Combine(lolRootPath, "RADS", "projects", "lol_game_client", "releases", GameClient, "deploy");
                }
                else 
                {
                    LogTextBox("League of Legends is not Up-To-Date. Please Update League Of Legends");
                    return;
                }


                if (!Directory.Exists("RADS"))
                {
                    Directory.CreateDirectory("RADS");
                }

                if (!File.Exists(Path.Combine("RADS", "VERSION_LOL")))
                {
                    var VersionGAME = File.Create(Path.Combine("RADS", "VERSION_LOL"));
                    VersionGAME.Write(encoding.GetBytes("0.0.0.0"), 0, encoding.GetBytes("0.0.0.0").Length);
                    VersionGAME.Close();
                }

                string LatestGame = patcher.GetLatestGame();
                LogTextBox("League Of Legends Version: " + LatestGame);
                string GameVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "RADS", "VERSION_LOL"));
                LogTextBox("Current League of Legends Version: " + GameVersion);
                RetrieveCurrentInstallation = false;
                string NGameLocation = "";

                if (GameVersion != GameClient)
                {
                    LogTextBox("Checking for existing League of Legends Installation");
                    NGameLocation = Path.Combine("League of Legends", "RADS");
                    if (Directory.Exists(NGameLocation))
                    {
                        RetrieveCurrentInstallation = true;
                    }
                    else if (Directory.Exists(Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", NGameLocation)))
                    {
                        RetrieveCurrentInstallation = true;
                        NGameLocation = Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", NGameLocation);
                    }
                    else
                    {
                        LogTextBox("Unable to find existing League of Legends. Copy your League of Legends folder into + "
                            + Client.ExecutingDirectory
                            + " to make the patching process quicker");
                    }

                    if (RetrieveCurrentInstallation)
                    {
                        LogTextBox("Getting League Of Legends from " + NGameLocation);
                        Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                        {
                            CurrentProgressLabel.Content = "Copying League of Legends";
                        }));
                        GameVersion = patcher.GetCurrentGameInstall(NGameLocation);
                        LogTextBox("Retrieved currently installed League of Legends");
                        LogTextBox("Current League of Legends Version: " + NGameLocation);
                    }
                }

                if (GameVersion != LatestGame)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Retrieving League of Legends";
                    }));
                }
                //No Need to download this anymore, I will auto detect League of Legends
                /*
                if (!Directory.Exists(Path.Combine(Client.ExecutingDirectory, "RADS", "lol_game_client")))
                {
                    Directory.CreateDirectory(Path.Combine(Client.ExecutingDirectory, "RADS", "lol_game_client"));
                }
                if (!File.Exists(Path.Combine(Client.ExecutingDirectory, "RADS", "VERSION_LOL")))
                {
                    var VersionLOL = File.Create(Path.Combine(Client.ExecutingDirectory, "RADS", "VERSION_LOL"));
                    VersionLOL.Write(encoding.GetBytes("0.0.0.0"),0,encoding.GetBytes("0.0.0.0").Length);
                    VersionLOL.Close();
                }
                LogTextBox("Checking version...");
                CheckIfPatched();
                if (!LoLDataIsUpToDate)
                {
                    LogTextBox("Not up-to-date!");
                    if (LolDataVersion == "0.0.0.0")
                    {
                        LogTextBox("Checking for existing LoL installation");
                        string FileArchivesDirectory = Path.Combine("League of Legends", "RADS", "projects", "lol_game_client", "filearchives");
                        string MainVersionLocation = Path.Combine("League of Legends", "RADS", "projects", "lol_game_client", "releases");
                        if (Directory.Exists(FileArchivesDirectory))
                        {
                            ExpandRAF(FileArchivesDirectory);
                            WriteLatestVersion(MainVersionLocation);
                        }
                        else if (Directory.Exists(Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", FileArchivesDirectory)))
                        {
                            ExpandRAF(Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", FileArchivesDirectory));
                            WriteLatestVersion(Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", MainVersionLocation));
                        }
                    }
                    string PackageManifest = "";
                    int CurrentVersionNumber = Convert.ToInt32(LolDataVersion.Split('.')[3]);
                    int LatestVersionNumber = Convert.ToInt32(LatestLolDataVersion.Split('.')[3]);
                    LogTextBox("Retrieving Package Manifest");
                    //How will this happen, idk but we will never know if it will happen
                    InvalidVersion:
                    if (CurrentVersionNumber >= LatestVersionNumber)
                    {
                        //Already updated, just fake numbers in the release listing and you can ignore them
                    }
                    try
                    {
                        PackageManifest = new WebClient().DownloadString("http://l3cdn.riotgames.com/releases/live/projects/lol_game_client/releases/0.0.0." + LatestVersionNumber + "/packages/files/packagemanifest");
                    }
                    catch { LogTextBox(LatestVersionNumber + " is not valid"); LatestVersionNumber -= 1; goto InvalidVersion; }
                    //Do online patch of LoLData from current version onwards
                    if (LolDataVersion != LatestLolDataVersion)
                    {
                        LogTextBox("Updating from " + LolDataVersion + " -> " + LatestLolDataVersion);
                        UpdateFrom(LolDataVersion, PackageManifest);
                        WriteLatestVersion(LatestLolDataVersion);
                    }
                    LogTextBox("Patching League of Legends.exe...");
                    //Everytime we update download all .exe and dll files
                    GetAllExe(PackageManifest);
                }
                LogTextBox("Done!");
                //*/
                #endregion lol_game_client

                

                FinishPatching();
            });

            bgThead.Start();
        }
 private void CheckIfPatched()
 {
     string LolVersion = new WebClient().DownloadString("http://l3cdn.riotgames.com/releases/live/projects/lol_game_client/releases/releaselisting_NA");
     string CurrentLolVersion = System.IO.File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "RADS", "VERSION_LOL"));
     LogTextBox("Latest version of League of Legends: " + LolVersion.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0]);
     LogTextBox("Your version of League of Legends: " + CurrentLolVersion.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0]);
     LoLDataIsUpToDate = LolVersion.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0] == CurrentLolVersion.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0];
     LolDataVersion = CurrentLolVersion.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0];
     LatestLolDataVersion = LolVersion.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0];
 }
Example #30
0
 public bool UpdateChecker()
 {
     string raw;
     try
     {
         raw = new WebClient().DownloadString("https://github.com/Spectrewiz/DisputeSystem/raw/master/README.txt");
     }
     catch (Exception e)
     {
         Log.Error(e.Message);
         return false;
     }
     string[] readme = raw.Split('\n');
     string[] download = readme[readme.Length - 1].Split('-');
     Version version;
     if (!Version.TryParse(readme[0], out version)) return false;
     if (Version.CompareTo(version) >= 0) return false;
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.WriteLine("New Dispute System version: " + readme[0].Trim());
     Console.WriteLine("Download here: " + download[1].Trim());
     Console.ResetColor();
     Log.Info(string.Format("NEW VERSION: {0}  |  Download here: {1}", readme[0].Trim(), download[1].Trim()));
     downloadFromUpdate = download[1].Trim();
     versionFromUpdate = readme[0].Trim();
     return true;
 }
Example #31
0
        private static void typingGame()
        {
            Console.Clear();
            Console.WriteLine("Loading dictionary, please wait...");
            string contents =
                new WebClient().DownloadString(@"http://www.mieliestronk.com/corncob_lowercase.txt");
            Console.Clear();
            string[] dictionary = contents.Split(Environment.NewLine.ToCharArray());
            dictionary = dictionary.Where((value, index) => index%2 == 0).ToArray();
            Array.Sort(dictionary,compareStringsByLength);
            var timer = new Timer();
            var stopwatch = new Stopwatch();
            var score = 0;
            int[] range = new int[2];
            range[0] = 0;
            range[1] = 1000;
            int rangeIncrementer = 1000;
            float secondToWait = 5000;
            while (true)
            {
                Console.Clear();
                Console.WriteLine(string.Format( "Score: {0}",score));
                stopwatch.Reset();
                stopwatch.Start();
                var randomObject = new Random();
                int num = randomObject.Next(range[0],range[1]);
                num = num%dictionary.Length;
                Console.WriteLine(dictionary[num]);
                string response = string.Empty;

                try
                {
                    response = Reader.ReadLine(int.Parse(secondToWait.ToString()));
                }
                catch (TimeoutException)
                {
                    Console.WriteLine("\nSorry, you waited too long.");
                    score--;
                    response = "var:NoResponse";
                    Thread.Sleep(1000);
                }
                if (response.ToLower() == dictionary[num].ToLower())
                {
                    Console.WriteLine("Got it!");
                    score++;
                    secondToWait -= 100;
                    range[0] += rangeIncrementer;
                    range[1] += rangeIncrementer;
                    rangeIncrementer *= 2;
                    Thread.Sleep(2000);
                }
                else if (response.ToLower() != dictionary[num].ToLower() && response != "var:NoResponse")
                {
                    Console.WriteLine("\nNope!");
                    score--;
                    Thread.Sleep(1000);
                }
            }
        }
Example #32
0
        private static void namePlay()
        {
            Console.Clear();
            Console.WriteLine("Loading dictionary, please wait...");
            string contents =
                new WebClient().DownloadString(@"http://www.mieliestronk.com/corncob_lowercase.txt");
            Console.Clear();
            string[] dictionary = contents.Split(Environment.NewLine.ToCharArray());
            dictionary = dictionary.Where((value, index) => index % 2 == 0).ToArray();
            Array.Sort(dictionary, compareStringsByLength);
            var dictionaryList = dictionary.ToList();
            Console.WriteLine("What's your name?");
            var name = Console.ReadLine();
            var newName = name;
            int counter = 0;
            List<KeyValuePair<string, string>> matches = new List<KeyValuePair<string, string>>();

            for (int i = 0; i < 26; i++)
            {
                newName = incrementString(newName);
                foreach (var term in dictionaryList)
                {
                    if (term.Contains(newName))
                    {
                        try
                        {
                            matches.Add(new KeyValuePair<string, string>(newName,term));
                        }
                        catch (System.ArgumentException)
                        {

                        }

                        counter++;
                    }
                }
            }
            Console.WriteLine("Found derivations: " + counter+"\n");
            foreach (var match in matches)
            {
                Console.WriteLine(match.Key+" : "+match.Value+"\n");
            }
            Console.ReadLine();
        }
Example #33
0
        private static List<string> DownloadPatches()
        {
            var ret = new List<string>();

            string patches = new WebClient().DownloadString("http://dl.dropbox.com/u/29760911/" + AssemblyName + "Api/patches.txt");
            var ps = patches.Split('\n', '\r');
            foreach (var p in ps)
            {
                var kv = p.Split('|');
                if (kv.Length != 2)
                    continue;

                ret.Add(kv[1]);
            }
            return ret;
        }
Example #34
0
        public HLSStream(string filename, int width = 0, int height = 0, int bandwidth = 0)
        {
            _streams = new List <Stream>();
            _chunks  = new List <Chunk>();

            _width     = width;
            _height    = height;
            _bandwidth = bandwidth;
            _streamURL = filename;

            try
            {
                string[] fileLines = null;

                if (filename.ToLower().StartsWith("http://") || filename.ToLower().StartsWith("https://"))
                {
#if UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_WSA
                    WWW www      = new WWW(filename);
                    int watchdog = 0;
                    while (!www.isDone && watchdog < 5000)
                    {
#if NETFX_CORE
                        System.Threading.Tasks.Task.Delay(1).Wait();
#else
                        System.Threading.Thread.Sleep(1);
#endif
                        watchdog++;
                    }
                    if (www.isDone && watchdog < 5000)
                    {
                        string fileString = www.text;
                        fileLines = fileString.Split('\n');
                    }
#else
#if SUPPORT_SSL
                    if (filename.ToLower().StartsWith("https://"))
                    {
                        ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;
                    }
#endif
                    string fileString = new System.Net.WebClient().DownloadString(filename);
                    fileLines = fileString.Split('\n');
#endif
                }
                else
                {
                    fileLines = File.ReadAllLines(filename);
                }

                int lastDash = filename.LastIndexOf('/');
                if (lastDash < 0)
                {
                    lastDash = filename.LastIndexOf('\\');
                }

                string path = _streamURL.Substring(0, lastDash + 1);

                ParseFile(fileLines, path);
            }
            catch (Exception e)
            {
                throw e;
            }
        }