Tabify
This commit is contained in:
parent
3af82ce51a
commit
6e12bcf5d9
@ -7,7 +7,7 @@ namespace UniversalEditor.DataFormats.VersatileContainer
|
||||
{
|
||||
public enum VersatileContainerSectionType : uint
|
||||
{
|
||||
None = 0,
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// A section that contains data stored within the Versatile Container.
|
||||
/// Multiple named Sections can point to the same data location.
|
||||
@ -18,10 +18,10 @@ namespace UniversalEditor.DataFormats.VersatileContainer
|
||||
/// 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
|
||||
/// <summary>
|
||||
/// A section that doesn't contain any data, but points to the data
|
||||
/// contained within another indexed Section.
|
||||
/// </summary>
|
||||
Reference = 3
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ namespace UniversalEditor.DataFormats.VersatileContainer
|
||||
string signature = br.ReadFixedLengthString(30);
|
||||
if (signature != "Versatile Container file 0001\0")
|
||||
{
|
||||
throw new InvalidDataFormatException();
|
||||
throw new InvalidDataFormatException();
|
||||
}
|
||||
|
||||
mvarFormatVersion = br.ReadVersion();
|
||||
@ -296,12 +296,12 @@ namespace UniversalEditor.DataFormats.VersatileContainer
|
||||
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;
|
||||
|
||||
@ -319,16 +319,16 @@ namespace UniversalEditor.DataFormats.VersatileContainer
|
||||
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;
|
||||
}
|
||||
|
||||
@ -8,196 +8,196 @@ 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; } }
|
||||
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;
|
||||
}
|
||||
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;
|
||||
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();
|
||||
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();
|
||||
mvarFormatVersion = br.ReadVersion();
|
||||
vcom.Title = br.ReadNullTerminatedString();
|
||||
|
||||
uint propertyCount = br.ReadUInt32();
|
||||
uint sectionClassCount = br.ReadUInt32();
|
||||
uint sectionCount = br.ReadUInt32();
|
||||
uint propertyCount = br.ReadUInt32();
|
||||
uint sectionClassCount = br.ReadUInt32();
|
||||
uint sectionCount = br.ReadUInt32();
|
||||
|
||||
List<string> sectionClassNames = new List<string>();
|
||||
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();
|
||||
#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);
|
||||
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);
|
||||
VersatileContainerBlankSection sect = new VersatileContainerBlankSection();
|
||||
vcom.Sections.Add(sect);
|
||||
break;
|
||||
}
|
||||
case VersatileContainerSectionType.Section:
|
||||
{
|
||||
uint sectionDataSize = br.ReadUInt32();
|
||||
sectionDataSizes.Add(sectionDataSize);
|
||||
|
||||
uint sectionClassIndex = br.ReadUInt32();
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
// 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);
|
||||
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);
|
||||
#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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,12 +5,12 @@ using System.Text;
|
||||
|
||||
namespace UniversalEditor.ObjectModels.VersatileContainer.Sections
|
||||
{
|
||||
public class VersatileContainerBlankSection : VersatileContainerSection
|
||||
{
|
||||
public override object Clone()
|
||||
{
|
||||
VersatileContainerBlankSection clone = new VersatileContainerBlankSection();
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
public class VersatileContainerBlankSection : VersatileContainerSection
|
||||
{
|
||||
public override object Clone()
|
||||
{
|
||||
VersatileContainerBlankSection clone = new VersatileContainerBlankSection();
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,34 +6,34 @@ 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 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; } }
|
||||
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;
|
||||
}
|
||||
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; } }
|
||||
}
|
||||
private Compression.CompressionMethod mvarCompressionMethod = Compression.CompressionMethod.None;
|
||||
public Compression.CompressionMethod CompressionMethod { get { return mvarCompressionMethod; } set { mvarCompressionMethod = value; } }
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,12 +5,12 @@ using System.Text;
|
||||
|
||||
namespace UniversalEditor.ObjectModels.VersatileContainer.Sections
|
||||
{
|
||||
public class VersatileContainerDirectorySection : VersatileContainerSection
|
||||
{
|
||||
public override object Clone()
|
||||
{
|
||||
VersatileContainerDirectorySection clone = new VersatileContainerDirectorySection();
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
public class VersatileContainerDirectorySection : VersatileContainerSection
|
||||
{
|
||||
public override object Clone()
|
||||
{
|
||||
VersatileContainerDirectorySection clone = new VersatileContainerDirectorySection();
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,16 +5,16 @@ 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 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;
|
||||
}
|
||||
}
|
||||
public override object Clone()
|
||||
{
|
||||
VersatileContainerReferenceSection clone = new VersatileContainerReferenceSection();
|
||||
clone.Target = mvarTarget;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,10 +18,10 @@ namespace UniversalEditor.ObjectModels.VersatileContainer
|
||||
}
|
||||
|
||||
private VersatileContainerSection.VersatileContainerSectionCollection mvarSections = new VersatileContainerSection.VersatileContainerSectionCollection();
|
||||
public VersatileContainerSection.VersatileContainerSectionCollection Sections { get { return mvarSections; } }
|
||||
public VersatileContainerSection.VersatileContainerSectionCollection Sections { get { return mvarSections; } }
|
||||
|
||||
private VersatileContainerProperty.VersatileContainerPropertyCollection mvarProperties = new VersatileContainerProperty.VersatileContainerPropertyCollection();
|
||||
public VersatileContainerProperty.VersatileContainerPropertyCollection Properties { get { return mvarProperties; } }
|
||||
private VersatileContainerProperty.VersatileContainerPropertyCollection mvarProperties = new VersatileContainerProperty.VersatileContainerPropertyCollection();
|
||||
public VersatileContainerProperty.VersatileContainerPropertyCollection Properties { get { return mvarProperties; } }
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
|
||||
@ -26,12 +26,12 @@ namespace UniversalEditor.ObjectModels.VersatileContainer
|
||||
|
||||
protected override void InsertItem(int index, VersatileContainerSection item)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(item.Name)) sectionsByName.Add(item.Name, 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);
|
||||
if (!String.IsNullOrEmpty(this[index].Name)) sectionsByName.Remove(this[index].Name);
|
||||
base.RemoveItem(index);
|
||||
}
|
||||
|
||||
@ -40,20 +40,20 @@ namespace UniversalEditor.ObjectModels.VersatileContainer
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
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();
|
||||
public abstract object Clone();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user