From fa8d47d6152e9f17b43cce02fc8b79b0972dd8b9 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 6 Jun 2017 18:04:08 +0100 Subject: [PATCH] Added XML documentation. --- Claunia.RsrcFork/PascalString.cs | 13 +++++++ Claunia.RsrcFork/Resource.cs | 23 ++++++++++-- Claunia.RsrcFork/ResourceFork.cs | 12 +++++-- Claunia.RsrcFork/Resources/Version.cs | 51 +++++++++++++++++++++++++++ Claunia.RsrcFork/Types.cs | 13 +++++++ 5 files changed, 106 insertions(+), 6 deletions(-) diff --git a/Claunia.RsrcFork/PascalString.cs b/Claunia.RsrcFork/PascalString.cs index 4667b82..06ca144 100644 --- a/Claunia.RsrcFork/PascalString.cs +++ b/Claunia.RsrcFork/PascalString.cs @@ -27,8 +27,16 @@ using System; using System.Text; namespace Claunia.RsrcFork { + /// + /// Contains convertes between .NET and Pascal strings. Only ASCII supported right now. + /// public static class PascalString { + /// + /// Converts an ASCII Pascal string to a .NET string. + /// + /// The .NET string. + /// The ASCII Pascal string. public static string GetString(byte[] PStr) { if(PStr == null || PStr[0] >= PStr.Length) @@ -37,6 +45,11 @@ namespace Claunia.RsrcFork return Encoding.ASCII.GetString(PStr, 1, PStr[0]); } + /// + /// Converts a .NET string to an ASCII Pascal string. + /// + /// The ASCII Pascal string. + /// The .NET string. public static byte[] GetBytes(string str) { if(str == null) diff --git a/Claunia.RsrcFork/Resource.cs b/Claunia.RsrcFork/Resource.cs index f6b925a..ce3eaa6 100644 --- a/Claunia.RsrcFork/Resource.cs +++ b/Claunia.RsrcFork/Resource.cs @@ -32,6 +32,9 @@ using System.Text; namespace Claunia.RsrcFork { + /// + /// This class represents a resource type. + /// public class Resource { readonly Dictionary resourceNames; @@ -47,7 +50,7 @@ namespace Claunia.RsrcFork } /// - /// Initializates the specified resource type + /// Initializates the specified resource type. /// /// Stream where the resources of this reside. /// How many resource of this type are. @@ -116,7 +119,7 @@ namespace Claunia.RsrcFork } /// - /// Gets the name of the specified resource id, or null if there is no name + /// Gets the name of the specified resource id, or null if there is no name. /// /// The name. /// Identifier. @@ -127,7 +130,7 @@ namespace Claunia.RsrcFork } /// - /// Gets the resource contents + /// Gets the resource contents. /// /// The resource. /// Identifier. @@ -152,17 +155,31 @@ namespace Claunia.RsrcFork return resource; } + /// + /// Gets the length of the resource specified by ID. + /// + /// The length. + /// Resource identifier. public long GetLength(short id) { ResourceData data; return !resources.TryGetValue(id, out data) ? 0 : data.length; } + /// + /// Gets the IDs of all the resources contained by this instance. + /// + /// The identifiers. public short[] GetIds() { return ids.ToArray(); } + /// + /// Checks if the resource specified by ID is contained by this instance. + /// + /// true, if the resource is contained in this instance, false otherwise. + /// Resource identifier. public bool ContainsId(short id) { return ids.Contains(id); diff --git a/Claunia.RsrcFork/ResourceFork.cs b/Claunia.RsrcFork/ResourceFork.cs index cfb46d0..ecc2afc 100644 --- a/Claunia.RsrcFork/ResourceFork.cs +++ b/Claunia.RsrcFork/ResourceFork.cs @@ -30,6 +30,9 @@ using System.Linq; namespace Claunia.RsrcFork { + /// + /// This class represents a resource fork. + /// public class ResourceFork { Stream rsrcStream; @@ -40,7 +43,7 @@ namespace Claunia.RsrcFork List osTypes; /// - /// Initializates a resource fork using a byte array as backend + /// Initializates a resource fork using a byte array as backend. /// /// Buffer. public ResourceFork(byte[] buffer) @@ -50,7 +53,7 @@ namespace Claunia.RsrcFork } /// - /// Initializates a resource fork using a stream as backed + /// Initializates a resource fork using a stream as backed. /// /// Stream. public ResourceFork(Stream stream) @@ -65,7 +68,10 @@ namespace Claunia.RsrcFork rsrcStream.Close(); } - public void Init() + /// + /// Initializes this instance. + /// + void Init() { header = new ResourceHeader(); byte[] tmp = new byte[4]; diff --git a/Claunia.RsrcFork/Resources/Version.cs b/Claunia.RsrcFork/Resources/Version.cs index b16e004..3ccb8c1 100644 --- a/Claunia.RsrcFork/Resources/Version.cs +++ b/Claunia.RsrcFork/Resources/Version.cs @@ -30,28 +30,71 @@ using Claunia.RsrcFork; namespace Resources { + /// + /// This class handles the "VERS" resource fork + /// public class Version { static uint ostype = 0x76657273; #region On-disk structure + /// + /// Major version. + /// public byte MajorVersion; + /// + /// Minor version. + /// public byte MinorVersion; + /// + /// Development stage. + /// public DevelopmentStage DevStage; + /// + /// Pre-release version. + /// public byte PreReleaseVersion; + /// + /// Region code. + /// public ushort RegionCode; + /// + /// Version string. + /// public string VersionString; + /// + /// Version message. + /// public string VersionMessage; #endregion + /// + /// Known development stages + /// public enum DevelopmentStage : byte { + /// + /// Pre-alpha. + /// PreAlpha = 0x20, + /// + /// Alpha. + /// Alpha = 0x40, + /// + /// Beta. + /// Beta = 0x60, + /// + /// Final release. + /// Final = 0x80 } + /// + /// Initializes a new instance of the class. + /// + /// Byte array containing the "VERS" resource. public Version(byte[] resource) { byte[] tmpShort, tmpStr, tmpMsg; @@ -72,6 +115,10 @@ namespace Resources VersionMessage = PascalString.GetString(tmpMsg); } + /// + /// Gets a byte array with the "VERS" resource contained by this instance. + /// + /// The "VERS" resource. public byte[] GetBytes() { byte[] tmpShort, tmpStr, tmpMsg; @@ -92,6 +139,10 @@ namespace Resources return vers; } + /// + /// Gets the OSTYPE of this resource. + /// + /// The OSTYPE. public static uint OSType { get { return ostype; diff --git a/Claunia.RsrcFork/Types.cs b/Claunia.RsrcFork/Types.cs index 1f450ce..95c15b3 100644 --- a/Claunia.RsrcFork/Types.cs +++ b/Claunia.RsrcFork/Types.cs @@ -30,8 +30,16 @@ using System.Linq; namespace Claunia.RsrcFork { + /// + /// This class contains static methods for OSTYPE handling. + /// public static class Types { + /// + /// Gets a descriptive name of a resource from its OSTYPE. + /// + /// The name corresponding to the specified OSTYPE. + /// The OSTYPE. public static string GetName(uint OSType) { switch(OSType) { @@ -680,6 +688,11 @@ namespace Claunia.RsrcFork } } + /// + /// Gets a descriptive name of a resource from its OSTYPE. + /// + /// The name corresponding to the specified OSTYPE. + /// The OSTYPE. public static string GetName(string OSType) { if(OSType.Length != 4)