Skip to content

Commit

Permalink
Add Appveyor CI
Browse files Browse the repository at this point in the history
- initial appveyor.yml CI configuration
- udated csproj to VS2013
- added x64 build target (needs usage of sdk 4.0 for ildasm and ilasm)

Close #1
  • Loading branch information
chcg authored and donho committed Mar 2, 2023
1 parent 0e45d16 commit 9408530
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 29 deletions.
18 changes: 6 additions & 12 deletions DllExport/DllExportAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,20 @@ partial class DllExportAttribute : Attribute
public DllExportAttribute()
{
}

public DllExportAttribute(string exportName)
: this(exportName, CallingConvention.StdCall)
{
}

public DllExportAttribute(string exportName, CallingConvention callingConvention)
{
ExportName = exportName;
CallingConvention = callingConvention;
}
CallingConvention _callingConvention;
public CallingConvention CallingConvention
{
get { return _callingConvention; }
set { _callingConvention = value; }
}
string _exportName;
public string ExportName
{
get { return _exportName; }
set { _exportName = value; }
}

public CallingConvention CallingConvention { get; set; }

public string ExportName { get; set; }
}
}
2 changes: 1 addition & 1 deletion DllExport/NppPlugin.DllExport.targets
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
FrameworkPath="$(TargetedFrameworkDir);$(TargetFrameworkDirectory)"
LibToolPath="$(DevEnvDir)\..\..\VC\bin"
LibToolDllPath="$(DevEnvDir)"
SdkPath="$(FrameworkSDKDir)"/>
SdkPath="$(SDK40ToolsPath)"/>
</Target>
</Project>
6 changes: 3 additions & 3 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class Main
static string iniFilePath = null;
static bool someSetting = false;
//static HashResultDlg frmMyDlg = null;
static int idMyDlg = -1;
//static int idMyDlg = -1;
//static Bitmap tbBmp = Properties.Resources.star;
//static Bitmap tbBmp_tbTab = Properties.Resources.star_bmp;
static Icon tbIcon = null;
//static Icon tbIcon = null;
static int maxDisplayDataStringLen = 85;
static HashResultDlg hashResultDlg = null;
public enum HashMethod {
Expand Down Expand Up @@ -58,7 +58,7 @@ internal static void CommandMenuInit()
PluginBase.SetCommand(3, "SHA384", sha384);
PluginBase.SetCommand(4, "SHA512", sha512);

idMyDlg = 1;
//idMyDlg = 1;
}
internal static void SetToolBarIcon()
{
Expand Down
53 changes: 52 additions & 1 deletion NppHash.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
Expand All @@ -10,6 +10,27 @@
<RootNamespace>NppHasher</RootNamespace>
<AssemblyName>NppHasher</AssemblyName>
<OutputPath>bin\Debug\</OutputPath>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -28,6 +49,24 @@
<ErrorReport>prompt</ErrorReport>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
Expand Down Expand Up @@ -62,6 +101,18 @@
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildProjectDirectory)\DllExport\NppPlugin.DllExport.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
20 changes: 10 additions & 10 deletions NppPluginNETHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ public void Add(FuncItem funcItem)
RtlMoveMemory(newPointer, _nativePointer, oldSize);
Marshal.FreeHGlobal(_nativePointer);
}
IntPtr ptrPosNewItem = (IntPtr)((int)newPointer + oldSize);
IntPtr ptrPosNewItem = (IntPtr)(newPointer.ToInt64() + oldSize);
byte[] aB = Encoding.Unicode.GetBytes(funcItem._itemName + "\0");
Marshal.Copy(aB, 0, ptrPosNewItem, aB.Length);
ptrPosNewItem = (IntPtr)((int)ptrPosNewItem + 128);
ptrPosNewItem = (IntPtr)(ptrPosNewItem.ToInt64() + 128);
IntPtr p = (funcItem._pFunc != null) ? Marshal.GetFunctionPointerForDelegate(funcItem._pFunc) : IntPtr.Zero;
Marshal.WriteIntPtr(ptrPosNewItem, p);
ptrPosNewItem = (IntPtr)((int)ptrPosNewItem + IntPtr.Size);
ptrPosNewItem = (IntPtr)(ptrPosNewItem.ToInt64() + IntPtr.Size);
Marshal.WriteInt32(ptrPosNewItem, funcItem._cmdID);
ptrPosNewItem = (IntPtr)((int)ptrPosNewItem + 4);
ptrPosNewItem = (IntPtr)(ptrPosNewItem.ToInt64() + 4);
Marshal.WriteInt32(ptrPosNewItem, Convert.ToInt32(funcItem._init2Check));
ptrPosNewItem = (IntPtr)((int)ptrPosNewItem + 4);
ptrPosNewItem = (IntPtr)(ptrPosNewItem.ToInt64() + 4);
if (funcItem._pShKey._key != 0)
{
IntPtr newShortCutKey = Marshal.AllocHGlobal(4);
Expand All @@ -103,15 +103,15 @@ public void RefreshItems()
{
FuncItem updatedItem = new FuncItem();
updatedItem._itemName = _funcItems[i]._itemName;
ptrPosItem = (IntPtr)((int)ptrPosItem + 128);
ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + 128);
updatedItem._pFunc = _funcItems[i]._pFunc;
ptrPosItem = (IntPtr)((int)ptrPosItem + IntPtr.Size);
ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + IntPtr.Size);
updatedItem._cmdID = Marshal.ReadInt32(ptrPosItem);
ptrPosItem = (IntPtr)((int)ptrPosItem + 4);
ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + 4);
updatedItem._init2Check = _funcItems[i]._init2Check;
ptrPosItem = (IntPtr)((int)ptrPosItem + 4);
ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + 4);
updatedItem._pShKey = _funcItems[i]._pShKey;
ptrPosItem = (IntPtr)((int)ptrPosItem + IntPtr.Size);
ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + IntPtr.Size);

