mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 10:16:24 +02:00
whitespace forced changes (#6002)
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
{
|
||||
[EventData]
|
||||
public class DebugEvent : EventBase, IEvent
|
||||
{
|
||||
public string Message { get; set; }
|
||||
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
|
||||
}
|
||||
}
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
{
|
||||
[EventData]
|
||||
public class DebugEvent : EventBase, IEvent
|
||||
{
|
||||
public string Message { get; set; }
|
||||
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class to implement properties that are common to all telemetry events.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class EventBase
|
||||
{
|
||||
public bool UTCReplace_AppSessionGuid => true;
|
||||
|
||||
private string _version;
|
||||
|
||||
public string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_version))
|
||||
{
|
||||
_version = GetVersionFromAssembly();
|
||||
}
|
||||
|
||||
return _version;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetVersionFromAssembly()
|
||||
{
|
||||
// For consistency this should be formatted the same way as
|
||||
// https://github.com/microsoft/PowerToys/blob/710f92d99965109fd788d85ebf8b6b9e0ba1524a/src/common/common.cpp#L635
|
||||
var version = Assembly.GetExecutingAssembly()?.GetName()?.Version ?? new Version();
|
||||
return $"v{version.Major}.{version.Minor}.{version.Build}";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class to implement properties that are common to all telemetry events.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class EventBase
|
||||
{
|
||||
public bool UTCReplace_AppSessionGuid => true;
|
||||
|
||||
private string _version;
|
||||
|
||||
public string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_version))
|
||||
{
|
||||
_version = GetVersionFromAssembly();
|
||||
}
|
||||
|
||||
return _version;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetVersionFromAssembly()
|
||||
{
|
||||
// For consistency this should be formatted the same way as
|
||||
// https://github.com/microsoft/PowerToys/blob/710f92d99965109fd788d85ebf8b6b9e0ba1524a/src/common/common.cpp#L635
|
||||
var version = Assembly.GetExecutingAssembly()?.GetName()?.Version ?? new Version();
|
||||
return $"v{version.Major}.{version.Minor}.{version.Build}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
{
|
||||
public interface IEvent
|
||||
{
|
||||
PartA_PrivTags PartA_PrivTags { get; }
|
||||
}
|
||||
}
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry.Events
|
||||
{
|
||||
public interface IEvent
|
||||
{
|
||||
PartA_PrivTags PartA_PrivTags { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// Telemetry helper class for PowerToys.
|
||||
/// </summary>
|
||||
public class PowerToysTelemetry : TelemetryBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Name for ETW event.
|
||||
/// </summary>
|
||||
private const string EventSourceName = "Microsoft.PowerToys";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PowerToysTelemetry"/> class.
|
||||
/// </summary>
|
||||
public PowerToysTelemetry()
|
||||
: base(EventSourceName)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an instance of the <see cref="PowerLauncherTelemetry"/> class.
|
||||
/// </summary>
|
||||
public static PowerToysTelemetry Log { get; } = new PowerToysTelemetry();
|
||||
|
||||
/// <summary>
|
||||
/// Publishes ETW event when an action is triggered on
|
||||
/// </summary>
|
||||
public void WriteEvent<T>(T telemetryEvent)
|
||||
where T : EventBase, IEvent
|
||||
{
|
||||
this.Write<T>(
|
||||
null,
|
||||
new EventSourceOptions()
|
||||
{
|
||||
Keywords = ProjectKeywordMeasure,
|
||||
Tags = ProjectTelemetryTagProductAndServicePerformance,
|
||||
},
|
||||
telemetryEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// Telemetry helper class for PowerToys.
|
||||
/// </summary>
|
||||
public class PowerToysTelemetry : TelemetryBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Name for ETW event.
|
||||
/// </summary>
|
||||
private const string EventSourceName = "Microsoft.PowerToys";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PowerToysTelemetry"/> class.
|
||||
/// </summary>
|
||||
public PowerToysTelemetry()
|
||||
: base(EventSourceName)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an instance of the <see cref="PowerLauncherTelemetry"/> class.
|
||||
/// </summary>
|
||||
public static PowerToysTelemetry Log { get; } = new PowerToysTelemetry();
|
||||
|
||||
/// <summary>
|
||||
/// Publishes ETW event when an action is triggered on
|
||||
/// </summary>
|
||||
public void WriteEvent<T>(T telemetryEvent)
|
||||
where T : EventBase, IEvent
|
||||
{
|
||||
this.Write<T>(
|
||||
null,
|
||||
new EventSourceOptions()
|
||||
{
|
||||
Keywords = ProjectKeywordMeasure,
|
||||
Tags = ProjectTelemetryTagProductAndServicePerformance,
|
||||
},
|
||||
telemetryEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,59 +1,59 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// Privacy Tag values
|
||||
/// </summary>
|
||||
public enum PartA_PrivTags
|
||||
: ulong
|
||||
{
|
||||
/// <nodoc/>
|
||||
None = 0,
|
||||
|
||||
/// <nodoc/>
|
||||
ProductAndServicePerformance = 0x0u,
|
||||
|
||||
/// <nodoc/>
|
||||
ProductAndServiceUsage = 0x0u,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base class for telemetry events.
|
||||
/// </summary>
|
||||
public class TelemetryBase : EventSource
|
||||
{
|
||||
/// <summary>
|
||||
/// The event tag for this event source.
|
||||
/// </summary>
|
||||
public const EventTags ProjectTelemetryTagProductAndServicePerformance = (EventTags)0x0u;
|
||||
|
||||
/// <summary>
|
||||
/// The event keyword for this event source.
|
||||
/// </summary>
|
||||
public const EventKeywords ProjectKeywordMeasure = (EventKeywords)0x0;
|
||||
|
||||
/// <summary>
|
||||
/// Group ID for Powertoys project.
|
||||
/// </summary>
|
||||
private static readonly string[] PowerToysTelemetryTraits = { "ETW_GROUP", "{42749043-438c-46a2-82be-c6cbeb192ff2}" };
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TelemetryBase"/> class.
|
||||
/// </summary>
|
||||
/// <param name="eventSourceName">.</param>
|
||||
public TelemetryBase(
|
||||
string eventSourceName)
|
||||
: base(
|
||||
eventSourceName,
|
||||
EventSourceSettings.EtwSelfDescribingEventFormat,
|
||||
PowerToysTelemetryTraits)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace Microsoft.PowerToys.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// Privacy Tag values
|
||||
/// </summary>
|
||||
public enum PartA_PrivTags
|
||||
: ulong
|
||||
{
|
||||
/// <nodoc/>
|
||||
None = 0,
|
||||
|
||||
/// <nodoc/>
|
||||
ProductAndServicePerformance = 0x0u,
|
||||
|
||||
/// <nodoc/>
|
||||
ProductAndServiceUsage = 0x0u,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base class for telemetry events.
|
||||
/// </summary>
|
||||
public class TelemetryBase : EventSource
|
||||
{
|
||||
/// <summary>
|
||||
/// The event tag for this event source.
|
||||
/// </summary>
|
||||
public const EventTags ProjectTelemetryTagProductAndServicePerformance = (EventTags)0x0u;
|
||||
|
||||
/// <summary>
|
||||
/// The event keyword for this event source.
|
||||
/// </summary>
|
||||
public const EventKeywords ProjectKeywordMeasure = (EventKeywords)0x0;
|
||||
|
||||
/// <summary>
|
||||
/// Group ID for Powertoys project.
|
||||
/// </summary>
|
||||
private static readonly string[] PowerToysTelemetryTraits = { "ETW_GROUP", "{42749043-438c-46a2-82be-c6cbeb192ff2}" };
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TelemetryBase"/> class.
|
||||
/// </summary>
|
||||
/// <param name="eventSourceName">.</param>
|
||||
public TelemetryBase(
|
||||
string eventSourceName)
|
||||
: base(
|
||||
eventSourceName,
|
||||
EventSourceSettings.EtwSelfDescribingEventFormat,
|
||||
PowerToysTelemetryTraits)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user