mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-03 19:06:41 +01:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1c1161d3b | ||
|
|
4208e05826 | ||
|
|
207b5dae50 | ||
|
|
6828961262 | ||
|
|
265e52967a | ||
|
|
f1308fad5e | ||
|
|
235a299b73 | ||
|
|
f60b294dcb | ||
|
|
5149ed4c00 | ||
|
|
b92db8134b | ||
|
|
b18652ad6c | ||
|
|
9bbda17811 | ||
|
|
ee4440f65f | ||
|
|
2234db6c6b | ||
|
|
cf5afc6c1c | ||
|
|
3de225c8fe | ||
|
|
9324162007 | ||
|
|
e21783473e | ||
|
|
e1fa78c50f | ||
|
|
8cb70648d3 | ||
|
|
d45ae2c197 | ||
|
|
5c0e14656e | ||
|
|
f9b1588375 | ||
|
|
5596a32e3d | ||
|
|
51a33afbdb | ||
|
|
ce010f5f7a | ||
|
|
27b234e38e | ||
|
|
c716aa65ae | ||
|
|
3c6d882e91 | ||
|
|
c87a344007 | ||
|
|
f97cc86f67 | ||
|
|
e7cc3a04f7 | ||
|
|
9c0ef91fd9 | ||
|
|
f2ed58f329 | ||
|
|
96c09532fa | ||
|
|
65a313fb4e |
3
.github/actions/spell-check/expect.txt
vendored
3
.github/actions/spell-check/expect.txt
vendored
@@ -1,6 +1,7 @@
|
||||
# FALSE POSITIVES
|
||||
## "PackagemanagerWrapper.cs" should be "PackageManagerWrapper.cs"
|
||||
## NOTICE.MD > MOZILLA PUBLIC LICENSE v1.1
|
||||
|
||||
aaaa
|
||||
abcdefghjkmnpqrstuvxyz
|
||||
abgr
|
||||
@@ -42,6 +43,7 @@ AMPROPSETID
|
||||
amr
|
||||
ANDSCANS
|
||||
animatedvisuals
|
||||
anr
|
||||
ansicolor
|
||||
ANull
|
||||
AOC
|
||||
@@ -1212,7 +1214,6 @@ prgms
|
||||
pri
|
||||
PRINTCLIENT
|
||||
printmanagement
|
||||
privacystatement
|
||||
prm
|
||||
proactively
|
||||
PROCESSENTRY
|
||||
|
||||
@@ -376,16 +376,6 @@ jobs:
|
||||
msbuildArchitecture: x64
|
||||
maximumCpuCount: true
|
||||
|
||||
### HACK: On ARM64 builds, building an app with Windows App SDK copies the x64 WebView2 dll instead of the ARM64 one. This task makes sure the right dll is used.
|
||||
- task: CopyFiles@2
|
||||
displayName: HACK Copy core WebView2 ARM64 dll to output directory
|
||||
condition: eq(variables['BuildPlatform'],'arm64')
|
||||
inputs:
|
||||
contents: packages/Microsoft.Web.WebView2.1.0.2739.15/runtimes/win-ARM64/native_uap/Microsoft.Web.WebView2.Core.dll
|
||||
targetFolder: $(Build.SourcesDirectory)/ARM64/Release/WinUI3Apps/
|
||||
flattenFolders: True
|
||||
OverWrite: True
|
||||
|
||||
# Check if deps.json files don't reference different dll versions.
|
||||
- pwsh: |-
|
||||
& '.pipelines/verifyDepsJsonLibraryVersions.ps1' -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)'
|
||||
|
||||
1012
DATA_AND_PRIVACY.md
1012
DATA_AND_PRIVACY.md
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,7 @@ namespace Microsoft.PowerToys.Telemetry
|
||||
|
||||
private readonly bool telemetryEnabled = DataDiagnosticsSettings.GetEnabledValue(); // This is the global telemetry setting on whether to log events
|
||||
private readonly bool telemetryRecordingEnabled = DataDiagnosticsSettings.GetViewEnabledValue(); // This is the setting for recording telemetry events to disk for viewing
|
||||
private string etwFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Microsoft\PowerToys\", "etw");
|
||||
private readonly string etwFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Microsoft\PowerToys\", "etw");
|
||||
private bool disposedValue;
|
||||
private string sessionName;
|
||||
private string etwFilePath;
|
||||
@@ -49,18 +49,6 @@ namespace Microsoft.PowerToys.Telemetry
|
||||
/// Initializes a new instance of the <see cref="ETWTrace"/> class.
|
||||
/// </summary>
|
||||
public ETWTrace()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
public ETWTrace(string etwPath)
|
||||
{
|
||||
this.etwFolderPath = etwPath;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
private void Init()
|
||||
{
|
||||
if (File.Exists(etwFolderPath))
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Hosts.Helpers
|
||||
public static void WaitForEventLoop(string eventName, Action callback)
|
||||
{
|
||||
var dispatcherQueue = DispatcherQueue.GetForCurrentThread();
|
||||
var t = new Thread(() =>
|
||||
new Thread(() =>
|
||||
{
|
||||
var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, eventName);
|
||||
while (true)
|
||||
@@ -24,10 +24,7 @@ namespace Hosts.Helpers
|
||||
dispatcherQueue.TryEnqueue(() => callback());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,12 +216,6 @@ public:
|
||||
m_hShowAdminEvent = nullptr;
|
||||
}
|
||||
|
||||
if (m_hTerminateEvent)
|
||||
{
|
||||
CloseHandle(m_hTerminateEvent);
|
||||
m_hTerminateEvent = nullptr;
|
||||
}
|
||||
|
||||
delete this;
|
||||
}
|
||||
|
||||
@@ -286,7 +280,6 @@ public:
|
||||
SetEvent(m_hTerminateEvent);
|
||||
WaitForSingleObject(m_hProcess, 1500);
|
||||
TerminateProcess(m_hProcess, 1);
|
||||
ResetEvent(m_hTerminateEvent);
|
||||
}
|
||||
|
||||
m_enabled = false;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 264 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 264 KiB |
@@ -38,38 +38,6 @@ int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR cmdline, int cm
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::wstring cmdLineStr{ GetCommandLineW() };
|
||||
auto cmdArgs = split(cmdLineStr, L" ");
|
||||
if (cmdArgs.workspaceId.empty())
|
||||
{
|
||||
Logger::warn("Incorrect command line arguments: no workspace id");
|
||||
MessageBox(NULL, GET_RESOURCE_STRING(IDS_INCORRECT_ARGS).c_str(), GET_RESOURCE_STRING(IDS_WORKSPACES).c_str(), MB_ICONERROR | MB_OK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!cmdArgs.isRestarted)
|
||||
{
|
||||
// check if restart is needed. Only check it if not yet restarted to avoid endless restarting. Restart is needed if the process is elevated.
|
||||
if (is_process_elevated())
|
||||
{
|
||||
Logger::warn("Workspaces Launcher is elevated, restart");
|
||||
|
||||
constexpr DWORD exe_path_size = 0xFFFF;
|
||||
auto exe_path = std::make_unique<wchar_t[]>(exe_path_size);
|
||||
GetModuleFileNameW(nullptr, exe_path.get(), exe_path_size);
|
||||
|
||||
const auto modulePath = get_module_folderpath();
|
||||
|
||||
std::string cmdLineStr(cmdline);
|
||||
std::wstring cmdLineWStr(cmdLineStr.begin(), cmdLineStr.end());
|
||||
|
||||
std::wstring cmd = cmdArgs.workspaceId + L" " + std::to_wstring(cmdArgs.invokePoint) + L" " + NonLocalizable::restartedString;
|
||||
|
||||
RunNonElevatedEx(exe_path.get(), cmd, modulePath);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
auto mutex = CreateMutex(nullptr, true, instanceMutexName.c_str());
|
||||
if (mutex == nullptr)
|
||||
{
|
||||
@@ -82,6 +50,34 @@ int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR cmdline, int cm
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::wstring cmdLineStr{ GetCommandLineW() };
|
||||
auto cmdArgs = split(cmdLineStr, L" ");
|
||||
if (cmdArgs.workspaceId.empty())
|
||||
{
|
||||
Logger::warn("Incorrect command line arguments: no workspace id");
|
||||
MessageBox(NULL, GET_RESOURCE_STRING(IDS_INCORRECT_ARGS).c_str(), GET_RESOURCE_STRING(IDS_WORKSPACES).c_str(), MB_ICONERROR | MB_OK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (is_process_elevated())
|
||||
{
|
||||
Logger::warn("Workspaces Launcher is elevated, restart");
|
||||
|
||||
constexpr DWORD exe_path_size = 0xFFFF;
|
||||
auto exe_path = std::make_unique<wchar_t[]>(exe_path_size);
|
||||
GetModuleFileNameW(nullptr, exe_path.get(), exe_path_size);
|
||||
|
||||
const auto modulePath = get_module_folderpath();
|
||||
|
||||
std::string cmdLineStr(cmdline);
|
||||
std::wstring cmdLineWStr(cmdLineStr.begin(), cmdLineStr.end());
|
||||
|
||||
std::wstring cmd = cmdArgs.workspaceId + L" " + std::to_wstring(cmdArgs.invokePoint);
|
||||
|
||||
RunNonElevatedEx(exe_path.get(), cmd, modulePath);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// COM should be initialized before ShellExecuteEx is called.
|
||||
if (FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED)))
|
||||
{
|
||||
|
||||
@@ -6,22 +6,15 @@
|
||||
#include <workspaces-common/GuidUtils.h>
|
||||
#include <workspaces-common/InvokePoint.h>
|
||||
|
||||
namespace NonLocalizable
|
||||
{
|
||||
const wchar_t restartedString[] = L"restarted";
|
||||
}
|
||||
|
||||
struct CommandLineArgs
|
||||
{
|
||||
std::wstring workspaceId;
|
||||
InvokePoint invokePoint;
|
||||
bool isRestarted;
|
||||
};
|
||||
|
||||
CommandLineArgs split(std::wstring s, const std::wstring& delimiter)
|
||||
{
|
||||
CommandLineArgs cmdArgs{};
|
||||
cmdArgs.isRestarted = false;
|
||||
|
||||
size_t pos = 0;
|
||||
std::wstring token;
|
||||
@@ -36,11 +29,7 @@ CommandLineArgs split(std::wstring s, const std::wstring& delimiter)
|
||||
|
||||
for (const auto& token : tokens)
|
||||
{
|
||||
if (token == NonLocalizable::restartedString)
|
||||
{
|
||||
cmdArgs.isRestarted = true;
|
||||
}
|
||||
else if (!cmdArgs.workspaceId.empty())
|
||||
if (!cmdArgs.workspaceId.empty())
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -58,7 +47,7 @@ CommandLineArgs split(std::wstring s, const std::wstring& delimiter)
|
||||
{
|
||||
cmdArgs.workspaceId = token;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cmdArgs;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Peek.UI.Native
|
||||
public static void WaitForEventLoop(string eventName, Action callback)
|
||||
{
|
||||
var dispatcherQueue = DispatcherQueue.GetForCurrentThread();
|
||||
var t = new Thread(() =>
|
||||
new Thread(() =>
|
||||
{
|
||||
var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, eventName);
|
||||
while (true)
|
||||
@@ -24,10 +24,7 @@ namespace Peek.UI.Native
|
||||
dispatcherQueue.TryEnqueue(() => callback());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
using Common;
|
||||
using Microsoft.PowerToys.FilePreviewCommon;
|
||||
using Microsoft.PowerToys.PreviewHandler.Gcode.Telemetry.Events;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Gcode
|
||||
{
|
||||
@@ -86,13 +84,6 @@ namespace Microsoft.PowerToys.PreviewHandler.Gcode
|
||||
|
||||
Resize += FormResized;
|
||||
base.DoPreview(fs);
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new GcodeFilePreviewed());
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -162,14 +153,6 @@ namespace Microsoft.PowerToys.PreviewHandler.Gcode
|
||||
/// <param name="dataSource">Stream reference to access source file.</param>
|
||||
private void PreviewError<T>(Exception exception, T dataSource)
|
||||
{
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new GcodeFilePreviewError { Message = exception.Message });
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
|
||||
Controls.Clear();
|
||||
_infoBarAdded = true;
|
||||
AddTextBoxControl(Properties.Resource.GcodeNotPreviewedError);
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Globalization;
|
||||
using System.Windows.Threading;
|
||||
|
||||
using Common.UI;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using PowerToys.Interop;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Gcode
|
||||
@@ -28,8 +27,6 @@ namespace Microsoft.PowerToys.PreviewHandler.Gcode
|
||||
{
|
||||
if (args.Length == 6)
|
||||
{
|
||||
ETWTrace etwTrace = new ETWTrace(Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "AppData", "LocalLow", "Microsoft", "PowerToys", "etw"));
|
||||
|
||||
string filePath = args[0];
|
||||
IntPtr hwnd = IntPtr.Parse(args[1], NumberStyles.HexNumber, CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -55,16 +52,12 @@ namespace Microsoft.PowerToys.PreviewHandler.Gcode
|
||||
Rectangle s = default;
|
||||
if (!_previewHandlerControl.SetRect(s))
|
||||
{
|
||||
etwTrace?.Dispose();
|
||||
|
||||
// When the parent HWND became invalid, the application won't respond to Application.Exit().
|
||||
Environment.Exit(0);
|
||||
}
|
||||
},
|
||||
Dispatcher.CurrentDispatcher,
|
||||
_tokenSource.Token);
|
||||
|
||||
etwTrace?.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Gcode.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event to be raised when a svg file has been viewed in the preview pane.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class GcodeFileHandlerLoaded : EventBase, IEvent
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Gcode.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event to be raised when an error has occurred in the preview pane.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class GcodeFilePreviewError : EventBase, IEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the error message to log as part of the telemetry event.
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Gcode.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event to be raised when a svg file has been viewed in the preview pane.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class GcodeFilePreviewed : EventBase, IEvent
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,6 @@ using System.Text.RegularExpressions;
|
||||
|
||||
using Common;
|
||||
using Microsoft.PowerToys.PreviewHandler.Markdown.Properties;
|
||||
using Microsoft.PowerToys.PreviewHandler.Markdown.Telemetry.Events;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using Microsoft.Web.WebView2.WinForms;
|
||||
using Windows.System;
|
||||
@@ -217,25 +215,9 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
||||
{
|
||||
}
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new MarkdownFilePreviewed());
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new MarkdownFilePreviewError { Message = ex.Message });
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
|
||||
Controls.Clear();
|
||||
_infoBarDisplayed = true;
|
||||
_infoBar = GetTextBoxControl(Resources.MarkdownNotPreviewedError);
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Globalization;
|
||||
using System.Windows.Threading;
|
||||
|
||||
using Common.UI;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using PowerToys.Interop;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
||||
@@ -28,8 +27,6 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
||||
{
|
||||
if (args.Length == 6)
|
||||
{
|
||||
ETWTrace etwTrace = new ETWTrace(Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "AppData", "LocalLow", "Microsoft", "PowerToys", "etw"));
|
||||
|
||||
string filePath = args[0];
|
||||
IntPtr hwnd = IntPtr.Parse(args[1], NumberStyles.HexNumber, CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -55,16 +52,12 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
||||
Rectangle s = default;
|
||||
if (!_previewHandlerControl.SetRect(s))
|
||||
{
|
||||
etwTrace?.Dispose();
|
||||
|
||||
// When the parent HWND became invalid, the application won't respond to Application.Exit().
|
||||
Environment.Exit(0);
|
||||
}
|
||||
},
|
||||
Dispatcher.CurrentDispatcher,
|
||||
_tokenSource.Token);
|
||||
|
||||
etwTrace?.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Markdown.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event that is triggered when a markdown file is viewed in the preview pane.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class MarkdownFileHandlerLoaded : EventBase, IEvent
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
// 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 Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Markdown.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event that is triggered when an error occurs while attempting to view a markdown file in the preview pane.
|
||||
/// </summary>
|
||||
public class MarkdownFilePreviewError : EventBase, IEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the error message.
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Markdown.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event that is triggered when a markdown file is viewed in the preview pane.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class MarkdownFilePreviewed : EventBase, IEvent
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,8 @@
|
||||
// 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.Drawing;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Common;
|
||||
using Common.Utilities;
|
||||
using Microsoft.PowerToys.PreviewHandler.Pdf.Properties;
|
||||
using Microsoft.PowerToys.PreviewHandler.Pdf.Telemetry.Events;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Windows.Data.Pdf;
|
||||
using Windows.Storage.Streams;
|
||||
using Windows.UI.ViewManagement;
|
||||
@@ -158,25 +149,9 @@ namespace Microsoft.PowerToys.PreviewHandler.Pdf
|
||||
memStream.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new PdfFilePreviewed());
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new PdfFilePreviewError { Message = ex.Message });
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
|
||||
Controls.Clear();
|
||||
_infoBar = GetTextBoxControl(Resources.PdfNotPreviewedError);
|
||||
Controls.Add(_infoBar);
|
||||
|
||||
@@ -5,7 +5,6 @@ using System.Globalization;
|
||||
using System.Windows.Threading;
|
||||
|
||||
using Common.UI;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using PowerToys.Interop;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Pdf
|
||||
@@ -27,8 +26,6 @@ namespace Microsoft.PowerToys.PreviewHandler.Pdf
|
||||
{
|
||||
if (args.Length == 6)
|
||||
{
|
||||
ETWTrace etwTrace = new ETWTrace(Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "AppData", "LocalLow", "Microsoft", "PowerToys", "etw"));
|
||||
|
||||
string filePath = args[0];
|
||||
IntPtr hwnd = IntPtr.Parse(args[1], NumberStyles.HexNumber, CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -54,16 +51,12 @@ namespace Microsoft.PowerToys.PreviewHandler.Pdf
|
||||
Rectangle s = default;
|
||||
if (!_previewHandlerControl.SetRect(s))
|
||||
{
|
||||
etwTrace?.Dispose();
|
||||
|
||||
// When the parent HWND became invalid, the application won't respond to Application.Exit().
|
||||
Environment.Exit(0);
|
||||
}
|
||||
},
|
||||
Dispatcher.CurrentDispatcher,
|
||||
_tokenSource.Token);
|
||||
|
||||
etwTrace?.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Pdf.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event that is triggered when a pdf file is viewed in the preview pane.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class PdfFileHandlerLoaded : EventBase, IEvent
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
// 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 Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Pdf.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event that is triggered when an error occurs while attempting to view a markdown file in the preview pane.
|
||||
/// </summary>
|
||||
public class PdfFilePreviewError : EventBase, IEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the error message.
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Pdf.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event that is triggered when a markdown file is viewed in the preview pane.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class PdfFilePreviewed : EventBase, IEvent
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ using System.Globalization;
|
||||
using System.Windows.Threading;
|
||||
|
||||
using Common.UI;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using PowerToys.Interop;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Qoi
|
||||
@@ -28,8 +27,6 @@ namespace Microsoft.PowerToys.PreviewHandler.Qoi
|
||||
{
|
||||
if (args.Length == 6)
|
||||
{
|
||||
ETWTrace etwTrace = new ETWTrace(Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "AppData", "LocalLow", "Microsoft", "PowerToys", "etw"));
|
||||
|
||||
string filePath = args[0];
|
||||
IntPtr hwnd = IntPtr.Parse(args[1], NumberStyles.HexNumber, CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -55,16 +52,12 @@ namespace Microsoft.PowerToys.PreviewHandler.Qoi
|
||||
Rectangle s = default;
|
||||
if (!_previewHandlerControl.SetRect(s))
|
||||
{
|
||||
etwTrace?.Dispose();
|
||||
|
||||
// When the parent HWND became invalid, the application won't respond to Application.Exit().
|
||||
Environment.Exit(0);
|
||||
}
|
||||
},
|
||||
Dispatcher.CurrentDispatcher,
|
||||
_tokenSource.Token);
|
||||
|
||||
etwTrace?.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
using Common;
|
||||
using Microsoft.PowerToys.FilePreviewCommon;
|
||||
using Microsoft.PowerToys.PreviewHandler.Qoi.Telemetry.Events;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Qoi
|
||||
{
|
||||
@@ -73,13 +71,6 @@ namespace Microsoft.PowerToys.PreviewHandler.Qoi
|
||||
|
||||
Resize += FormResized;
|
||||
base.DoPreview(fs);
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new QoiFilePreviewed());
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -149,14 +140,6 @@ namespace Microsoft.PowerToys.PreviewHandler.Qoi
|
||||
/// <param name="dataSource">Stream reference to access source file.</param>
|
||||
private void PreviewError<T>(Exception exception, T dataSource)
|
||||
{
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new QoiFilePreviewError { Message = exception.Message });
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
|
||||
Controls.Clear();
|
||||
_infoBarAdded = true;
|
||||
AddTextBoxControl(Properties.Resource.QoiNotPreviewedError);
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Qoi.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event to be raised when an error has occurred in the preview pane.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class QoiFilePreviewError : EventBase, IEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the error message to log as part of the telemetry event.
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Qoi.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event to be raised when a Qoi file has been viewed in the preview pane.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class QoiFilePreviewed : EventBase, IEvent
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ using System.Globalization;
|
||||
using System.Windows.Threading;
|
||||
|
||||
using Common.UI;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using PowerToys.Interop;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Svg
|
||||
@@ -28,8 +27,6 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg
|
||||
{
|
||||
if (args.Length == 6)
|
||||
{
|
||||
ETWTrace etwTrace = new ETWTrace(Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "AppData", "LocalLow", "Microsoft", "PowerToys", "etw"));
|
||||
|
||||
string filePath = args[0];
|
||||
IntPtr hwnd = IntPtr.Parse(args[1], NumberStyles.HexNumber, CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -55,16 +52,12 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg
|
||||
Rectangle s = default;
|
||||
if (!_previewHandlerControl.SetRect(s))
|
||||
{
|
||||
etwTrace?.Dispose();
|
||||
|
||||
// When the parent HWND became invalid, the application won't respond to Application.Exit().
|
||||
Environment.Exit(0);
|
||||
}
|
||||
},
|
||||
Dispatcher.CurrentDispatcher,
|
||||
_tokenSource.Token);
|
||||
|
||||
etwTrace?.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
// 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.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using Common;
|
||||
using Common.Utilities;
|
||||
using Microsoft.PowerToys.PreviewHandler.Svg.Telemetry.Events;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using Microsoft.Web.WebView2.WinForms;
|
||||
using SvgPreviewHandler;
|
||||
@@ -142,15 +139,8 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg
|
||||
svgData = SvgPreviewHandlerHelper.SwapNamespaces(svgData);
|
||||
svgData = SvgPreviewHandlerHelper.AddStyleSVG(svgData);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new SvgFilePreviewError { Message = ex.Message });
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
@@ -167,13 +157,6 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg
|
||||
AddWebViewControl(svgData);
|
||||
Resize += FormResized;
|
||||
base.DoPreview(dataSource);
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new SvgFilePreviewed());
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -301,14 +284,6 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg
|
||||
/// <param name="dataSource">Stream reference to access source file.</param>
|
||||
private void PreviewError<T>(Exception exception, T dataSource)
|
||||
{
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new SvgFilePreviewError { Message = exception.Message });
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
|
||||
Controls.Clear();
|
||||
_infoBarAdded = true;
|
||||
AddTextBoxControl(Properties.Resource.SvgNotPreviewedError);
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Svg.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event to be raised when a svg file has been viewed in the preview pane.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class SvgFileHandlerLoaded : EventBase, IEvent
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Svg.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event to be raised when an error has occurred in the preview pane.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class SvgFilePreviewError : EventBase, IEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the error message to log as part of the telemetry event.
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Svg.Telemetry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// A telemetry event to be raised when a svg file has been viewed in the preview pane.
|
||||
/// </summary>
|
||||
[EventData]
|
||||
public class SvgFilePreviewed : EventBase, IEvent
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 5.9 KiB |
@@ -4,7 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.UI.Dispatching;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
@@ -14,7 +14,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
public static void WaitForEventLoop(string eventName, Action callback)
|
||||
{
|
||||
var dispatcherQueue = DispatcherQueue.GetForCurrentThread();
|
||||
var t = new Thread(() =>
|
||||
new Task(() =>
|
||||
{
|
||||
var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, eventName);
|
||||
while (true)
|
||||
@@ -24,10 +24,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
dispatcherQueue.TryEnqueue(() => callback());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,9 +159,9 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
ViewModel.RefreshSettingsOnExternalChange();
|
||||
}
|
||||
|
||||
private async void ViewDiagnosticData_Click(object sender, RoutedEventArgs e)
|
||||
private void ViewDiagnosticData_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await Task.Run(ViewModel.ViewDiagnosticData);
|
||||
ViewModel.ViewDiagnosticData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,9 +168,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
string etwDirPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft\\PowerToys\\etw");
|
||||
DeleteDiagnosticDataOlderThan28Days(etwDirPath);
|
||||
|
||||
string localLowEtwDirPath = Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "AppData", "LocalLow", "Microsoft", "PowerToys", "etw");
|
||||
DeleteDiagnosticDataOlderThan28Days(localLowEtwDirPath);
|
||||
|
||||
InitializeLanguages();
|
||||
}
|
||||
|
||||
@@ -1256,34 +1253,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
internal void ViewDiagnosticData()
|
||||
{
|
||||
string localLowEtwDirPath = Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "AppData", "LocalLow", "Microsoft", "PowerToys", "etw");
|
||||
string etwDirPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft\\PowerToys\\etw");
|
||||
|
||||
if (Directory.Exists(localLowEtwDirPath))
|
||||
{
|
||||
if (!Directory.Exists(etwDirPath))
|
||||
{
|
||||
Directory.CreateDirectory(etwDirPath);
|
||||
}
|
||||
|
||||
string[] localLowEtlFiles = Directory.GetFiles(localLowEtwDirPath, "*.etl");
|
||||
|
||||
foreach (string file in localLowEtlFiles)
|
||||
{
|
||||
string fileName = Path.GetFileName(file);
|
||||
string destFile = Path.Combine(etwDirPath, fileName);
|
||||
|
||||
try
|
||||
{
|
||||
File.Copy(file, destFile, overwrite: true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Failed to copy etl file: {fileName}. Error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string tracerptPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "system32");
|
||||
|
||||
ETLConverter converter = new ETLConverter(etwDirPath, tracerptPath);
|
||||
|
||||
Reference in New Issue
Block a user