I swear I write this stuff on crack - still needs to be finished though
This commit is contained in:
parent
d82cc67a44
commit
cb7a2ae583
@ -24,7 +24,7 @@
|
||||
<ObjectModel TypeName="UniversalEditor.ObjectModels.FileSystem.FileSystemObjectModel" />
|
||||
</ObjectModels>
|
||||
<DataFormats>
|
||||
<DataFormat TypeName="UniversalEditor.DataFormats.FileSystem.FARC.FARCDataFormat" />
|
||||
<DataFormat ID="{F9970625-4147-424A-81FB-FF470F2AA67D}" />
|
||||
</DataFormats>
|
||||
</Association>
|
||||
</Associations>
|
||||
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UniversalEditor Version="4.0">
|
||||
<DataFormats>
|
||||
<DataFormat ID="{F9970625-4147-424A-81FB-FF470F2AA67D}">
|
||||
<Information>
|
||||
<Title>SEGA FARC archive</Title>
|
||||
</Information>
|
||||
<ExportOptions>
|
||||
<CustomOptionBoolean ID="Compressed" Title="_Compress the data with the gzip algorithm" />
|
||||
<CustomOptionBoolean ID="Encrypted" Title="_Encrypt the data with the specified key" />
|
||||
</ExportOptions>
|
||||
<Structures>
|
||||
<Structure ID="{8964EB0B-3666-4866-B72F-5B11BB1597DD}">
|
||||
<Information>
|
||||
<Title>Compressed file entry</Title>
|
||||
</Information>
|
||||
<Format>
|
||||
<Field DataType="TerminatedString" ID="FileName" />
|
||||
<Field DataType="Int32" ID="Offset" />
|
||||
<Field DataType="Int32" ID="CompressedSize" />
|
||||
<Field DataType="Int32" ID="DecompressedSize" />
|
||||
</Format>
|
||||
</Structure>
|
||||
<Structure ID="{A5945008-DB97-4314-BE99-6A3A383064FF}">
|
||||
<Information>
|
||||
<Title>File entry</Title>
|
||||
</Information>
|
||||
<Format>
|
||||
<Field DataType="TerminatedString" ID="FileName" />
|
||||
<Field DataType="Int32" ID="Offset" />
|
||||
<Field DataType="Int32" ID="Length" />
|
||||
</Format>
|
||||
</Structure>
|
||||
</Structures>
|
||||
<Format>
|
||||
<!-- signature field -->
|
||||
<Field DataType="FixedString" ID="Signature" Length="2" Value="FA" />
|
||||
<!--
|
||||
Conditional properties within a Field behave like so:
|
||||
|
||||
During a LOAD operation, if the FieldCondition is satisfied (i.e., current field value matches 'TrueResult'), the 'Variable' is set to the given 'Value'.
|
||||
During a SAVE operation, if the FieldCondition is satisfied (i.e, 'Variable' matches 'TrueResult'), the 'TrueResult' is written as the value of the field; otherwise, the 'FalseResult' is written.
|
||||
-->
|
||||
<Field DataType="FixedString" ID="EncryptionFlag" Length="1"
|
||||
Conditional-Variable="$(CustomOption:Encrypted)" Conditional-Value="true" Conditional-TrueResult="R" Conditional-FalseResult="r" />
|
||||
<Field DataType="FixedString" ID="CompressionFlag" Length="1"
|
||||
Conditional-Variable="$(CustomOption:Encrypted)" Conditional-Value="true" Conditional-TrueResult="C" Conditional-FalseResult="c" />
|
||||
|
||||
<Field DataType="Int32" ID="DirectorySize">
|
||||
<Value>
|
||||
<!--
|
||||
for each file:
|
||||
directorySize += (fileName.length + 1 + 4 + 4 + 4)
|
||||
|
||||
TODO: Figure out how to represent this!
|
||||
-->
|
||||
</Value>
|
||||
</Field>
|
||||
<Field DataType="Int32" ID="Reserved1" />
|
||||
|
||||
<Array DataType="Structure" ID="Files" StructureID="{A5945008-DB97-4314-BE99-6A3A383064FF}" MaximumSize="$(Field:DirectorySize)" />
|
||||
</Format>
|
||||
</DataFormat>
|
||||
</DataFormats>
|
||||
</UniversalEditor>
|
||||
@ -181,7 +181,7 @@
|
||||
<Content Include="Extensions\GameDeveloper\Associations\FileSystem\PrincessWaltzARC.uexml" />
|
||||
<Content Include="Extensions\GameDeveloper\Associations\FileSystem\RoxorInTheGroove.uexml" />
|
||||
<Content Include="Extensions\GameDeveloper\Associations\FileSystem\SecretFilesTunguska.uexml" />
|
||||
<Content Include="Extensions\GameDeveloper\Associations\FileSystem\SegaFARC.uexml" />
|
||||
<Content Include="Extensions\GameDeveloper\Extensions\SEGA\Associations\SegaFARC.uexml" />
|
||||
<Content Include="Extensions\GameDeveloper\Associations\FileSystem\SinisterGames.uexml" />
|
||||
<Content Include="Extensions\GameDeveloper\Associations\FileSystem\StellaGamesLzmaPack.uexml" />
|
||||
<Content Include="Extensions\GameDeveloper\Associations\FileSystem\TerminalRealityPOD.uexml" />
|
||||
@ -661,6 +661,9 @@
|
||||
<Content Include="Templates\Project\Concertroid\Images\Library.xcf" />
|
||||
<Content Include="Templates\Project\File Distribution\Images\Torrent.xcf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Extensions\GameDeveloper\Extensions\SEGA\DataFormats\SegaFARC.uexml" />
|
||||
</ItemGroup>
|
||||
<Target Name="Build">
|
||||
<Copy SourceFiles="@(Content)" DestinationFiles="@(Content->'$(OutputPath)%(RelativeDir)%(Filename)%(Extension)')" />
|
||||
</Target>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UniversalEditor.IO;
|
||||
|
||||
namespace UniversalEditor
|
||||
{
|
||||
@ -22,121 +23,11 @@ namespace UniversalEditor
|
||||
IO.Reader br = base.Accessor.Reader;
|
||||
foreach (CustomDataFormatItem cdfi in cdfr.Items)
|
||||
{
|
||||
object value = ReadObject(br, cdfi);
|
||||
|
||||
if (cdfi is CustomDataFormatItemField)
|
||||
{
|
||||
CustomDataFormatItemField fld = (cdfi as CustomDataFormatItemField);
|
||||
object value = null;
|
||||
switch (fld.DataType)
|
||||
{
|
||||
case "Boolean":
|
||||
{
|
||||
value = br.ReadBoolean();
|
||||
break;
|
||||
}
|
||||
case "Byte":
|
||||
{
|
||||
value = br.ReadByte();
|
||||
break;
|
||||
}
|
||||
case "Char":
|
||||
{
|
||||
value = br.ReadChar();
|
||||
break;
|
||||
}
|
||||
case "DateTime":
|
||||
{
|
||||
value = br.ReadDateTime();
|
||||
break;
|
||||
}
|
||||
case "Decimal":
|
||||
{
|
||||
value = br.ReadDecimal();
|
||||
break;
|
||||
}
|
||||
case "Double":
|
||||
{
|
||||
value = br.ReadDouble();
|
||||
break;
|
||||
}
|
||||
case "Guid":
|
||||
{
|
||||
value = br.ReadGuid();
|
||||
break;
|
||||
}
|
||||
case "Int16":
|
||||
{
|
||||
value = br.ReadInt16();
|
||||
break;
|
||||
}
|
||||
case "Int32":
|
||||
{
|
||||
value = br.ReadInt32();
|
||||
break;
|
||||
}
|
||||
case "Int64":
|
||||
{
|
||||
value = br.ReadInt64();
|
||||
break;
|
||||
}
|
||||
case "SByte":
|
||||
{
|
||||
value = br.ReadSByte();
|
||||
break;
|
||||
}
|
||||
case "Single":
|
||||
{
|
||||
value = br.ReadSingle();
|
||||
break;
|
||||
}
|
||||
case "String":
|
||||
{
|
||||
value = br.ReadLengthPrefixedString();
|
||||
break;
|
||||
}
|
||||
case "UInt16":
|
||||
{
|
||||
value = br.ReadUInt16();
|
||||
break;
|
||||
}
|
||||
case "UInt32":
|
||||
{
|
||||
value = br.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
case "UInt64":
|
||||
{
|
||||
value = br.ReadUInt64();
|
||||
break;
|
||||
}
|
||||
case "TerminatedString":
|
||||
{
|
||||
IO.Encoding encoding = IO.Encoding.Default;
|
||||
if (fld.Encoding != null) encoding = fld.Encoding;
|
||||
|
||||
if (fld.Length.HasValue)
|
||||
{
|
||||
value = br.ReadNullTerminatedString(fld.Length.Value, encoding);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = br.ReadNullTerminatedString(encoding);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "FixedString":
|
||||
{
|
||||
IO.Encoding encoding = IO.Encoding.Default;
|
||||
if (fld.Encoding != null) encoding = fld.Encoding;
|
||||
|
||||
if (!fld.Length.HasValue)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
value = br.ReadFixedLengthString(fld.Length.Value, encoding);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fld.Name != null)
|
||||
{
|
||||
string fldName = ReplaceVariables(fld.Name, localVariables);
|
||||
@ -156,12 +47,170 @@ namespace UniversalEditor
|
||||
}
|
||||
}
|
||||
|
||||
private object ReadObject(Reader reader, CustomDataFormatItem item)
|
||||
{
|
||||
object value = null;
|
||||
if (item is CustomDataFormatItemField)
|
||||
{
|
||||
CustomDataFormatItemField itm = (item as CustomDataFormatItemField);
|
||||
switch (itm.DataType)
|
||||
{
|
||||
case "Boolean":
|
||||
{
|
||||
value = reader.ReadBoolean();
|
||||
break;
|
||||
}
|
||||
case "Byte":
|
||||
{
|
||||
value = reader.ReadByte();
|
||||
break;
|
||||
}
|
||||
case "Char":
|
||||
{
|
||||
value = reader.ReadChar();
|
||||
break;
|
||||
}
|
||||
case "DateTime":
|
||||
{
|
||||
value = reader.ReadDateTime();
|
||||
break;
|
||||
}
|
||||
case "Decimal":
|
||||
{
|
||||
value = reader.ReadDecimal();
|
||||
break;
|
||||
}
|
||||
case "Double":
|
||||
{
|
||||
value = reader.ReadDouble();
|
||||
break;
|
||||
}
|
||||
case "Guid":
|
||||
{
|
||||
value = reader.ReadGuid();
|
||||
break;
|
||||
}
|
||||
case "Int16":
|
||||
{
|
||||
value = reader.ReadInt16();
|
||||
break;
|
||||
}
|
||||
case "Int32":
|
||||
{
|
||||
value = reader.ReadInt32();
|
||||
break;
|
||||
}
|
||||
case "Int64":
|
||||
{
|
||||
value = reader.ReadInt64();
|
||||
break;
|
||||
}
|
||||
case "SByte":
|
||||
{
|
||||
value = reader.ReadSByte();
|
||||
break;
|
||||
}
|
||||
case "Single":
|
||||
{
|
||||
value = reader.ReadSingle();
|
||||
break;
|
||||
}
|
||||
case "String":
|
||||
{
|
||||
value = reader.ReadLengthPrefixedString();
|
||||
break;
|
||||
}
|
||||
case "Structure":
|
||||
{
|
||||
value = ReadStructure(reader, itm.StructureID);
|
||||
break;
|
||||
}
|
||||
case "UInt16":
|
||||
{
|
||||
value = reader.ReadUInt16();
|
||||
break;
|
||||
}
|
||||
case "UInt32":
|
||||
{
|
||||
value = reader.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
case "UInt64":
|
||||
{
|
||||
value = reader.ReadUInt64();
|
||||
break;
|
||||
}
|
||||
case "TerminatedString":
|
||||
{
|
||||
IO.Encoding encoding = IO.Encoding.Default;
|
||||
if (itm.Encoding != null) encoding = itm.Encoding;
|
||||
|
||||
if (itm.Length.HasValue)
|
||||
{
|
||||
value = reader.ReadNullTerminatedString(itm.Length.Value, encoding);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = reader.ReadNullTerminatedString(encoding);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "FixedString":
|
||||
{
|
||||
IO.Encoding encoding = IO.Encoding.Default;
|
||||
if (itm.Encoding != null) encoding = itm.Encoding;
|
||||
|
||||
if (!itm.Length.HasValue)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
value = reader.ReadFixedLengthString(itm.Length.Value, encoding);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private object ReadStructure(Reader reader, Guid id)
|
||||
{
|
||||
CustomDataFormatReference cdfr = (base.Reference as CustomDataFormatReference);
|
||||
if (cdfr == null) throw new InvalidOperationException("Must have a CustomDataFormatReference");
|
||||
|
||||
CustomDataFormatStructure type = cdfr.Structures[id];
|
||||
CustomDataFormatStructureInstance inst = type.CreateInstance();
|
||||
|
||||
foreach (CustomDataFormatItem item in type.Items)
|
||||
{
|
||||
CustomDataFormatItemField cdfif = (inst.Items[item.Name] as CustomDataFormatItemField);
|
||||
if (cdfif != null)
|
||||
{
|
||||
cdfif.Value = ReadObject(reader, item);
|
||||
}
|
||||
}
|
||||
return inst;
|
||||
}
|
||||
|
||||
private void WriteStructure(Writer writer, CustomDataFormatStructure structure)
|
||||
{
|
||||
CustomDataFormatReference cdfr = (base.Reference as CustomDataFormatReference);
|
||||
if (cdfr == null) throw new InvalidOperationException("Must have a CustomDataFormatReference");
|
||||
|
||||
foreach (CustomDataFormatItem item in structure.Items)
|
||||
{
|
||||
WriteObject(writer, item);
|
||||
}
|
||||
}
|
||||
|
||||
private string ReplaceVariables(string p, Dictionary<string, object> localVariables)
|
||||
{
|
||||
string retval = p;
|
||||
foreach (string key in localVariables.Keys)
|
||||
{
|
||||
retval = retval.Replace("$(" + key + ")", localVariables[key].ToString());
|
||||
string value = String.Empty;
|
||||
if (localVariables[key] != null) value = localVariables[key].ToString();
|
||||
|
||||
retval = retval.Replace("$(Local:" + key + ")", value);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
@ -213,8 +262,24 @@ namespace UniversalEditor
|
||||
string sectionName = null;
|
||||
if (variableStr.Contains(":")) sectionName = variableStr.Substring(0, variableStr.IndexOf(':'));
|
||||
|
||||
string methodName = variableStr.Substring(variableStr.IndexOf(':'));
|
||||
string methodOrPropertyName = variableStr.Substring(variableStr.IndexOf(':') + 1);
|
||||
|
||||
switch (sectionName)
|
||||
{
|
||||
case "CustomOption":
|
||||
{
|
||||
// this is a CustomOption property
|
||||
CustomOption co = mvarReference.ExportOptions[methodOrPropertyName];
|
||||
if (co != null)
|
||||
{
|
||||
string bw = co.GetValue().ToString();
|
||||
sb.Append(bw);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
i += variableStr.Length + 1; // $(...)
|
||||
}
|
||||
}
|
||||
else if (value[i] == '\\')
|
||||
@ -238,6 +303,20 @@ namespace UniversalEditor
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private bool EvaluateCondition(CustomDataFormatFieldCondition condition)
|
||||
{
|
||||
bool retval = false;
|
||||
|
||||
string value = ExpandVariables(condition.Variable);
|
||||
|
||||
bool bValue1 = (value.ToLower().Equals("true"));
|
||||
bool bValue2 = (condition.Value.ToLower().Equals("true"));
|
||||
|
||||
retval = (bValue1 == bValue2);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
protected override void SaveInternal(ObjectModel objectModel)
|
||||
{
|
||||
CustomDataFormatReference cdfr = (this.Reference as CustomDataFormatReference);
|
||||
@ -251,137 +330,8 @@ namespace UniversalEditor
|
||||
if (cdfi is CustomDataFormatItemField)
|
||||
{
|
||||
CustomDataFormatItemField fld = (cdfi as CustomDataFormatItemField);
|
||||
object value = ExpandVariables(fld.Value);
|
||||
|
||||
switch (fld.DataType)
|
||||
{
|
||||
case "Boolean":
|
||||
{
|
||||
value = (value.ToString().ToLower().Equals("true"));
|
||||
bw.WriteBoolean((bool)value);
|
||||
break;
|
||||
}
|
||||
case "Byte":
|
||||
{
|
||||
value = Byte.Parse(value.ToString());
|
||||
bw.WriteByte((byte)value);
|
||||
break;
|
||||
}
|
||||
case "Char":
|
||||
{
|
||||
value = Char.Parse(value.ToString());
|
||||
bw.WriteChar((char)value);
|
||||
break;
|
||||
}
|
||||
case "DateTime":
|
||||
{
|
||||
value = DateTime.Parse(value.ToString());
|
||||
bw.WriteDateTime((DateTime)value);
|
||||
break;
|
||||
}
|
||||
case "Decimal":
|
||||
{
|
||||
value = Decimal.Parse(value.ToString());
|
||||
bw.WriteDecimal((decimal)value);
|
||||
break;
|
||||
}
|
||||
case "Double":
|
||||
{
|
||||
value = Double.Parse(value.ToString());
|
||||
bw.WriteDouble((double)value);
|
||||
break;
|
||||
}
|
||||
case "Guid":
|
||||
{
|
||||
value = Guid.Parse(value.ToString());
|
||||
bw.WriteGuid((Guid)value);
|
||||
break;
|
||||
}
|
||||
case "Int16":
|
||||
{
|
||||
value = Int16.Parse(value.ToString());
|
||||
bw.WriteInt16((short)value);
|
||||
break;
|
||||
}
|
||||
case "Int32":
|
||||
{
|
||||
value = Int32.Parse(value.ToString());
|
||||
bw.WriteInt32((int)value);
|
||||
break;
|
||||
}
|
||||
case "Int64":
|
||||
{
|
||||
value = Int64.Parse(value.ToString());
|
||||
bw.WriteInt64((long)value);
|
||||
break;
|
||||
}
|
||||
case "SByte":
|
||||
{
|
||||
value = SByte.Parse(value.ToString());
|
||||
bw.WriteSByte((sbyte)value);
|
||||
break;
|
||||
}
|
||||
case "Single":
|
||||
{
|
||||
value = Single.Parse(value.ToString());
|
||||
bw.WriteSingle((float)value);
|
||||
break;
|
||||
}
|
||||
case "String":
|
||||
{
|
||||
bw.WriteLengthPrefixedString((string)value);
|
||||
break;
|
||||
}
|
||||
case "UInt16":
|
||||
{
|
||||
value = UInt16.Parse(value.ToString());
|
||||
bw.WriteUInt16((ushort)value);
|
||||
break;
|
||||
}
|
||||
case "UInt32":
|
||||
{
|
||||
value = UInt32.Parse(value.ToString());
|
||||
bw.WriteUInt32((uint)value);
|
||||
break;
|
||||
}
|
||||
case "UInt64":
|
||||
{
|
||||
value = UInt64.Parse(value.ToString());
|
||||
bw.WriteUInt64((ulong)value);
|
||||
break;
|
||||
}
|
||||
case "TerminatedString":
|
||||
{
|
||||
IO.Encoding encoding = IO.Encoding.Default;
|
||||
if (fld.Encoding != null) encoding = fld.Encoding;
|
||||
|
||||
if (fld.Length.HasValue)
|
||||
{
|
||||
bw.WriteNullTerminatedString((string)value, encoding, fld.Length.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.WriteNullTerminatedString((string)value, encoding);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "FixedString":
|
||||
{
|
||||
IO.Encoding encoding = IO.Encoding.Default;
|
||||
if (fld.Encoding != null) encoding = fld.Encoding;
|
||||
if (fld.Value == null) continue;
|
||||
|
||||
if (fld.Length != null)
|
||||
{
|
||||
bw.WriteFixedLengthString(fld.Value, encoding, fld.Length.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.WriteFixedLengthString(fld.Value, encoding);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
WriteObject(bw, fld);
|
||||
|
||||
if (fld.Name != null)
|
||||
{
|
||||
@ -401,6 +351,169 @@ namespace UniversalEditor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteObject(Writer writer, CustomDataFormatItem item)
|
||||
{
|
||||
object value = null;
|
||||
|
||||
if (item is CustomDataFormatItemField)
|
||||
{
|
||||
CustomDataFormatItemField fld = (item as CustomDataFormatItemField);
|
||||
if (fld != null)
|
||||
{
|
||||
if (fld.FieldCondition == null)
|
||||
{
|
||||
if (fld.Value == null) return;
|
||||
value = ExpandVariables(fld.Value.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (EvaluateCondition(fld.FieldCondition))
|
||||
{
|
||||
value = ExpandVariables(fld.FieldCondition.TrueResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = ExpandVariables(fld.FieldCondition.FalseResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (fld.DataType)
|
||||
{
|
||||
case "Boolean":
|
||||
{
|
||||
value = (value.ToString().ToLower().Equals("true"));
|
||||
writer.WriteBoolean((bool)value);
|
||||
break;
|
||||
}
|
||||
case "Byte":
|
||||
{
|
||||
value = Byte.Parse(value.ToString());
|
||||
writer.WriteByte((byte)value);
|
||||
break;
|
||||
}
|
||||
case "Char":
|
||||
{
|
||||
value = Char.Parse(value.ToString());
|
||||
writer.WriteChar((char)value);
|
||||
break;
|
||||
}
|
||||
case "DateTime":
|
||||
{
|
||||
value = DateTime.Parse(value.ToString());
|
||||
writer.WriteDateTime((DateTime)value);
|
||||
break;
|
||||
}
|
||||
case "Decimal":
|
||||
{
|
||||
value = Decimal.Parse(value.ToString());
|
||||
writer.WriteDecimal((decimal)value);
|
||||
break;
|
||||
}
|
||||
case "Double":
|
||||
{
|
||||
value = Double.Parse(value.ToString());
|
||||
writer.WriteDouble((double)value);
|
||||
break;
|
||||
}
|
||||
case "Guid":
|
||||
{
|
||||
value = Guid.Parse(value.ToString());
|
||||
writer.WriteGuid((Guid)value);
|
||||
break;
|
||||
}
|
||||
case "Int16":
|
||||
{
|
||||
value = Int16.Parse(value.ToString());
|
||||
writer.WriteInt16((short)value);
|
||||
break;
|
||||
}
|
||||
case "Int32":
|
||||
{
|
||||
value = Int32.Parse(value.ToString());
|
||||
writer.WriteInt32((int)value);
|
||||
break;
|
||||
}
|
||||
case "Int64":
|
||||
{
|
||||
value = Int64.Parse(value.ToString());
|
||||
writer.WriteInt64((long)value);
|
||||
break;
|
||||
}
|
||||
case "SByte":
|
||||
{
|
||||
value = SByte.Parse(value.ToString());
|
||||
writer.WriteSByte((sbyte)value);
|
||||
break;
|
||||
}
|
||||
case "Single":
|
||||
{
|
||||
value = Single.Parse(value.ToString());
|
||||
writer.WriteSingle((float)value);
|
||||
break;
|
||||
}
|
||||
case "String":
|
||||
{
|
||||
writer.WriteLengthPrefixedString((string)value);
|
||||
break;
|
||||
}
|
||||
case "Structure":
|
||||
{
|
||||
writer.WriteLengthPrefixedString((string)value);
|
||||
break;
|
||||
}
|
||||
case "UInt16":
|
||||
{
|
||||
value = UInt16.Parse(value.ToString());
|
||||
writer.WriteUInt16((ushort)value);
|
||||
break;
|
||||
}
|
||||
case "UInt32":
|
||||
{
|
||||
value = UInt32.Parse(value.ToString());
|
||||
writer.WriteUInt32((uint)value);
|
||||
break;
|
||||
}
|
||||
case "UInt64":
|
||||
{
|
||||
value = UInt64.Parse(value.ToString());
|
||||
writer.WriteUInt64((ulong)value);
|
||||
break;
|
||||
}
|
||||
case "TerminatedString":
|
||||
{
|
||||
IO.Encoding encoding = IO.Encoding.Default;
|
||||
if (fld.Encoding != null) encoding = fld.Encoding;
|
||||
|
||||
if (fld.Length.HasValue)
|
||||
{
|
||||
writer.WriteNullTerminatedString((string)value, encoding, fld.Length.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteNullTerminatedString((string)value, encoding);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "FixedString":
|
||||
{
|
||||
IO.Encoding encoding = IO.Encoding.Default;
|
||||
if (fld.Encoding != null) encoding = fld.Encoding;
|
||||
|
||||
if (fld.Length != null)
|
||||
{
|
||||
writer.WriteFixedLengthString((string)value, encoding, fld.Length.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteFixedLengthString((string)value, encoding);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public class CustomDataFormatReference : DataFormatReference
|
||||
{
|
||||
@ -408,6 +521,9 @@ namespace UniversalEditor
|
||||
{
|
||||
}
|
||||
|
||||
private CustomDataFormatStructure.CustomDataFormatStructureCollection mvarStructures = new CustomDataFormatStructure.CustomDataFormatStructureCollection();
|
||||
public CustomDataFormatStructure.CustomDataFormatStructureCollection Structures { get { return mvarStructures; } }
|
||||
|
||||
private CustomDataFormatItem.CustomDataFormatItemCollection mvarItems = new CustomDataFormatItem.CustomDataFormatItemCollection();
|
||||
public CustomDataFormatItem.CustomDataFormatItemCollection Items
|
||||
{
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor
|
||||
{
|
||||
public class CustomDataFormatFieldCondition
|
||||
{
|
||||
private string mvarVariable = String.Empty;
|
||||
public string Variable { get { return mvarVariable; } set { mvarVariable = value; } }
|
||||
|
||||
private string mvarValue = String.Empty;
|
||||
public string Value { get { return mvarValue; } set { mvarValue = value; } }
|
||||
|
||||
private string mvarTrueResult = String.Empty;
|
||||
public string TrueResult { get { return mvarTrueResult; } set { mvarTrueResult = value; } }
|
||||
|
||||
private string mvarFalseResult = String.Empty;
|
||||
public string FalseResult { get { return mvarFalseResult; } set { mvarFalseResult = value; } }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("`");
|
||||
sb.Append(mvarVariable);
|
||||
sb.Append("` == `");
|
||||
sb.Append(mvarValue);
|
||||
sb.Append("` ? `");
|
||||
sb.Append(mvarTrueResult);
|
||||
sb.Append("` : `");
|
||||
sb.Append(mvarFalseResult);
|
||||
sb.Append("`");
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,34 @@ namespace UniversalEditor
|
||||
public class CustomDataFormatItemCollection
|
||||
: System.Collections.ObjectModel.Collection<CustomDataFormatItem>
|
||||
{
|
||||
public CustomDataFormatItem this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (CustomDataFormatItem item in this)
|
||||
{
|
||||
if (item.Name == name) return item;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
public class CustomDataFormatItemReadOnlyCollection
|
||||
: System.Collections.ObjectModel.ReadOnlyCollection<CustomDataFormatItem>
|
||||
{
|
||||
public CustomDataFormatItemReadOnlyCollection(IList<CustomDataFormatItem> list) : base(list) { }
|
||||
|
||||
public CustomDataFormatItem this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (CustomDataFormatItem item in this)
|
||||
{
|
||||
if (item.Name == name) return item;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string mvarName = null;
|
||||
@ -22,21 +50,33 @@ namespace UniversalEditor
|
||||
private string mvarDataType = String.Empty;
|
||||
public string DataType { get { return mvarDataType; } set { mvarDataType = value; } }
|
||||
|
||||
private Guid mvarStructureID = Guid.Empty;
|
||||
public Guid StructureID { get { return mvarStructureID; } set { mvarStructureID = value; } }
|
||||
|
||||
private int? mvarLength = null;
|
||||
public int? Length { get { return mvarLength; } set { mvarLength = value; } }
|
||||
|
||||
private IO.Encoding mvarEncoding = null;
|
||||
public IO.Encoding Encoding { get { return mvarEncoding; } set { mvarEncoding = value; } }
|
||||
|
||||
private string mvarValue = null;
|
||||
public string Value { get { return mvarValue; } set { mvarValue = value; } }
|
||||
private object mvarValue = null;
|
||||
public object Value { get { return mvarValue; } set { mvarValue = value; } }
|
||||
|
||||
private CustomDataFormatFieldCondition mvarFieldCondition = null;
|
||||
public CustomDataFormatFieldCondition FieldCondition { get { return mvarFieldCondition; } set { mvarFieldCondition = value; } }
|
||||
}
|
||||
public class CustomDataFormatItemArray : CustomDataFormatItem
|
||||
{
|
||||
private string mvarDataType = String.Empty;
|
||||
public string DataType { get { return mvarDataType; } set { mvarDataType = value; } }
|
||||
|
||||
private int mvarLength = 0;
|
||||
public int Length { get { return mvarLength; } set { mvarLength = value; } }
|
||||
private Guid mvarStructureID = Guid.Empty;
|
||||
public Guid StructureID { get { return mvarStructureID; } set { mvarStructureID = value; } }
|
||||
|
||||
private string mvarLength = null;
|
||||
public string Length { get { return mvarLength; } set { mvarLength = value; } }
|
||||
|
||||
private string mvarMaximumSize = null;
|
||||
public string MaximumSize { get { return mvarMaximumSize; } set { mvarMaximumSize = value; } }
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor
|
||||
{
|
||||
public class CustomDataFormatStructure
|
||||
{
|
||||
public class CustomDataFormatStructureCollection
|
||||
: System.Collections.ObjectModel.Collection<CustomDataFormatStructure>
|
||||
{
|
||||
public CustomDataFormatStructure this[Guid id]
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (CustomDataFormatStructure item in this)
|
||||
{
|
||||
if (item.ID == id) return item;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Guid mvarID = Guid.Empty;
|
||||
public Guid ID { get { return mvarID; } set { mvarID = value; } }
|
||||
|
||||
private CustomDataFormatItem.CustomDataFormatItemCollection mvarItems = new CustomDataFormatItem.CustomDataFormatItemCollection();
|
||||
public CustomDataFormatItem.CustomDataFormatItemCollection Items
|
||||
{
|
||||
get { return mvarItems; }
|
||||
}
|
||||
|
||||
public CustomDataFormatStructureInstance CreateInstance()
|
||||
{
|
||||
CustomDataFormatStructureInstance inst = new CustomDataFormatStructureInstance(this);
|
||||
return inst;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor
|
||||
{
|
||||
public class CustomDataFormatStructureInstance
|
||||
{
|
||||
private CustomDataFormatStructure mvarStructure = null;
|
||||
public CustomDataFormatStructure Structure { get { return mvarStructure; } }
|
||||
|
||||
private CustomDataFormatItem.CustomDataFormatItemReadOnlyCollection mvarItems = null;
|
||||
public CustomDataFormatItem.CustomDataFormatItemReadOnlyCollection Items { get { return mvarItems; } }
|
||||
|
||||
internal CustomDataFormatStructureInstance(CustomDataFormatStructure structure)
|
||||
{
|
||||
mvarStructure = structure;
|
||||
|
||||
List<CustomDataFormatItem> items = new List<CustomDataFormatItem>();
|
||||
foreach (CustomDataFormatItem item in structure.Items)
|
||||
{
|
||||
items.Add(item);
|
||||
}
|
||||
mvarItems = new CustomDataFormatItem.CustomDataFormatItemReadOnlyCollection(items);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -56,7 +56,10 @@
|
||||
<Compile Include="Common\Path.cs" />
|
||||
<Compile Include="Common\Strings.cs" />
|
||||
<Compile Include="CustomDataFormat.cs" />
|
||||
<Compile Include="CustomDataFormatFieldCondition.cs" />
|
||||
<Compile Include="CustomDataFormatItem.cs" />
|
||||
<Compile Include="CustomDataFormatStructure.cs" />
|
||||
<Compile Include="CustomDataFormatStructureInstance.cs" />
|
||||
<Compile Include="ObjectModelCustomProperty.cs" />
|
||||
<Compile Include="DataCorruptedException.cs" />
|
||||
<Compile Include="DataFormatCapabilities.cs" />
|
||||
|
||||
@ -162,128 +162,38 @@ namespace UniversalEditor.DataFormats.UEPackage
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Filters
|
||||
#region Export Options
|
||||
{
|
||||
if (tagFilters != null)
|
||||
MarkupTagElement tagCustomOptions = (tagDataFormat.Elements["ExportOptions"] as MarkupTagElement);
|
||||
if (tagCustomOptions != null)
|
||||
{
|
||||
Console.WriteLine("WARNING: this method of adding filters is deprecated; please use Associations instead!");
|
||||
|
||||
foreach (MarkupElement elFilter in tagFilters.Elements)
|
||||
foreach (MarkupElement elCustomOption in tagCustomOptions.Elements)
|
||||
{
|
||||
MarkupTagElement tagFilter = (elFilter as MarkupTagElement);
|
||||
if (tagFilter.Name != "Filter") continue;
|
||||
MarkupTagElement tagCustomOption = (elCustomOption as MarkupTagElement);
|
||||
if (tagCustomOption == null) continue;
|
||||
|
||||
CustomOption co = LoadCustomOption(tagCustomOption);
|
||||
if (co == null) continue;
|
||||
|
||||
DataFormatFilter filter = new DataFormatFilter();
|
||||
MarkupAttribute attHintComparison = tagFilter.Attributes["HintComparison"];
|
||||
if (attHintComparison != null)
|
||||
{
|
||||
switch (attHintComparison.Value.ToLower())
|
||||
{
|
||||
case "always":
|
||||
{
|
||||
filter.HintComparison = DataFormatHintComparison.Always;
|
||||
break;
|
||||
}
|
||||
case "filteronly":
|
||||
{
|
||||
filter.HintComparison = DataFormatHintComparison.FilterOnly;
|
||||
break;
|
||||
}
|
||||
case "filterthenmagic":
|
||||
{
|
||||
filter.HintComparison = DataFormatHintComparison.FilterThenMagic;
|
||||
break;
|
||||
}
|
||||
case "magiconly":
|
||||
{
|
||||
filter.HintComparison = DataFormatHintComparison.MagicOnly;
|
||||
break;
|
||||
}
|
||||
case "magicthenfilter":
|
||||
{
|
||||
filter.HintComparison = DataFormatHintComparison.MagicThenFilter;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
filter.HintComparison = DataFormatHintComparison.Never;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
dfr.ExportOptions.Add(co);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Import Options
|
||||
{
|
||||
MarkupTagElement tagCustomOptions = (tagDataFormat.Elements["ImportOptions"] as MarkupTagElement);
|
||||
if (tagCustomOptions != null)
|
||||
{
|
||||
foreach (MarkupElement elCustomOption in tagCustomOptions.Elements)
|
||||
{
|
||||
MarkupTagElement tagCustomOption = (elCustomOption as MarkupTagElement);
|
||||
if (tagCustomOption == null) continue;
|
||||
|
||||
MarkupTagElement tagFilterTitle = (tagFilter.Elements["Title"] as MarkupTagElement);
|
||||
if (tagFilterTitle != null) filter.Title = tagFilterTitle.Value;
|
||||
CustomOption co = LoadCustomOption(tagCustomOption);
|
||||
if (co == null) continue;
|
||||
|
||||
#region File Name Filters
|
||||
{
|
||||
MarkupTagElement tagFilterFileNames = (tagFilter.Elements["FileNameFilters"] as MarkupTagElement);
|
||||
if (tagFilterFileNames != null)
|
||||
{
|
||||
foreach (MarkupElement elFilterFileName in tagFilterFileNames.Elements)
|
||||
{
|
||||
MarkupTagElement tagFilterFileName = (elFilterFileName as MarkupTagElement);
|
||||
if (tagFilterFileName.Name != "FileNameFilter") continue;
|
||||
filter.FileNameFilters.Add(tagFilterFileName.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Magic Bytes
|
||||
{
|
||||
MarkupTagElement tagMagicBytes = (tagFilter.Elements["MagicBytes"] as MarkupTagElement);
|
||||
if (tagMagicBytes != null)
|
||||
{
|
||||
foreach (MarkupElement elMagicByteCollection in tagMagicBytes.Elements)
|
||||
{
|
||||
MarkupTagElement tagMagicByteCollection = (elMagicByteCollection as MarkupTagElement);
|
||||
if (tagMagicByteCollection == null) continue;
|
||||
if (tagMagicByteCollection.Name != "MagicByteCollection") continue;
|
||||
|
||||
List<byte?> array = new List<byte?>();
|
||||
foreach (MarkupElement elMagicByte in tagMagicByteCollection.Elements)
|
||||
{
|
||||
MarkupTagElement tagMagicByte = (elMagicByte as MarkupTagElement);
|
||||
if (tagMagicByte == null) continue;
|
||||
if (tagMagicByte.Name != "MagicByte") continue;
|
||||
|
||||
byte? value = null;
|
||||
byte tryValue = 0;
|
||||
char tryChar = '\0';
|
||||
|
||||
if (Byte.TryParse(tagMagicByte.Value, out tryValue))
|
||||
{
|
||||
value = tryValue;
|
||||
}
|
||||
else if (tagMagicByte.Value.StartsWith("0x"))
|
||||
{
|
||||
if (Byte.TryParse(tagMagicByte.Value.Substring(2), System.Globalization.NumberStyles.HexNumber, null, out tryValue))
|
||||
{
|
||||
value = tryValue;
|
||||
}
|
||||
}
|
||||
else if (tagMagicByte.Value.Length > 1)
|
||||
{
|
||||
for (int i = 0; i < tagMagicByte.Value.Length; i++)
|
||||
{
|
||||
array.Add((byte)(tagMagicByte.Value[i]));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (Char.TryParse(tagMagicByte.Value, out tryChar))
|
||||
{
|
||||
value = (byte)tryChar;
|
||||
}
|
||||
array.Add(value);
|
||||
}
|
||||
filter.MagicBytes.Add(array.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
// dfr.Filters.Add(filter);
|
||||
dfr.ImportOptions.Add(co);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -295,53 +205,8 @@ namespace UniversalEditor.DataFormats.UEPackage
|
||||
MarkupTagElement tagField = (elField as MarkupTagElement);
|
||||
if (tagField == null) continue;
|
||||
|
||||
switch (tagField.Name)
|
||||
{
|
||||
case "Field":
|
||||
{
|
||||
if (tagField.Attributes["DataType"] == null) continue;
|
||||
|
||||
CustomDataFormatItemField cdfif = new CustomDataFormatItemField();
|
||||
cdfif.DataType = tagField.Attributes["DataType"].Value;
|
||||
|
||||
MarkupAttribute attFieldID = tagField.Attributes["ID"];
|
||||
if (attFieldID != null)
|
||||
{
|
||||
cdfif.Name = attFieldID.Value;
|
||||
}
|
||||
|
||||
MarkupAttribute attValue = tagField.Attributes["Value"];
|
||||
if (attValue != null)
|
||||
{
|
||||
cdfif.Value = attValue.Value;
|
||||
}
|
||||
dfr.Items.Add(cdfif);
|
||||
break;
|
||||
}
|
||||
case "Array":
|
||||
{
|
||||
if (tagField.Attributes["DataType"] == null) continue;
|
||||
|
||||
CustomDataFormatItemArray cdfif = new CustomDataFormatItemArray();
|
||||
cdfif.DataType = tagField.Attributes["DataType"].Value;
|
||||
|
||||
if (tagField.Attributes["ID"] != null)
|
||||
{
|
||||
cdfif.Name = tagField.Attributes["ID"].Value;
|
||||
}
|
||||
if (tagField.Attributes["Length"] != null)
|
||||
{
|
||||
string value = tagField.Attributes["Length"].Value;
|
||||
value = UniversalEditor.Common.Strings.ReplaceVariables(value, localVariables);
|
||||
int length = 0;
|
||||
Int32.TryParse(value, out length);
|
||||
|
||||
cdfif.Length = length;
|
||||
}
|
||||
dfr.Items.Add(cdfif);
|
||||
break;
|
||||
}
|
||||
}
|
||||
CustomDataFormatItem cdfi = CreateField(tagField, localVariables);
|
||||
if (cdfi != null) dfr.Items.Add(cdfi);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@ -1037,7 +902,7 @@ namespace UniversalEditor.DataFormats.UEPackage
|
||||
for (int i = 0; i < value.Length; i += 2)
|
||||
{
|
||||
string val = value.Substring(i, 2);
|
||||
realvalue = Byte.Parse(value, System.Globalization.NumberStyles.HexNumber);
|
||||
realvalue = Byte.Parse(val, System.Globalization.NumberStyles.HexNumber);
|
||||
magicByteSequence.Add(realvalue);
|
||||
}
|
||||
break;
|
||||
@ -1059,6 +924,112 @@ namespace UniversalEditor.DataFormats.UEPackage
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
private CustomOption LoadCustomOption(MarkupTagElement tag)
|
||||
{
|
||||
CustomOption co = null;
|
||||
|
||||
Type[] tCustomOptions = UniversalEditor.Common.Reflection.GetAvailableTypes(new Type[] { typeof(CustomOption) });
|
||||
foreach (Type tCustomOption in tCustomOptions)
|
||||
{
|
||||
if (tCustomOption.Name == tag.FullName)
|
||||
{
|
||||
MarkupAttribute attID = tag.Attributes["ID"];
|
||||
if (attID == null) continue;
|
||||
|
||||
MarkupAttribute attTitle = tag.Attributes["Title"];
|
||||
if (attTitle == null) continue;
|
||||
|
||||
co = (CustomOption)tCustomOption.Assembly.CreateInstance(tCustomOption.FullName, false, System.Reflection.BindingFlags.Default | System.Reflection.BindingFlags.OptionalParamBinding, null, new object[] { attID.Value, attTitle.Value.Replace("_", "&") }, null, null);
|
||||
|
||||
foreach (MarkupAttribute att in tag.Attributes)
|
||||
{
|
||||
if (att.Name == "ID" || att.Name == "Title")
|
||||
{
|
||||
// already initialized
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
tCustomOption.GetProperty(att.Name).SetValue(co, att.Value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return co;
|
||||
}
|
||||
|
||||
private CustomDataFormatItem CreateField(MarkupTagElement tagField, Dictionary<string, object> localVariables)
|
||||
{
|
||||
switch (tagField.Name)
|
||||
{
|
||||
case "Field":
|
||||
{
|
||||
if (tagField.Attributes["DataType"] == null) return null;
|
||||
|
||||
CustomDataFormatItemField cdfif = new CustomDataFormatItemField();
|
||||
cdfif.DataType = tagField.Attributes["DataType"].Value;
|
||||
|
||||
MarkupAttribute attFieldID = tagField.Attributes["ID"];
|
||||
if (attFieldID != null)
|
||||
{
|
||||
cdfif.Name = attFieldID.Value;
|
||||
}
|
||||
|
||||
MarkupAttribute attValue = tagField.Attributes["Value"];
|
||||
if (attValue != null)
|
||||
{
|
||||
cdfif.Value = attValue.Value;
|
||||
}
|
||||
|
||||
MarkupAttribute attConditionalVariable = tagField.Attributes["Conditional-Variable"];
|
||||
if (attConditionalVariable != null)
|
||||
{
|
||||
CustomDataFormatFieldCondition cond = new CustomDataFormatFieldCondition();
|
||||
cond.Variable = attConditionalVariable.Value;
|
||||
|
||||
MarkupAttribute attConditionalValue = tagField.Attributes["Conditional-Value"];
|
||||
if (attConditionalValue != null) cond.Value = attConditionalValue.Value;
|
||||
|
||||
MarkupAttribute attConditionalTrueResult = tagField.Attributes["Conditional-TrueResult"];
|
||||
if (attConditionalTrueResult != null) cond.TrueResult = attConditionalTrueResult.Value;
|
||||
|
||||
MarkupAttribute attConditionalFalseResult = tagField.Attributes["Conditional-FalseResult"];
|
||||
if (attConditionalFalseResult != null) cond.FalseResult = attConditionalFalseResult.Value;
|
||||
|
||||
cdfif.FieldCondition = cond;
|
||||
}
|
||||
return cdfif;
|
||||
}
|
||||
case "Array":
|
||||
{
|
||||
if (tagField.Attributes["DataType"] == null) return null;
|
||||
|
||||
CustomDataFormatItemArray cdfif = new CustomDataFormatItemArray();
|
||||
cdfif.DataType = tagField.Attributes["DataType"].Value;
|
||||
if (cdfif.DataType == "Structure")
|
||||
{
|
||||
MarkupAttribute attStructureID = tagField.Attributes["StructureID"];
|
||||
if (attStructureID != null) cdfif.StructureID = new Guid(attStructureID.Value);
|
||||
}
|
||||
|
||||
if (tagField.Attributes["ID"] != null)
|
||||
{
|
||||
cdfif.Name = tagField.Attributes["ID"].Value;
|
||||
}
|
||||
if (tagField.Attributes["Length"] != null)
|
||||
{
|
||||
cdfif.Length = tagField.Attributes["Length"].Value;
|
||||
}
|
||||
if (tagField.Attributes["MaximumSize"] != null)
|
||||
{
|
||||
cdfif.MaximumSize = tagField.Attributes["MaximumSize"].Value;
|
||||
}
|
||||
return cdfif;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
protected override void BeforeSaveInternal(Stack<ObjectModel> objectModels)
|
||||
{
|
||||
base.BeforeSaveInternal(objectModels);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user