From dd7fb3ee99912db517044310852408e396b912ed Mon Sep 17 00:00:00 2001
From: hyousatsu <118750527+hyousatsu@users.noreply.github.com>
Date: Sun, 19 Nov 2023 17:27:22 +0000
Subject: [PATCH 1/6] Invoke mono explicitly.
---
bundle/bin/pickit3 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bundle/bin/pickit3 b/bundle/bin/pickit3
index e933471..771712e 100755
--- a/bundle/bin/pickit3
+++ b/bundle/bin/pickit3
@@ -2,4 +2,4 @@
set -e
cd $(dirname $(realpath $0))/..
-exec bin/PICkit3.exe
+exec mono bin/PICkit3.exe "$@"
From 2ca79971c004ceda3a0f3f8e82e02ec59fa10bc9 Mon Sep 17 00:00:00 2001
From: hyousatsu <118750527+hyousatsu@users.noreply.github.com>
Date: Mon, 20 Nov 2023 04:37:17 +0000
Subject: [PATCH 2/6] Update to HidSharp 2.1.0.
---
PICkit2V2/PICkit3V3.csproj | 4 ++--
PICkit2V2/packages.config | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/PICkit2V2/PICkit3V3.csproj b/PICkit2V2/PICkit3V3.csproj
index e9c423b..7ab802f 100644
--- a/PICkit2V2/PICkit3V3.csproj
+++ b/PICkit2V2/PICkit3V3.csproj
@@ -83,7 +83,7 @@
- ..\packages\HidSharp.2.0.5\lib\net35\HidSharp.dll
+ ..\packages\HidSharp.2.1.0\lib\net35\HidSharp.dll
@@ -352,4 +352,4 @@
-->
-
\ No newline at end of file
+
diff --git a/PICkit2V2/packages.config b/PICkit2V2/packages.config
index 28afb3e..3197b38 100644
--- a/PICkit2V2/packages.config
+++ b/PICkit2V2/packages.config
@@ -1,4 +1,4 @@

