コード例 #1
0
        static void Main(string[] args)
        {
            try
            {
                _client = new ReportServiceClient();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
                Console.ReadKey();
                return;
            }

            try
            {
                foreach (var i in Enumerable.Range(0, 2).Reverse())
                {
                    Guid id = PrepareReport(i);
                    if (id != Guid.Empty)
                        CheckReport(id);
                }
                
                Console.ReadKey();
            }
            finally
            {
                if (_client != null)
                    _client.Close();
            }
        }
コード例 #2
0
ファイル: Updater.cs プロジェクト: nullkuhl/fsu-dev
        /// <summary>
        /// check if app is up to date
        /// </summary>
        /// <param name="latestVerLink"></param>
        /// <returns></returns>
        public bool IsUpToDate(out string latestVerLink)
        {
            string currVersion = CfgFile.Get("Version");

            BasicHttpBinding binding = new BasicHttpBinding();
            EndpointAddress address = new EndpointAddress("http://service.freemiumlab.com/ReportService.svc");

            ReportServiceClient client = new ReportServiceClient(binding, address);
            string[] latestVersion;
            try
            {
                latestVersion = client.GetLatestVersion();
                client.Close();
            }
            catch
            {
                latestVerLink = string.Empty;
                return true;
            }
            latestVerLink = latestVersion[1];
            return latestVersion[0] == currVersion;
        }
