-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert to C# and add Github Action to compile it
Co-authored-by: Henry Franks <henryefranks@gmail.com>
- Loading branch information
1 parent
47d1375
commit e880480
Showing
12 changed files
with
308 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Charon Build | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: webfactory/ssh-agent@v0.5.3 | ||
with: | ||
ssh-private-key: ${{ secrets.DEPLOY_KEY }} | ||
- name: Prepare | ||
run: | | ||
git clone https://github.com/smh-my-head/charon | ||
git clone git@github.com:smh-my-head/charon-build-assets | ||
mkdir charon/compare/build | ||
cp charon-build-assets/* charon/compare/build | ||
- name: Build | ||
run: | | ||
cd charon/compare | ||
dotnet.exe publish -r win-x64 -o build --nologo --configuration "Release" /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
charon/compare/build/compare.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/test | ||
/compare/bin | ||
/compare/obj | ||
/compare/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// https://stackoverflow.com/a/65496277 | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Runtime.Versioning; | ||
using System.Security; | ||
|
||
public static class Marshal2 | ||
{ | ||
internal const String OLEAUT32 = "oleaut32.dll"; | ||
internal const String OLE32 = "ole32.dll"; | ||
|
||
[System.Security.SecurityCritical] // auto-generated_required | ||
public static Object GetActiveObject(String progID) | ||
{ | ||
Object obj = null; | ||
Guid clsid; | ||
|
||
// Call CLSIDFromProgIDEx first then fall back on CLSIDFromProgID if | ||
// CLSIDFromProgIDEx doesn't exist. | ||
try | ||
{ | ||
CLSIDFromProgIDEx(progID, out clsid); | ||
} | ||
// catch | ||
catch (Exception) | ||
{ | ||
CLSIDFromProgID(progID, out clsid); | ||
} | ||
|
||
GetActiveObject(ref clsid, IntPtr.Zero, out obj); | ||
return obj; | ||
} | ||
|
||
//[DllImport(Microsoft.Win32.Win32Native.OLE32, PreserveSig = false)] | ||
[DllImport(OLE32, PreserveSig = false)] | ||
[ResourceExposure(ResourceScope.None)] | ||
[SuppressUnmanagedCodeSecurity] | ||
[System.Security.SecurityCritical] // auto-generated | ||
private static extern void CLSIDFromProgIDEx([MarshalAs(UnmanagedType.LPWStr)] String progId, out Guid clsid); | ||
|
||
//[DllImport(Microsoft.Win32.Win32Native.OLE32, PreserveSig = false)] | ||
[DllImport(OLE32, PreserveSig = false)] | ||
[ResourceExposure(ResourceScope.None)] | ||
[SuppressUnmanagedCodeSecurity] | ||
[System.Security.SecurityCritical] // auto-generated | ||
private static extern void CLSIDFromProgID([MarshalAs(UnmanagedType.LPWStr)] String progId, out Guid clsid); | ||
|
||
//[DllImport(Microsoft.Win32.Win32Native.OLEAUT32, PreserveSig = false)] | ||
[DllImport(OLEAUT32, PreserveSig = false)] | ||
[ResourceExposure(ResourceScope.None)] | ||
[SuppressUnmanagedCodeSecurity] | ||
[System.Security.SecurityCritical] // auto-generated | ||
private static extern void GetActiveObject(ref Guid rclsid, IntPtr reserved, [MarshalAs(UnmanagedType.Interface)] out Object ppunk); | ||
|
||
} |
Oops, something went wrong.