Updating to UE4 and reorganizing
This commit is contained in:
parent
155dd50456
commit
b80a6396c7
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -17,7 +17,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Output\Debug\</OutputPath>
|
||||
<OutputPath>..\..\..\..\Output\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@ -261,27 +261,27 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\AwesomeControls\AwesomeControls\AwesomeControls.csproj">
|
||||
<ProjectReference Include="..\..\..\..\..\..\AwesomeControls\AwesomeControls\AwesomeControls.csproj">
|
||||
<Project>{617d9eb5-ca93-45d6-aa6b-5a012b7698ac}</Project>
|
||||
<Name>AwesomeControls</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Glue\Glue\Glue.csproj">
|
||||
<ProjectReference Include="..\..\..\..\..\..\Glue\Glue\Glue.csproj">
|
||||
<Project>{fe016ea3-dc31-4a92-8b0a-8c746ec117e1}</Project>
|
||||
<Name>Glue</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
<ProjectReference Include="..\..\..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
<Project>{2d4737e6-6d95-408a-90db-8dff38147e85}</Project>
|
||||
<Name>UniversalEditor.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.UserInterface.WindowsForms\UniversalEditor.UserInterface.WindowsForms.csproj">
|
||||
<ProjectReference Include="..\..\..\..\Libraries\UniversalEditor.UserInterface.WindowsForms\UniversalEditor.UserInterface.WindowsForms.csproj">
|
||||
<Project>{bcbb72bd-0ecb-4ff2-8d91-e466361fb6f9}</Project>
|
||||
<Name>UniversalEditor.UserInterface.WindowsForms</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.UserInterface\UniversalEditor.UserInterface.csproj">
|
||||
<ProjectReference Include="..\..\..\..\Libraries\UniversalEditor.UserInterface\UniversalEditor.UserInterface.csproj">
|
||||
<Project>{8622ebc4-8e20-476e-b284-33d472081f5c}</Project>
|
||||
<Name>UniversalEditor.UserInterface</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Plugins\UniversalEditor.Essential\UniversalEditor.Essential.csproj">
|
||||
<ProjectReference Include="..\..\..\..\Plugins\UniversalEditor.Essential\UniversalEditor.Essential.csproj">
|
||||
<Project>{30467e5c-05bc-4856-aadc-13906ef4cadd}</Project>
|
||||
<Name>UniversalEditor.Essential</Name>
|
||||
</ProjectReference>
|
||||
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UniversalEditor.Accessors.File;
|
||||
using UniversalEditor.Accessors;
|
||||
using UniversalEditor.ObjectModels.Multimedia.Picture.Collection;
|
||||
using UniversalEditor.ObjectModels.NWCSceneLayout;
|
||||
using UniversalEditor.DataFormats.Multimedia.Picture.NewWorldComputing.ICN;
|
||||
@ -34,7 +34,7 @@ namespace UniversalEditor.Editors.NewWorldComputing.Scene.DesignerAreas
|
||||
|
||||
ICNDataFormat icn = new ICNDataFormat();
|
||||
PictureCollectionObjectModel picc = new PictureCollectionObjectModel();
|
||||
FileAccessor.Load(ICNFileName, picc, icn, true);
|
||||
Document.Load(picc, icn, new FileAccessor(ICNFileName));
|
||||
_bmpBackground = picc.Pictures[(int)mvarScene.BackgroundImageIndex].ToBitmap();
|
||||
}
|
||||
if (_bmpBackground != null)
|
||||
|
||||
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using UniversalEditor.Accessors.File;
|
||||
using UniversalEditor.Accessors;
|
||||
using UniversalEditor.ObjectModels.NWCSceneLayout;
|
||||
using UniversalEditor.ObjectModels.NWCSceneLayout.SceneObjects;
|
||||
|
||||
@ -13,170 +13,170 @@ using UniversalEditor.DataFormats.Multimedia.Picture.NewWorldComputing.ICN;
|
||||
|
||||
namespace UniversalEditor.Editors.NewWorldComputing.Scene.DesignerObjectClasses
|
||||
{
|
||||
public class NwcGenericControlClass : DesignerObjectClass
|
||||
{
|
||||
private static ICNDataFormat icn = new ICNDataFormat();
|
||||
public class NwcGenericControlClass : DesignerObjectClass
|
||||
{
|
||||
private static ICNDataFormat icn = new ICNDataFormat();
|
||||
|
||||
protected override void RenderClientArea(DesignerObjectPaintEventArgs e)
|
||||
{
|
||||
protected override void RenderClientArea(DesignerObjectPaintEventArgs e)
|
||||
{
|
||||
SceneObject obj = (SceneObject)e.Item.Properties["SceneObject"];
|
||||
|
||||
string ParentDirectory = String.Empty;
|
||||
if (e.Item.Properties.ContainsKey("ParentDirectory") && e.Item.Properties["ParentDirectory"] != null) ParentDirectory = e.Item.Properties["ParentDirectory"].ToString();
|
||||
|
||||
if (obj is SceneObjectButton)
|
||||
{
|
||||
SceneObjectButton btn = (obj as SceneObjectButton);
|
||||
if (obj is SceneObjectButton)
|
||||
{
|
||||
SceneObjectButton btn = (obj as SceneObjectButton);
|
||||
|
||||
System.Drawing.Bitmap _bmp = null;
|
||||
if (e.Item.Properties.ContainsKey("Bitmap"))
|
||||
{
|
||||
_bmp = (e.Item.Properties["Bitmap"] as System.Drawing.Bitmap);
|
||||
}
|
||||
if (_bmp == null)
|
||||
{
|
||||
string imageFileName = btn.BackgroundImageFileName;
|
||||
if (!String.IsNullOrEmpty(ParentDirectory)) imageFileName = ParentDirectory + "\\" + imageFileName;
|
||||
System.Drawing.Bitmap _bmp = null;
|
||||
if (e.Item.Properties.ContainsKey("Bitmap"))
|
||||
{
|
||||
_bmp = (e.Item.Properties["Bitmap"] as System.Drawing.Bitmap);
|
||||
}
|
||||
if (_bmp == null)
|
||||
{
|
||||
string imageFileName = btn.BackgroundImageFileName;
|
||||
if (!String.IsNullOrEmpty(ParentDirectory)) imageFileName = ParentDirectory + "\\" + imageFileName;
|
||||
|
||||
if (!System.IO.File.Exists(imageFileName))
|
||||
{
|
||||
e.Graphics.DrawRectangle(System.Drawing.Pens.Blue, e.Item.Bounds);
|
||||
return;
|
||||
}
|
||||
if (!System.IO.File.Exists(imageFileName))
|
||||
{
|
||||
e.Graphics.DrawRectangle(System.Drawing.Pens.Blue, e.Item.Bounds);
|
||||
return;
|
||||
}
|
||||
|
||||
PictureCollectionObjectModel picc = new PictureCollectionObjectModel();
|
||||
FileAccessor.Load(imageFileName, picc, icn, true);
|
||||
_bmp = picc.Pictures[(int)btn.BackgroundImageIndex].ToBitmap();
|
||||
e.Item.Properties["Bitmap"] = _bmp;
|
||||
}
|
||||
e.Graphics.DrawImage(_bmp, e.Item.Bounds);
|
||||
}
|
||||
else if (obj is SceneObjectImage)
|
||||
{
|
||||
SceneObjectImage btn = (obj as SceneObjectImage);
|
||||
PictureCollectionObjectModel picc = new PictureCollectionObjectModel();
|
||||
Document.Load(picc, icn, new FileAccessor(imageFileName));
|
||||
_bmp = picc.Pictures[(int)btn.BackgroundImageIndex].ToBitmap();
|
||||
e.Item.Properties["Bitmap"] = _bmp;
|
||||
}
|
||||
e.Graphics.DrawImage(_bmp, e.Item.Bounds);
|
||||
}
|
||||
else if (obj is SceneObjectImage)
|
||||
{
|
||||
SceneObjectImage btn = (obj as SceneObjectImage);
|
||||
|
||||
System.Drawing.Bitmap _bmp = null;
|
||||
if (e.Item.Properties.ContainsKey("Bitmap"))
|
||||
{
|
||||
_bmp = (e.Item.Properties["Bitmap"] as System.Drawing.Bitmap);
|
||||
}
|
||||
if (_bmp == null)
|
||||
{
|
||||
string imageFileName = btn.BackgroundImageFileName;
|
||||
if (!String.IsNullOrEmpty(ParentDirectory)) imageFileName = ParentDirectory + "\\" + imageFileName;
|
||||
System.Drawing.Bitmap _bmp = null;
|
||||
if (e.Item.Properties.ContainsKey("Bitmap"))
|
||||
{
|
||||
_bmp = (e.Item.Properties["Bitmap"] as System.Drawing.Bitmap);
|
||||
}
|
||||
if (_bmp == null)
|
||||
{
|
||||
string imageFileName = btn.BackgroundImageFileName;
|
||||
if (!String.IsNullOrEmpty(ParentDirectory)) imageFileName = ParentDirectory + "\\" + imageFileName;
|
||||
|
||||
if (!System.IO.File.Exists(imageFileName))
|
||||
{
|
||||
e.Graphics.DrawRectangle(System.Drawing.Pens.Blue, e.Item.Bounds);
|
||||
return;
|
||||
}
|
||||
if (!System.IO.File.Exists(imageFileName))
|
||||
{
|
||||
e.Graphics.DrawRectangle(System.Drawing.Pens.Blue, e.Item.Bounds);
|
||||
return;
|
||||
}
|
||||
|
||||
PictureCollectionObjectModel picc = new PictureCollectionObjectModel();
|
||||
FileAccessor.Load(imageFileName, picc, icn, true);
|
||||
_bmp = picc.Pictures[(int)btn.BackgroundImageIndex].ToBitmap();
|
||||
e.Item.Properties["Bitmap"] = _bmp;
|
||||
}
|
||||
e.Graphics.DrawImageUnscaled(_bmp, e.Item.Bounds);
|
||||
}
|
||||
else if (obj is SceneObjectLabel)
|
||||
{
|
||||
SceneObjectLabel lbl = (obj as SceneObjectLabel);
|
||||
PictureCollectionObjectModel picc = new PictureCollectionObjectModel();
|
||||
Document.Load(picc, icn, new FileAccessor(imageFileName));
|
||||
_bmp = picc.Pictures[(int)btn.BackgroundImageIndex].ToBitmap();
|
||||
e.Item.Properties["Bitmap"] = _bmp;
|
||||
}
|
||||
e.Graphics.DrawImageUnscaled(_bmp, e.Item.Bounds);
|
||||
}
|
||||
else if (obj is SceneObjectLabel)
|
||||
{
|
||||
SceneObjectLabel lbl = (obj as SceneObjectLabel);
|
||||
|
||||
PictureCollectionObjectModel piccFont = null;
|
||||
if (e.Item.Properties.ContainsKey("Font"))
|
||||
{
|
||||
piccFont = (e.Item.Properties["Font"] as PictureCollectionObjectModel);
|
||||
}
|
||||
if (piccFont == null)
|
||||
{
|
||||
string imageFileName = lbl.FontFileName;
|
||||
if (!String.IsNullOrEmpty(ParentDirectory)) imageFileName = ParentDirectory + "\\" + imageFileName;
|
||||
|
||||
UniversalEditor.ObjectModels.NewWorldComputing.Font.FontObjectModel font = new ObjectModels.NewWorldComputing.Font.FontObjectModel();
|
||||
UniversalEditor.DataFormats.NewWorldComputing.FNT.FNTDataFormat fnt = new DataFormats.NewWorldComputing.FNT.FNTDataFormat();
|
||||
PictureCollectionObjectModel piccFont = null;
|
||||
if (e.Item.Properties.ContainsKey("Font"))
|
||||
{
|
||||
piccFont = (e.Item.Properties["Font"] as PictureCollectionObjectModel);
|
||||
}
|
||||
if (piccFont == null)
|
||||
{
|
||||
string imageFileName = lbl.FontFileName;
|
||||
if (!String.IsNullOrEmpty(ParentDirectory)) imageFileName = ParentDirectory + "\\" + imageFileName;
|
||||
|
||||
UniversalEditor.ObjectModels.NewWorldComputing.Font.FontObjectModel font = new ObjectModels.NewWorldComputing.Font.FontObjectModel();
|
||||
UniversalEditor.DataFormats.NewWorldComputing.FNT.FNTDataFormat fnt = new DataFormats.NewWorldComputing.FNT.FNTDataFormat();
|
||||
try
|
||||
{
|
||||
FileAccessor.Load(imageFileName, font, fnt, true);
|
||||
Document.Load(font, fnt, new FileAccessor(imageFileName));
|
||||
}
|
||||
catch (System.IO.FileNotFoundException ex)
|
||||
{
|
||||
|
||||
}
|
||||
imageFileName = font.GlyphCollectionFileName;
|
||||
imageFileName = font.GlyphCollectionFileName;
|
||||
|
||||
if (!String.IsNullOrEmpty(ParentDirectory)) imageFileName = ParentDirectory + "\\" + imageFileName;
|
||||
if (!String.IsNullOrEmpty(ParentDirectory)) imageFileName = ParentDirectory + "\\" + imageFileName;
|
||||
|
||||
if (!System.IO.File.Exists(imageFileName))
|
||||
{
|
||||
e.Graphics.DrawRectangle(System.Drawing.Pens.Blue, e.Item.Bounds);
|
||||
if (!System.IO.File.Exists(imageFileName))
|
||||
{
|
||||
e.Graphics.DrawRectangle(System.Drawing.Pens.Blue, e.Item.Bounds);
|
||||
e.Graphics.DrawString(lbl.Text, System.Windows.Forms.SystemInformation.MenuFont, System.Drawing.Brushes.Black, new System.Drawing.Rectangle(lbl.Left, lbl.Top, lbl.Width, lbl.Height));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
piccFont = new PictureCollectionObjectModel();
|
||||
FileAccessor.Load(imageFileName, piccFont, icn, true);
|
||||
e.Item.Properties["Font"] = piccFont;
|
||||
}
|
||||
|
||||
System.Drawing.Bitmap bitmap = RenderFontICN(lbl.Text, piccFont, e.Item.Bounds);
|
||||
if (bitmap != null) e.Graphics.DrawImage(bitmap, e.Item.Bounds);
|
||||
piccFont = new PictureCollectionObjectModel();
|
||||
Document.Load(piccFont, icn, new FileAccessor(imageFileName));
|
||||
e.Item.Properties["Font"] = piccFont;
|
||||
}
|
||||
|
||||
System.Drawing.Bitmap bitmap = RenderFontICN(lbl.Text, piccFont, e.Item.Bounds);
|
||||
if (bitmap != null) e.Graphics.DrawImage(bitmap, e.Item.Bounds);
|
||||
|
||||
// e.Graphics.DrawRectangle(System.Drawing.Pens.Black, e.Item.Bounds);
|
||||
// e.Graphics.DrawString(lbl.Text, System.Drawing.SystemFonts.MenuFont, System.Drawing.Brushes.Black, e.Item.Bounds);
|
||||
}
|
||||
// e.Graphics.DrawRectangle(System.Drawing.Pens.Black, e.Item.Bounds);
|
||||
// e.Graphics.DrawString(lbl.Text, System.Drawing.SystemFonts.MenuFont, System.Drawing.Brushes.Black, e.Item.Bounds);
|
||||
}
|
||||
|
||||
// e.Graphics.FillRectangle(System.Drawing.Brushes.Red, e.Item.Bounds);
|
||||
}
|
||||
// e.Graphics.FillRectangle(System.Drawing.Brushes.Red, e.Item.Bounds);
|
||||
}
|
||||
|
||||
private Dictionary<char, int> icnsdata = null;
|
||||
private System.Drawing.Bitmap RenderFontICN(string p, PictureCollectionObjectModel piccFont, System.Drawing.Rectangle rectangle)
|
||||
{
|
||||
if (icnsdata == null)
|
||||
{
|
||||
char[] icns = new char[] { '\'', '!', '"', '*', '$', '%', '&', '<', '(', ')', '*', '+', '`', '-', '\'', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '.', '=', '.', '?', '\'', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '.', ']', '.', '_', ',', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
|
||||
icnsdata = new Dictionary<char, int>();
|
||||
for (int i = 0; i < icns.Length; i++)
|
||||
{
|
||||
if (icnsdata.ContainsKey(icns[i])) continue;
|
||||
icnsdata.Add(icns[i], i);
|
||||
}
|
||||
}
|
||||
private Dictionary<char, int> icnsdata = null;
|
||||
private System.Drawing.Bitmap RenderFontICN(string p, PictureCollectionObjectModel piccFont, System.Drawing.Rectangle rectangle)
|
||||
{
|
||||
if (icnsdata == null)
|
||||
{
|
||||
char[] icns = new char[] { '\'', '!', '"', '*', '$', '%', '&', '<', '(', ')', '*', '+', '`', '-', '\'', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '.', '=', '.', '?', '\'', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '.', ']', '.', '_', ',', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
|
||||
icnsdata = new Dictionary<char, int>();
|
||||
for (int i = 0; i < icns.Length; i++)
|
||||
{
|
||||
if (icnsdata.ContainsKey(icns[i])) continue;
|
||||
icnsdata.Add(icns[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
if (rectangle.Width <= 0 || rectangle.Height <= 0) return null;
|
||||
if (rectangle.Width <= 0 || rectangle.Height <= 0) return null;
|
||||
|
||||
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(rectangle.Width, rectangle.Height);
|
||||
System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
|
||||
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(rectangle.Width, rectangle.Height);
|
||||
System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
|
||||
|
||||
int maxpich = piccFont.MaximumPictureHeight;
|
||||
int maxpich = piccFont.MaximumPictureHeight;
|
||||
|
||||
int x = 0, y = 0;
|
||||
for (int i = 0; i < p.Length; i++)
|
||||
{
|
||||
if (p[i] == ' ')
|
||||
{
|
||||
x += 8;
|
||||
continue;
|
||||
}
|
||||
int x = 0, y = 0;
|
||||
for (int i = 0; i < p.Length; i++)
|
||||
{
|
||||
if (p[i] == ' ')
|
||||
{
|
||||
x += 8;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!icnsdata.ContainsKey(p[i]))
|
||||
{
|
||||
x += 8;
|
||||
continue;
|
||||
}
|
||||
if (!icnsdata.ContainsKey(p[i]))
|
||||
{
|
||||
x += 8;
|
||||
continue;
|
||||
}
|
||||
|
||||
int index = icnsdata[p[i]];
|
||||
int index = icnsdata[p[i]];
|
||||
|
||||
System.Drawing.Bitmap bmp = piccFont.Pictures[index].ToBitmap();
|
||||
int diff = maxpich - bmp.Height;
|
||||
System.Drawing.Bitmap bmp = piccFont.Pictures[index].ToBitmap();
|
||||
int diff = maxpich - bmp.Height;
|
||||
|
||||
graphics.DrawImage(bmp, x, y + diff);
|
||||
x += bmp.Width;
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
graphics.DrawImage(bmp, x, y + diff);
|
||||
x += bmp.Width;
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
protected override void RenderNonClientArea(DesignerObjectPaintEventArgs e)
|
||||
{
|
||||
}
|
||||
}
|
||||
protected override void RenderNonClientArea(DesignerObjectPaintEventArgs e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ using UniversalEditor.ObjectModels.NWCSceneLayout;
|
||||
using AwesomeControls.Designer;
|
||||
using UniversalEditor.Editors.NewWorldComputing.Scene.DesignerObjectClasses;
|
||||
using UniversalEditor.ObjectModels.Multimedia.Picture.Collection;
|
||||
using UniversalEditor.Accessors.File;
|
||||
using UniversalEditor.Accessors;
|
||||
using UniversalEditor.DataFormats.Multimedia.Picture.NewWorldComputing.ICN;
|
||||
|
||||
using UniversalEditor.ObjectModels.NWCSceneLayout.SceneObjects;
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Output\Debug\Plugins\</OutputPath>
|
||||
<OutputPath>..\..\..\..\Output\Debug\Plugins\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@ -67,14 +67,18 @@
|
||||
<Project>{617d9eb5-ca93-45d6-aa6b-5a012b7698ac}</Project>
|
||||
<Name>AwesomeControls</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
<Project>{a92d520b-ffa3-4464-8cf6-474d18959e03}</Project>
|
||||
<ProjectReference Include="..\..\..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
<Project>{2d4737e6-6d95-408a-90db-8dff38147e85}</Project>
|
||||
<Name>UniversalEditor.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Libraries\UniversalEditor.UserInterface\UniversalEditor.UserInterface.csproj">
|
||||
<Project>{8622ebc4-8e20-476e-b284-33d472081f5c}</Project>
|
||||
<Name>UniversalEditor.UserInterface</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Plugins\UniversalEditor.Essential\UniversalEditor.Essential.csproj">
|
||||
<Project>{30467e5c-05bc-4856-aadc-13906ef4cadd}</Project>
|
||||
<Name>UniversalEditor.Essential</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Plugins\UniversalEditor.Plugins.Multimedia.Binders.GdiPlus\UniversalEditor.Plugins.Multimedia.Binders.GdiPlus.csproj">
|
||||
<Project>{369cfd53-3e65-4a9e-8bdd-4ccd78bf3e33}</Project>
|
||||
<Name>UniversalEditor.Plugins.Multimedia.Binders.GdiPlus</Name>
|
||||
|
||||
@ -7,14 +7,14 @@ using UniversalEditor.ObjectModels.FileSystem;
|
||||
namespace UniversalEditor.DataFormats.FileSystem.NewWorldComputing.AGG
|
||||
{
|
||||
public class AGGDataFormat : DataFormat
|
||||
{
|
||||
private struct AGGFileEntry
|
||||
{
|
||||
public uint hash;
|
||||
public uint offset;
|
||||
public uint size;
|
||||
public string name;
|
||||
}
|
||||
{
|
||||
private struct AGGFileEntry
|
||||
{
|
||||
public uint hash;
|
||||
public uint offset;
|
||||
public uint size;
|
||||
public string name;
|
||||
}
|
||||
|
||||
private static DataFormatReference _dfr = null;
|
||||
public override DataFormatReference MakeReference()
|
||||
@ -30,85 +30,85 @@ namespace UniversalEditor.DataFormats.FileSystem.NewWorldComputing.AGG
|
||||
|
||||
protected override void LoadInternal(ref ObjectModel objectModel)
|
||||
{
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
if (fsom == null) return;
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
if (fsom == null) return;
|
||||
|
||||
IO.BinaryReader br = base.Stream.BinaryReader;
|
||||
ushort fileCount = br.ReadUInt16();
|
||||
IO.Reader br = base.Accessor.Reader;
|
||||
ushort fileCount = br.ReadUInt16();
|
||||
|
||||
AGGFileEntry[] files = new AGGFileEntry[fileCount];
|
||||
for (ushort i = 0; i < fileCount; i++)
|
||||
{
|
||||
files[i].hash = br.ReadUInt32();
|
||||
files[i].offset = br.ReadUInt32();
|
||||
files[i].size = br.ReadUInt32();
|
||||
}
|
||||
br.BaseStream.Seek(-(fileCount * 15), System.IO.SeekOrigin.End);
|
||||
for (ushort i = 0; i < fileCount; i++)
|
||||
{
|
||||
files[i].name = br.ReadFixedLengthString(15);
|
||||
files[i].name = files[i].name.TrimNull();
|
||||
AGGFileEntry[] files = new AGGFileEntry[fileCount];
|
||||
for (ushort i = 0; i < fileCount; i++)
|
||||
{
|
||||
files[i].hash = br.ReadUInt32();
|
||||
files[i].offset = br.ReadUInt32();
|
||||
files[i].size = br.ReadUInt32();
|
||||
}
|
||||
br.Accessor.Seek(-(fileCount * 15), IO.SeekOrigin.End);
|
||||
for (ushort i = 0; i < fileCount; i++)
|
||||
{
|
||||
files[i].name = br.ReadFixedLengthString(15);
|
||||
files[i].name = files[i].name.TrimNull();
|
||||
|
||||
File file = new File();
|
||||
file.Name = files[i].name;
|
||||
file.Size = files[i].size;
|
||||
file.Properties.Add("InternalData", files[i]);
|
||||
file.Properties.Add("BinaryReader", br);
|
||||
file.DataRequest += file_DataRequest;
|
||||
fsom.Files.Add(file);
|
||||
}
|
||||
File file = new File();
|
||||
file.Name = files[i].name;
|
||||
file.Size = files[i].size;
|
||||
file.Properties.Add("InternalData", files[i]);
|
||||
file.Properties.Add("BinaryReader", br);
|
||||
file.DataRequest += file_DataRequest;
|
||||
fsom.Files.Add(file);
|
||||
}
|
||||
|
||||
|
||||
// 43341516
|
||||
// 43341516
|
||||
}
|
||||
|
||||
void file_DataRequest(object sender, DataRequestEventArgs e)
|
||||
{
|
||||
File file = (sender as File);
|
||||
void file_DataRequest(object sender, DataRequestEventArgs e)
|
||||
{
|
||||
File file = (sender as File);
|
||||
|
||||
AGGFileEntry entry = (AGGFileEntry)file.Properties["InternalData"];
|
||||
IO.BinaryReader br = (IO.BinaryReader)file.Properties["BinaryReader"];
|
||||
AGGFileEntry entry = (AGGFileEntry)file.Properties["InternalData"];
|
||||
IO.Reader br = (IO.Reader)file.Properties["BinaryReader"];
|
||||
|
||||
br.BaseStream.Seek(entry.offset, System.IO.SeekOrigin.Begin);
|
||||
e.Data = br.ReadBytes(entry.size);
|
||||
br.Accessor.Seek(entry.offset, IO.SeekOrigin.Begin);
|
||||
e.Data = br.ReadBytes(entry.size);
|
||||
|
||||
// UniversalEditor.Common.Hashing.CRC32.Initialize(UniversalEditor.Common.Hashing.CRC32.Keys.ReversedReciprocal);
|
||||
// UniversalEditor.Common.Hashing.CRC32.Initialize(UniversalEditor.Common.Hashing.CRC32.Keys.ReversedReciprocal);
|
||||
UniversalEditor.Checksum.Modules.CRC32.CRC32ChecksumModule cksm = new UniversalEditor.Checksum.Modules.CRC32.CRC32ChecksumModule();
|
||||
uint hash = (uint)cksm.Calculate(e.Data);
|
||||
uint hash = (uint)cksm.Calculate(e.Data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SaveInternal(ObjectModel objectModel)
|
||||
{
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
if (fsom == null) return;
|
||||
protected override void SaveInternal(ObjectModel objectModel)
|
||||
{
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
if (fsom == null) return;
|
||||
|
||||
IO.BinaryWriter bw = base.Stream.BinaryWriter;
|
||||
ushort fileCount = (ushort)fsom.Files.Count;
|
||||
bw.Write(fileCount);
|
||||
IO.Writer bw = base.Accessor.Writer;
|
||||
ushort fileCount = (ushort)fsom.Files.Count;
|
||||
bw.WriteUInt16(fileCount);
|
||||
|
||||
uint offset = (uint)(bw.BaseStream.Position + (12 * fsom.Files.Count));
|
||||
foreach (File file in fsom.Files)
|
||||
{
|
||||
uint hash = 0;
|
||||
uint size = (uint)file.Size;
|
||||
uint offset = (uint)(bw.Accessor.Position + (12 * fsom.Files.Count));
|
||||
foreach (File file in fsom.Files)
|
||||
{
|
||||
uint hash = 0;
|
||||
uint size = (uint)file.Size;
|
||||
|
||||
bw.Write(hash);
|
||||
bw.Write(offset);
|
||||
bw.Write(size);
|
||||
bw.WriteUInt32(hash);
|
||||
bw.WriteUInt32(offset);
|
||||
bw.WriteUInt32(size);
|
||||
|
||||
offset += size;
|
||||
}
|
||||
offset += size;
|
||||
}
|
||||
|
||||
for (ushort i = 0; i < fileCount; i++)
|
||||
{
|
||||
bw.Write(fsom.Files[i].GetDataAsByteArray());
|
||||
}
|
||||
for (ushort i = 0; i < fileCount; i++)
|
||||
{
|
||||
bw.WriteBytes(fsom.Files[i].GetDataAsByteArray());
|
||||
}
|
||||
|
||||
foreach (File file in fsom.Files)
|
||||
{
|
||||
bw.WriteFixedLengthString(file.Name, 15);
|
||||
}
|
||||
foreach (File file in fsom.Files)
|
||||
{
|
||||
bw.WriteFixedLengthString(file.Name, 15);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UniversalEditor.Accessors.File;
|
||||
using UniversalEditor.Accessors;
|
||||
using UniversalEditor.ObjectModels.FileSystem;
|
||||
|
||||
namespace UniversalEditor.DataFormats.FileSystem.NewWorldComputing
|
||||
@ -25,7 +25,7 @@ namespace UniversalEditor.DataFormats.FileSystem.NewWorldComputing
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
if (fsom == null) return;
|
||||
|
||||
IO.BinaryReader br = base.Stream.BinaryReader;
|
||||
IO.Reader br = base.Accessor.Reader;
|
||||
uint fileCount = br.ReadUInt32();
|
||||
for (uint i = 0; i < fileCount; i++)
|
||||
{
|
||||
@ -56,9 +56,9 @@ namespace UniversalEditor.DataFormats.FileSystem.NewWorldComputing
|
||||
FileName = (Accessor as FileAccessor).FileName;
|
||||
}
|
||||
|
||||
IO.BinaryReader br = new IO.BinaryReader(System.IO.File.Open(FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read));
|
||||
IO.Reader br = new IO.Reader(new FileAccessor(FileName));
|
||||
File send = (sender as File);
|
||||
br.BaseStream.Position = offsets[send];
|
||||
br.Accessor.Position = offsets[send];
|
||||
e.Data = br.ReadBytes(lengths[send]);
|
||||
br.Close();
|
||||
}
|
||||
|
||||
@ -2,72 +2,86 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UniversalEditor.Accessors.File;
|
||||
using UniversalEditor.Accessors;
|
||||
using UniversalEditor.ObjectModels.FileSystem;
|
||||
|
||||
namespace UniversalEditor.DataFormats.FileSystem.NewWorldComputing
|
||||
{
|
||||
public class Heroes3VIDDataFormat : DataFormat
|
||||
{
|
||||
private static DataFormatReference _dfr = null;
|
||||
public override DataFormatReference MakeReference()
|
||||
{
|
||||
if (_dfr == null)
|
||||
{
|
||||
_dfr = base.MakeReference();
|
||||
_dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All);
|
||||
_dfr.Filters.Add("Heroes of Might and Magic VID archive", new string[] { "*.vid" });
|
||||
}
|
||||
return _dfr;
|
||||
}
|
||||
protected override void LoadInternal(ref ObjectModel objectModel)
|
||||
{
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
if (fsom == null) return;
|
||||
public class Heroes3VIDDataFormat : DataFormat
|
||||
{
|
||||
private static DataFormatReference _dfr = null;
|
||||
public override DataFormatReference MakeReference()
|
||||
{
|
||||
if (_dfr == null)
|
||||
{
|
||||
_dfr = base.MakeReference();
|
||||
_dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All);
|
||||
_dfr.Filters.Add("Heroes of Might and Magic VID archive", new string[] { "*.vid" });
|
||||
}
|
||||
return _dfr;
|
||||
}
|
||||
protected override void LoadInternal(ref ObjectModel objectModel)
|
||||
{
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
if (fsom == null) return;
|
||||
|
||||
IO.BinaryReader br = base.Stream.BinaryReader;
|
||||
uint fileCount = br.ReadUInt32();
|
||||
uint offset = 0;
|
||||
for (uint i = 0; i < fileCount; i++)
|
||||
{
|
||||
File file = new File();
|
||||
file.Name = br.ReadNullTerminatedString(40);
|
||||
IO.Reader br = base.Accessor.Reader;
|
||||
uint fileCount = br.ReadUInt32();
|
||||
uint offset = 0;
|
||||
for (uint i = 0; i < fileCount; i++)
|
||||
{
|
||||
File file = new File();
|
||||
file.Name = br.ReadNullTerminatedString(40);
|
||||
|
||||
uint length = br.ReadUInt32();
|
||||
uint length = br.ReadUInt32();
|
||||
|
||||
offsets.Add(file, offset);
|
||||
lengths.Add(file, length);
|
||||
offsets.Add(file, offset);
|
||||
lengths.Add(file, length);
|
||||
|
||||
file.DataRequest += new DataRequestEventHandler(file_DataRequest);
|
||||
file.Size = length;
|
||||
fsom.Files.Add(file);
|
||||
file.DataRequest += new DataRequestEventHandler(file_DataRequest);
|
||||
file.Size = length;
|
||||
fsom.Files.Add(file);
|
||||
|
||||
offset += length;
|
||||
}
|
||||
}
|
||||
offset += length;
|
||||
}
|
||||
}
|
||||
|
||||
#region Data Request
|
||||
private Dictionary<File, uint> offsets = new Dictionary<File, uint>();
|
||||
private Dictionary<File, uint> lengths = new Dictionary<File, uint>();
|
||||
private void file_DataRequest(object sender, DataRequestEventArgs e)
|
||||
{
|
||||
string FileName = String.Empty;
|
||||
if (Accessor is FileAccessor)
|
||||
{
|
||||
FileName = (Accessor as FileAccessor).FileName;
|
||||
}
|
||||
|
||||
IO.BinaryReader br = new IO.BinaryReader(System.IO.File.Open(FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read));
|
||||
File send = (sender as File);
|
||||
br.BaseStream.Position = offsets[send];
|
||||
e.Data = br.ReadBytes(lengths[send]);
|
||||
br.Close();
|
||||
}
|
||||
#endregion
|
||||
protected override void SaveInternal(ObjectModel objectModel)
|
||||
{
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
if (fsom == null) return;
|
||||
|
||||
protected override void SaveInternal(ObjectModel objectModel)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
IO.Writer bw = base.Accessor.Writer;
|
||||
File[] files = fsom.GetAllFiles();
|
||||
bw.WriteUInt32((uint)files.Length);
|
||||
foreach (File file in files)
|
||||
{
|
||||
bw.WriteNullTerminatedString(file.Name, 40);
|
||||
bw.WriteUInt32((uint)file.Size);
|
||||
}
|
||||
foreach (File file in files)
|
||||
{
|
||||
bw.WriteBytes(file.GetDataAsByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
#region Data Request
|
||||
private Dictionary<File, uint> offsets = new Dictionary<File, uint>();
|
||||
private Dictionary<File, uint> lengths = new Dictionary<File, uint>();
|
||||
private void file_DataRequest(object sender, DataRequestEventArgs e)
|
||||
{
|
||||
string FileName = String.Empty;
|
||||
if (Accessor is FileAccessor)
|
||||
{
|
||||
FileName = (Accessor as FileAccessor).FileName;
|
||||
}
|
||||
|
||||
IO.Reader br = new IO.Reader(new FileAccessor(FileName));
|
||||
File send = (sender as File);
|
||||
br.Accessor.Position = offsets[send];
|
||||
e.Data = br.ReadBytes(lengths[send]);
|
||||
br.Close();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user