diff --git a/CSharp/Plugins/UniversalEditor.Essential/Collections/Generic/AutoDictionary.cs b/CSharp/Plugins/UniversalEditor.Essential/Collections/Generic/AutoDictionary.cs index 2e2a7456..7cc37f1b 100644 --- a/CSharp/Plugins/UniversalEditor.Essential/Collections/Generic/AutoDictionary.cs +++ b/CSharp/Plugins/UniversalEditor.Essential/Collections/Generic/AutoDictionary.cs @@ -5,22 +5,27 @@ using System.Text; namespace UniversalEditor.Collections.Generic { - public class AutoDictionary : System.Collections.Generic.Dictionary + /// + /// Provides a that automatically adds or updates a key or value when it is + /// requested. + /// + /// The type of the key part of the dictionary. + /// The type of the value part of the dictionary. + public class AutoDictionary : Dictionary { public new TValue this[TKey key] { - get - { - return this[key, default(TValue)]; - } + get { return this[key, default(TValue)]; } set { if (ContainsKey(key)) { + // we already contain an item with this key, so update the value accordingly base[key] = value; } else { + // we do not already contain an item with this key, so create a new value base.Add(key, value); } } @@ -31,18 +36,18 @@ namespace UniversalEditor.Collections.Generic { if (ContainsKey(key)) { + // we already contain an item with this key, so return the value accordingly return base[key]; } else { + // we do not already contain an item with this key, so create a new value set to the + // specified default value and return that base.Add(key, defaultValue); return defaultValue; } } - set - { - this[key] = value; - } + set { this[key] = value; } } } } diff --git a/CSharp/Plugins/UniversalEditor.Essential/Collections/Generic/BidirectionalDictionary.cs b/CSharp/Plugins/UniversalEditor.Essential/Collections/Generic/BidirectionalDictionary.cs index 84571d90..f9b0a9f5 100644 --- a/CSharp/Plugins/UniversalEditor.Essential/Collections/Generic/BidirectionalDictionary.cs +++ b/CSharp/Plugins/UniversalEditor.Essential/Collections/Generic/BidirectionalDictionary.cs @@ -4,10 +4,16 @@ using System.Text; namespace UniversalEditor.Collections.Generic { + /// + /// Provides a collection that can be keyed either forward (T1=>T2) or backward (T2=>T1). + /// + /// The type of the value on which to forward-key the collection. + /// The type of the value on which to backward-key the collection. public class BidirectionalDictionary : System.Collections.IEnumerable { private Dictionary mvarForwardDictionary = new Dictionary(); private Dictionary mvarBackwardDictionary = new Dictionary(); + public void Add(T1 value1, T2 value2) { this.mvarForwardDictionary.Add(value1, value2); @@ -50,22 +56,22 @@ namespace UniversalEditor.Collections.Generic return this.mvarForwardDictionary.GetEnumerator(); } - public bool ContainsValue1(T1 value) - { - return this.mvarForwardDictionary.ContainsKey(value); - } - public bool ContainsValue2(T2 value) - { - return this.mvarBackwardDictionary.ContainsKey(value); - } + public bool ContainsValue1(T1 value) + { + return this.mvarForwardDictionary.ContainsKey(value); + } + public bool ContainsValue2(T2 value) + { + return this.mvarBackwardDictionary.ContainsKey(value); + } - public int Count - { - get - { - if (mvarForwardDictionary.Count != mvarBackwardDictionary.Count) throw new InvalidOperationException("Count mismatch"); - return mvarBackwardDictionary.Count; - } - } + public int Count + { + get + { + if (mvarForwardDictionary.Count != mvarBackwardDictionary.Count) throw new InvalidOperationException("Count mismatch"); + return mvarBackwardDictionary.Count; + } + } } } diff --git a/CSharp/Plugins/UniversalEditor.Essential/UniversalEditor.Essential.csproj b/CSharp/Plugins/UniversalEditor.Essential/UniversalEditor.Essential.csproj index bdbef002..e08a5658 100644 --- a/CSharp/Plugins/UniversalEditor.Essential/UniversalEditor.Essential.csproj +++ b/CSharp/Plugins/UniversalEditor.Essential/UniversalEditor.Essential.csproj @@ -22,6 +22,7 @@ DEBUG;TRACE prompt 4 + ..\..\Output\Debug\Plugins\UniversalEditor.Essential.xml pdbonly diff --git a/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/AnimatedTexture/AMTDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/AnimatedTexture/AMTDataFormat.cs index dc5cc785..f88226f4 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/AnimatedTexture/AMTDataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/AnimatedTexture/AMTDataFormat.cs @@ -6,50 +6,53 @@ using UniversalEditor.ObjectModels.FileSystem; namespace UniversalEditor.DataFormats.AniMiku.AnimatedTexture { - public class AMTDataFormat : DataFormat - { - private static DataFormatReference _dfr = null; - public override DataFormatReference MakeReference() - { - if (_dfr == null) - { - _dfr = base.MakeReference(); - _dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All); - _dfr.Filters.Add("AniMiku texture package", new string[] { "*.amt" }); - } - return _dfr; - } - protected override void LoadInternal(ref ObjectModel objectModel) - { - FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel); - if (fsom == null) return; + /// + /// Implements the AniMiku Texture Package data format. + /// + public class AMTDataFormat : DataFormat + { + private static DataFormatReference _dfr = null; + public override DataFormatReference MakeReference() + { + if (_dfr == null) + { + _dfr = base.MakeReference(); + _dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All); + _dfr.Filters.Add("AniMiku texture package", new string[] { "*.amt" }); + } + return _dfr; + } + protected override void LoadInternal(ref ObjectModel objectModel) + { + FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel); + if (fsom == null) return; - IO.Reader br = base.Accessor.Reader; - int unknown = br.ReadInt32(); - int count = br.ReadInt32(); - for (int i = 0; i < count; i++) - { - int dataSize = br.ReadInt32(); - byte[] data = br.ReadBytes(dataSize); - fsom.Files.Add(i.ToString().PadLeft(8, '0'), data); - } - } - protected override void SaveInternal(ObjectModel objectModel) - { - FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel); - if (fsom == null) return; + IO.Reader br = base.Accessor.Reader; + int unknown = br.ReadInt32(); + int count = br.ReadInt32(); + for (int i = 0; i < count; i++) + { + int dataSize = br.ReadInt32(); + byte[] data = br.ReadBytes(dataSize); + fsom.Files.Add(i.ToString().PadLeft(8, '0'), data); + } + } + protected override void SaveInternal(ObjectModel objectModel) + { + FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel); + if (fsom == null) return; - IO.Writer bw = base.Accessor.Writer; - int unknown = 150; - bw.WriteInt32(unknown); + IO.Writer bw = base.Accessor.Writer; + int unknown = 150; + bw.WriteInt32(unknown); - bw.WriteInt32(fsom.Files.Count); - foreach (File file in fsom.Files) - { - byte[] data = file.GetDataAsByteArray(); - bw.WriteInt32(data.Length); - bw.WriteBytes(data); - } - } - } + bw.WriteInt32(fsom.Files.Count); + foreach (File file in fsom.Files) + { + byte[] data = file.GetDataAsByteArray(); + bw.WriteInt32(data.Length); + bw.WriteBytes(data); + } + } + } } diff --git a/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/Concert/AniMikuINIDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/Concert/AniMikuINIDataFormat.cs index 555315d9..6e572620 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/Concert/AniMikuINIDataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/Concert/AniMikuINIDataFormat.cs @@ -13,6 +13,9 @@ using UniversalEditor.ObjectModels.Concertroid.Concert; namespace UniversalEditor.DataFormats.AniMiku.Concert { + /// + /// Implements the AniMiku performance data format. + /// public class AniMikuINIDataFormat : WindowsConfigurationDataFormat { public override DataFormatReference MakeReference() @@ -54,17 +57,25 @@ namespace UniversalEditor.DataFormats.AniMiku.Concert Performance perf = new Performance(); + // The title of the song used in this performance. Property prpName = grp.Properties["name"]; perf.Title = prpName.Value.ToString(); + // File name of the motion data files associated with characters 1 and 2. Property prpVmd1 = grp.Properties["vmd1"]; Property prpVmd2 = grp.Properties["vmd2"]; + // Background audio to play during the performance, and delay in milliseconds between + // start of animation and start of audio. Property prpSound = grp.Properties["sound"]; Property prpDelay = grp.Properties["delay"]; + // File name of the model data files associated with characters 1 and 2. Property prpModel1 = grp.Properties["model1"]; Property prpModel2 = grp.Properties["model2"]; + + // Offset of the model along the X axis. Currently AMP does not support offsetting the + // model along the Y axis. Property prpOffset1 = grp.Properties["offset1"]; Property prpOffset2 = grp.Properties["offset2"]; diff --git a/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/ExtendedPMD/ExtendedPMDDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/ExtendedPMD/ExtendedPMDDataFormat.cs index 796025c6..3def6a35 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/ExtendedPMD/ExtendedPMDDataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/ExtendedPMD/ExtendedPMDDataFormat.cs @@ -13,45 +13,49 @@ using UniversalEditor.ObjectModels.Multimedia3D.Model; namespace UniversalEditor.DataFormats.AniMiku.ExtendedPMD { - public class ExtendedPMDDataFormat : PMDModelDataFormat - { - private static DataFormatReference _dfr = null; - public override DataFormatReference MakeReference() - { - if (_dfr == null) - { - _dfr = base.MakeReference(); - _dfr.Clear(); - _dfr.Capabilities.Add(typeof(ModelObjectModel), DataFormatCapabilities.All); - _dfr.Filters.Add("AniMiku extended Polygon Movie Maker model", new string[] { "*.apmd" }); - _dfr.Priority = 1; - } - return _dfr; - } - protected override void AfterLoadInternal(Stack objectModels) - { - base.AfterLoadInternal(objectModels); + /// + /// Implements the AniMiku extended PMD (APMD) data format. This is different than the PMAX (PMD by + /// ALCEproject Extended) data format implemented by Concertroid. + /// + public class ExtendedPMDDataFormat : PMDModelDataFormat + { + private static DataFormatReference _dfr = null; + public override DataFormatReference MakeReference() + { + if (_dfr == null) + { + _dfr = base.MakeReference(); + _dfr.Clear(); + _dfr.Capabilities.Add(typeof(ModelObjectModel), DataFormatCapabilities.All); + _dfr.Filters.Add("AniMiku extended Polygon Movie Maker model", new string[] { "*.apmd" }); + _dfr.Priority = 1; + } + return _dfr; + } + protected override void AfterLoadInternal(Stack objectModels) + { + base.AfterLoadInternal(objectModels); - ModelObjectModel model = (objectModels.Pop() as ModelObjectModel); + ModelObjectModel model = (objectModels.Pop() as ModelObjectModel); - // attempt to load more - IO.Reader br = base.Accessor.Reader; - if (br.EndOfStream) return; - byte[] datas = br.ReadUntil("END", false); + // attempt to load more + IO.Reader br = base.Accessor.Reader; + if (br.EndOfStream) return; + byte[] datas = br.ReadUntil("END", false); - PMDExtensionObjectModel pmdo = new PMDExtensionObjectModel(); - PMDExtensionDataFormat pmdf = new PMDExtensionDataFormat(); - pmdf.Model = model; - - Document.Load(pmdo, pmdf, new MemoryAccessor(datas), true); - - foreach (PMDExtensionTextureGroup file in pmdo.ArchiveFiles) - { - foreach (string fileName in file.TextureImageFileNames) - { - file.Material.Textures.Add(file.ArchiveFileName + "::/" + fileName, null, ModelTextureFlags.Texture); - } - } - } - } + PMDExtensionObjectModel pmdo = new PMDExtensionObjectModel(); + PMDExtensionDataFormat pmdf = new PMDExtensionDataFormat(); + pmdf.Model = model; + + Document.Load(pmdo, pmdf, new MemoryAccessor(datas), true); + + foreach (PMDExtensionTextureGroup file in pmdo.ArchiveFiles) + { + foreach (string fileName in file.TextureImageFileNames) + { + file.Material.Textures.Add(file.ArchiveFileName + "::/" + fileName, null, ModelTextureFlags.Texture); + } + } + } + } } diff --git a/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/PMDExtension/PMDExtensionDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/PMDExtension/PMDExtensionDataFormat.cs index 8fd6c495..51762029 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/PMDExtension/PMDExtensionDataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/DataFormats/AniMiku/PMDExtension/PMDExtensionDataFormat.cs @@ -8,86 +8,90 @@ using UniversalEditor.ObjectModels.Multimedia3D.Model; namespace UniversalEditor.DataFormats.AniMiku.PMDExtension { - internal class PMDExtensionDataFormat : DataFormat - { - private static DataFormatReference _dfr = null; - public override DataFormatReference MakeReference() - { - if (_dfr == null) - { - _dfr = base.MakeReference(); - _dfr.Capabilities.Add(typeof(PMDExtensionObjectModel), DataFormatCapabilities.All); - // _dfr.Filters.Add("AniMiku PMD extension"); - } - return _dfr; - } - protected override void LoadInternal(ref ObjectModel objectModel) - { - PMDExtensionObjectModel pmdo = (objectModel as PMDExtensionObjectModel); - if (pmdo == null) return; + /// + /// Implements an internal for processing PMAX extensions to the PMD data + /// format. + /// + internal class PMDExtensionDataFormat : DataFormat + { + private static DataFormatReference _dfr = null; + public override DataFormatReference MakeReference() + { + if (_dfr == null) + { + _dfr = base.MakeReference(); + _dfr.Capabilities.Add(typeof(PMDExtensionObjectModel), DataFormatCapabilities.All); + // _dfr.Filters.Add("AniMiku PMD extension"); + } + return _dfr; + } + protected override void LoadInternal(ref ObjectModel objectModel) + { + PMDExtensionObjectModel pmdo = (objectModel as PMDExtensionObjectModel); + if (pmdo == null) return; - IO.Reader br = base.Accessor.Reader; - foreach (ModelMaterial mat in mvarModel.Materials) - { - mat.AlwaysLight = br.ReadBoolean(); - mat.EnableAnimation = br.ReadBoolean(); - mat.EnableGlow = br.ReadBoolean(); + IO.Reader br = base.Accessor.Reader; + foreach (ModelMaterial mat in mvarModel.Materials) + { + mat.AlwaysLight = br.ReadBoolean(); + mat.EnableAnimation = br.ReadBoolean(); + mat.EnableGlow = br.ReadBoolean(); if (mat.EnableAnimation) - { - int textureCount = br.ReadInt32(); - string archiveFileName = br.ReadNullTerminatedString(100); + { + int textureCount = br.ReadInt32(); + string archiveFileName = br.ReadNullTerminatedString(100); - PMDExtensionTextureGroup file = new PMDExtensionTextureGroup(); - file.Material = mat; - file.ArchiveFileName = archiveFileName; - for (int i = 0; i < textureCount; i++) - { - string textureFileName = br.ReadNullTerminatedString(256); - file.TextureImageFileNames.Add(textureFileName); - } - pmdo.ArchiveFiles.Add(file); - } - } + PMDExtensionTextureGroup file = new PMDExtensionTextureGroup(); + file.Material = mat; + file.ArchiveFileName = archiveFileName; + for (int i = 0; i < textureCount; i++) + { + string textureFileName = br.ReadNullTerminatedString(256); + file.TextureImageFileNames.Add(textureFileName); + } + pmdo.ArchiveFiles.Add(file); + } + } - int originalModelLength = br.ReadInt32(); - string END = br.ReadFixedLengthString(3); - } - protected override void SaveInternal(ObjectModel objectModel) - { + int originalModelLength = br.ReadInt32(); + string END = br.ReadFixedLengthString(3); + } + protected override void SaveInternal(ObjectModel objectModel) + { #if READYTOSAVE - IO.Writer bw = base.Accessor.Writer; - foreach (ModelMaterial mat in mvarModel.Materials) - { - bw.Write(mat.AlwaysLight); - bw.Write(mat.EnableAnimation); - bw.Write(mat.EnableGlow); + IO.Writer bw = base.Accessor.Writer; + foreach (ModelMaterial mat in mvarModel.Materials) + { + bw.Write(mat.AlwaysLight); + bw.Write(mat.EnableAnimation); + bw.Write(mat.EnableGlow); - if (mat.EnableAnimation) - { - // TODO: figure out how to get texture count for the model - int textureCount = br.ReadInt32(); - string archiveFileName = br.ReadNullTerminatedString(100); + if (mat.EnableAnimation) + { + // TODO: figure out how to get texture count for the model + int textureCount = br.ReadInt32(); + string archiveFileName = br.ReadNullTerminatedString(100); - PMDExtensionTextureGroup file = new PMDExtensionTextureGroup(); - file.Material = mat; - file.ArchiveFileName = archiveFileName; - for (int i = 0; i < textureCount; i++) - { - string textureFileName = br.ReadNullTerminatedString(256); - file.TextureImageFileNames.Add(textureFileName); - } - pmdo.ArchiveFiles.Add(file); - } - } + PMDExtensionTextureGroup file = new PMDExtensionTextureGroup(); + file.Material = mat; + file.ArchiveFileName = archiveFileName; + for (int i = 0; i < textureCount; i++) + { + string textureFileName = br.ReadNullTerminatedString(256); + file.TextureImageFileNames.Add(textureFileName); + } + pmdo.ArchiveFiles.Add(file); + } + } - int originalModelLength = br.ReadInt32(); - string END = br.ReadFixedLengthString(3); + int originalModelLength = br.ReadInt32(); + string END = br.ReadFixedLengthString(3); #endif - throw new NotImplementedException(); - } + throw new NotImplementedException(); + } - private ModelObjectModel mvarModel = null; - public ModelObjectModel Model { get { return mvarModel; } set { mvarModel = value; } } - } + private ModelObjectModel mvarModel = null; + public ModelObjectModel Model { get { return mvarModel; } set { mvarModel = value; } } + } } diff --git a/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/ObjectModels/AniMiku/PMDExtension/PMDExtensionTextureGroup.cs b/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/ObjectModels/AniMiku/PMDExtension/PMDExtensionTextureGroup.cs index 17abd9fa..51d12532 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/ObjectModels/AniMiku/PMDExtension/PMDExtensionTextureGroup.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/ObjectModels/AniMiku/PMDExtension/PMDExtensionTextureGroup.cs @@ -7,31 +7,37 @@ using UniversalEditor.ObjectModels.Multimedia3D.Model; namespace UniversalEditor.ObjectModels.AniMiku.PMDExtension { - public class PMDExtensionTextureGroup : ICloneable - { - public class PMDExtensionArchiveFileCollection - : System.Collections.ObjectModel.Collection - { - } + public class PMDExtensionTextureGroup : ICloneable + { + public class PMDExtensionArchiveFileCollection + : System.Collections.ObjectModel.Collection + { + } - private string mvarName = String.Empty; - public string ArchiveFileName { get { return mvarName; } set { mvarName = value; } } + private string mvarName = String.Empty; + /// + /// The name of the archive file associated with this PMD extension. + /// + public string ArchiveFileName { get { return mvarName; } set { mvarName = value; } } - private System.Collections.Specialized.StringCollection mvarTextureImageFileNames = new System.Collections.Specialized.StringCollection(); - public System.Collections.Specialized.StringCollection TextureImageFileNames { get { return mvarTextureImageFileNames; } } + private System.Collections.Specialized.StringCollection mvarTextureImageFileNames = new System.Collections.Specialized.StringCollection(); + /// + /// The file name(s) of texture(s) associated with this PMD extension. + /// + public System.Collections.Specialized.StringCollection TextureImageFileNames { get { return mvarTextureImageFileNames; } } - public object Clone() - { - PMDExtensionTextureGroup clone = new PMDExtensionTextureGroup(); - clone.ArchiveFileName = (mvarName.Clone() as string); - foreach (string s in mvarTextureImageFileNames) - { - clone.TextureImageFileNames.Add(s.Clone() as string); - } - return clone; - } + public object Clone() + { + PMDExtensionTextureGroup clone = new PMDExtensionTextureGroup(); + clone.ArchiveFileName = (mvarName.Clone() as string); + foreach (string s in mvarTextureImageFileNames) + { + clone.TextureImageFileNames.Add(s.Clone() as string); + } + return clone; + } - private ModelMaterial mvarMaterial = null; - public ModelMaterial Material { get { return mvarMaterial; } set { mvarMaterial = value; } } - } + private ModelMaterial mvarMaterial = null; + public ModelMaterial Material { get { return mvarMaterial; } set { mvarMaterial = value; } } + } } diff --git a/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/UniversalEditor.Plugins.AniMiku.csproj b/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/UniversalEditor.Plugins.AniMiku.csproj index 2ad7902c..a06695fb 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/UniversalEditor.Plugins.AniMiku.csproj +++ b/CSharp/Plugins/UniversalEditor.Plugins.AniMiku/UniversalEditor.Plugins.AniMiku.csproj @@ -1,4 +1,4 @@ - + Debug @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + ..\..\Output\Debug\Plugins\UniversalEditor.Plugins.AniMiku.xml pdbonly