Example #1
0
        /// <summary>
        /// Upload function for providers
        /// </summary>
        /// <param name="provider">Provider</param>
        /// <param name="region">Get Region</param>
        /// <param name="window">Get Window</param>
        private void ProviderUpload(dynamic provider, bool region = false, bool window = false)
        {
            byte [] fullScreen = null;
            bool    onlyData   = false;

            try {
                fullScreen = ScreenshotCapture.TakeScreenshot(region, window);
            } catch (Exception ex) {
#if DEBUG
                Console.WriteLine(ex);
#endif
                Helper.NotifyMe("Error", "There was an error taking a screenshot");
                return;
            }

            Dictionary <string, string> args    = ProcessArgs(provider);
            Dictionary <string, string> headers = ProcessHeaders(provider);

            if (provider.ContainsKey("DataOnly"))
            {
                onlyData = (bool)provider ["DataOnly"];
            }
            string data = UploadScreenshot(fullScreen, provider ["RequestURL"], provider ["FileFormName"], args, headers, onlyData);
            if (string.IsNullOrEmpty(data))
            {
                return;
            }
                        #if DEBUG
            Console.WriteLine("Data: {0}", data);
                        #endif

            ProcessFinalUrl(provider, data);
        }
Example #2
0
        /// <summary>
        /// Uploads the screenshot.
        /// </summary>
        /// <returns>The screenshot.</returns>
        /// <param name="fullScreen">Full screen.</param>
        /// <param name="url">URL.</param>
        /// <param name="fileFormName">File form name.</param>
        /// <param name="args">Arguments.</param>
        private string UploadScreenshot(byte[] fullScreen, string url, string fileFormName, Dictionary <string, string> args, Dictionary <string, string> headers, bool onlyData = false)
        {
            string data = "";

            try{
                data = ScreenshotCapture.Upload(fullScreen, url, fileFormName, args, headers, onlyData);
            }catch {
                Helper.NotifyMe("Error", "There was an error uploading your screenshot");
                return("");
            }
            return(data);
        }