Skip to content

Commit

Permalink
Convert to C# and add Github Action to compile it
Browse files Browse the repository at this point in the history
Co-authored-by: Henry Franks <henryefranks@gmail.com>
  • Loading branch information
eleanor-clifford and henryefranks committed Oct 18, 2021
1 parent 47d1375 commit e880480
Show file tree
Hide file tree
Showing 12 changed files with 308 additions and 267 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/test
/compare/bin
/compare/obj
/compare/build
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Charon
The ferryman to Hell (aka CAD version control). Provides integration with git
for SolidWorks parts and assemblies.
for SolidWorks parts and assemblies. Fully integrated with [Hades](https://github.com/smh-my-head/hades)

## Usage

Add this repo as a submodule and then run `./charon/setup.sh` from Git Bash or
MSYS2. You can then use git as normal, but `git diff` and `git merge` will have
added sugar. If you use Linux, check out
[hades](https://github.com/smh-my-head/hades), as the two projects are fully
integrated.
See the CUSF wiki page on [Charon](https://wiki.cusf.co.uk/Charon).

You will also need to enable *SOLIDWORKS Utilities* at startup, you can do this
by navigating (in SolidWorks) to *Tools->Add-Ins* and checking the box for
Expand Down
1 change: 0 additions & 1 deletion charon_diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ if ! $driver --check-health; then
echo "File $1 differs"
else
echo "Opening $prog_name to diff $1..."
echo "$prog_name must exit fully before this diff can exit"
$driver $left_filename $right_filename
fi

Expand Down
224 changes: 0 additions & 224 deletions compare.swb

This file was deleted.

55 changes: 55 additions & 0 deletions compare/Marshal2.cs
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);

}
Loading

0 comments on commit e880480

Please sign in to comment.