diff --git a/Libraries/UniversalEditor.Essential/NameValuePair.cs b/Libraries/UniversalEditor.Essential/NameValuePair.cs deleted file mode 100644 index f12daf73..00000000 --- a/Libraries/UniversalEditor.Essential/NameValuePair.cs +++ /dev/null @@ -1,144 +0,0 @@ -// -// NameValuePair.cs - represents a name-value pair of String expressions (not sure why we did this) -// -// Author: -// Michael Becker -// -// Copyright (c) 2011-2020 Mike Becker's Software -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -namespace UniversalEditor -{ - using System; - - /// - /// Represents a name-value pair of String expressions (not sure why we did this). - /// - public class NameValuePair : NameValuePair - { - public NameValuePair(string Name) : base(Name) - { - } - - public NameValuePair(string Name, string Value) : base(Name, Value) - { - } - } - public class NameValuePair : ICloneable - { - private string mvarName; - private T mvarValue; - - public NameValuePair(string Name) - { - this.mvarName = ""; - this.mvarValue = default(T); - this.mvarName = Name; - this.mvarValue = default(T); - } - - public NameValuePair(string Name, T Value) - { - this.mvarName = ""; - this.mvarValue = default(T); - this.mvarName = Name; - this.mvarValue = Value; - } - - public string Name - { - get - { - return this.mvarName; - } - set - { - this.mvarName = value; - } - } - - public T Value - { - get - { - return this.mvarValue; - } - set - { - this.mvarValue = value; - } - } - - public class NameValuePairCollection : System.Collections.ObjectModel.Collection> - { - public NameValuePair Add(string Name) - { - return this.Add(Name, default(T)); - } - - public NameValuePair Add(string Name, T Value) - { - NameValuePair p = new NameValuePair(Name, Value); - base.Add(p); - return p; - } - - public bool Contains(string Name) - { - return (this[Name] != null); - } - - public bool Remove(string Name) - { - NameValuePair p = this[Name]; - if (p != null) - { - base.Remove(p); - return true; - } - return false; - } - - public NameValuePair this[string Name] - { - get - { - foreach (NameValuePair p in this) - { - if (p.Name == Name) - { - return p; - } - } - return null; - } - } - } - - public object Clone() - { - NameValuePair clone = new NameValuePair(mvarName.Clone() as string); - if (mvarValue is ICloneable) - { - clone.Value = (T)((mvarValue as ICloneable).Clone()); - } - else - { - clone.Value = mvarValue; - } - return clone; - } - } -} diff --git a/Libraries/UniversalEditor.Essential/NameValuePairGroup.cs b/Libraries/UniversalEditor.Essential/NameValuePairGroup.cs deleted file mode 100644 index 10667649..00000000 --- a/Libraries/UniversalEditor.Essential/NameValuePairGroup.cs +++ /dev/null @@ -1,226 +0,0 @@ -// -// NameValuePairGroup.cs - represents a grouped collection of NameValuePair items -// -// Author: -// Michael Becker -// -// Copyright (c) 2011-2020 Mike Becker's Software -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -namespace UniversalEditor -{ - using System; - - /// - /// Represents a grouped collection of items. - /// - public class NameValuePairGroup - { - private NameValuePairGroupCollection mvarGroups; - private NameValuePair.NameValuePairCollection mvarItems; - private string mvarName; - private string mvarPathSeparator; - - public NameValuePairGroup(string Name) - { - mvarGroups = new NameValuePairGroupCollection(); - mvarItems = new NameValuePair.NameValuePairCollection(); - mvarPathSeparator = ""; - mvarName = Name; - } - - public NameValuePairGroup GetGroup(string GroupName) - { - string[] path = GroupName.Split(new string[] { this.mvarPathSeparator }, StringSplitOptions.None); - if (path.Length == 1) - { - return this.mvarGroups[path[0]]; - } - NameValuePairGroup pgParent = this.mvarGroups[path[0]]; - int i = 1; - while (pgParent != null) - { - if (pgParent.Groups[path[i]] != null) - { - pgParent = pgParent.Groups[path[i]]; - i++; - } - else - { - break; - } - } - return pgParent.Groups[path[path.Length - 1]]; - } - - public NameValuePair GetItem(string PropertyName) - { - string[] path = PropertyName.Split(new string[] { this.mvarPathSeparator }, StringSplitOptions.None); - if (path.Length == 1) - { - return mvarItems[path[0]]; - } - NameValuePairGroup pgParent = mvarGroups[path[0]]; - int i = 1; - while (pgParent != null) - { - if (pgParent.Groups[path[i]] != null) - { - pgParent = pgParent.Groups[path[i]]; - i++; - } - else - { - break; - } - } - return pgParent.Items[path[path.Length - 1]]; - } - - public bool GetItemValueAsBoolean(string ValueName) - { - return this.GetItemValueAsBoolean(ValueName, false); - } - - public bool GetItemValueAsBoolean(string ValueName, bool DefaultValue) - { - string val = this.GetItemValueAsString(ValueName); - if ((((val.ToLower() == "1") || (val.ToLower() == "true")) || (val.ToLower() == "yes")) || (val.ToLower() == "on")) - { - return true; - } - if ((((val.ToLower() == "0") || (val.ToLower() == "false")) || (val.ToLower() == "no")) || (val.ToLower() == "off")) - { - return false; - } - return DefaultValue; - } - - public int GetItemValueAsInteger(string ValueName) - { - return this.GetItemValueAsInteger(ValueName, -1); - } - - public int GetItemValueAsInteger(string ValueName, int DefaultValue) - { - try - { - return int.Parse(this.GetItemValueAsString(ValueName, DefaultValue.ToString())); - } - catch - { - return DefaultValue; - } - } - - public string GetItemValueAsString(string ValueName) - { - return this.GetItemValueAsString(ValueName, ""); - } - - public string GetItemValueAsString(string ValueName, string DefaultValue) - { - try - { - return this.GetItem(ValueName).Value.ToString(); - } - catch - { - return DefaultValue; - } - } - - public NameValuePairGroupCollection Groups - { - get - { - return this.mvarGroups; - } - } - - public NameValuePair.NameValuePairCollection Items - { - get - { - return this.mvarItems; - } - } - - public string Name - { - get - { - return this.mvarName; - } - set - { - this.mvarName = value; - } - } - - public string PathSeparator - { - get - { - return this.mvarPathSeparator; - } - set - { - this.mvarPathSeparator = value; - } - } - - public class NameValuePairGroupCollection : System.Collections.ObjectModel.Collection> - { - public NameValuePairGroup Add(string Name) - { - NameValuePairGroup pg = new NameValuePairGroup(Name); - base.Add(pg); - return pg; - } - - public bool Contains(string Name) - { - return (this[Name] != null); - } - - public bool Remove(string Name) - { - NameValuePairGroup pg = this[Name]; - if (pg != null) - { - base.Remove(pg); - return true; - } - return false; - } - - public NameValuePairGroup this[string Name] - { - get - { - foreach (NameValuePairGroup pg in this) - { - if (pg.Name == Name) - { - return pg; - } - } - return null; - } - } - } - } -} diff --git a/Libraries/UniversalEditor.Essential/UniversalEditor.Essential.csproj b/Libraries/UniversalEditor.Essential/UniversalEditor.Essential.csproj index 3920cacf..575fa508 100644 --- a/Libraries/UniversalEditor.Essential/UniversalEditor.Essential.csproj +++ b/Libraries/UniversalEditor.Essential/UniversalEditor.Essential.csproj @@ -74,8 +74,6 @@ - - diff --git a/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/Microsoft/MicrosoftExecutableDataFormat.cs b/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/Microsoft/MicrosoftExecutableDataFormat.cs index ebbea003..dc382a82 100644 --- a/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/Microsoft/MicrosoftExecutableDataFormat.cs +++ b/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/Microsoft/MicrosoftExecutableDataFormat.cs @@ -26,6 +26,7 @@ using UniversalEditor.ObjectModels.Executable; using UniversalEditor.ObjectModels.FileSystem; using UniversalEditor.DataFormats.Executable.Microsoft.PortableExecutable; +using System.Collections.Generic; #if EXECUTABLE_LOAD_RESOURCES using UniversalEditor.DataFormats.Resource.Microsoft; @@ -40,7 +41,7 @@ namespace UniversalEditor.DataFormats.Executable.Microsoft /// public class MicrosoftExecutableDataFormat : DataFormat { - public NameValuePair.NameValuePairCollection ImportTable { get; } = new NameValuePair.NameValuePairCollection(); + public Dictionary ImportTable { get; } = new Dictionary(); public System.Reflection.Assembly CLRAssembly { get; private set; } = null; private static DataFormatReference _dfr;