Esempio n. 1
0
// ----------------------------------------------

		private string RetrData(string url, CookieContainer cookies, CredentialCache credentials, string param1, string val1, string param2, string val2, string param3, string val3, int Timeout, string param4, string val4, Hashtable Files)
		{
			DebugLine("");
			DebugLine("RetrData: url: " + url);
			if (param1 != null)
			{
				DebugLine("RetrData: param1: " + param1);
				DebugLine("RetrData: val1: (hidden)");
			}
			if (param2 != null)
			{
				DebugLine("RetrData: param2: " + param2);
				DebugLine("RetrData: val2: (hidden)");
			}
			if (param3 != null)
			{
				DebugLine("RetrData: param3: " + param3);
				DebugLine("RetrData: val3: (hidden)");
			}
			if (param4 != null)
			{
				DebugLine("RetrData: param4: " + param4);
				DebugLine("RetrData: val4: (hidden)");
			}
			DebugLine("RetrData: Timeout: " + Timeout);
			DebugLine("RetrData: ------------------------------------------------------------------------");
			ArrayList allParams = new ArrayList();
			allParams.Add(new string[2] { param1, val1 });
			allParams.Add(new string[2] { param2, val2 });
			allParams.Add(new string[2] { param3, val3 });
			allParams.Add(new string[2] { param4, val4 });
			UniUploader.http.Response Response = new UniUploader.http.Response();
			if (!http.post(ref Response, url, allParams))
			{
				if (cbUpErrorPop.Checked)
				{
					MessageBox.Show("Error - Check Debug Log");
				}
				DebugLine("Failed to Retrieve Data");
			}
			DebugLine(Response.ToString());
			DebugLine("RetrData: ------------------------------------------------------------------------");
			return Response.ToString();
		}
Esempio n. 2
0
// ----------------------------------------------

		private bool download(string path_download, string path_local)
		{
			UniUploader.http.Response Response = new UniUploader.http.Response();
			if (http.post(ref Response, path_download))
			{
				FileStream lFileStream = new FileStream(path_local, FileMode.Create);
				lFileStream.Write(Response.Content.ToArray(), 0, (int)Response.ContentLength);
				lFileStream.Close();
				return true;
			}
			else
			{
				if (cbUpErrorPop.Checked)
				{
					MessageBox.Show("Error - Check Debug Log");
				}
			}
			return false;
		}
Esempio n. 3
0
// ----------------------------------------------

		public string Upload(string url, string fieldname, CookieContainer cookies, CredentialCache credentials, string param1, string param2, string param3, string param4, string val1, string val2, string val3, string val4)
		{
			if (UploadALLAccounts.Checked) {
				string InstallPath = GetInstallPath();
				string[] Accounts = GetAccounts(InstallPath);

				if (Accounts == null) {
					return "";
					}

				foreach (string Account in Accounts) {
					tmpmainSvLocation = InstallPath + "\\WTF\\Account\\" + Account + "\\SavedVariables.lua";
					DebugLine("UploadALL: Name \"" + Account + "\"");
					UploadALL(url, fieldname, cookies, credentials, param1, param2, param3, param4, val1, val2, val3, val4, Account, tmpmainSvLocation);
					}

				return "";
				}

			Hashtable files = new Hashtable();
			string fullFilePath = "";
			string sep = Path.DirectorySeparatorChar.ToString();
			foreach (string checkedSV in SVList.CheckedItems) //itterate through all checked files in the sv file list
			{
				if (checkedSV != "SavedVariables")
				{

					fullFilePath = Path.GetDirectoryName(this.mainSvLocation) + sep + "SavedVariables" + sep + checkedSV + ".lua";
				}
				else
				{

					fullFilePath = Path.GetDirectoryName(this.mainSvLocation) + sep + "SavedVariables.lua";
				}

				// Error checking required here to make sure that the file exists else no point in trying to upload it!
				if (File.Exists(fullFilePath))
				{
					files[checkedSV] = fullFilePath;
				}
			}
			ArrayList AllParams = new ArrayList();
			AllParams.Add(new string[2] { param1, val1 });
			AllParams.Add(new string[2] { param2, val2 });
			AllParams.Add(new string[2] { param3, val3 });
			AllParams.Add(new string[2] { param4, val4 });
			UniUploader.http.FILE_COMPRESSION_METHODS CompressionMethod = UniUploader.http.FILE_COMPRESSION_METHODS.NONE;
			if (GZcompress.Checked)
				CompressionMethod = UniUploader.http.FILE_COMPRESSION_METHODS.GZIP;
			http.UserAgent = getUserAgent();

			DebugLine("Upload: ------------------------------------------------------------------------");
			//http.onInformationMessage += new UniUploader.http.httpInfoDelegate(http_onInformationMessage);
			//string result = http.post(files, AllParams, url, UniUploader.http.ENCODING_TYPES.MULTI_FORM_DATA, UniUploader.http.REQUEST_METHODS.POST, "", CompressionMethod, cookies, credentials);

			UniUploader.http.Response Response = new UniUploader.http.Response();
			if (!http.post(ref Response, url, AllParams, files, CompressionMethod))
			{
				if (cbUpErrorPop.Checked)
				{
					MessageBox.Show("Error - Check Debug Log");
				}
				DebugLine("Failed to Upload");
			}

			//http.onInformationMessage -= new UniUploader.http.httpInfoDelegate(http_onInformationMessage);
			DebugLine("[See Server Response Tab for upload result]");
			DebugLine("Upload: ------------------------------------------------------------------------");
			return Response.ToString();
		}
