Beispiel #1
0
 bool SendErrorData(TelemetryErrorData Data, string Version, string IpAddress)
 {
     try
     {
         Stopwatch Timer = Stopwatch.StartNew();
         LogWriter.WriteLine("Posting error data... ({0}, {1})", Data.Type, Data.Timestamp);
         RESTApi.POST(ApiUrl, "error", new JavaScriptSerializer().Serialize(Data), string.Format("Version={0}", Version), string.Format("IpAddress={0}", IpAddress));
         LogWriter.WriteLine("Done in {0}ms.", Timer.ElapsedMilliseconds);
         return(true);
     }
     catch (Exception Ex)
     {
         LogWriter.WriteException(Ex, "Failed with exception.");
         return(false);
     }
 }
Beispiel #2
0
        public static void Enqueue(TelemetryErrorType Type, string Text, string Project, DateTime Timestamp)
        {
            TelemetryWriter Writer = Instance;

            if (Writer != null)
            {
                TelemetryErrorData Error = new TelemetryErrorData();
                Error.Type      = Type;
                Error.Text      = Text;
                Error.UserName  = Environment.UserName;
                Error.Project   = Project;
                Error.Timestamp = Timestamp;

                Writer.QueuedErrorData.Enqueue(Error);
                Writer.RefreshEvent.Set();
            }
        }
Beispiel #3
0
 bool SendErrorData(TelemetryErrorData Data, string Version, string IpAddress)
 {
     try
     {
         Stopwatch Timer = Stopwatch.StartNew();
         LogWriter.WriteLine("Posting error data... ({0}, {1})", Data.Type, Data.Timestamp);
         using (SqlConnection Connection = new SqlConnection(SqlConnectionString))
         {
             Connection.Open();
             using (SqlCommand Command = new SqlCommand("INSERT INTO dbo.[Errors] (Type, Text, UserName, Project, Timestamp, Version, IpAddress) VALUES (@Type, @Text, @UserName, @Project, @Timestamp, @Version, @IpAddress)", Connection))
             {
                 Command.Parameters.AddWithValue("@Type", Data.Type.ToString());
                 Command.Parameters.AddWithValue("@Text", Data.Text);
                 Command.Parameters.AddWithValue("@UserName", Data.UserName);
                 if (Data.Project == null)
                 {
                     Command.Parameters.AddWithValue("@Project", DBNull.Value);
                 }
                 else
                 {
                     Command.Parameters.AddWithValue("@Project", Data.Project);
                 }
                 Command.Parameters.AddWithValue("@Timestamp", Data.Timestamp);
                 Command.Parameters.AddWithValue("@Version", Version);
                 Command.Parameters.AddWithValue("@IPAddress", IpAddress);
                 Command.ExecuteNonQuery();
             }
         }
         LogWriter.WriteLine("Done in {0}ms.", Timer.ElapsedMilliseconds);
         return(true);
     }
     catch (Exception Ex)
     {
         LogWriter.WriteException(Ex, "Failed with exception.");
         return(false);
     }
 }
		public static void Enqueue(TelemetryErrorType Type, string Text, string Project, DateTime Timestamp)
		{
			TelemetryWriter Writer = Instance;
			if(Writer != null)
			{
				TelemetryErrorData Error = new TelemetryErrorData();
				Error.Type = Type;
				Error.Text = Text;
				Error.UserName = Environment.UserName;
				Error.Project = Project;
				Error.Timestamp = Timestamp;

				Writer.QueuedErrorData.Enqueue(Error);
				Writer.RefreshEvent.Set();
			}
		}
		bool SendErrorData(TelemetryErrorData Data, string Version, string IpAddress)
		{
			try
			{
				Stopwatch Timer = Stopwatch.StartNew();
				LogWriter.WriteLine("Posting error data... ({0}, {1})", Data.Type, Data.Timestamp);
				using(SqlConnection Connection = new SqlConnection(SqlConnectionString))
				{
					Connection.Open();
					using (SqlCommand Command = new SqlCommand("INSERT INTO dbo.[Errors] (Type, Text, UserName, Project, Timestamp, Version, IpAddress) VALUES (@Type, @Text, @UserName, @Project, @Timestamp, @Version, @IpAddress)", Connection))
					{
						Command.Parameters.AddWithValue("@Type", Data.Type.ToString());
						Command.Parameters.AddWithValue("@Text", Data.Text);
						Command.Parameters.AddWithValue("@UserName", Data.UserName);
						if(Data.Project == null)
						{
							Command.Parameters.AddWithValue("@Project", DBNull.Value);
						}
						else
						{
							Command.Parameters.AddWithValue("@Project", Data.Project);
						}
						Command.Parameters.AddWithValue("@Timestamp", Data.Timestamp);
						Command.Parameters.AddWithValue("@Version", Version);
						Command.Parameters.AddWithValue("@IPAddress", IpAddress);
						Command.ExecuteNonQuery();
					}
				}
				LogWriter.WriteLine("Done in {0}ms.", Timer.ElapsedMilliseconds);
				return true;
			}
			catch(Exception Ex)
			{
				LogWriter.WriteException(Ex, "Failed with exception.");
				return false;
			}
		}