Added more plugins to UniversalEditor
This commit is contained in:
parent
9bdb964f24
commit
3af82ce51a
@ -53,10 +53,6 @@
|
||||
<Project>{30467e5c-05bc-4856-aadc-13906ef4cadd}</Project>
|
||||
<Name>UniversalEditor.Essential</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\UniversalEditor.Plugins.Concertroid\UniversalEditor.Plugins.Concertroid.csproj">
|
||||
<Project>{d3bbda07-5088-454e-a16d-da24d8d88037}</Project>
|
||||
<Name>UniversalEditor.Plugins.Concertroid</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\UniversalEditor.Plugins.Multimedia3D\UniversalEditor.Plugins.Multimedia3D.csproj">
|
||||
<Project>{4fd9db1d-76aa-48d1-8446-95376c4a2bc2}</Project>
|
||||
<Name>UniversalEditor.Plugins.Multimedia3D</Name>
|
||||
|
||||
@ -54,14 +54,6 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\Surodoine\Surodoine\Surodoine.csproj">
|
||||
<Project>{e0897b7b-617a-4709-a4c6-fc0f6b441b2a}</Project>
|
||||
<Name>Surodoine</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VersatileContainer\VersatileContainer\VersatileContainer.csproj">
|
||||
<Project>{ffc91b24-39af-49ac-9a3a-900fbe1012ed}</Project>
|
||||
<Name>VersatileContainer</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
<Project>{a92d520b-ffa3-4464-8cf6-474d18959e03}</Project>
|
||||
<Name>UniversalEditor.Core</Name>
|
||||
@ -82,6 +74,10 @@
|
||||
<Project>{be4d0ba3-0888-42a5-9c09-fc308a4509d2}</Project>
|
||||
<Name>UniversalEditor.Plugins.Multimedia</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\UniversalEditor.Plugins.VersatileContainer\UniversalEditor.Plugins.VersatileContainer.csproj">
|
||||
<Project>{ffc91b24-39af-49ac-9a3a-900fbe1012ed}</Project>
|
||||
<Name>UniversalEditor.Plugins.VersatileContainer</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@ -0,0 +1,203 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using UniversalEditor.ObjectModels.VersatileContainer;
|
||||
using UniversalEditor.ObjectModels.VersatileContainer.Sections;
|
||||
|
||||
namespace UniversalEditor.DataFormats.VersatileContainer
|
||||
{
|
||||
public class VersatileContainerDataFormat : DataFormat
|
||||
{
|
||||
private Version mvarFormatVersion = new Version(2, 0);
|
||||
public Version FormatVersion { get { return mvarFormatVersion; } set { mvarFormatVersion = value; } }
|
||||
|
||||
private static DataFormatReference _dfr = null;
|
||||
public override DataFormatReference MakeReference()
|
||||
{
|
||||
if (_dfr == null)
|
||||
{
|
||||
_dfr = base.MakeReference();
|
||||
_dfr.Capabilities.Add(typeof(VersatileContainerObjectModel), DataFormatCapabilities.All);
|
||||
_dfr.Filters.Add("Versatile Container object file", new byte?[][] { new byte?[] { (byte)'V', (byte)'e', (byte)'r', (byte)'s', (byte)'a', (byte)'t', (byte)'i', (byte)'l', (byte)'e', (byte)' ', (byte)'C', (byte)'o', (byte)'n', (byte)'t', (byte)'a', (byte)'i', (byte)'n', (byte)'e', (byte)'r', (byte)' ', (byte)'f', (byte)'i', (byte)'l', (byte)'e', (byte)' ', (byte)'0', (byte)'0', (byte)'0', (byte)'2' } }, new string[] { "*.vco" });
|
||||
}
|
||||
return _dfr;
|
||||
}
|
||||
|
||||
protected override void LoadInternal(ref ObjectModel objectModel)
|
||||
{
|
||||
VersatileContainerObjectModel vcom = (objectModel as VersatileContainerObjectModel);
|
||||
if (vcom == null) return;
|
||||
|
||||
IO.BinaryReader br = base.Stream.BinaryReader;
|
||||
string signature = br.ReadFixedLengthString(30); // Versatile Container file 0002
|
||||
signature = signature.TrimNull();
|
||||
if (signature != "Versatile Container file 0002") throw new DataFormatException(Localization.StringTable.ErrorDataFormatInvalid);
|
||||
|
||||
mvarFormatVersion = br.ReadVersion();
|
||||
vcom.Title = br.ReadNullTerminatedString();
|
||||
|
||||
uint propertyCount = br.ReadUInt32();
|
||||
uint sectionClassCount = br.ReadUInt32();
|
||||
uint sectionCount = br.ReadUInt32();
|
||||
|
||||
List<string> sectionClassNames = new List<string>();
|
||||
|
||||
#region Section Class Entries
|
||||
for (uint i = 0; i < sectionClassCount; i++)
|
||||
{
|
||||
string sectionClassName = br.ReadNullTerminatedString();
|
||||
sectionClassNames.Add(sectionClassName);
|
||||
}
|
||||
#endregion
|
||||
#region Section Entries
|
||||
List<uint> sectionDataSizes = new List<uint>();
|
||||
for (uint i = 0; i < sectionCount; i++)
|
||||
{
|
||||
VersatileContainerSectionType sectionType = (VersatileContainerSectionType)br.ReadUInt32();
|
||||
string sectionName = br.ReadNullTerminatedString();
|
||||
|
||||
switch (sectionType)
|
||||
{
|
||||
case VersatileContainerSectionType.None:
|
||||
{
|
||||
sectionDataSizes.Add(0);
|
||||
|
||||
VersatileContainerBlankSection sect = new VersatileContainerBlankSection();
|
||||
vcom.Sections.Add(sect);
|
||||
break;
|
||||
}
|
||||
case VersatileContainerSectionType.Section:
|
||||
{
|
||||
uint sectionDataSize = br.ReadUInt32();
|
||||
sectionDataSizes.Add(sectionDataSize);
|
||||
|
||||
uint sectionClassIndex = br.ReadUInt32();
|
||||
|
||||
VersatileContainerContentSection sect = new VersatileContainerContentSection();
|
||||
sect.Name = sectionName;
|
||||
if (sectionClassIndex != 0xFFFFFFFF)
|
||||
{
|
||||
sect.ClassName = sectionClassNames[(int)sectionClassIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
sect.ClassName = null;
|
||||
}
|
||||
vcom.Sections.Add(sect);
|
||||
break;
|
||||
}
|
||||
case VersatileContainerSectionType.Directory:
|
||||
{
|
||||
sectionDataSizes.Add(0);
|
||||
|
||||
VersatileContainerDirectorySection sect = new VersatileContainerDirectorySection();
|
||||
vcom.Sections.Add(sect);
|
||||
break;
|
||||
}
|
||||
case VersatileContainerSectionType.Reference:
|
||||
{
|
||||
sectionDataSizes.Add(0);
|
||||
uint sectionIndex = br.ReadUInt32();
|
||||
|
||||
VersatileContainerReferenceSection sect = new VersatileContainerReferenceSection();
|
||||
sect.Target = vcom.Sections[(int)sectionIndex];
|
||||
vcom.Sections.Add(sect);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
for (uint i = 0; i < sectionCount; i++)
|
||||
{
|
||||
VersatileContainerSection section = vcom.Sections[(int)i];
|
||||
if (section is VersatileContainerContentSection)
|
||||
{
|
||||
VersatileContainerContentSection sect = (section as VersatileContainerContentSection);
|
||||
byte[] data = br.ReadBytes(sectionDataSizes[(int)i]);
|
||||
if (sect == null) continue;
|
||||
sect.Data = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SaveInternal(ObjectModel objectModel)
|
||||
{
|
||||
VersatileContainerObjectModel vcom = (objectModel as VersatileContainerObjectModel);
|
||||
if (vcom == null) return;
|
||||
|
||||
IO.BinaryWriter bw = base.Stream.BinaryWriter;
|
||||
bw.WriteNullTerminatedString("Versatile Container file 0002");
|
||||
bw.Write(mvarFormatVersion);
|
||||
bw.WriteNullTerminatedString(vcom.Title);
|
||||
|
||||
bw.Write((uint)vcom.Properties.Count);
|
||||
|
||||
// get a list of section class names
|
||||
List<string> sectionClassNames = new List<string>();
|
||||
foreach (VersatileContainerSection section in vcom.Sections)
|
||||
{
|
||||
if (section is VersatileContainerContentSection)
|
||||
{
|
||||
VersatileContainerContentSection sect = (section as VersatileContainerContentSection);
|
||||
if (!sectionClassNames.Contains(sect.ClassName)) sectionClassNames.Add(sect.ClassName);
|
||||
}
|
||||
}
|
||||
bw.Write((uint)sectionClassNames.Count);
|
||||
|
||||
bw.Write((uint)vcom.Sections.Count);
|
||||
|
||||
#region Section Class Entries
|
||||
foreach (string sectionClassName in sectionClassNames)
|
||||
{
|
||||
bw.WriteNullTerminatedString(sectionClassName);
|
||||
}
|
||||
#endregion
|
||||
#region Section Entries
|
||||
List<VersatileContainerSectionType> sectionTypes = new List<VersatileContainerSectionType>();
|
||||
List<uint> sectionDataSizes = new List<uint>();
|
||||
foreach (VersatileContainerSection section in vcom.Sections)
|
||||
{
|
||||
VersatileContainerSectionType sectionType = VersatileContainerSectionType.Section; // (VersatileContainerSectionType)br.ReadUInt32();
|
||||
bw.Write((uint)sectionType);
|
||||
|
||||
bw.WriteNullTerminatedString(section.Name);
|
||||
if (section is VersatileContainerBlankSection)
|
||||
{
|
||||
}
|
||||
else if (section is VersatileContainerContentSection)
|
||||
{
|
||||
VersatileContainerContentSection sect = (section as VersatileContainerContentSection);
|
||||
bw.Write((uint)sect.Data.LongLength);
|
||||
if (!String.IsNullOrEmpty(sect.ClassName))
|
||||
{
|
||||
bw.Write(sectionClassNames.IndexOf(sect.ClassName));
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write((uint)0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
else if (section is VersatileContainerDirectorySection)
|
||||
{
|
||||
VersatileContainerDirectorySection sect = (section as VersatileContainerDirectorySection);
|
||||
}
|
||||
else if (section is VersatileContainerReferenceSection)
|
||||
{
|
||||
VersatileContainerReferenceSection sect = (section as VersatileContainerReferenceSection);
|
||||
bw.Write((uint)vcom.Sections.IndexOf(sect.Target));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
foreach (VersatileContainerSection section in vcom.Sections)
|
||||
{
|
||||
if (section is VersatileContainerContentSection)
|
||||
{
|
||||
VersatileContainerContentSection sect = (section as VersatileContainerContentSection);
|
||||
bw.Write(sect.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.VersatileContainer
|
||||
{
|
||||
public enum VersatileContainerSectionType : uint
|
||||
{
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// A section that contains data stored within the Versatile Container.
|
||||
/// Multiple named Sections can point to the same data location.
|
||||
/// </summary>
|
||||
Section = 1,
|
||||
/// <summary>
|
||||
/// A section that contains another list of sections. Directories can be
|
||||
/// nested within one another.
|
||||
/// </summary>
|
||||
Directory = 2,
|
||||
/// <summary>
|
||||
/// A section that doesn't contain any data, but points to the data
|
||||
/// contained within another indexed Section.
|
||||
/// </summary>
|
||||
Reference = 3
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,407 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UniversalEditor.Compression;
|
||||
using UniversalEditor.IO;
|
||||
using UniversalEditor.ObjectModels.FileSystem;
|
||||
using UniversalEditor.ObjectModels.VersatileContainer;
|
||||
using UniversalEditor.ObjectModels.VersatileContainer.Sections;
|
||||
|
||||
namespace UniversalEditor.DataFormats.VersatileContainer
|
||||
{
|
||||
public class VersatileContainerV1DataFormat : DataFormat
|
||||
{
|
||||
private static DataFormatReference _dfr = null;
|
||||
public override DataFormatReference MakeReference()
|
||||
{
|
||||
_dfr = base.MakeReference();
|
||||
_dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All);
|
||||
_dfr.Filters.Add("Versatile Container binary file", new byte?[][] { new byte?[] { (byte)'V', (byte)'e', (byte)'r', (byte)'s', (byte)'a', (byte)'t', (byte)'i', (byte)'l', (byte)'e', (byte)' ', (byte)'C', (byte)'o', (byte)'n', (byte)'t', (byte)'a', (byte)'i', (byte)'n', (byte)'e', (byte)'r', (byte)' ', (byte)'f', (byte)'i', (byte)'l', (byte)'e', (byte)' ', (byte)'0', (byte)'0', (byte)'0', (byte)'1' } }, new string[] { "*.vcb" });
|
||||
return _dfr;
|
||||
}
|
||||
|
||||
private VersatileContainerProperty.VersatileContainerPropertyCollection mvarProperties = new VersatileContainerProperty.VersatileContainerPropertyCollection();
|
||||
public VersatileContainerProperty.VersatileContainerPropertyCollection Properties { get { return mvarProperties; } }
|
||||
|
||||
private Version mvarFormatVersion = new Version(2, 0);
|
||||
public Version FormatVersion { get { return mvarFormatVersion; } set { mvarFormatVersion = value; } }
|
||||
|
||||
private uint mvarBytesPerNUMBER = 4;
|
||||
public uint BytesPerNUMBER { get { return mvarBytesPerNUMBER; } set { mvarBytesPerNUMBER = value; } }
|
||||
|
||||
private uint mvarSectionAlignment = 512;
|
||||
public uint SectionAlignment { get { return mvarSectionAlignment; } set { mvarSectionAlignment = value; } }
|
||||
|
||||
protected override void LoadInternal(ref ObjectModel objectModel)
|
||||
{
|
||||
IO.Reader br = base.Accessor.Reader;
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
VersatileContainerObjectModel vcom = (objectModel as VersatileContainerObjectModel);
|
||||
|
||||
string signature = br.ReadFixedLengthString(30);
|
||||
if (signature != "Versatile Container file 0001\0")
|
||||
{
|
||||
throw new InvalidDataFormatException();
|
||||
}
|
||||
|
||||
mvarFormatVersion = br.ReadVersion();
|
||||
mvarSectionAlignment = br.ReadUInt32();
|
||||
mvarBytesPerNUMBER = br.ReadUInt32();
|
||||
|
||||
string title = br.ReadNullTerminatedString(64);
|
||||
|
||||
if (mvarFormatVersion.Major > 1)
|
||||
{
|
||||
long oldPosition = br.Accessor.Position;
|
||||
long numberOfPropertiesInFile = (long)ReadUnum(br);
|
||||
|
||||
long[] propertyNameLengths = new long[numberOfPropertiesInFile];
|
||||
long[] propertyValueLengths = new long[numberOfPropertiesInFile];
|
||||
|
||||
for (long i = 0; i < numberOfPropertiesInFile; i++)
|
||||
{
|
||||
long propertyNameLength = (long)ReadUnum(br);
|
||||
long propertyValueLength = (long)ReadUnum(br);
|
||||
propertyNameLengths.SetValue(propertyNameLength, i);
|
||||
propertyValueLengths.SetValue(propertyValueLength, i);
|
||||
}
|
||||
for (long i = 0; i < numberOfPropertiesInFile; i++)
|
||||
{
|
||||
long propertyNameLength = (long)propertyNameLengths.GetValue(i);
|
||||
long propertyValueLength = (long)propertyValueLengths.GetValue(i);
|
||||
|
||||
string propertyName = br.ReadFixedLengthString(propertyNameLength);
|
||||
string propertyValue = br.ReadFixedLengthString(propertyValueLength);
|
||||
mvarProperties.Add(propertyName, propertyValue);
|
||||
}
|
||||
long newPosition = br.Accessor.Position;
|
||||
|
||||
long totalSizeOfBlock = (newPosition - oldPosition);
|
||||
if ((mvarSectionAlignment - totalSizeOfBlock) > 0)
|
||||
{
|
||||
byte[] padding = br.ReadBytes((ulong)(mvarSectionAlignment - totalSizeOfBlock));
|
||||
}
|
||||
}
|
||||
|
||||
long numberOfSectionsInFile = (long)ReadUnum(br);
|
||||
|
||||
string[] sectionNames = new string[numberOfSectionsInFile];
|
||||
ulong[] sectionOffsets = new ulong[numberOfSectionsInFile];
|
||||
ulong[] sectionVirtualSizes = new ulong[numberOfSectionsInFile];
|
||||
ulong[] sectionPhysicalSizes = new ulong[numberOfSectionsInFile];
|
||||
VersatileContainerSectionType[] sectionContentTypes = new VersatileContainerSectionType[numberOfSectionsInFile];
|
||||
|
||||
Compression.CompressionMethod[] sectionCompressions = new Compression.CompressionMethod[numberOfSectionsInFile];
|
||||
|
||||
for (long i = 0; i < numberOfSectionsInFile; i++)
|
||||
{
|
||||
string sectionName = br.ReadFixedLengthString(32);
|
||||
if (sectionName.Contains("\0")) sectionName = sectionName.Substring(0, sectionName.IndexOf('\0'));
|
||||
|
||||
ulong sectionOffset = ReadUnum(br);
|
||||
ulong sectionVirtualSize = ReadUnum(br);
|
||||
ulong sectionPhysicalSize = ReadUnum(br);
|
||||
|
||||
sectionCompressions.SetValue((Compression.CompressionMethod)br.ReadInt32(), i);
|
||||
sectionNames.SetValue(sectionName, i);
|
||||
sectionOffsets.SetValue(sectionOffset, i);
|
||||
sectionPhysicalSizes.SetValue(sectionPhysicalSize, i);
|
||||
sectionVirtualSizes.SetValue(sectionVirtualSize, i);
|
||||
}
|
||||
|
||||
for (long i = 0; i < numberOfSectionsInFile; i++)
|
||||
{
|
||||
ulong sectionOffset = (ulong)sectionOffsets.GetValue(i);
|
||||
ulong sectionVirtualSize = (ulong)sectionVirtualSizes.GetValue(i);
|
||||
ulong sectionPhysicalSize = (ulong)sectionPhysicalSizes.GetValue(i);
|
||||
string sectionName = (string)sectionNames.GetValue(i);
|
||||
ulong sectionRemainder = sectionPhysicalSize - sectionVirtualSize;
|
||||
|
||||
byte[] sectionData = br.ReadBytes(sectionVirtualSize);
|
||||
br.Accessor.Seek((long)sectionRemainder, SeekOrigin.Current);
|
||||
|
||||
Compression.CompressionMethod sectionCompression = (Compression.CompressionMethod)sectionCompressions.GetValue(i);
|
||||
|
||||
if (fsom != null)
|
||||
{
|
||||
if (sectionCompression != Compression.CompressionMethod.None)
|
||||
{
|
||||
File section = new File();
|
||||
section.Name = sectionName;
|
||||
byte[] data = CompressionModule.FromKnownCompressionMethod(sectionCompression).Decompress(sectionData);
|
||||
section.SetDataAsByteArray(data);
|
||||
fsom.Files.Add(section);
|
||||
}
|
||||
else
|
||||
{
|
||||
File section = new File();
|
||||
section.Name = sectionName;
|
||||
section.SetDataAsByteArray(sectionData);
|
||||
fsom.Files.Add(section);
|
||||
}
|
||||
}
|
||||
else if (vcom != null)
|
||||
{
|
||||
if (sectionCompression != Compression.CompressionMethod.None)
|
||||
{
|
||||
VersatileContainerContentSection section = new VersatileContainerContentSection();
|
||||
// section.CompressionMethod = sectionCompression;
|
||||
section.Name = sectionName;
|
||||
byte[] data = CompressionModule.FromKnownCompressionMethod(sectionCompression).Decompress(sectionData);
|
||||
section.Data = data;
|
||||
vcom.Sections.Add(section);
|
||||
}
|
||||
else
|
||||
{
|
||||
VersatileContainerContentSection section = new VersatileContainerContentSection();
|
||||
section.Name = sectionName;
|
||||
section.Data = sectionData;
|
||||
vcom.Sections.Add(section);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fsom != null)
|
||||
{
|
||||
fsom.Title = title;
|
||||
}
|
||||
else if (vcom != null)
|
||||
{
|
||||
vcom.Title = title;
|
||||
}
|
||||
}
|
||||
|
||||
private ulong ReadUnum(IO.Reader br)
|
||||
{
|
||||
switch (mvarBytesPerNUMBER)
|
||||
{
|
||||
case 1: return br.ReadByte();
|
||||
case 2: return br.ReadUInt16();
|
||||
case 4: return br.ReadUInt32();
|
||||
case 8: return br.ReadUInt64();
|
||||
}
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
private long ReadNum(IO.Reader br)
|
||||
{
|
||||
switch (mvarBytesPerNUMBER)
|
||||
{
|
||||
case 1: return br.ReadByte();
|
||||
case 2: return br.ReadInt16();
|
||||
case 4: return br.ReadInt32();
|
||||
case 8: return br.ReadInt64();
|
||||
}
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
private void WriteUnum(IO.Writer bw, ulong value)
|
||||
{
|
||||
switch (mvarBytesPerNUMBER)
|
||||
{
|
||||
case 1: bw.WriteByte((byte)value); return;
|
||||
case 2: bw.WriteUInt16((ushort)value); return;
|
||||
case 4: bw.WriteUInt32((uint)value); return;
|
||||
case 8: bw.WriteUInt64((ulong)value); return;
|
||||
}
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
private void WriteNum(IO.Writer bw, long value)
|
||||
{
|
||||
switch (mvarBytesPerNUMBER)
|
||||
{
|
||||
case 1: bw.WriteByte((byte)value); return;
|
||||
case 2: bw.WriteInt16((short)value); return;
|
||||
case 4: bw.WriteInt32((int)value); return;
|
||||
case 8: bw.WriteInt64((long)value); return;
|
||||
}
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
protected override void SaveInternal(ObjectModel objectModel)
|
||||
{
|
||||
IO.Writer bw = base.Accessor.Writer;
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
VersatileContainerObjectModel vcom = (objectModel as VersatileContainerObjectModel);
|
||||
|
||||
bw.WriteFixedLengthString("Versatile Container file 0001\0");
|
||||
bw.WriteVersion(mvarFormatVersion);
|
||||
bw.WriteUInt32(mvarSectionAlignment);
|
||||
bw.WriteUInt32(mvarBytesPerNUMBER);
|
||||
if (fsom != null)
|
||||
{
|
||||
bw.WriteFixedLengthString(fsom.Title, 64);
|
||||
}
|
||||
else if (vcom != null)
|
||||
{
|
||||
bw.WriteFixedLengthString(vcom.Title, 64);
|
||||
}
|
||||
|
||||
#region Properties/Metadata (Versatile Container V2)
|
||||
if (mvarFormatVersion.Major > 1)
|
||||
{
|
||||
long oldPosition = bw.Accessor.Position;
|
||||
WriteUnum(bw, (ulong)mvarProperties.Count);
|
||||
foreach (VersatileContainerProperty property in mvarProperties)
|
||||
{
|
||||
WriteUnum(bw, (ulong)property.Name.Length);
|
||||
WriteUnum(bw, (ulong)property.Value.Length);
|
||||
}
|
||||
foreach (VersatileContainerProperty property in mvarProperties)
|
||||
{
|
||||
bw.WriteFixedLengthString(property.Name);
|
||||
bw.WriteFixedLengthString(property.Value);
|
||||
}
|
||||
long newPosition = bw.Accessor.Position;
|
||||
|
||||
long totalSizeOfBlock = (newPosition - oldPosition);
|
||||
if ((mvarSectionAlignment - totalSizeOfBlock) > 0)
|
||||
{
|
||||
byte[] padding = new byte[mvarSectionAlignment - totalSizeOfBlock];
|
||||
bw.WriteBytes(padding);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (fsom != null)
|
||||
{
|
||||
WriteUnum(bw, (ulong)fsom.Files.Count);
|
||||
}
|
||||
else if (vcom != null)
|
||||
{
|
||||
WriteUnum(bw, (ulong)vcom.Sections.Count);
|
||||
}
|
||||
|
||||
ulong sectionOffset = 0;
|
||||
if (fsom != null)
|
||||
{
|
||||
sectionOffset = (ulong)(bw.Accessor.Position + ((32 + (mvarBytesPerNUMBER * 3)) * fsom.Files.Count));
|
||||
}
|
||||
else if (vcom != null)
|
||||
{
|
||||
sectionOffset = (ulong)(bw.Accessor.Position + ((32 + (mvarBytesPerNUMBER * 3)) * vcom.Sections.Count));
|
||||
}
|
||||
|
||||
byte[][] realDatas = null;
|
||||
if (fsom != null)
|
||||
{
|
||||
realDatas = new byte[fsom.Files.Count][];
|
||||
}
|
||||
else if (vcom != null)
|
||||
{
|
||||
realDatas = new byte[vcom.Sections.Count][];
|
||||
}
|
||||
|
||||
if (fsom != null)
|
||||
{
|
||||
foreach (File section in fsom.Files)
|
||||
{
|
||||
byte[] data = section.GetDataAsByteArray();
|
||||
/*
|
||||
if (section is File)
|
||||
{
|
||||
data = Compression.CompressionStream.Compress((section as File).CompressionMethod, data);
|
||||
}
|
||||
*/
|
||||
ulong sectionVirtualSize = (ulong)data.Length;
|
||||
realDatas[fsom.Files.IndexOf(section)] = data;
|
||||
|
||||
bw.WriteFixedLengthString(section.Name, 32);
|
||||
|
||||
ulong sectionPhysicalSize = sectionVirtualSize;
|
||||
|
||||
ulong remainder = (sectionPhysicalSize % mvarSectionAlignment);
|
||||
if (remainder != 0)
|
||||
{
|
||||
sectionPhysicalSize += (mvarSectionAlignment - remainder);
|
||||
}
|
||||
|
||||
WriteUnum(bw, sectionOffset);
|
||||
WriteUnum(bw, sectionVirtualSize);
|
||||
WriteUnum(bw, sectionPhysicalSize);
|
||||
|
||||
/*
|
||||
if (section is File)
|
||||
{
|
||||
bw.WriteInt32((int)((section as File).CompressionMethod));
|
||||
}
|
||||
else
|
||||
{
|
||||
*/
|
||||
bw.WriteInt32((int)Compression.CompressionMethod.None);
|
||||
// }
|
||||
|
||||
sectionOffset += sectionPhysicalSize;
|
||||
}
|
||||
|
||||
foreach (File section in fsom.Files)
|
||||
{
|
||||
byte[] realData = realDatas[fsom.Files.IndexOf(section)];
|
||||
ulong sectionVirtualSize = (ulong)realData.Length;
|
||||
ulong sectionPhysicalSize = sectionVirtualSize;
|
||||
|
||||
ulong remainder = (sectionPhysicalSize % mvarSectionAlignment);
|
||||
if (remainder != 0)
|
||||
{
|
||||
sectionPhysicalSize += (mvarSectionAlignment - remainder);
|
||||
}
|
||||
|
||||
byte[] sectionData = new byte[sectionPhysicalSize];
|
||||
Array.Copy(realData, 0, sectionData, 0, (long)sectionVirtualSize);
|
||||
|
||||
bw.WriteBytes(sectionData);
|
||||
}
|
||||
}
|
||||
else if (vcom != null)
|
||||
{
|
||||
foreach (VersatileContainerSection section in vcom.Sections)
|
||||
{
|
||||
if (section is VersatileContainerContentSection)
|
||||
{
|
||||
VersatileContainerContentSection content = (section as VersatileContainerContentSection);
|
||||
|
||||
byte[] data = content.Data;
|
||||
|
||||
ulong sectionVirtualSize = (ulong)data.Length;
|
||||
realDatas[vcom.Sections.IndexOf(section)] = data;
|
||||
|
||||
bw.WriteFixedLengthString(section.Name, 32);
|
||||
|
||||
ulong sectionPhysicalSize = sectionVirtualSize;
|
||||
|
||||
ulong remainder = (sectionPhysicalSize % mvarSectionAlignment);
|
||||
if (remainder != 0)
|
||||
{
|
||||
sectionPhysicalSize += (mvarSectionAlignment - remainder);
|
||||
}
|
||||
|
||||
WriteUnum(bw, sectionOffset);
|
||||
WriteUnum(bw, sectionVirtualSize);
|
||||
WriteUnum(bw, sectionPhysicalSize);
|
||||
|
||||
bw.WriteInt32((int)Compression.CompressionMethod.None);
|
||||
|
||||
sectionOffset += sectionPhysicalSize;
|
||||
}
|
||||
}
|
||||
foreach (VersatileContainerSection section in vcom.Sections)
|
||||
{
|
||||
byte[] realData = realDatas[vcom.Sections.IndexOf(section)];
|
||||
ulong sectionVirtualSize = (ulong)realData.Length;
|
||||
ulong sectionPhysicalSize = sectionVirtualSize;
|
||||
|
||||
ulong remainder = (sectionPhysicalSize % mvarSectionAlignment);
|
||||
if (remainder != 0)
|
||||
{
|
||||
sectionPhysicalSize += (mvarSectionAlignment - remainder);
|
||||
}
|
||||
|
||||
byte[] sectionData = new byte[sectionPhysicalSize];
|
||||
Array.Copy(realData, 0, sectionData, 0, (long)sectionVirtualSize);
|
||||
|
||||
bw.WriteBytes(sectionData);
|
||||
}
|
||||
}
|
||||
bw.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,203 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using UniversalEditor.ObjectModels.VersatileContainer;
|
||||
using UniversalEditor.ObjectModels.VersatileContainer.Sections;
|
||||
|
||||
namespace UniversalEditor.DataFormats.VersatileContainer
|
||||
{
|
||||
public class VersatileContainerV2DataFormat : DataFormat
|
||||
{
|
||||
private Version mvarFormatVersion = new Version(2, 0);
|
||||
public Version FormatVersion { get { return mvarFormatVersion; } set { mvarFormatVersion = value; } }
|
||||
|
||||
private static DataFormatReference _dfr = null;
|
||||
public override DataFormatReference MakeReference()
|
||||
{
|
||||
if (_dfr == null)
|
||||
{
|
||||
_dfr = base.MakeReference();
|
||||
_dfr.Capabilities.Add(typeof(VersatileContainerObjectModel), DataFormatCapabilities.All);
|
||||
_dfr.Filters.Add("Versatile Container object file", new byte?[][] { new byte?[] { (byte)'V', (byte)'e', (byte)'r', (byte)'s', (byte)'a', (byte)'t', (byte)'i', (byte)'l', (byte)'e', (byte)' ', (byte)'C', (byte)'o', (byte)'n', (byte)'t', (byte)'a', (byte)'i', (byte)'n', (byte)'e', (byte)'r', (byte)' ', (byte)'f', (byte)'i', (byte)'l', (byte)'e', (byte)' ', (byte)'0', (byte)'0', (byte)'0', (byte)'2' } }, new string[] { "*.vco" });
|
||||
}
|
||||
return _dfr;
|
||||
}
|
||||
|
||||
protected override void LoadInternal(ref ObjectModel objectModel)
|
||||
{
|
||||
VersatileContainerObjectModel vcom = (objectModel as VersatileContainerObjectModel);
|
||||
if (vcom == null) return;
|
||||
|
||||
IO.Reader br = base.Accessor.Reader;
|
||||
string signature = br.ReadFixedLengthString(30); // Versatile Container file 0002
|
||||
signature = signature.TrimNull();
|
||||
if (signature != "Versatile Container file 0002") throw new InvalidDataFormatException();
|
||||
|
||||
mvarFormatVersion = br.ReadVersion();
|
||||
vcom.Title = br.ReadNullTerminatedString();
|
||||
|
||||
uint propertyCount = br.ReadUInt32();
|
||||
uint sectionClassCount = br.ReadUInt32();
|
||||
uint sectionCount = br.ReadUInt32();
|
||||
|
||||
List<string> sectionClassNames = new List<string>();
|
||||
|
||||
#region Section Class Entries
|
||||
for (uint i = 0; i < sectionClassCount; i++)
|
||||
{
|
||||
string sectionClassName = br.ReadNullTerminatedString();
|
||||
sectionClassNames.Add(sectionClassName);
|
||||
}
|
||||
#endregion
|
||||
#region Section Entries
|
||||
List<uint> sectionDataSizes = new List<uint>();
|
||||
for (uint i = 0; i < sectionCount; i++)
|
||||
{
|
||||
VersatileContainerSectionType sectionType = (VersatileContainerSectionType)br.ReadUInt32();
|
||||
string sectionName = br.ReadNullTerminatedString();
|
||||
|
||||
switch (sectionType)
|
||||
{
|
||||
case VersatileContainerSectionType.None:
|
||||
{
|
||||
sectionDataSizes.Add(0);
|
||||
|
||||
VersatileContainerBlankSection sect = new VersatileContainerBlankSection();
|
||||
vcom.Sections.Add(sect);
|
||||
break;
|
||||
}
|
||||
case VersatileContainerSectionType.Section:
|
||||
{
|
||||
uint sectionDataSize = br.ReadUInt32();
|
||||
sectionDataSizes.Add(sectionDataSize);
|
||||
|
||||
uint sectionClassIndex = br.ReadUInt32();
|
||||
|
||||
VersatileContainerContentSection sect = new VersatileContainerContentSection();
|
||||
sect.Name = sectionName;
|
||||
if (sectionClassIndex != 0xFFFFFFFF)
|
||||
{
|
||||
sect.ClassName = sectionClassNames[(int)sectionClassIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
sect.ClassName = null;
|
||||
}
|
||||
vcom.Sections.Add(sect);
|
||||
break;
|
||||
}
|
||||
case VersatileContainerSectionType.Directory:
|
||||
{
|
||||
sectionDataSizes.Add(0);
|
||||
|
||||
VersatileContainerDirectorySection sect = new VersatileContainerDirectorySection();
|
||||
vcom.Sections.Add(sect);
|
||||
break;
|
||||
}
|
||||
case VersatileContainerSectionType.Reference:
|
||||
{
|
||||
sectionDataSizes.Add(0);
|
||||
uint sectionIndex = br.ReadUInt32();
|
||||
|
||||
VersatileContainerReferenceSection sect = new VersatileContainerReferenceSection();
|
||||
sect.Target = vcom.Sections[(int)sectionIndex];
|
||||
vcom.Sections.Add(sect);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
for (uint i = 0; i < sectionCount; i++)
|
||||
{
|
||||
VersatileContainerSection section = vcom.Sections[(int)i];
|
||||
if (section is VersatileContainerContentSection)
|
||||
{
|
||||
VersatileContainerContentSection sect = (section as VersatileContainerContentSection);
|
||||
byte[] data = br.ReadBytes(sectionDataSizes[(int)i]);
|
||||
if (sect == null) continue;
|
||||
sect.Data = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SaveInternal(ObjectModel objectModel)
|
||||
{
|
||||
VersatileContainerObjectModel vcom = (objectModel as VersatileContainerObjectModel);
|
||||
if (vcom == null) return;
|
||||
|
||||
IO.Writer bw = base.Accessor.Writer;
|
||||
bw.WriteNullTerminatedString("Versatile Container file 0002");
|
||||
bw.WriteVersion(mvarFormatVersion);
|
||||
bw.WriteNullTerminatedString(vcom.Title);
|
||||
|
||||
bw.WriteUInt32((uint)vcom.Properties.Count);
|
||||
|
||||
// get a list of section class names
|
||||
List<string> sectionClassNames = new List<string>();
|
||||
foreach (VersatileContainerSection section in vcom.Sections)
|
||||
{
|
||||
if (section is VersatileContainerContentSection)
|
||||
{
|
||||
VersatileContainerContentSection sect = (section as VersatileContainerContentSection);
|
||||
if (!sectionClassNames.Contains(sect.ClassName)) sectionClassNames.Add(sect.ClassName);
|
||||
}
|
||||
}
|
||||
bw.WriteUInt32((uint)sectionClassNames.Count);
|
||||
|
||||
bw.WriteUInt32((uint)vcom.Sections.Count);
|
||||
|
||||
#region Section Class Entries
|
||||
foreach (string sectionClassName in sectionClassNames)
|
||||
{
|
||||
bw.WriteNullTerminatedString(sectionClassName);
|
||||
}
|
||||
#endregion
|
||||
#region Section Entries
|
||||
List<VersatileContainerSectionType> sectionTypes = new List<VersatileContainerSectionType>();
|
||||
List<uint> sectionDataSizes = new List<uint>();
|
||||
foreach (VersatileContainerSection section in vcom.Sections)
|
||||
{
|
||||
VersatileContainerSectionType sectionType = VersatileContainerSectionType.Section; // (VersatileContainerSectionType)br.ReadUInt32();
|
||||
bw.WriteUInt32((uint)sectionType);
|
||||
|
||||
bw.WriteNullTerminatedString(section.Name);
|
||||
if (section is VersatileContainerBlankSection)
|
||||
{
|
||||
}
|
||||
else if (section is VersatileContainerContentSection)
|
||||
{
|
||||
VersatileContainerContentSection sect = (section as VersatileContainerContentSection);
|
||||
bw.WriteUInt32((uint)sect.Data.LongLength);
|
||||
if (!String.IsNullOrEmpty(sect.ClassName))
|
||||
{
|
||||
bw.WriteUInt32((uint)sectionClassNames.IndexOf(sect.ClassName));
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.WriteUInt32((uint)0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
else if (section is VersatileContainerDirectorySection)
|
||||
{
|
||||
VersatileContainerDirectorySection sect = (section as VersatileContainerDirectorySection);
|
||||
}
|
||||
else if (section is VersatileContainerReferenceSection)
|
||||
{
|
||||
VersatileContainerReferenceSection sect = (section as VersatileContainerReferenceSection);
|
||||
bw.WriteUInt32((uint)vcom.Sections.IndexOf(sect.Target));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
foreach (VersatileContainerSection section in vcom.Sections)
|
||||
{
|
||||
if (section is VersatileContainerContentSection)
|
||||
{
|
||||
VersatileContainerContentSection sect = (section as VersatileContainerContentSection);
|
||||
bw.WriteBytes(sect.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.ObjectModels.VersatileContainer.Sections
|
||||
{
|
||||
public class VersatileContainerBlankSection : VersatileContainerSection
|
||||
{
|
||||
public override object Clone()
|
||||
{
|
||||
VersatileContainerBlankSection clone = new VersatileContainerBlankSection();
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.ObjectModels.VersatileContainer.Sections
|
||||
{
|
||||
public class VersatileContainerContentSection : VersatileContainerSection
|
||||
{
|
||||
private string mvarClassName = String.Empty;
|
||||
public string ClassName { get { return mvarClassName; } set { mvarClassName = value; } }
|
||||
|
||||
private byte[] mvarData = new byte[0];
|
||||
public byte[] Data { get { return mvarData; } set { mvarData = value; } }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("\"" + this.Name + "\"");
|
||||
if (!String.IsNullOrEmpty(mvarClassName))
|
||||
{
|
||||
sb.Append(" : ");
|
||||
sb.Append(mvarClassName);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
public override object Clone()
|
||||
{
|
||||
VersatileContainerContentSection clone = new VersatileContainerContentSection();
|
||||
clone.Name = (this.Name.Clone() as string);
|
||||
clone.ClassName = (mvarClassName.Clone() as string);
|
||||
clone.Data = (mvarData.Clone() as byte[]);
|
||||
return clone;
|
||||
}
|
||||
|
||||
private Compression.CompressionMethod mvarCompressionMethod = Compression.CompressionMethod.None;
|
||||
public Compression.CompressionMethod CompressionMethod { get { return mvarCompressionMethod; } set { mvarCompressionMethod = value; } }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.ObjectModels.VersatileContainer.Sections
|
||||
{
|
||||
public class VersatileContainerDirectorySection : VersatileContainerSection
|
||||
{
|
||||
public override object Clone()
|
||||
{
|
||||
VersatileContainerDirectorySection clone = new VersatileContainerDirectorySection();
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.ObjectModels.VersatileContainer.Sections
|
||||
{
|
||||
public class VersatileContainerReferenceSection : VersatileContainerSection
|
||||
{
|
||||
private VersatileContainerSection mvarTarget = null;
|
||||
public VersatileContainerSection Target { get { return mvarTarget; } set { mvarTarget = value; } }
|
||||
|
||||
public override object Clone()
|
||||
{
|
||||
VersatileContainerReferenceSection clone = new VersatileContainerReferenceSection();
|
||||
clone.Target = mvarTarget;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.ObjectModels.VersatileContainer
|
||||
{
|
||||
public class VersatileContainerObjectModel : ObjectModel
|
||||
{
|
||||
private static ObjectModelReference _omr = null;
|
||||
public override ObjectModelReference MakeReference()
|
||||
{
|
||||
if (_omr == null)
|
||||
{
|
||||
_omr = base.MakeReference();
|
||||
_omr.Title = "Versatile Container";
|
||||
}
|
||||
return _omr;
|
||||
}
|
||||
|
||||
private VersatileContainerSection.VersatileContainerSectionCollection mvarSections = new VersatileContainerSection.VersatileContainerSectionCollection();
|
||||
public VersatileContainerSection.VersatileContainerSectionCollection Sections { get { return mvarSections; } }
|
||||
|
||||
private VersatileContainerProperty.VersatileContainerPropertyCollection mvarProperties = new VersatileContainerProperty.VersatileContainerPropertyCollection();
|
||||
public VersatileContainerProperty.VersatileContainerPropertyCollection Properties { get { return mvarProperties; } }
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
mvarSections.Clear();
|
||||
}
|
||||
public override void CopyTo(ObjectModel where)
|
||||
{
|
||||
VersatileContainerObjectModel clone = (where as VersatileContainerObjectModel);
|
||||
if (clone == null) return;
|
||||
|
||||
foreach (VersatileContainerSection section in mvarSections)
|
||||
{
|
||||
clone.Sections.Add(section.Clone() as VersatileContainerSection);
|
||||
}
|
||||
}
|
||||
|
||||
private string mvarTitle = String.Empty;
|
||||
public string Title { get { return mvarTitle; } set { mvarTitle = value; } }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.ObjectModels.VersatileContainer
|
||||
{
|
||||
public class VersatileContainerProperty
|
||||
{
|
||||
public class VersatileContainerPropertyCollection
|
||||
: System.Collections.ObjectModel.Collection<VersatileContainerProperty>
|
||||
{
|
||||
public VersatileContainerProperty Add(string name, string value)
|
||||
{
|
||||
VersatileContainerProperty property = new VersatileContainerProperty();
|
||||
property.Name = name;
|
||||
property.Value = value;
|
||||
base.Add(property);
|
||||
return property;
|
||||
}
|
||||
}
|
||||
|
||||
private string mvarName = String.Empty;
|
||||
public string Name { get { return mvarName; } set { mvarName = value; } }
|
||||
|
||||
private string mvarValue = String.Empty;
|
||||
public string Value { get { return mvarValue; } set { mvarValue = value; } }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UniversalEditor.ObjectModels.VersatileContainer.Sections;
|
||||
|
||||
namespace UniversalEditor.ObjectModels.VersatileContainer
|
||||
{
|
||||
public abstract class VersatileContainerSection : ICloneable
|
||||
{
|
||||
public class VersatileContainerSectionCollection
|
||||
: System.Collections.ObjectModel.Collection<VersatileContainerSection>
|
||||
{
|
||||
private Dictionary<string, VersatileContainerSection> sectionsByName = new Dictionary<string, VersatileContainerSection>();
|
||||
|
||||
public VersatileContainerSection this[string Name]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (sectionsByName.ContainsKey(Name))
|
||||
{
|
||||
return sectionsByName[Name];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void InsertItem(int index, VersatileContainerSection item)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(item.Name)) sectionsByName.Add(item.Name, item);
|
||||
base.InsertItem(index, item);
|
||||
}
|
||||
protected override void RemoveItem(int index)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(this[index].Name)) sectionsByName.Remove(this[index].Name);
|
||||
base.RemoveItem(index);
|
||||
}
|
||||
|
||||
|
||||
public VersatileContainerContentSection Add(string Name, byte[] Data)
|
||||
{
|
||||
return Add(Name, String.Empty, Data);
|
||||
}
|
||||
public VersatileContainerContentSection Add(string Name, string ClassName, byte[] Data)
|
||||
{
|
||||
VersatileContainerContentSection content = new VersatileContainerContentSection();
|
||||
content.Name = Name;
|
||||
content.ClassName = ClassName;
|
||||
content.Data = Data;
|
||||
Add(content);
|
||||
return content;
|
||||
}
|
||||
}
|
||||
|
||||
private string mvarName = String.Empty;
|
||||
public string Name { get { return mvarName; } set { mvarName = value; } }
|
||||
|
||||
public abstract object Clone();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("VersatileContainer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("City of Orlando")]
|
||||
[assembly: AssemblyProduct("VersatileContainer")]
|
||||
[assembly: AssemblyCopyright("Copyright © City of Orlando 2012")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("66a1c3a0-e85e-42ff-ad5e-a19c07d191ab")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{FFC91B24-39AF-49AC-9A3A-900FBE1012ED}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UniversalEditor</RootNamespace>
|
||||
<AssemblyName>UniversalEditor.Plugins.VersatileContainer</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Output\Debug\Plugins\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Output\Release\Plugins\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataFormats\VersatileContainer\VersatileContainerV2DataFormat.cs" />
|
||||
<Compile Include="DataFormats\VersatileContainer\VersatileContainerSectionType.cs" />
|
||||
<Compile Include="DataFormats\VersatileContainer\VersatileContainerV1DataFormat.cs" />
|
||||
<Compile Include="ObjectModels\VersatileContainer\Sections\VersatileContainerBlankSection.cs" />
|
||||
<Compile Include="ObjectModels\VersatileContainer\Sections\VersatileContainerDirectorySection.cs" />
|
||||
<Compile Include="ObjectModels\VersatileContainer\Sections\VersatileContainerReferenceSection.cs" />
|
||||
<Compile Include="ObjectModels\VersatileContainer\VersatileContainerObjectModel.cs" />
|
||||
<Compile Include="ObjectModels\VersatileContainer\VersatileContainerProperty.cs" />
|
||||
<Compile Include="ObjectModels\VersatileContainer\VersatileContainerSection.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ObjectModels\VersatileContainer\Sections\VersatileContainerContentSection.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Compression\UniversalEditor.Compression.csproj">
|
||||
<Project>{3f664673-7e22-4486-9ad0-fc81861d0b78}</Project>
|
||||
<Name>UniversalEditor.Compression</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
<Project>{2d4737e6-6d95-408a-90db-8dff38147e85}</Project>
|
||||
<Name>UniversalEditor.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\UniversalEditor.Essential\UniversalEditor.Essential.csproj">
|
||||
<Project>{30467e5c-05bc-4856-aadc-13906ef4cadd}</Project>
|
||||
<Name>UniversalEditor.Essential</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@ -65,6 +65,20 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Abo
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.ConsoleBootstrapper", "Applications\UniversalEditor.ConsoleBootstrapper\UniversalEditor.ConsoleBootstrapper.csproj", "{62CFC025-B8CF-42AA-880A-92F27377FCAF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Multimedia3D", "Plugins\UniversalEditor.Plugins.Multimedia3D\UniversalEditor.Plugins.Multimedia3D.csproj", "{4FD9DB1D-76AA-48D1-8446-95376C4A2BC2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Moosta", "Plugins\UniversalEditor.Plugins.Moosta\UniversalEditor.Plugins.Moosta.csproj", "{10B9B771-9939-4D0B-8D47-501B6F60209F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.AniMiku", "Plugins\UniversalEditor.Plugins.AniMiku\UniversalEditor.Plugins.AniMiku.csproj", "{FEC4EAD0-8A6E-4029-A537-EBD9F420B227}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Avalanche", "Plugins\UniversalEditor.Plugins.Avalanche\UniversalEditor.Plugins.Avalanche.csproj", "{828C6BB6-3543-4EAF-B0F9-F11410AE8836}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Lighting", "Plugins\UniversalEditor.Plugins.Lighting\UniversalEditor.Plugins.Lighting.csproj", "{1C24F4F8-9D94-4783-B5C0-11564D70B76A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Concertroid", "Plugins\UniversalEditor.Plugins.Concertroid\UniversalEditor.Plugins.Concertroid.csproj", "{D3BBDA07-5088-454E-A16D-DA24D8D88037}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.VersatileContainer", "Plugins\UniversalEditor.Plugins.VersatileContainer\UniversalEditor.Plugins.VersatileContainer.csproj", "{FFC91B24-39AF-49AC-9A3A-900FBE1012ED}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -207,6 +221,48 @@ Global
|
||||
{62CFC025-B8CF-42AA-880A-92F27377FCAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{62CFC025-B8CF-42AA-880A-92F27377FCAF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{62CFC025-B8CF-42AA-880A-92F27377FCAF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{4FD9DB1D-76AA-48D1-8446-95376C4A2BC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4FD9DB1D-76AA-48D1-8446-95376C4A2BC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4FD9DB1D-76AA-48D1-8446-95376C4A2BC2}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{4FD9DB1D-76AA-48D1-8446-95376C4A2BC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4FD9DB1D-76AA-48D1-8446-95376C4A2BC2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4FD9DB1D-76AA-48D1-8446-95376C4A2BC2}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{10B9B771-9939-4D0B-8D47-501B6F60209F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{10B9B771-9939-4D0B-8D47-501B6F60209F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{10B9B771-9939-4D0B-8D47-501B6F60209F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{10B9B771-9939-4D0B-8D47-501B6F60209F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{10B9B771-9939-4D0B-8D47-501B6F60209F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{10B9B771-9939-4D0B-8D47-501B6F60209F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{FEC4EAD0-8A6E-4029-A537-EBD9F420B227}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FEC4EAD0-8A6E-4029-A537-EBD9F420B227}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FEC4EAD0-8A6E-4029-A537-EBD9F420B227}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{FEC4EAD0-8A6E-4029-A537-EBD9F420B227}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FEC4EAD0-8A6E-4029-A537-EBD9F420B227}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FEC4EAD0-8A6E-4029-A537-EBD9F420B227}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{828C6BB6-3543-4EAF-B0F9-F11410AE8836}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{828C6BB6-3543-4EAF-B0F9-F11410AE8836}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{828C6BB6-3543-4EAF-B0F9-F11410AE8836}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{828C6BB6-3543-4EAF-B0F9-F11410AE8836}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{828C6BB6-3543-4EAF-B0F9-F11410AE8836}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{828C6BB6-3543-4EAF-B0F9-F11410AE8836}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{1C24F4F8-9D94-4783-B5C0-11564D70B76A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1C24F4F8-9D94-4783-B5C0-11564D70B76A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1C24F4F8-9D94-4783-B5C0-11564D70B76A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{1C24F4F8-9D94-4783-B5C0-11564D70B76A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1C24F4F8-9D94-4783-B5C0-11564D70B76A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1C24F4F8-9D94-4783-B5C0-11564D70B76A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D3BBDA07-5088-454E-A16D-DA24D8D88037}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D3BBDA07-5088-454E-A16D-DA24D8D88037}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D3BBDA07-5088-454E-A16D-DA24D8D88037}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D3BBDA07-5088-454E-A16D-DA24D8D88037}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D3BBDA07-5088-454E-A16D-DA24D8D88037}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D3BBDA07-5088-454E-A16D-DA24D8D88037}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{FFC91B24-39AF-49AC-9A3A-900FBE1012ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FFC91B24-39AF-49AC-9A3A-900FBE1012ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FFC91B24-39AF-49AC-9A3A-900FBE1012ED}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{FFC91B24-39AF-49AC-9A3A-900FBE1012ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FFC91B24-39AF-49AC-9A3A-900FBE1012ED}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FFC91B24-39AF-49AC-9A3A-900FBE1012ED}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -229,6 +285,13 @@ Global
|
||||
{76FD1306-9CA4-428F-993B-B7E4EEEACBF3} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
|
||||
{26095090-3F7D-4DB5-A9BF-4C687230FC0F} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
|
||||
{D4D9C9A6-04A4-46AD-8238-2493A455723F} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
|
||||
{4FD9DB1D-76AA-48D1-8446-95376C4A2BC2} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
|
||||
{10B9B771-9939-4D0B-8D47-501B6F60209F} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
|
||||
{FEC4EAD0-8A6E-4029-A537-EBD9F420B227} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
|
||||
{828C6BB6-3543-4EAF-B0F9-F11410AE8836} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
|
||||
{1C24F4F8-9D94-4783-B5C0-11564D70B76A} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
|
||||
{D3BBDA07-5088-454E-A16D-DA24D8D88037} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
|
||||
{FFC91B24-39AF-49AC-9A3A-900FBE1012ED} = {71CFF024-26F7-4626-A526-B435FDF8D64E}
|
||||
{FE016EA3-DC31-4A92-8B0A-8C746EC117E1} = {46041F27-7C1C-4209-B72B-251EDB5D4C61}
|
||||
{C1F34183-7A2F-41A6-9958-F6F329099654} = {A846CA33-9CAA-4237-B14F-8721DBA89442}
|
||||
{5A423A3E-51C5-4188-8AD5-FB5C0CB76C6A} = {C1F34183-7A2F-41A6-9958-F6F329099654}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user