mirror of
https://github.com/modernw/App-Installer-For-Windows-8.x-Reset.git
synced 2026-06-14 03:16:38 +10:00
Coding for Package Manager.
This commit is contained in:
@@ -67,6 +67,12 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\IEHelper\IEHelper.vcxproj">
|
||||
<Project>{e4ca78a9-9408-4f5f-add6-730fd501ff8e}</Project>
|
||||
<Name>IEHelper</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
+47
-11
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DataUtils
|
||||
@@ -51,30 +48,69 @@ namespace DataUtils
|
||||
}
|
||||
public sealed class TaskbarProgress: IDisposable
|
||||
{
|
||||
private readonly ITaskbarList3 _taskbar;
|
||||
private readonly IntPtr _hwnd;
|
||||
private ITaskbarList3 _taskbar3;
|
||||
public TaskbarProgress (IntPtr hwnd)
|
||||
{
|
||||
_hwnd = hwnd;
|
||||
_taskbar = (ITaskbarList3)new TaskbarList ();
|
||||
_taskbar.HrInit ();
|
||||
object obj = new TaskbarList ();
|
||||
ITaskbarList baseTaskbar = (ITaskbarList)obj;
|
||||
baseTaskbar.HrInit ();
|
||||
_taskbar3 = obj as ITaskbarList3;
|
||||
}
|
||||
public bool IsSupported
|
||||
{
|
||||
get { return _taskbar3 != null; }
|
||||
}
|
||||
public void SetState (TBPFLAG state)
|
||||
{
|
||||
_taskbar.SetProgressState (_hwnd, state);
|
||||
if (_taskbar3 != null)
|
||||
_taskbar3.SetProgressState (_hwnd, state);
|
||||
}
|
||||
public void SetValue (ulong completed, ulong total)
|
||||
{
|
||||
_taskbar.SetProgressValue (_hwnd, completed, total);
|
||||
if (_taskbar3 != null)
|
||||
_taskbar3.SetProgressValue (_hwnd, completed, total);
|
||||
}
|
||||
public void Clear ()
|
||||
{
|
||||
_taskbar.SetProgressState (_hwnd, TBPFLAG.TBPF_NOPROGRESS);
|
||||
if (_taskbar3 != null)
|
||||
_taskbar3.SetProgressState (_hwnd, TBPFLAG.TBPF_NOPROGRESS);
|
||||
}
|
||||
public void Dispose ()
|
||||
{
|
||||
Clear ();
|
||||
Marshal.ReleaseComObject (_taskbar);
|
||||
if (_taskbar3 != null)
|
||||
{
|
||||
Marshal.ReleaseComObject (_taskbar3);
|
||||
_taskbar3 = null;
|
||||
}
|
||||
}
|
||||
~TaskbarProgress () { Dispose (); }
|
||||
public ITaskbarList3 Instance => _taskbar3;
|
||||
}
|
||||
[ComImport]
|
||||
[Guid ("56FDF342-FD6D-11d0-958A-006097C9A090")]
|
||||
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
|
||||
public interface ITaskbarList
|
||||
{
|
||||
void HrInit ();
|
||||
void AddTab (IntPtr hwnd);
|
||||
void DeleteTab (IntPtr hwnd);
|
||||
void ActivateTab (IntPtr hwnd);
|
||||
void SetActiveAlt (IntPtr hwnd);
|
||||
}
|
||||
public interface ITaskbarProgress
|
||||
{
|
||||
double ProgressValue { set; }
|
||||
TBPFLAG ProgressStatus { set; }
|
||||
}
|
||||
[ComVisible (true)]
|
||||
[ClassInterface (ClassInterfaceType.AutoDual)]
|
||||
public class _I_Taskbar
|
||||
{
|
||||
private ITaskbarProgress taskbar = null;
|
||||
public double Progress { set { if (taskbar == null) return; taskbar.ProgressValue = value; } }
|
||||
public int Status { set { if (taskbar == null) return; taskbar.ProgressStatus = (TBPFLAG)value; } }
|
||||
public _I_Taskbar (ITaskbarProgress tp) { taskbar = tp; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,5 +181,9 @@ namespace DataUtils
|
||||
}
|
||||
public static bool NNoEmpty (this string l) => !((l ?? "")?.NEmpty () ?? true);
|
||||
public static string NNormalize (this string l) => (l ?? "")?.Trim ()?.ToLower () ?? "";
|
||||
public interface IJsonBuild
|
||||
{
|
||||
object BuildJSON ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-2
@@ -8,7 +8,7 @@ namespace DataUtils
|
||||
/// bits 48..63 = major, 32..47 = minor, 16..31 = build, 0..15 = revision.
|
||||
/// </summary>
|
||||
[ComVisible (true)]
|
||||
public class Version: IComparable<Version>, IEquatable<Version>
|
||||
public class Version: IComparable<Version>, IEquatable<Version>, Utilities.IJsonBuild
|
||||
{
|
||||
// Backing fields
|
||||
private ushort major;
|
||||
@@ -70,12 +70,13 @@ namespace DataUtils
|
||||
// cast to ulong before shifting
|
||||
return (((ulong)major) << 48) | (((ulong)minor) << 32) | (((ulong)build) << 16) | ((ulong)revision);
|
||||
}
|
||||
public void FromUInt64 (ulong value)
|
||||
public Version FromUInt64 (ulong value)
|
||||
{
|
||||
major = (ushort)((value >> 48) & 0xFFFFUL);
|
||||
minor = (ushort)((value >> 32) & 0xFFFFUL);
|
||||
build = (ushort)((value >> 16) & 0xFFFFUL);
|
||||
revision = (ushort)(value & 0xFFFFUL);
|
||||
return this;
|
||||
}
|
||||
public ulong Data { get { return ToUInt64 (); } set { FromUInt64 (value); } }
|
||||
public override string ToString ()
|
||||
@@ -242,6 +243,16 @@ namespace DataUtils
|
||||
if (v == null) return 0UL;
|
||||
return v.ToUInt64 ();
|
||||
}
|
||||
public object BuildJSON ()
|
||||
{
|
||||
return new
|
||||
{
|
||||
major = Major,
|
||||
minor = Minor,
|
||||
build = Build,
|
||||
revision = Revision
|
||||
};
|
||||
}
|
||||
}
|
||||
[ComVisible (true)]
|
||||
[ClassInterface (ClassInterfaceType.AutoDual)]
|
||||
|
||||
+19
-2
@@ -22,12 +22,13 @@ namespace DataUtils
|
||||
void ExecWB (
|
||||
OLECMDID cmdID,
|
||||
OLECMDEXECOPT cmdexecopt,
|
||||
ref object pvaIn,
|
||||
ref object pvaOut
|
||||
[In, Optional] object pvaIn,
|
||||
[Out, Optional] object pvaOut
|
||||
);
|
||||
}
|
||||
public static class WebBrowserHelper
|
||||
{
|
||||
static Guid CGID_MSHTML = new Guid ("DE4BA900-59CA-11CF-9592-444553540000");
|
||||
public static IWebBrowser2 GetWebBrowser2 (WebBrowser browser)
|
||||
{
|
||||
return browser.ActiveXInstance as IWebBrowser2;
|
||||
@@ -37,4 +38,20 @@ namespace DataUtils
|
||||
{
|
||||
int PageScale { get; set; }
|
||||
}
|
||||
[ComImport]
|
||||
[Guid ("B722BCCB-4E68-101B-A2BC-00AA00404770")]
|
||||
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
|
||||
public interface IOleCommandTarget
|
||||
{
|
||||
[PreserveSig]
|
||||
int Exec (
|
||||
ref Guid pguidCmdGroup,
|
||||
uint nCmdID,
|
||||
uint nCmdexecopt,
|
||||
ref object pvaIn,
|
||||
ref object pvaOut
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user