From b2a5229ffceb70ec4ff8f24e8e34602ac3800336 Mon Sep 17 00:00:00 2001 From: Marcel Schnirring Date: Sun, 5 May 2019 22:01:50 +0200 Subject: [PATCH 1/5] [PlgxTools] Fix whitespace --- PlgxTools/PlgxInfo.cs | 88 +++++++++++++++++++++---------------------- PlgxTools/Program.cs | 30 +++++++-------- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/PlgxTools/PlgxInfo.cs b/PlgxTools/PlgxInfo.cs index 233328f..2e7571d 100644 --- a/PlgxTools/PlgxInfo.cs +++ b/PlgxTools/PlgxInfo.cs @@ -19,12 +19,12 @@ public class PlgxInfo /// public const string PlgxExtension = "plgx"; public const string none = ""; - + private const uint PlgxSignature1 = 0x65D90719; private const uint PlgxSignature2 = 0x3DDD0503; public const uint PlgxVersion1 = 0x00010000; private const uint PlgxVersionMask = 0xFFFF0000; - + private const ushort PlgxEOF = 0; private const ushort PlgxFileUuid = 1; private const ushort PlgxBaseFileName = 2; @@ -40,7 +40,7 @@ public class PlgxInfo private const ushort PlgxPrereqPtr = 12; // Pointer size private const ushort PlgxBuildPre = 13; private const ushort PlgxBuildPost = 14; - + private const ushort PlgxfEOF = 0; private const ushort PlgxfPath = 1; private const ushort PlgxfData = 2; @@ -58,7 +58,7 @@ public class PlgxInfo /// /// Gets or sets the name of the base file. /// - public string BaseFileName { get; set; } + public string BaseFileName { get; set; } /// /// Gets or sets the creation time. @@ -73,7 +73,7 @@ public class PlgxInfo /// /// Gets or sets the generator version. /// - public ulong GeneratorVersion { get; set; } + public ulong GeneratorVersion { get; set; } /// /// Gets or sets the prerequsite KeePass version required @@ -125,11 +125,11 @@ public void WriteFile(string destDir) Path.Combine (destDir, BaseFileName + "." + PlgxExtension); //PlgxCsprojLoader.LoadDefault(destDir, plgx); - + FileStream fs = new FileStream(plgxFileName, FileMode.Create, FileAccess.Write, FileShare.None); BinaryWriter writer = new BinaryWriter(fs); - + writer.Write(PlgxSignature1); writer.Write(PlgxSignature2); writer.Write(Version); @@ -142,7 +142,7 @@ public void WriteFile(string destDir) GeneratorName)); WriteObject(writer, PlgxGeneratorVersion, MemUtil.UInt64ToBytes( GeneratorVersion)); - + if (PrereqKP.HasValue) { WriteObject (writer, PlgxPrereqKP, MemUtil.UInt64ToBytes (PrereqKP.Value)); } @@ -167,16 +167,16 @@ public void WriteFile(string destDir) if (!string.IsNullOrEmpty (BuildPost)) { WriteObject (writer, PlgxBuildPost, StrUtil.Utf8.GetBytes (BuildPost)); } - + WriteObject(writer, PlgxBeginContent, null); - + foreach (var file in Files) { AddFile (writer, file); } - + WriteObject(writer, PlgxEndContent, null); WriteObject(writer, PlgxEOF, null); - + writer.Close(); fs.Close(); } @@ -196,7 +196,7 @@ private static void WriteObject(BinaryWriter writer, private static void AddFile(BinaryWriter writer, KeyValuePair file) { - + var stream = new MemoryStream(); var streamWriter = new BinaryWriter(stream); @@ -204,12 +204,12 @@ private static void AddFile(BinaryWriter writer, if(file.Value.LongLength >= (long)(int.MaxValue / 2)) // Max 1 GB throw new OutOfMemoryException(); - + byte[] compressedData = MemUtil.Compress(file.Value); WriteObject(streamWriter, PlgxfData, compressedData); - + WriteObject(streamWriter, PlgxfEOF, null); - + WriteObject(writer, PlgxFile, stream.ToArray()); streamWriter.Close(); stream.Close(); @@ -228,22 +228,22 @@ public static PlgxInfo ReadFile(Stream stream) { var reader = new BinaryReader (stream); var plgx = new PlgxInfo (); - + var signature1 = reader.ReadUInt32(); var signature2 = reader.ReadUInt32(); plgx.Version = reader.ReadUInt32(); - + if ((signature1 != PlgxSignature1) || (signature2 != PlgxSignature2)) throw new PlgxException ("Invalid signature at start of file"); if((plgx.Version & PlgxVersionMask) > (PlgxVersion1 & PlgxVersionMask)) throw new PlgxException(KLRes.FileVersionUnsupported); - + bool? content = null; - + while(true) { var pair = ReadObject(reader); - + if(pair.Key == PlgxEOF) break; else if(pair.Key == PlgxFileUuid) plgx.FileUuid = new PwUuid(pair.Value); @@ -271,14 +271,14 @@ public static PlgxInfo ReadFile(Stream stream) { if(content.HasValue) throw new PlgxException(KLRes.FileCorrupted); - + content = true; } else if(pair.Key == PlgxFile) { if(!content.HasValue || !content.Value) throw new PlgxException(KLRes.FileCorrupted); - + var file = ExtractFile(pair.Value); if (file != null) { plgx.Files.Add(file.Value); @@ -288,17 +288,17 @@ public static PlgxInfo ReadFile(Stream stream) { if(!content.HasValue || !content.Value) throw new PlgxException(KLRes.FileCorrupted); - + content = false; } - else { + else { // TODO - do we want to list extra data? } } - + return plgx; } - + private static KeyValuePair ReadObject(BinaryReader reader) { try @@ -306,24 +306,24 @@ private static KeyValuePair ReadObject(BinaryReader reader) ushort dataType = reader.ReadUInt16(); uint length = reader.ReadUInt32(); byte[] dataValue = ((length > 0) ? reader.ReadBytes((int)length) : null); - + return new KeyValuePair(dataType, dataValue); } catch(Exception) { throw new PlgxException(KLRes.FileCorrupted); } } - + private static KeyValuePair? ExtractFile(byte[] data) { var stream = new MemoryStream(data, false); var reader = new BinaryReader(stream); - + string path = null; byte[] contents = null; - + while(true) { var pair = ReadObject(reader); - + if(pair.Key == PlgxfEOF) break; else if(pair.Key == PlgxfPath) path = StrUtil.Utf8.GetString(pair.Value); @@ -331,15 +331,15 @@ private static KeyValuePair ReadObject(BinaryReader reader) contents = pair.Value; else { Debug.Assert(false); } } - + reader.Close(); stream.Close(); - + if (!string.IsNullOrEmpty (path) && contents != null) { byte[] pbDecompressed = MemUtil.Decompress(contents); return new KeyValuePair (path, pbDecompressed); } - + Debug.Assert (false); return null; } @@ -349,21 +349,22 @@ private static KeyValuePair ReadObject(BinaryReader reader) /// /// Contents to extract (from Files property). /// Destination directory to store file. - public static void ExtractFile(byte[] contents, string destDir) { - + public static void ExtractFile(byte[] contents, string destDir) + { + string path = null; - + string tempFile = UrlUtil.EnsureTerminatingSeparator (destDir, false) + UrlUtil.ConvertSeparators (path); - + string tempDir = UrlUtil.GetFileDirectory (tempFile, false, true); if (!Directory.Exists (tempDir)) { Directory.CreateDirectory (tempDir); } - + byte[] decompressedData = MemUtil.Decompress (contents); - File.WriteAllBytes (tempFile, decompressedData); + File.WriteAllBytes (tempFile, decompressedData); } public override string ToString () @@ -390,7 +391,7 @@ public string ToString(bool verbose) PrereqKP.HasValue ? StrUtil.VersionToString (PrereqKP.Value) : none); builder.AppendFormat ("Prerequsite .NET Version: {0}\n", - PrereqNet.HasValue ? + PrereqNet.HasValue ? StrUtil.VersionToString (PrereqNet.Value) : none); builder.AppendFormat ("Prerequsite Operating System: {0}\n", PrereqOS != null ? PrereqOS : none); @@ -424,8 +425,7 @@ public void AddFileFromDisk(string sourceFile, string destinationFile) { sourceFile = Path.GetFullPath (sourceFile); var data = File.ReadAllBytes (sourceFile); - Files.Add (destinationFile, data); + Files.Add (destinationFile, data); } } } - diff --git a/PlgxTools/Program.cs b/PlgxTools/Program.cs index 240434a..517d8ce 100644 --- a/PlgxTools/Program.cs +++ b/PlgxTools/Program.cs @@ -11,12 +11,12 @@ using System.Collections.Generic; namespace KeePassPluginDevTools.PlgxTools -{ +{ public class Program - { + { [Flags()] private enum Command - { + { Help = 0, // default Build, List, @@ -109,7 +109,7 @@ public static int Main (string[] args) switch (selectedCommand) { #region Build Command - case Command.Build: + case Command.Build: try { // populate common information for all plgx var plgx = new PlgxInfo (); @@ -118,7 +118,7 @@ public static int Main (string[] args) plgx.CreationTime = TimeUtil.SerializeUtc (DateTime.Now); var assm = Assembly.GetAssembly (typeof(Program)).GetName (); plgx.GeneratorName = assm.Name; - plgx.GeneratorVersion = + plgx.GeneratorVersion = StrUtil.ParseVersion (assm.Version.ToString ()); // read the optional config file to get the rest of the plgx header @@ -141,15 +141,15 @@ public static int Main (string[] args) serializer.UnknownAttribute += (sender, e) => Console.WriteLine ("Unknown attribute: {0} at {1}:{2}", e.Attr.Name, e.LineNumber, e.LinePosition); - serializer.UnknownElement += (sender, e) => + serializer.UnknownElement += (sender, e) => Console.WriteLine ("Unknown element: {0} at {1}:{2}", e.Element.Name, e.LineNumber, e.LinePosition); - serializer.UnknownNode += (sender, e) => + serializer.UnknownNode += (sender, e) => Console.WriteLine ("Unknown node: {0} at {1}:{2}", e.Name, e.LineNumber, e.LinePosition); - serializer.UnreferencedObject += (sender, e) => + serializer.UnreferencedObject += (sender, e) => Console.WriteLine ("Unreferenced object: {0}", - e.UnreferencedId); + e.UnreferencedId); } configDoc.Save (config); var plgxConfig = @@ -176,7 +176,7 @@ public static int Main (string[] args) plgx.BuildPost = plgxConfig.BuildCommands.PostBuild; } } - } + } // read the .csproj file to find which files we need to include in // the plgx @@ -247,7 +247,7 @@ public static int Main (string[] args) if (includeFile != null && !string.IsNullOrWhiteSpace (includeFile.Value)) { - // skip "Include" files that are marked for exclusion from + // skip "Include" files that are marked for exclusion from // the .plgx var exclude = false; foreach(XmlNode grandchild in child.ChildNodes) @@ -297,7 +297,7 @@ public static int Main (string[] args) } // write the in-memory project xml document (.csproj) to the plgx // instead of the file on disk since we may have changed it - using (var stream = new MemoryStream()) { + using (var stream = new MemoryStream()) { var writer = new XmlTextWriter (stream, Encoding.UTF8); writer.Formatting = Formatting.Indented; project.Save (writer); @@ -335,7 +335,7 @@ public static int Main (string[] args) } catch (Exception ex) { Console.WriteLine (ex.Message); return 1; - } + } break; #endregion @@ -350,7 +350,7 @@ public static int Main (string[] args) private static string GetUsage () { - string executable = + string executable = Environment.OSVersion.Platform == PlatformID.Win32Windows ? "PlgxTool.exe" : "plgx-tool"; const string line = "{0,-4}{1,-12}{2}\n"; @@ -373,7 +373,7 @@ private static string GetUsage () builder.AppendLine (); // | --- ruler --- | - // |00000000011111111112222222222333333333344444444445555555555666666666677777777778| + // |00000000011111111112222222222333333333344444444445555555555666666666677777777778| // |12345678901234567890123456789012345678901234567890123456789012345678901234567890| // |x x x | From 4486701615121990b4427e6e8baddb93d27c8ff9 Mon Sep 17 00:00:00 2001 From: Marcel Schnirring Date: Sun, 5 May 2019 22:05:55 +0200 Subject: [PATCH 2/5] [PlgxTools] Fix command parsing --- PlgxTools/Program.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/PlgxTools/Program.cs b/PlgxTools/Program.cs index 517d8ce..2e15288 100644 --- a/PlgxTools/Program.cs +++ b/PlgxTools/Program.cs @@ -45,15 +45,15 @@ public static int Main (string[] args) var options = new OptionSet () { { "b|build", "create plgx file", - v => { if (v != null) selectedCommand |= Command.Build; } }, + v => { if (v != null) selectedCommand = Command.Build; } }, { "l|list", "list contents of plgx file", - v => { if (v != null) selectedCommand |= Command.List; } }, + v => { if (v != null) selectedCommand = Command.List; } }, { "e|extract", "extract file(s) from plgx", - v => { if (v != null) selectedCommand |= Command.Extract; } }, + v => { if (v != null) selectedCommand = Command.Extract; } }, { "p|package", "package plgx for distribution", - v => { if (v != null) selectedCommand |= Command.Package; } }, + v => { if (v != null) selectedCommand = Command.Package; } }, { "h|help|?", "show usage", - v => { if (v != null) selectedCommand |= Command.Help; } }, + v => { if (v != null) selectedCommand = Command.Help; } }, { "i|in|input=", "input file or directory", v => { input = v; } }, { "o|out|output=", "output file or directory", @@ -97,12 +97,10 @@ public static int Main (string[] args) } if (selectedCommand == Command.Help || - // build requires source dir + // build requires source and destination dir (selectedCommand == Command.Build && (input == null || output == null)) || - // build requires source dir - (selectedCommand == Command.List && input == null) || - // selected commands are mutually exclusive - Math.Log ((double)selectedCommand, 2) % 1 != 0) { + // list requires source dir + (selectedCommand == Command.List && input == null)) { Console.WriteLine (GetUsage ()); return 1; } From 5912ce88890c0797f73f01b2c828b5fad3e9be17 Mon Sep 17 00:00:00 2001 From: Marcel Schnirring Date: Sun, 5 May 2019 22:08:34 +0200 Subject: [PATCH 3/5] [PlgxTools] Implement and fix file extraction. --- PlgxTools/PlgxInfo.cs | 16 +++++----------- PlgxTools/Program.cs | 30 ++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/PlgxTools/PlgxInfo.cs b/PlgxTools/PlgxInfo.cs index 2e7571d..52c87f9 100644 --- a/PlgxTools/PlgxInfo.cs +++ b/PlgxTools/PlgxInfo.cs @@ -345,26 +345,20 @@ private static KeyValuePair ReadObject(BinaryReader reader) } /// - /// Extracts the file contents to destDir. + /// Extracts the file contents to destFile. /// /// Contents to extract (from Files property). - /// Destination directory to store file. - public static void ExtractFile(byte[] contents, string destDir) + /// Destination file to store contents. + public static void ExtractFile(byte[] contents, string destFile) { - - string path = null; - - string tempFile = - UrlUtil.EnsureTerminatingSeparator (destDir, false) + - UrlUtil.ConvertSeparators (path); + string tempFile = UrlUtil.ConvertSeparators (destFile); string tempDir = UrlUtil.GetFileDirectory (tempFile, false, true); if (!Directory.Exists (tempDir)) { Directory.CreateDirectory (tempDir); } - byte[] decompressedData = MemUtil.Decompress (contents); - File.WriteAllBytes (tempFile, decompressedData); + File.WriteAllBytes (tempFile, contents); } public override string ToString () diff --git a/PlgxTools/Program.cs b/PlgxTools/Program.cs index 2e15288..f2d32eb 100644 --- a/PlgxTools/Program.cs +++ b/PlgxTools/Program.cs @@ -100,7 +100,9 @@ public static int Main (string[] args) // build requires source and destination dir (selectedCommand == Command.Build && (input == null || output == null)) || // list requires source dir - (selectedCommand == Command.List && input == null)) { + (selectedCommand == Command.List && input == null) || + // extract requires source and destination dir + (selectedCommand == Command.Extract && (input == null || output == null))) { Console.WriteLine (GetUsage ()); return 1; } @@ -321,7 +323,25 @@ public static int Main (string[] args) #region Extract Command case Command.Extract: - Console.WriteLine ("Not implemented."); + try { + string outDir = UrlUtil.EnsureTerminatingSeparator (output, false) + + UrlUtil.StripExtension (UrlUtil.GetFileName (input)) + + UrlUtil.LocalDirSepChar; + if (Directory.Exists (outDir)) { + Console.WriteLine ("Output directory \"" + outDir + "\" must not exist!"); + return 1; + } + + var plgx = PlgxInfo.ReadFile (File.OpenRead (input)); + foreach (KeyValuePair file in plgx.Files) { + string outFile = outDir + file.Key; + Console.WriteLine (file.Key + " -> " + outFile); + PlgxInfo.ExtractFile(file.Value, outFile); + } + } catch (Exception ex) { + Console.WriteLine (ex.Message); + return 1; + } return 1; #endregion @@ -368,6 +388,12 @@ private static string GetUsage () builder.Append (executable); builder.Append (" --list [--in=] "); builder.AppendLine (); + + /* List syntax */ + builder.Append (executable); + builder.Append (" --extract [--in=] "); + builder.Append ("[--out=] "); + builder.AppendLine (); builder.AppendLine (); // | --- ruler --- | From 8637632da4b04d99da7ffdb325155ee184b362ae Mon Sep 17 00:00:00 2001 From: Marcel Schnirring Date: Sun, 5 May 2019 22:08:58 +0200 Subject: [PATCH 4/5] Improve .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 13ff373..7014988 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ _ReSharper*/ *.resources *.userprefs *.il +.vs/ # Ignore NuGet Packages *.nupkg From e52393e8ba0b8f88db39ac23a38b0ac295d14148 Mon Sep 17 00:00:00 2001 From: Marcel Schnirring Date: Thu, 16 May 2019 00:19:56 +0200 Subject: [PATCH 5/5] [PlgxTools] Fix XSD usage. --- PlgxTools/.gitignore | 1 + PlgxTools/Microsoft.Build.Plgx.cs | 244 -------------------------- PlgxTools/Microsoft.Build.Plgx.xsd | 4 + PlgxTools/Microsoft.Build.Plgx_xsd.cs | 4 +- PlgxTools/PlgxTool.csproj | 6 +- PlgxTools/Program.cs | 4 +- SamplePlugin/SamplePlugin.csproj | 2 +- 7 files changed, 12 insertions(+), 253 deletions(-) create mode 100644 PlgxTools/.gitignore delete mode 100644 PlgxTools/Microsoft.Build.Plgx.cs diff --git a/PlgxTools/.gitignore b/PlgxTools/.gitignore new file mode 100644 index 0000000..64750dd --- /dev/null +++ b/PlgxTools/.gitignore @@ -0,0 +1 @@ +Microsoft.Build.Plgx.cs diff --git a/PlgxTools/Microsoft.Build.Plgx.cs b/PlgxTools/Microsoft.Build.Plgx.cs deleted file mode 100644 index e01e38c..0000000 --- a/PlgxTools/Microsoft.Build.Plgx.cs +++ /dev/null @@ -1,244 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 4.0.30319.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -// -//This source code was auto-generated by MonoXSD -// -namespace KeePassPluginDevTools.PlgxTools { - - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] - public partial class PlgxConfiguration { - - private PlgxConfigurationPrerequisites prerequisitesField; - - private PlgxConfigurationBuildCommands buildCommandsField; - - /// - public PlgxConfigurationPrerequisites Prerequisites { - get { - return this.prerequisitesField; - } - set { - this.prerequisitesField = value; - } - } - - /// - public PlgxConfigurationBuildCommands BuildCommands { - get { - return this.buildCommandsField; - } - set { - this.buildCommandsField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - public partial class PlgxConfigurationPrerequisites { - - private string keePassVersionField; - - private string dotNetVersionField; - - private PlgxConfigurationPrerequisitesOS oSField; - - private bool oSSpecifiedField; - - private PlgxConfigurationPrerequisitesPointerSize pointerSizeField; - - private bool pointerSizeSpecifiedField; - - /// - public string KeePassVersion { - get { - return this.keePassVersionField; - } - set { - this.keePassVersionField = value; - } - } - - /// - public string DotNetVersion { - get { - return this.dotNetVersionField; - } - set { - this.dotNetVersionField = value; - } - } - - /// - public PlgxConfigurationPrerequisitesOS OS { - get { - return this.oSField; - } - set { - this.oSField = value; - } - } - - /// - [System.Xml.Serialization.XmlIgnore()] - public virtual bool OSSpecified { - get { - return this.oSSpecifiedField; - } - set { - this.oSSpecifiedField = value; - } - } - - /// - public PlgxConfigurationPrerequisitesPointerSize PointerSize { - get { - return this.pointerSizeField; - } - set { - this.pointerSizeField = value; - } - } - - /// - [System.Xml.Serialization.XmlIgnore()] - public virtual bool PointerSizeSpecified { - get { - return this.pointerSizeSpecifiedField; - } - set { - this.pointerSizeSpecifiedField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] - [System.SerializableAttribute()] - public enum PlgxConfigurationPrerequisitesOS { - - /// - Windows, - - /// - Unix, - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] - [System.SerializableAttribute()] - public enum PlgxConfigurationPrerequisitesPointerSize { - - /// - [System.Xml.Serialization.XmlEnumAttribute("4")] - Item4, - - /// - [System.Xml.Serialization.XmlEnumAttribute("8")] - Item8, - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - public partial class PlgxConfigurationBuildCommands { - - private string preBuildField; - - private string postBuildField; - - /// - public string PreBuild { - get { - return this.preBuildField; - } - set { - this.preBuildField = value; - } - } - - /// - public string PostBuild { - get { - return this.postBuildField; - } - set { - this.postBuildField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] - public partial class PlgxExtras { - - private PlgxExtrasItem itemField; - - /// - public PlgxExtrasItem Item { - get { - return this.itemField; - } - set { - this.itemField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - public partial class PlgxExtrasItem { - - private string sourceField; - - private string destinationField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Source { - get { - return this.sourceField; - } - set { - this.sourceField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Destination { - get { - return this.destinationField; - } - set { - this.destinationField = value; - } - } - } -} diff --git a/PlgxTools/Microsoft.Build.Plgx.xsd b/PlgxTools/Microsoft.Build.Plgx.xsd index 06d4300..cfe64fa 100644 --- a/PlgxTools/Microsoft.Build.Plgx.xsd +++ b/PlgxTools/Microsoft.Build.Plgx.xsd @@ -3,7 +3,11 @@ xmlns:msb="http://schemas.microsoft.com/developer/msbuild/2003" targetNamespace="http://schemas.microsoft.com/developer/msbuild/2003" elementFormDefault="qualified"> + + + + diff --git a/PlgxTools/Microsoft.Build.Plgx_xsd.cs b/PlgxTools/Microsoft.Build.Plgx_xsd.cs index 3102a61..042e254 100644 --- a/PlgxTools/Microsoft.Build.Plgx_xsd.cs +++ b/PlgxTools/Microsoft.Build.Plgx_xsd.cs @@ -12,12 +12,12 @@ public static string Test(this string test) return test; } - public static string GetValue(this PlgxConfigurationPrerequisitesOS version) + public static string GetValue(this PropertyGroupTypePropertyPlgxConfigurationPrerequisitesOS version) { return GetXmlEnumAttribute (version) ?? version.ToString (); } - public static string GetValue(this PlgxConfigurationPrerequisitesPointerSize version) + public static string GetValue(this PropertyGroupTypePropertyPlgxConfigurationPrerequisitesPointerSize version) { return GetXmlEnumAttribute (version) ?? version.ToString (); } diff --git a/PlgxTools/PlgxTool.csproj b/PlgxTools/PlgxTool.csproj index d8dfc86..905208e 100644 --- a/PlgxTools/PlgxTool.csproj +++ b/PlgxTools/PlgxTool.csproj @@ -75,7 +75,6 @@ - @@ -86,11 +85,10 @@ - - + - \ No newline at end of file + diff --git a/PlgxTools/Program.cs b/PlgxTools/Program.cs index f2d32eb..4bbd3b1 100644 --- a/PlgxTools/Program.cs +++ b/PlgxTools/Program.cs @@ -130,7 +130,7 @@ public static int Main (string[] args) // strip them or else the serializer fails configDoc = XmlNamespaceStripper.StripNamespace (configDoc); - var serializer = new XmlSerializer (typeof(PlgxConfiguration)); + var serializer = new XmlSerializer (typeof(PropertyGroupTypePropertyPlgxConfiguration)); if (verbose) { #if DEBUG var writer = new XmlTextWriter(Console.OpenStandardOutput(), Encoding.UTF8); @@ -153,7 +153,7 @@ public static int Main (string[] args) } configDoc.Save (config); var plgxConfig = - serializer.Deserialize (File.OpenRead (config)) as PlgxConfiguration; + serializer.Deserialize (File.OpenRead (config)) as PropertyGroupTypePropertyPlgxConfiguration; if (plgxConfig.Prerequisites != null) { if (!string.IsNullOrWhiteSpace (plgxConfig.Prerequisites.KeePassVersion)) { plgx.PrereqKP = StrUtil.ParseVersion (plgxConfig.Prerequisites.KeePassVersion); diff --git a/SamplePlugin/SamplePlugin.csproj b/SamplePlugin/SamplePlugin.csproj index ab38843..52ace06 100644 --- a/SamplePlugin/SamplePlugin.csproj +++ b/SamplePlugin/SamplePlugin.csproj @@ -126,4 +126,4 @@ - \ No newline at end of file +