-
-
\ No newline at end of file
+
+
From ab975f57f0317eb29f5f2226ce213797fc1e6ed6 Mon Sep 17 00:00:00 2001
From: hyousatsu <118750527+hyousatsu@users.noreply.github.com>
Date: Mon, 20 Nov 2023 04:41:27 +0000
Subject: [PATCH 3/6] Let libgdiplus to choose the proper PixelFormat.
---
PICkit2V2/DialogLogic.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/PICkit2V2/DialogLogic.cs b/PICkit2V2/DialogLogic.cs
index b9d5f95..9654ed9 100644
--- a/PICkit2V2/DialogLogic.cs
+++ b/PICkit2V2/DialogLogic.cs
@@ -442,7 +442,7 @@ private Bitmap getDisplayGraph(int zoom)
else if (zoom == 3)
length = 4096;
- Bitmap gridmap = new Bitmap(length, width, PixelFormat.Format16bppRgb555);
+ Bitmap gridmap = new Bitmap(length, width);
Graphics graphics = Graphics.FromImage(gridmap);
SolidBrush brush = new SolidBrush(Color.Black);
graphics.FillRectangle(brush, 0, 0, length, width);
@@ -1480,4 +1480,4 @@ private void checkBoxVDD_Click(object sender, EventArgs e)
}
}
-}
\ No newline at end of file
+}
From d125716f45087ce8d12baffc8b6385c4e8023f04 Mon Sep 17 00:00:00 2001
From: hyousatsu <118750527+hyousatsu@users.noreply.github.com>
Date: Mon, 20 Nov 2023 04:48:32 +0000
Subject: [PATCH 4/6] Save INI file to ApplicationData.
---
PICkit2V2/FormPICkit2.cs | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/PICkit2V2/FormPICkit2.cs b/PICkit2V2/FormPICkit2.cs
index 7f21823..6e8c5bd 100644
--- a/PICkit2V2/FormPICkit2.cs
+++ b/PICkit2V2/FormPICkit2.cs
@@ -9,6 +9,7 @@
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices; // DllImport
+using System.Reflection;
using Pk2 = PICkit2V2.PICkitFunctions;
using P32 = PICkit2V2.PIC32MXFunctions;
using PE33 = PICkit2V2.dsPIC33_PE;
@@ -438,6 +439,7 @@ public struct FLASHWINFO
public static float ScalefactW = 1F; // scaling factors for dealing with non-standard DPI
public static float ScalefactH = 1F;
public static string HomeDirectory;
+ public static string UserConfigDirectory;
public static byte slowSpeedICSP = 4; // default value
public static bool PlaySuccessWav = false;
public static string SuccessWavFile = "\\Sounds\\success.wav";
@@ -5950,15 +5952,21 @@ private void autoDownloadFW(object sender, EventArgs e)
private void SaveINI()
{
//StreamWriter hexFile = new StreamWriter("PICkit2.ini");
+
+ string iniFile;
StreamWriter hexFile;
+
if (!Pk2.isPK3)
- hexFile = File.CreateText(Path.Combine(HomeDirectory, "PICkit2.ini"));
+ iniFile = "PICkit2.ini";
else
- hexFile = File.CreateText(Path.Combine(HomeDirectory, "PICkit3.ini"));
+ iniFile = "PICkit3.ini";
- // Comments
- string value = ";" + Pk2.ToolName + " version " + Constants.AppVersion + " INI file.";
+ hexFile = File.CreateText(Path.Combine(UserConfigDirectory, iniFile));
+
+ // Comments
+ string value = ";" + Pk2.ToolName + " version " + Constants.AppVersion + " INI file.";
hexFile.WriteLine(value);
+
DateTime now = new DateTime();
now = System.DateTime.Now;
value = ";" + now.Date.ToShortDateString() + " " + now.ToShortTimeString();
@@ -6369,14 +6377,28 @@ private float loadINI()
int desktopHeigth = SystemInformation.VirtualScreen.Height;
int desktopWidth = SystemInformation.VirtualScreen.Width;
+ string iniFile;
FileInfo hexFile;
if (!Pk2.isPK3)
- hexFile = new FileInfo("PICkit2.ini");
+ iniFile = "PICkit2.ini";
else
- hexFile = new FileInfo("PICkit3.ini");
+ iniFile = "PICkit3.ini";
+ hexFile = new FileInfo(iniFile);
HomeDirectory = hexFile.DirectoryName;
+ hexFile = null;
+
+ UserConfigDirectory = Path.Combine(
+ Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
+ this.GetType().Assembly.GetName().Name);
+
+ if (!Directory.Exists(UserConfigDirectory)) {
+ Directory.CreateDirectory(UserConfigDirectory);
+ }
+
+ hexFile = new FileInfo(Path.Combine(UserConfigDirectory, iniFile));
+
// init default sounds locations
SuccessWavFile = Path.Combine(HomeDirectory, SuccessWavFile);
WarningWavFile = Path.Combine(HomeDirectory, WarningWavFile);
From d5a7c29ff839a7f7320af0dac8b117fcb7ed6c1d Mon Sep 17 00:00:00 2001
From: hyousatsu <118750527+hyousatsu@users.noreply.github.com>
Date: Mon, 20 Nov 2023 05:55:41 +0000
Subject: [PATCH 5/6] Open documents properly.
---
PICkit2V2/FormPICkit2.Designer.cs | 2 +-
PICkit2V2/FormPICkit2.cs | 19 +++++++++++--------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/PICkit2V2/FormPICkit2.Designer.cs b/PICkit2V2/FormPICkit2.Designer.cs
index 6b6f744..4802472 100644
--- a/PICkit2V2/FormPICkit2.Designer.cs
+++ b/PICkit2V2/FormPICkit2.Designer.cs
@@ -773,7 +773,7 @@ private void InitializeComponent()
//
this.usersGuidePk3ToolStripMenuItem.Name = "usersGuidePk3ToolStripMenuItem";
this.usersGuidePk3ToolStripMenuItem.Size = new System.Drawing.Size(316, 22);
- this.usersGuidePk3ToolStripMenuItem.Text = "PICkit 3 Programmer Application &User’s Guide";
+ this.usersGuidePk3ToolStripMenuItem.Text = "PICkit 3 Programmer Application &User\'s Guide";
this.usersGuidePk3ToolStripMenuItem.Click += new System.EventHandler(this.launchUsersGuidePK3);
//
// toolStripMenuItemProgToGo
diff --git a/PICkit2V2/FormPICkit2.cs b/PICkit2V2/FormPICkit2.cs
index 6e8c5bd..5e250ab 100644
--- a/PICkit2V2/FormPICkit2.cs
+++ b/PICkit2V2/FormPICkit2.cs
@@ -439,6 +439,7 @@ public struct FLASHWINFO
public static float ScalefactW = 1F; // scaling factors for dealing with non-standard DPI
public static float ScalefactH = 1F;
public static string HomeDirectory;
+ public static string DocDirectory;
public static string UserConfigDirectory;
public static byte slowSpeedICSP = 4; // default value
public static bool PlaySuccessWav = false;
@@ -5631,7 +5632,7 @@ private void launchUsersGuide(object sender, EventArgs e)
{
try
{
- System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, KONST.UserGuideFileNamePK2));
+ System.Diagnostics.Process.Start(Path.Combine(DocDirectory, KONST.UserGuideFileNamePK2));
}
catch
{
@@ -5643,7 +5644,7 @@ private void launchReadMe(object sender, EventArgs e)
{
try
{
- System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, "PICkit 2 Readme.txt"));
+ System.Diagnostics.Process.Start(Path.Combine(DocDirectory, "PICkit 2 Readme.txt"));
}
catch
{
@@ -5655,7 +5656,7 @@ private void betaReleaseReadMeToolStripMenuItem_Click(object sender, EventArgs e
{
try
{
- System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, "PICkit 3 Programmer Application ReadMe.txt"));
+ System.Diagnostics.Process.Start(Path.Combine(DocDirectory, "PICkit 3 Programmer Application ReadMe.txt"));
}
catch
{
@@ -6389,6 +6390,8 @@ private float loadINI()
HomeDirectory = hexFile.DirectoryName;
hexFile = null;
+ DocDirectory = Path.Combine(HomeDirectory, "docs");
+
UserConfigDirectory = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
this.GetType().Assembly.GetName().Name);
@@ -8126,7 +8129,7 @@ public void OpenProgToGoUserGuide()
{
try
{
- System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, "Programmer-To-Go User Guide.pdf"));
+ System.Diagnostics.Process.Start(Path.Combine(DocDirectory, "Programmer-To-Go User Guide.pdf"));
}
catch
{
@@ -8211,7 +8214,7 @@ private void toolStripMenuItemLogicToolUG_Click(object sender, EventArgs e)
{
try
{
- System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, "Logic Tool User Guide.pdf"));
+ System.Diagnostics.Process.Start(Path.Combine(DocDirectory, "Logic Tool User Guide.pdf"));
}
catch
{
@@ -8635,7 +8638,7 @@ private void launchUsersGuidePK3(object sender, EventArgs e)
{
try
{
- System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, KONST.UserGuideFileNamePK3));
+ System.Diagnostics.Process.Start(Path.Combine(DocDirectory, KONST.UserGuideFileNamePK3));
}
catch
{
@@ -8659,7 +8662,7 @@ private void uG44pinToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
- System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, "44-Pin Demo Board User Guide 41296B.pdf"));
+ System.Diagnostics.Process.Start(Path.Combine(DocDirectory, "44-Pin Demo Board User Guide 41296B.pdf"));
}
catch
{
@@ -8671,7 +8674,7 @@ private void lpcUsersGuideToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
- System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, "Low Pin Count User Guide 51556a.pdf"));
+ System.Diagnostics.Process.Start(Path.Combine(DocDirectory, "Low Pin Count User Guide 51556a.pdf"));
}
catch
{
From c436d49f683e4cba28a256e87ff57cdd10d736f4 Mon Sep 17 00:00:00 2001
From: hyousatsu <118750527+hyousatsu@users.noreply.github.com>
Date: Mon, 20 Nov 2023 06:46:12 +0000
Subject: [PATCH 6/6] Make xbuild as an alternative.
---
Makefile | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Makefile b/Makefile
index 8f40490..7978f09 100644
--- a/Makefile
+++ b/Makefile
@@ -2,13 +2,19 @@ APP_NAME=PICkit3
PROJECT_DIR=PICkit2V2
BUILD_CONFIG=Release
INSTALL_DIR=/opt/microchip/pickit3
+USE_MSBUILD := $(shell command -v msbuild 2> /dev/null)
BUILD_DIR=$(PROJECT_DIR)/bin/$(BUILD_CONFIG)
build:
nuget restore -NonInteractive
+
+ifdef USE_MSBUILD
msbuild -t:Build -p:Configuration="$(BUILD_CONFIG)" -v:quiet
+else
+ xbuild /target:Build /property:Configuration="$(BUILD_CONFIG)" /verbosity:quiet
+endif
install: install-bundle install-bin install-link install-udev-rules