Esempio n. 4
0
// ----------------------------------------------

		private void doScreenshots()
		{
			Hashtable files = new Hashtable();//getSVFileList();
			string dummyFilePath = writeDummyScreenshotsLuaFile();
			files["screenshots"] = dummyFilePath;

			SetStatusBarPanelText(statusBarPanel1, Environment.NewLine + "Checking Screenshots" + Environment.NewLine);
			Hashtable h = get_screenshot_list();
			string data = "";
			foreach (DictionaryEntry de in h)
			{
				data += de.Value + "\n";
			}
			ArrayList allParams = get_all_params();
			allParams.Add(new string[2] { "OPERATION", "CHECKSHOTS" });
			allParams.Add(new string[2] { "data", data });
			UniUploader.http.Response Response = new UniUploader.http.Response();
			if (http.post(ref Response, URL.Text, allParams, files))
			{
				TextBoxAppendText(servResponse, Environment.NewLine + "Screenshot Process Step 1 Response:" + Environment.NewLine);
				TextBoxAppendText(servResponse, fixLineEnds(Response.ToString()));

				string[] NotUploadedYet = Response.ToString().Split('\n');
				foreach (string ssToUp in NotUploadedYet)
				{
					foreach (DictionaryEntry de in h)
					{
						if ((string)de.Value == ssToUp)
						{
							files[ssToUp] = de.Key;
						}
					}
				}
				if (files.Count - 1 > 0)
				{
					allParams = get_all_params();
					allParams.Add(new string[2] { "OPERATION", "UPSHOTS" });
					SetStatusBarPanelText(statusBarPanel1, "Uploading " + (files.Count - 1).ToString() + " Screenshots");
					if (http.post(ref Response, URL.Text, allParams, files))
					{
						TextBoxAppendText(servResponse, Environment.NewLine + "Screenshot Process Step 2 Response:" + Environment.NewLine);
						TextBoxAppendText(servResponse, fixLineEnds(Response.ToString()));
						DebugLine("Uploaded " + (files.Count - 1).ToString() + " Screenshots");
					}
					else
					{
						if (cbUpErrorPop.Checked)
						{
							MessageBox.Show("Error - Check Debug Log");
						}
					}
				}

			}
			else
			{
				if (cbUpErrorPop.Checked)
				{
					MessageBox.Show("Error - Check Debug Log");
				}
				DebugLine("Failed to upload screenshots");
			}

			SetStatusBarPanelText(statusBarPanel1, _READY);
		}