修正格式

This commit is contained in:
Aigio Liu
2022-04-25 18:28:32 +08:00
parent 416f88d993
commit b6733bf965
291 changed files with 1677 additions and 802 deletions
@@ -8,6 +8,7 @@ static class DWMApi
DWM_TNP_RECTDESTINATION = 0x1;
const string DllName = "dwmapi";
[DllImport(DllName, CharSet = CharSet.Auto)]
public static extern int DwmRegisterThumbnail(IntPtr dest, IntPtr src, out IntPtr thumb);
@@ -21,6 +21,7 @@ static class MouseHook
Subscribe();
MouseUp += value;
}
remove
{
MouseUp -= value;
@@ -147,6 +148,7 @@ static class MouseHook
SPI_GETFONTSMOOTHINGORIENTATION = 8210,
SPI_SETFONTSMOOTHINGORIENTATION = 8211
}
[Flags]
public enum SystemParamtersInfoFlags : uint
{
@@ -23,8 +23,8 @@ static partial class NativeMethods
public static extern IntPtr OpenProcess(
uint processAccess,
bool bInheritHandle,
int processId
);
int processId);
public static IntPtr OpenProcess(Process proc, ProcessAccessFlags flags)
{
return OpenProcess((uint)flags, false, proc.Id);
@@ -62,7 +62,6 @@ static partial class NativeMethods
[ResourceExposure(ResourceScope.None)]
public static extern int GetACP();
[DllImport("Powrprof.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern bool SetSuspendState(bool hiberate, bool forceCritical, bool disableWakeEvent);
}
@@ -125,6 +125,7 @@ internal static class UnmanagedMethods
public string? szTip;
public int dwState = 0;
public int dwStateMask = 0;
/// <summary>
/// String with the text for a balloon ToolTip. It can have a maximum of 255 characters.
/// To remove the ToolTip, set the NIF_INFO flag in uFlags and set szInfo to an empty string.
@@ -132,6 +133,7 @@ internal static class UnmanagedMethods
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string? szInfo;
public int uTimeoutOrVersion;
/// <summary>
/// String containing a title for a balloon ToolTip. This title appears in boldface
/// above the text. It can have a maximum of 63 characters.
@@ -178,6 +180,7 @@ internal static class UnmanagedMethods
public MENUITEMINFO()
{
}
public MENUITEMINFO(MIIM pfMask)
{
fMask = pfMask;
@@ -1587,18 +1590,22 @@ internal static class UnmanagedMethods
/// Text format. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data. Use this format for ANSI text.
/// </summary>
CF_TEXT = 1,
/// <summary>
/// A handle to a bitmap
/// </summary>
CF_BITMAP = 2,
/// <summary>
/// A memory object containing a BITMAPINFO structure followed by the bitmap bits.
/// </summary>
CF_DIB = 3,
/// <summary>
/// Unicode text format. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data.
/// </summary>
CF_UNICODETEXT = 13,
/// <summary>
/// A handle to type HDROP that identifies a list of files.
/// </summary>
@@ -2136,10 +2143,13 @@ internal interface IDropTarget
{
[PreserveSig]
UnmanagedMethods.HRESULT DragEnter([MarshalAs(UnmanagedType.Interface)][In] IOleDataObject pDataObj, [MarshalAs(UnmanagedType.U4)][In] int grfKeyState, [MarshalAs(UnmanagedType.U8)][In] long pt, [In][Out] ref DropEffect pdwEffect);
[PreserveSig]
UnmanagedMethods.HRESULT DragOver([MarshalAs(UnmanagedType.U4)][In] int grfKeyState, [MarshalAs(UnmanagedType.U8)][In] long pt, [In][Out] ref DropEffect pdwEffect);
[PreserveSig]
UnmanagedMethods.HRESULT DragLeave();
[PreserveSig]
UnmanagedMethods.HRESULT Drop([MarshalAs(UnmanagedType.Interface)][In] IOleDataObject pDataObj, [MarshalAs(UnmanagedType.U4)][In] int grfKeyState, [MarshalAs(UnmanagedType.U8)][In] long pt, [In][Out] ref DropEffect pdwEffect);
}
@@ -2151,6 +2161,7 @@ internal interface IDropSource
{
[PreserveSig]
int QueryContinueDrag(int fEscapePressed, [MarshalAs(UnmanagedType.U4)][In] int grfKeyState);
[PreserveSig]
int GiveFeedback([MarshalAs(UnmanagedType.U4)][In] int dwEffect);
}
@@ -2161,16 +2172,24 @@ internal interface IDropSource
internal interface IOleDataObject
{
void GetData([In] ref FORMATETC format, out STGMEDIUM medium);
void GetDataHere([In] ref FORMATETC format, ref STGMEDIUM medium);
[PreserveSig]
int QueryGetData([In] ref FORMATETC format);
[PreserveSig]
int GetCanonicalFormatEtc([In] ref FORMATETC formatIn, out FORMATETC formatOut);
void SetData([In] ref FORMATETC formatIn, [In] ref STGMEDIUM medium, [MarshalAs(UnmanagedType.Bool)] bool release);
IEnumFORMATETC EnumFormatEtc(DATADIR direction);
[PreserveSig]
int DAdvise([In] ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection);
void DUnadvise(int connection);
[PreserveSig]
int EnumDAdvise(out IEnumSTATDATA enumAdvise);
}
@@ -155,7 +155,7 @@ internal static class User32Window
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport(LibraryName, CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string? lpszWindow);
[DllImport(LibraryName, CharSet = CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam);
@@ -74,7 +74,7 @@ internal static class WinInet
[DllImport("wininet.dll",
SetLastError = true,
CharSet = CharSet.Unicode,
CharSet = CharSet.Unicode,
EntryPoint = "InternetGetCookieEx",
CallingConvention = CallingConvention.StdCall)]
public static extern bool InternetGetCookieEx(
@@ -75,4 +75,8 @@
<LastGenOutput>SR.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" PrivateAssets="All" />
</ItemGroup>
</Project>
@@ -130,7 +130,7 @@ namespace System.Application.Services.Implementation
IntPtr result = User32Window.SendMessage(progman, 0x052C, new IntPtr(0), IntPtr.Zero);
IntPtr workerw = IntPtr.Zero;
User32Window.EnumWindows(((tophandle, topparamhandle) =>
User32Window.EnumWindows((tophandle, topparamhandle) =>
{
IntPtr p = User32Window.FindWindowEx(tophandle,
IntPtr.Zero,
@@ -145,10 +145,9 @@ namespace System.Application.Services.Implementation
null);
}
return true;
}), IntPtr.Zero);
}, IntPtr.Zero);
SetParentWindow(window.Handle, workerw);
int p1 = User32Window.GetWindowLongA(window.Handle, (int)WindowLongFlags.GWL_STYLE);
p1 &= ~13500416;
User32Window.SetWindowLong(window.Handle, (int)WindowLongFlags.GWL_STYLE, p1);
@@ -54,9 +54,10 @@ namespace System.Application.Services.Implementation
readonly string? mRegistryVdfPath;
readonly string[] steamProcess = new[] { "steam", "steam_osx", "steamservice", "steamwebhelper" };
readonly Lazy<IHttpService> _http = new(() => DI.Get<IHttpService>());
IHttpService Http => _http.Value;
List<FileSystemWatcher>? steamDownloadingWatchers;
IHttpService Http => _http.Value;
public SteamServiceImpl(IPlatformService platformService)
{
this.platformService = platformService;
@@ -76,6 +77,7 @@ namespace System.Application.Services.Implementation
}
public string? SteamDirPath => mSteamDirPath;
public string? RegistryVdfPath => mRegistryVdfPath;
public string? SteamProgramPath => mSteamProgramPath;
@@ -457,7 +459,7 @@ namespace System.Application.Services.Implementation
{
throw new Exception("Steam Dir Path is null or empty.");
}
var fsw = new FileSystemWatcher(Path.Combine(SteamDirPath, "config"), "loginusers.vdf")
{
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.CreationTime,
@@ -67,19 +67,24 @@ namespace System.Application.Services.Implementation
{
[DllImport("user32.dll")]
public static extern IntPtr GetShellWindow();
[DllImport("user32.dll", SetLastError = true)]
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr OpenProcess(int processAccess, bool bInheritHandle, int processId);
[DllImport("advapi32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool OpenProcessToken(IntPtr processHandle, uint desiredAccess, out IntPtr tokenHandle);
[DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool DuplicateTokenEx(IntPtr hExistingToken, uint dwDesiredAccess,
ref SecurityAttributes lpTokenAttributes,
int impersonationLevel,
int tokenType,
out IntPtr phNewToken);
[DllImport("advapi32", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern bool CreateProcessWithTokenW(
IntPtr hToken, int dwLogonFlags,
@@ -27,7 +27,6 @@ namespace System.Application.Services.Implementation
const string TAG = "WindowsPlatformS";
const string SteamRegistryPath = @"SOFTWARE\Valve\Steam";
public string? GetRegistryVdfPath() { return null; }
public string GetCommandLineArgs(Process process)
@@ -78,6 +77,7 @@ namespace System.Application.Services.Implementation
}
const string explorer = "explorer.exe";
static string Explorer => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), explorer);
public void OpenFolderByDirectoryPath(DirectoryInfo info)
@@ -261,6 +261,7 @@ namespace System.Application.Services.Implementation
//}
const string explorer_exe = "explorer.exe";
static Process? StartAsInvokerByExplorer(string fileName, string? arguments = null)
{
if (string.IsNullOrEmpty(arguments))
@@ -385,8 +386,10 @@ namespace System.Application.Services.Implementation
var value = reg32.Read(@"SOFTWARE\Steam++", "InstPath").TrimEnd(Path.DirectorySeparatorChar);
return string.Equals(IOPath.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar), value, StringComparison.OrdinalIgnoreCase);
});
/// <inheritdoc cref="IPlatformService.IsInstall"/>
public static bool IsInstall => _IsInstall.Value;
bool IPlatformService.IsInstall => IsInstall;
#endregion
+2 -1
View File
@@ -20,6 +20,7 @@ namespace System.Application
var text = File.ReadAllText(filePath, Encoding.UTF8);
return VdfConvert.Deserialize(text);
}
public static void Write(string filePath, VProperty content)
{
try
@@ -31,7 +32,7 @@ namespace System.Application
Log.Error(nameof(VdfHelper), e, "Write Vdf Error");
}
}
}
#if DEBUG
@@ -37,8 +37,8 @@ namespace System.Application
if (TryGetAppSecret(out var appSecret))
{
#if WINDOWS
var _applicationSettingsFactory = typeof(AppCenter).GetField("_applicationSettingsFactory", BindingFlags.NonPublic | BindingFlags.Static);
_applicationSettingsFactory.ThrowIsNull(nameof(_applicationSettingsFactory)).SetValue(null, DI.Get<IApplicationSettingsFactory>());
var applicationSettingsFactory_ = typeof(AppCenter).GetField("_applicationSettingsFactory", BindingFlags.NonPublic | BindingFlags.Static);
applicationSettingsFactory_.ThrowIsNull(nameof(applicationSettingsFactory_)).SetValue(null, DI.Get<IApplicationSettingsFactory>());
#endif
AppCenter.Start(appSecret, typeof(Analytics), typeof(Crashes));
}
@@ -147,6 +147,7 @@ namespace Microsoft.AppCenter.Utils
internal sealed class TestAppCenter : ITestAppCenter
{
readonly IApplicationSettings settings;
public TestAppCenter(IApplicationSettings settings)
{
this.settings = settings;
@@ -7,7 +7,6 @@
// This file was generated, please do not edit it directly.
//
// Please see MilCodeGen.html for more information.
//
namespace System.Windows
{
@@ -22,9 +21,6 @@ namespace System.Windows
#region Public Methods
/// <summary>
/// Compares two Point instances for exact equality.
/// Note that double values can acquire error when operated upon, such that
@@ -57,6 +53,7 @@ namespace System.Windows
{
return !(point1 == point2);
}
/// <summary>
/// Compares two Point instances for object equality. In this equality
/// Double.NaN is equal to itself, unlike in numeric equality.
@@ -88,7 +85,7 @@ namespace System.Windows
/// <param name='o'>The object to compare to "this"</param>
public override bool Equals(object? o)
{
if ((null == o) || o is not Point)
if (o is null or not Point)
{
return false;
}
@@ -112,6 +109,7 @@ namespace System.Windows
{
return Point.Equals(this, value);
}
/// <summary>
/// Returns the HashCode for this Point
/// </summary>
@@ -133,9 +131,6 @@ namespace System.Windows
//
//------------------------------------------------------
#region Public Properties
/// <summary>
@@ -180,10 +175,6 @@ namespace System.Windows
#region Protected Methods
#endregion ProtectedMethods
//------------------------------------------------------
@@ -194,14 +185,6 @@ namespace System.Windows
#region Internal Methods
#endregion Internal Methods
//------------------------------------------------------
@@ -212,7 +195,6 @@ namespace System.Windows
#region Internal Properties
/// <summary>
/// Creates a string representation of this object based on the current culture.
/// </summary>
@@ -273,8 +255,6 @@ namespace System.Windows
_y);
}
#endregion Internal Properties
//------------------------------------------------------
@@ -285,8 +265,6 @@ namespace System.Windows
#region Dependency Properties
#endregion Dependency Properties
//------------------------------------------------------
@@ -297,14 +275,11 @@ namespace System.Windows
#region Internal Fields
internal double _x;
internal double _y;
#endregion Internal Fields
#region Constructors
//------------------------------------------------------
@@ -313,9 +288,6 @@ namespace System.Windows
//
//------------------------------------------------------
#endregion Constructors
}
}