_funcItems[i] = updatedItem;
}
Expand Down
4 changes: 2 additions & 2 deletions Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
version: 1.0.4.{build}
image: Visual Studio 2015


platform:
- AnyCPU
#- x86
- x64

configuration:
- Debug
- Release

install:
- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"

build:
parallel: true # enable MSBuild parallel builds
verbosity: minimal

build_script:
- cd "%APPVEYOR_BUILD_FOLDER%"
- msbuild NppHash.csproj /m /p:configuration="%configuration%" /p:platform="%platform%"

after_build:
- cd "%APPVEYOR_BUILD_FOLDER%"
- ps: >-
if ($env:PLATFORM -eq "x64") {
Push-AppveyorArtifact "bin\$($env:PLATFORM)\$($env:CONFIGURATION)\NppHasher.dll" -FileName NppHasher.dll
}
if ($env:PLATFORM -eq "x86" ) {
Push-AppveyorArtifact "bin\$($env:PLATFORM)\$($env:CONFIGURATION)\NppHasher.dll" -FileName NppHasher.dll
}
if ($env:PLATFORM -eq "AnyCPU" ) {
Push-AppveyorArtifact "bin\$($env:CONFIGURATION)\NppHasher.dll" -FileName NppHasher.dll
}
if ($($env:APPVEYOR_REPO_TAG) -eq "true" -and $env:CONFIGURATION -eq "Release") {
if($env:PLATFORM -eq "x64"){
$ZipFileName = "NppHash_$($env:APPVEYOR_REPO_TAG_NAME)_x64.zip"
7z a $ZipFileName bin\$env:PLATFORM\$env:CONFIGURATION\NppHasher.dll
}
if($env:PLATFORM -eq "x86"){
$ZipFileName = "NppHash_$($env:APPVEYOR_REPO_TAG_NAME)_x86.zip"
7z a $ZipFileName bin\$env:PLATFORM\$env:CONFIGURATION\NppHasher.dll
}
if($env:PLATFORM -eq "AnyCPU"){
$ZipFileName = "NppHash_$($env:APPVEYOR_REPO_TAG_NAME)_x86.zip"
7z a $ZipFileName bin\$env:CONFIGURATION\NppHasher.dll
}
}
artifacts:
- path: NppHash_*.zip
name: releases

deploy:
provider: GitHub
auth_token:
secure: !!TODO, see https://www.appveyor.com/docs/deployment/github/#provider-settings!!
artifact: releases
draft: false
prerelease: false
force_update: true
on:
appveyor_repo_tag: true
configuration: Release

0 comments on commit 9408530

Please sign in to comment.