diff --git a/CSharp/Libraries/UniversalEditor.Core/ObjectModel.cs b/CSharp/Libraries/UniversalEditor.Core/ObjectModel.cs index eb80f2d5..386deb60 100644 --- a/CSharp/Libraries/UniversalEditor.Core/ObjectModel.cs +++ b/CSharp/Libraries/UniversalEditor.Core/ObjectModel.cs @@ -65,5 +65,8 @@ namespace UniversalEditor } } } + + private ObjectModelCustomProperty.ObjectModelCustomPropertyCollection mvarCustomProperties = new ObjectModelCustomProperty.ObjectModelCustomPropertyCollection(); + public ObjectModelCustomProperty.ObjectModelCustomPropertyCollection CustomProperties { get { return mvarCustomProperties; } } } } diff --git a/CSharp/Libraries/UniversalEditor.Core/ObjectModelCustomProperty.cs b/CSharp/Libraries/UniversalEditor.Core/ObjectModelCustomProperty.cs new file mode 100644 index 00000000..b596698e --- /dev/null +++ b/CSharp/Libraries/UniversalEditor.Core/ObjectModelCustomProperty.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniversalEditor +{ + public class ObjectModelCustomProperty + { + public class ObjectModelCustomPropertyCollection + { + private Dictionary> _internalCollection = new Dictionary>(); + + public ObjectModelCustomProperty Add(DataFormat dataFormat, string name, object value) + { + ObjectModelCustomProperty item = new ObjectModelCustomProperty(); + item.DataFormat = dataFormat; + item.Name = name; + item.Value = value; + + Dictionary values = null; + if (!_internalCollection.ContainsKey(dataFormat)) + { + values = new Dictionary(); + _internalCollection.Add(dataFormat, values); + } + else + { + values = _internalCollection[dataFormat]; + } + values[name] = item; + return item; + } + public ObjectModelCustomProperty[] this[DataFormat dataFormat] + { + get + { + List list = new List(); + if (_internalCollection.ContainsKey(dataFormat)) + { + foreach (KeyValuePair kvp in _internalCollection[dataFormat]) + { + list.Add(kvp.Value); + } + } + return list.ToArray(); + } + } + public ObjectModelCustomProperty this[DataFormat dataFormat, string name] + { + get + { + if (!_internalCollection.ContainsKey(dataFormat)) return null; + if (!_internalCollection[dataFormat].ContainsKey(name)) return null; + return _internalCollection[dataFormat][name]; + } + set + { + if (!_internalCollection.ContainsKey(dataFormat)) _internalCollection.Add(dataFormat, new Dictionary()); + if (!_internalCollection[dataFormat].ContainsKey(name)) _internalCollection[dataFormat].Add(name, value); + _internalCollection[dataFormat][name] = value; + } + } + } + + private DataFormat mvarDataFormat = null; + public DataFormat DataFormat { get { return mvarDataFormat; } set { mvarDataFormat = value; } } + + private string mvarName = String.Empty; + public string Name { get { return mvarName; } set { mvarName = value; } } + + private object mvarValue = null; + public object Value { get { return mvarValue; } set { mvarValue = value; } } + } +} diff --git a/CSharp/Libraries/UniversalEditor.Core/UniversalEditor.Core.csproj b/CSharp/Libraries/UniversalEditor.Core/UniversalEditor.Core.csproj index 5f468b79..fc8b2407 100644 --- a/CSharp/Libraries/UniversalEditor.Core/UniversalEditor.Core.csproj +++ b/CSharp/Libraries/UniversalEditor.Core/UniversalEditor.Core.csproj @@ -56,6 +56,7 @@ +