Skip to content

Commit 65df135

Browse files
committed
v1.1.6
1 parent 4c440e4 commit 65df135

4 files changed

Lines changed: 60 additions & 10 deletions

File tree

barraider-sdtools/PluginContainer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ private async void Connection_OnWillAppear(object sender, StreamDeckEventReceive
142142
}
143143
}
144144

145-
// Stopwatch instance no longer shown
146145
private async void Connection_OnWillDisappear(object sender, StreamDeckEventReceivedEventArgs<WillDisappearEvent> e)
147146
{
148147
await instancesLock.WaitAsync();
149148
try
150149
{
151150
if (instances.ContainsKey(e.Event.Context))
152151
{
153-
instances.Remove(e.Event.Context);
152+
instances[e.Event.Context].Dispose();
153+
instances.Remove(e.Event.Context);
154154
}
155155
}
156156
finally

barraider-sdtools/Tools.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,34 @@ public static string ImageToBase64(Image image, bool addHeaderPrefix)
6969
}
7070
}
7171

72+
/// <summary>
73+
/// Convert a base64 image string to an Image object
74+
/// </summary>
75+
/// <param name="base64String"></param>
76+
/// <returns></returns>
77+
public static Image Base64StringToImage(string base64String)
78+
{
79+
try
80+
{
81+
// Remove header
82+
if (base64String.Substring(0, HEADER_PREFIX.Length) == HEADER_PREFIX)
83+
{
84+
base64String = base64String.Substring(HEADER_PREFIX.Length);
85+
}
86+
87+
byte[] imageBytes = Convert.FromBase64String(base64String);
88+
using (MemoryStream m = new MemoryStream(imageBytes))
89+
{
90+
return Image.FromStream(m);
91+
}
92+
}
93+
catch (Exception ex)
94+
{
95+
Logger.Instance.LogMessage(TracingLevel.ERROR, $"Base64StringToImage Exception: {ex}");
96+
}
97+
return null;
98+
}
99+
72100
/// <summary>
73101
/// Generates an empty key bitmap with the default height and width
74102
/// </summary>
@@ -89,5 +117,15 @@ public static Bitmap GenerateKeyImage(out Graphics graphics)
89117
graphics.FillRectangle(brush, 0, 0, KEY_DEFAULT_WIDTH, KEY_DEFAULT_HEIGHT);
90118
return bitmap;
91119
}
120+
121+
/// <summary>
122+
/// Extracts the actual filename from a file payload received from the Property Inspector
123+
/// </summary>
124+
/// <param name="payload"></param>
125+
/// <returns></returns>
126+
public static string FilenameFromPayload(Newtonsoft.Json.Linq.JToken payload)
127+
{
128+
return Uri.UnescapeDataString(((string)payload).Replace("C:\\fakepath\\", ""));
129+
}
92130
}
93131
}

barraider-sdtools/barraider-sdtools.csproj

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,18 @@
66
<Product>StreamDeck Tools by BarRaider</Product>
77
<Description>Start developing your Elgato StreamDeck plugin faster!
88
This library holds all the basic logic of setting up the framework, so that you can focus on writing the logic of the plugin itself.
9-
Using this library, you only need to derive from the abstract plugin base class and addd three lines in your program.cs to have a working plugin. More information here: https://github.com/BarRaider/barraider-sdtools</Description>
9+
Using this library, you only need to derive from the abstract PluginBase class and add three lines in your program.cs to have a working plugin. More information here: https://github.com/BarRaider/barraider-sdtools</Description>
1010
<Copyright>Copyright © BarRaider 2019</Copyright>
1111
<PackageLicenseUrl>https://github.com/BarRaider/streamdeck-tools/blob/master/LICENSE</PackageLicenseUrl>
1212
<PackageProjectUrl>https://github.com/BarRaider/streamdeck-tools</PackageProjectUrl>
1313
<RepositoryUrl>https://github.com/BarRaider/streamdeck-tools</RepositoryUrl>
1414
<PackageTags>StreamDeck Elgato Library Plugin Stream Deck</PackageTags>
1515
<PackageId>StreamDeck-Tools</PackageId>
1616
<PackageIconUrl>https://raw.githubusercontent.com/BarRaider/barraider.github.io/master/images/BRLogo.png</PackageIconUrl>
17-
<AssemblyVersion>1.1.5.0</AssemblyVersion>
18-
<FileVersion>1.1.5.0</FileVersion>
19-
<Version>1.1.5</Version>
20-
<PackageReleaseNotes>* ContextId can now be obtained from the SDConnection object
21-
* Logging now automaticaly archives old logs to a "logs" folder
22-
* Updated dependencies to release versions</PackageReleaseNotes>
17+
<AssemblyVersion>1.1.7.0</AssemblyVersion>
18+
<FileVersion>1.1.7.0</FileVersion>
19+
<Version>1.1.7</Version>
20+
<PackageReleaseNotes></PackageReleaseNotes>
2321
</PropertyGroup>
2422
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'">
2523
<DocumentationFile>D:\Projects\github\barraider-sdtools\barraider-sdtools\barraider-sdtools.xml</DocumentationFile>

barraider-sdtools/barraider-sdtools.xml

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)