コード例 #3
0
ファイル: FormMain.cs プロジェクト: nullkuhl/fsu-dev
        /// <summary>
        /// Handles send button click event to send bug details to the server.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnSend_Click(object sender, EventArgs e)
        {
            // OS info
            string os = Environment.OSVersion.VersionString;
            if (Is64Bit())
                os += " 64-bit";
            else
                os += " 32-bit";

            // MAC address
            string mac = String.Empty;
            NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
            foreach (NetworkInterface intrfce in interfaces)
            {
                mac = intrfce.GetPhysicalAddress().ToString();
                if (!string.IsNullOrEmpty(mac))
                    break;
            }

            // IP address
            IPHostEntry ipEntry = Dns.GetHostEntry(Dns.GetHostName());
            string ip = ipEntry.AddressList[0].ToString();

            // Host name
            string hostName = Dns.GetHostName();

            string stackTraceTrimmed;
            try
            {
                // Bug stack trace
                int trimLimit = Program.BugStackTrace.IndexOf("line");
                stackTraceTrimmed = Program.BugStackTrace.Substring(0, trimLimit + 10);
            }
            catch (Exception)
            {
                stackTraceTrimmed = Program.BugStackTrace.Length > 100
                                        ? Program.BugStackTrace.Substring(0, 100)
                                        : Program.BugStackTrace;
            }

            // Hide window
            ShowInTaskbar = false;
            Hide();

            // Submit report
            var binding = new BasicHttpBinding();
            var address = new EndpointAddress("http://service.freemiumlab.com/ReportService.svc");

            ReportServiceClient client = null;
            try
            {
                client = new ReportServiceClient(binding, address);
            }
            catch
            {
                // MessageBox.Show(ex.Message + " " + ex.Source + " " + ex.InnerException);
            }

            try
            {
                string str_ver = String.Empty;
                string str_mac = String.Empty;
                string str_ip = String.Empty;
                string str_os = String.Empty;
                string str_host = String.Empty;
                string str_stacktrace = String.Empty;
                string str_bugtype = String.Empty;
                string str_bugmsg = String.Empty;
                string str_userinput = String.Empty;
                string str_target = String.Empty;
                string str_source = String.Empty;

                try
                {
                    if (Program.Version.Length > 0) str_ver = Program.Version;
                }
                catch
                {
                }
                try
                {
                    if (mac.Length > 0) str_mac = mac;
                }
                catch
                {
                }
                try
                {
                    if (ip.Length > 0) str_ip = ip;
                }
                catch
                {
                }
                try
                {
                    if (os.Length > 0) str_os = os;
                }
                catch
                {
                }
                try
                {
                    if (hostName.Length > 0) str_host = hostName;
                }
                catch
                {
                }
                try
                {
                    if (stackTraceTrimmed.Length > 0) str_stacktrace = stackTraceTrimmed;
                }
                catch
                {
                }
                try
                {
                    if (Program.BugType.Length > 0) str_bugtype = Program.BugType;
                }
                catch
                {
                }
                try
                {
                    if (Program.BugMessage.Length > 0) str_bugmsg = Program.BugMessage;
                }
                catch
                {
                }
                try
                {
                    if (txtContext.Text.Length > 0) str_userinput = txtContext.Text;
                }
                catch
                {
                }
                try
                {
                    if (Program.BugTargetSite.Length > 0) str_target = Program.BugTargetSite;
                }
                catch
                {
                }
                try
                {
                    if (Program.BugSource.Length > 0) str_source = Program.BugSource;
                }
                catch
                {
                }

                client.SubmitBugReport(
                    str_ver,
                    str_mac,
                    str_ip,
                    str_os,
                    str_host,
                    str_stacktrace,
                    str_bugtype,
                    str_bugmsg,
                    str_userinput,
                    str_target,
                    str_source
                    );
            }
            catch
            {
                // MessageBox.Show(ex.Message + " " + ex.Source + " " + ex.InnerException);
            }
            client.Close();

            // Close program
            Application.Exit();
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: nullkuhl/fdu-dev
		private void btnSend_Click(object sender, EventArgs e)
		{
			// OS info
			var os = Environment.OSVersion.VersionString;
			if (Is64Bit())
				os += " 64-bit";
			else
				os += " 32-bit";

			// MAC address
			var mac = "";
			var interfaces = NetworkInterface.GetAllNetworkInterfaces();
			foreach (NetworkInterface intrfce in interfaces)
			{
				mac = intrfce.GetPhysicalAddress().ToString();
				if (!string.IsNullOrEmpty(mac))
					break;
			}

			// IP address
			var ipEntry = Dns.GetHostEntry(Dns.GetHostName());
			var ip = ipEntry.AddressList[0].ToString();

			// Host name
			var hostName = Dns.GetHostName();

			string stackTrace = "";
			try
			{
				stackTrace = GZipStreamStringHelper.Zip(Program.BugStackTrace);
			}
			catch { }

			// Hide window
			ShowInTaskbar = false;
			Hide();

			// Submit report
			var binding = new BasicHttpBinding();
			var address = new EndpointAddress("http://driverservice.freemiumlab.com/ReportService.svc");
			//EndpointAddress address = new EndpointAddress("http://localhost:12758/ReportService.svc");

			ReportServiceClient client = null;
			try
			{
				client = new ReportServiceClient(binding, address);
			}
			catch (Exception ex)
			{
				// MessageBox.Show(ex.Message + " " + ex.Source + " " + ex.InnerException);
			}

			try
			{
				string str_ver = "";
				string str_mac = "";
				string str_ip = "";
				string str_os = "";
				string str_host = "";
				string str_stacktrace = "";
				string str_bugtype = "";
				string str_bugmsg = "";
				string str_userinput = "";
				string str_target = "";
				string str_source = "";

				try { if (Program.Version.Length > 0)str_ver = Program.Version; }
				catch { }
				try { if (mac.Length > 0)str_mac = mac; }
				catch { }
				try { if (ip.Length > 0)str_ip = ip; }
				catch { }
				try { if (os.Length > 0)str_os = os; }
				catch { }
				try { if (hostName.Length > 0)str_host = hostName; }
				catch { }
				try { if (stackTrace.Length > 0)str_stacktrace = stackTrace; }
				catch { }
				try { if (Program.BugType.Length > 0)str_bugtype = Program.BugType; }
				catch { }
				try { if (Program.BugMessage.Length > 0)str_bugmsg = Program.BugMessage; }
				catch { }
				try { if (txtContext.Text.Length > 0)str_userinput = txtContext.Text; }
				catch { }
				try { if (Program.BugTargetSite.Length > 0)str_target = Program.BugTargetSite; }
				catch { }
				try { if (Program.BugSource.Length > 0)str_source = Program.BugSource; }
				catch { }

				client.SubmitBugReport(
					str_ver,
					str_mac,
					str_ip,
					str_os,
					str_host,
					str_stacktrace,
					str_bugtype,
					str_bugmsg,
					str_userinput,
					str_target,
					str_source
					);

				client.SubmitNormalReport(
					str_ver,
					str_userinput,
					str_mac,
					str_ip,
					str_os,
					str_host);
			}
			catch { }
			client.Close();

			// Close program
			Application.Exit();
		}