Code moved out of UnityStudioForm and into new class UnityStudio.cs (#17)

This commit is contained in:
ordigdug 2017-02-11 02:39:14 -05:00 committed by Perfare
parent 2357e55337
commit 66b9b46523
12 changed files with 1886 additions and 1873 deletions

View File

@ -111,7 +111,7 @@ namespace Unity_Studio
else
{
EndianStream estream = null;
if (UnityStudioForm.assetsfileandstream.TryGetValue(Path.GetFileName(m_Source), out estream))
if (UnityStudio.assetsfileandstream.TryGetValue(Path.GetFileName(m_Source), out estream))
{
estream.Position = m_Offset;
m_AudioData = estream.ReadBytes((int)m_Size);

View File

@ -177,7 +177,7 @@ namespace Unity_Studio
else
{
EndianStream estream = null;
if (UnityStudioForm.assetsfileandstream.TryGetValue(Path.GetFileName(path), out estream))
if (UnityStudio.assetsfileandstream.TryGetValue(Path.GetFileName(path), out estream))
{
estream.Position = offset;
image_data = estream.ReadBytes(image_data_size);
@ -981,20 +981,28 @@ namespace Unity_Studio
private Bitmap BGRA32ToBitmap()
{
var hObject = GCHandle.Alloc(image_data, GCHandleType.Pinned);
var pObject = hObject.AddrOfPinnedObject();
var bitmap = new Bitmap(m_Width, m_Height, m_Width * 4, PixelFormat.Format32bppArgb, pObject);
hObject.Free();
return bitmap;
if (image_data.Length > 0)
{
var hObject = GCHandle.Alloc(image_data, GCHandleType.Pinned);
var pObject = hObject.AddrOfPinnedObject();
var bitmap = new Bitmap(m_Width, m_Height, m_Width * 4, PixelFormat.Format32bppArgb, pObject);
hObject.Free();
return bitmap;
}
return null;
}
private Bitmap RGB565ToBitmap()
{
var hObject = GCHandle.Alloc(image_data, GCHandleType.Pinned);
var pObject = hObject.AddrOfPinnedObject();
var bitmap = new Bitmap(m_Width, m_Height, m_Width * 2, PixelFormat.Format16bppRgb565, pObject);
hObject.Free();
return bitmap;
if (image_data.Length > 0)
{
var hObject = GCHandle.Alloc(image_data, GCHandleType.Pinned);
var pObject = hObject.AddrOfPinnedObject();
var bitmap = new Bitmap(m_Width, m_Height, m_Width * 2, PixelFormat.Format16bppRgb565, pObject);
hObject.Free();
return bitmap;
}
return null;
}
private Bitmap PVRToBitmap(byte[] pvrdata)

View File

@ -461,6 +461,5 @@ namespace Unity_Studio
ClassStructures.Add(classID, aClass);
}
}
}
}

View File

@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using SevenZip;
using Lz4;
namespace Unity_Studio

File diff suppressed because it is too large Load Diff

View File

@ -144,12 +144,13 @@
<Compile Include="AboutBox.Designer.cs">
<DependentUpon>AboutBox.cs</DependentUpon>
</Compile>
<Compile Include="AssetPreloadData.cs" />
<Compile Include="Unity Studio Classes\AssetPreloadData.cs" />
<Compile Include="Unity Classes\AudioClip.cs" />
<Compile Include="Unity Classes\BuildSettings.cs" />
<Compile Include="BundleFile.cs" />
<Compile Include="ClassIDReference.cs" />
<Compile Include="EndianStream.cs" />
<Compile Include="Unity Studio Classes\BundleFile.cs" />
<Compile Include="Unity Studio Classes\UnityStudio.cs" />
<Compile Include="Unity Studio Classes\ClassIDReference.cs" />
<Compile Include="Unity Studio Classes\EndianStream.cs" />
<Compile Include="ExportOptions.cs">
<SubType>Form</SubType>
</Compile>
@ -163,11 +164,11 @@
<Compile Include="GOHierarchy.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Lz4DecoderStream.cs" />
<Compile Include="Unity Studio Classes\Lz4DecoderStream.cs" />
<Compile Include="Unity Classes\Material.cs" />
<Compile Include="Unity Classes\Mesh.cs" />
<Compile Include="Unity Classes\GameObject.cs" />
<Compile Include="helpers.cs" />
<Compile Include="Unity Studio Classes\helpers.cs" />
<Compile Include="Unity Classes\MonoBehaviour.cs" />
<Compile Include="Unity Classes\PlayerSettings.cs" />
<Compile Include="Unity Classes\RectTransform.cs" />
@ -180,7 +181,7 @@
<Compile Include="Unity Classes\Transform.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="AssetsFile.cs" />
<Compile Include="Unity Studio Classes\AssetsFile.cs" />
<Compile Include="UnityStudioForm.cs">
<SubType>Form</SubType>
</Compile>

File diff suppressed because it is too large Load Diff