Skip to content

Commit

Permalink
v1.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
BarRaider committed Feb 18, 2019
1 parent 4c440e4 commit 65df135
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 10 deletions.
4 changes: 2 additions & 2 deletions barraider-sdtools/PluginContainer.cs
Expand Up @@ -142,15 +142,15 @@ private async void Connection_OnWillAppear(object sender, StreamDeckEventReceive
}
}

// Stopwatch instance no longer shown
private async void Connection_OnWillDisappear(object sender, StreamDeckEventReceivedEventArgs<WillDisappearEvent> e)
{
await instancesLock.WaitAsync();
try
{
if (instances.ContainsKey(e.Event.Context))
{
instances.Remove(e.Event.Context);
instances[e.Event.Context].Dispose();
instances.Remove(e.Event.Context);
}
}
finally
Expand Down
38 changes: 38 additions & 0 deletions barraider-sdtools/Tools.cs
Expand Up @@ -69,6 +69,34 @@ public static string ImageToBase64(Image image, bool addHeaderPrefix)
}
}

/// <summary>
/// Convert a base64 image string to an Image object
/// </summary>
/// <param name="base64String"></param>
/// <returns></returns>
public static Image Base64StringToImage(string base64String)
{
try
{
// Remove header
if (base64String.Substring(0, HEADER_PREFIX.Length) == HEADER_PREFIX)
{
base64String = base64String.Substring(HEADER_PREFIX.Length);
}

byte[] imageBytes = Convert.FromBase64String(base64String);
using (MemoryStream m = new MemoryStream(imageBytes))
{
return Image.FromStream(m);
}
}
catch (Exception ex)
{
Logger.Instance.LogMessage(TracingLevel.ERROR, $"Base64StringToImage Exception: {ex}");
}
return null;
}

/// <summary>
/// Generates an empty key bitmap with the default height and width
/// </summary>
Expand All @@ -89,5 +117,15 @@ public static Bitmap GenerateKeyImage(out Graphics graphics)
graphics.FillRectangle(brush, 0, 0, KEY_DEFAULT_WIDTH, KEY_DEFAULT_HEIGHT);
return bitmap;
}

/// <summary>
/// Extracts the actual filename from a file payload received from the Property Inspector
/// </summary>
/// <param name="payload"></param>
/// <returns></returns>
public static string FilenameFromPayload(Newtonsoft.Json.Linq.JToken payload)
{
return Uri.UnescapeDataString(((string)payload).Replace("C:\\fakepath\\", ""));
}
}
}
12 changes: 5 additions & 7 deletions barraider-sdtools/barraider-sdtools.csproj
Expand Up @@ -6,20 +6,18 @@
<Product>StreamDeck Tools by BarRaider</Product>
<Description>Start developing your Elgato StreamDeck plugin faster!
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.
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>
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>
<Copyright>Copyright © BarRaider 2019</Copyright>
<PackageLicenseUrl>https://github.com/BarRaider/streamdeck-tools/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/BarRaider/streamdeck-tools</PackageProjectUrl>
<RepositoryUrl>https://github.com/BarRaider/streamdeck-tools</RepositoryUrl>
<PackageTags>StreamDeck Elgato Library Plugin Stream Deck</PackageTags>
<PackageId>StreamDeck-Tools</PackageId>
<PackageIconUrl>https://raw.githubusercontent.com/BarRaider/barraider.github.io/master/images/BRLogo.png</PackageIconUrl>
<AssemblyVersion>1.1.5.0</AssemblyVersion>
<FileVersion>1.1.5.0</FileVersion>
<Version>1.1.5</Version>
<PackageReleaseNotes>* ContextId can now be obtained from the SDConnection object
* Logging now automaticaly archives old logs to a "logs" folder
* Updated dependencies to release versions</PackageReleaseNotes>
<AssemblyVersion>1.1.7.0</AssemblyVersion>
<FileVersion>1.1.7.0</FileVersion>
<Version>1.1.7</Version>
<PackageReleaseNotes></PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'">
<DocumentationFile>D:\Projects\github\barraider-sdtools\barraider-sdtools\barraider-sdtools.xml</DocumentationFile>
Expand Down
16 changes: 15 additions & 1 deletion barraider-sdtools/barraider-sdtools.xml

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

0 comments on commit 65df135

Please sign in to comment.