Skip to content

Commit

Permalink
Optimized Symbol Load by direcly cloning byte[]
Browse files Browse the repository at this point in the history
  • Loading branch information
Soon5 committed Sep 14, 2020
1 parent c0fc328 commit 2581c88
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 27 deletions.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions Lumos3DconnexionPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="3DxIcon_32.png" />
<None Include="3DxIcon_32.png.bin" />
</ItemGroup>
<ItemGroup>
<None Include="3DxIcon_16.png" />
<None Include="3DxIcon_16.png.bin" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
18 changes: 9 additions & 9 deletions Properties/Resources.Designer.cs

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

8 changes: 4 additions & 4 deletions Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="_3DxIcon_16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\3DxIcon_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="_3DxIcon_16_png" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\3dxicon_16.png.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="_3DxIcon_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\3DxIcon_32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="_3DxIcon_32_png" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\3dxicon_32.png.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
19 changes: 7 additions & 12 deletions _3DxPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,14 @@ public byte[] loadResource(EResourceDataType type, string name)
{
if (type == EResourceDataType.SYMBOL)
{
using (var ms = new MemoryStream())
switch (name)
{
switch (name)
{
case "3DxIcon":
case "3DxIcon_32":
Properties.Resources._3DxIcon_32.Save(ms, ImageFormat.Png);
return ms.ToArray();

case "3DxIcon_16":
Properties.Resources._3DxIcon_16.Save(ms, ImageFormat.Png);
return ms.ToArray();
}
case "3DxIcon":
case "3DxIcon_32":
return (byte[]) Properties.Resources._3DxIcon_32_png.Clone();

case "3DxIcon_16":
return (byte[]) Properties.Resources._3DxIcon_16_png.Clone();
}
}

Expand Down

0 comments on commit 2581c88

Please sign in to comment.