diff --git a/src/ndefpclib/StyleCop.Cache b/src/ndefpclib/StyleCop.Cache new file mode 100644 index 0000000..e683bf9 --- /dev/null +++ b/src/ndefpclib/StyleCop.Cache @@ -0,0 +1,272 @@ + + 12 + + + 2013.09.19 14:09:50.000 + 2012.09.27 21:03:32.000 + 2013.10.23 10:54:09.249 + 2013.09.19 14:09:50.000 + 2013.09.19 14:09:50.000 + -1945363787 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + + + + The file has no header, the header Xml is invalid, or the header is not located at the top of the file. + 1 + False + + + All using directives must be placed inside of the namespace. + 1 + False + + + All using directives must be placed inside of the namespace. + 2 + False + + + System using directives must be placed before all other using directives. + 2 + False + + + All using directives must be placed inside of the namespace. + 3 + False + + + All using directives must be placed inside of the namespace. + 4 + False + + + All using directives must be placed inside of the namespace. + 5 + False + + + All using directives must be placed inside of the namespace. + 6 + False + + + namespace names begin with an upper-case letter: ndefpclib. + 8 + False + + + namespace names begin with an upper-case letter: type. + 8 + False + + + The class must have a documentation header. + 10 + False + + + The constructor must have a documentation header. + 12 + False + + + The method must have a documentation header. + 19 + False + + + Statements or elements wrapped in curly brackets must be followed by a blank line. + 24 + False + + + The code contains an extra semicolon. + 34 + False + + + Invalid spacing around the semicolon. + 34 + 1009 + 1009 + 34 + 50 + 34 + 50 + False + + + + + + 2013.09.19 14:09:50.000 + 2012.09.27 21:03:32.000 + 2013.10.23 15:18:02.510 + 2013.09.19 14:09:50.000 + 2013.09.19 14:09:50.000 + -1945363787 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + + + + The file header must contain a copyright tag. + 1 + False + + + Tabs are not allowed. Use spaces instead. + 3 + 42 + 54 + 3 + 1 + 3 + 13 + False + + + namespace names begin with an upper-case letter: ndefpclib. + 4 + False + + + namespace names begin with an upper-case letter: message. + 4 + False + + + The documentation text within the remarks tag contains incorrectly spelled words: Stubbfel + 12 + False + + + The documentation text within the remarks tag contains incorrectly spelled words: Stubbfel + 19 + False + + + Invalid spacing around the comma. + 20 + 809 + 809 + 20 + 50 + 20 + 50 + False + + + + + DEBUG;TRACE + + + + 2013.09.19 14:09:50.000 + 2012.09.27 21:03:32.000 + 2013.10.23 15:21:08.323 + 2013.09.19 14:09:50.000 + 2013.09.19 14:09:50.000 + -1945363787 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + 2013.09.19 14:09:50.000 + 0 + + + + The file header must contain a copyright tag. + 1 + False + + + Tabs are not allowed. Use spaces instead. + 3 + 37 + 49 + 3 + 1 + 3 + 13 + False + + + namespace names begin with an upper-case letter: ndefpclib. + 4 + False + + + namespace names begin with an upper-case letter: message. + 4 + False + + + System using directives must be placed before all other using directives. + 8 + False + + + The documentation text within the summary tag contains incorrectly spelled words: Ndef + 13 + False + + + The documentation text within the remarks tag contains incorrectly spelled words: Stubbfel + 13 + False + + + The documentation text within the remarks tag contains incorrectly spelled words: Stubbfel + 31 + False + + + The documentation text within the remarks tag contains incorrectly spelled words: Stubbfel + 65 + False + + + The documentation text within the remarks tag contains incorrectly spelled words: Stubbfel + 97 + False + + + The documentation text within the remarks tag contains incorrectly spelled words: Stubbfel + 112 + False + + + + \ No newline at end of file diff --git a/src/ndefpclib/message/NDEFMessage.cs b/src/ndefpclib/message/NDEFMessage.cs index 87b38f0..b14c5e5 100644 --- a/src/ndefpclib/message/NDEFMessage.cs +++ b/src/ndefpclib/message/NDEFMessage.cs @@ -1,39 +1,43 @@ -namespace ndefpclib.message +// namespace: ndefpclib.message +// +// summary: . +namespace ndefpclib.message { using ndefpclib.records; using ndefpclib.type; using System.Collections.Generic; using System.IO; - using System.Text; - /// Ndef message. - /// Stubbfel, 21.08.2013. + /// Ndef message. + /// Stubbfel, 21.08.2013. public class NDEFMessage { #region Members - /// The records. + /// The records. private List records; + /// Type of the message. + private MsgType msgType; + #endregion #region constructors + /// Initializes a new instance of the NDEFMessage class. + /// Stubbfel, 23.10.2013. + /// The content. + /// The type. public NDEFMessage(string content, MsgType type) { this.records = new List(); float recordsCount = (float)content.Length / NDEFRecord.MaxRecordPayLoad; NDEFRecord tmpRecord = null; - string praefix = type.PayloadPrefix; - MsgType.TNFVAL tnf = type.TNFValue; - MsgType.TYPEVAL typeVal = type.TypeValue; + this.msgType = type; for (int i = 0; recordsCount > 0; i++) { - tmpRecord = new NDEFShortRecord(); - tmpRecord.Type = typeVal; - tmpRecord.TNF = tnf; - tmpRecord.PayloadPraefix = praefix; + tmpRecord = new NDEFShortRecord(type); int recordsize = 255; if (content.Length < (i + 1) * recordsize) @@ -55,17 +59,17 @@ this.records[this.records.IndexOf(tmpRecord)].ME = NDEFRecord.NDEFFlags.MESET; } - /// Initializes a new instance of the NDEFMessage class. - /// Stubbfel, 21.08.2013. - /// The array. - public NDEFMessage(byte[] array, Encoding payLoadEncoding) + /// Initializes a new instance of the NDEFMessage class. + /// Stubbfel, 21.08.2013. + /// The array. + public NDEFMessage(byte[] array) { this.records = new List(); NDEFRecord tmpRecord = null; for (int i = 0; i < array.Length; i += tmpRecord.RecordSize) { - tmpRecord = new NDEFShortRecord(array, payLoadEncoding, i); + tmpRecord = new NDEFShortRecord(array, i); this.records.Add(tmpRecord); } @@ -73,11 +77,23 @@ #endregion + #region property + + /// Gets or sets the type of the message. + /// The type of the message. + protected MsgType MsgType + { + get { return this.msgType; } + set { this.msgType = value; } + } + + #endregion + #region Methods - /// Gets the content. - /// Stubbfel, 21.08.2013. - /// The content. + /// Gets the content. + /// Stubbfel, 21.08.2013. + /// The content. public string GetContent() { string result = string.Empty; @@ -90,15 +106,15 @@ return result; } - /// Converts this object to a byte array. - /// Stubbfel, 21.08.2013. - /// This object as a byte[]. - public virtual byte[] ToByteArray(Encoding payLoadEncoding) + /// Converts this object to a byte array. + /// Stubbfel, 21.08.2013. + /// This object as a byte[]. + public virtual byte[] ToByteArray() { MemoryStream ms = new MemoryStream(); foreach (NDEFRecord record in this.records) { - ms.Write(record.ToByteArray(payLoadEncoding), 0, record.RecordSize); + ms.Write(record.ToByteArray(), 0, record.RecordSize); } return ms.ToArray(); diff --git a/src/ndefpclib/message/Text/TextMessageUTF16.cs b/src/ndefpclib/message/Text/TextMessageUTF16.cs new file mode 100644 index 0000000..dbfaa41 --- /dev/null +++ b/src/ndefpclib/message/Text/TextMessageUTF16.cs @@ -0,0 +1,23 @@ + +// namespace: ndefpclib.message.Text +// +// summary: . +namespace ndefpclib.message.Text +{ + using ndefpclib.type.Const; + + /// A text message UTF 16. + /// Stubbfel, 23.10.2013. + /// + public class TextMessageUTF16 : TextMessage + { + /// Initializes a new instance of the TextMessageUTF16 class. + /// Stubbfel, 23.10.2013. + /// The content. + /// The language. + public TextMessageUTF16(string content, string lang) + : base(content, TextEncoding.UTF16, lang) + { + } + } +} diff --git a/src/ndefpclib/message/Text/TextMessageUTF8.cs b/src/ndefpclib/message/Text/TextMessageUTF8.cs new file mode 100644 index 0000000..5ddd66d --- /dev/null +++ b/src/ndefpclib/message/Text/TextMessageUTF8.cs @@ -0,0 +1,22 @@ +// namespace: ndefpclib.message.Text +// +// summary: . +namespace ndefpclib.message.Text +{ + using ndefpclib.type.Const; + + /// A text message UTF 8. + /// Stubbfel, 23.10.2013. + /// + public class TextMessageUTF8 : TextMessage + { + /// Initializes a new instance of the TextMessageUTF8 class. + /// Stubbfel, 23.10.2013. + /// The content. + /// The language. + public TextMessageUTF8(string content, string lang) + : base(content, TextEncoding.UTF8, lang) + { + } + } +} diff --git a/src/ndefpclib/message/Text/TextMessages.cs b/src/ndefpclib/message/Text/TextMessages.cs new file mode 100644 index 0000000..0096a00 --- /dev/null +++ b/src/ndefpclib/message/Text/TextMessages.cs @@ -0,0 +1,23 @@ +// namespace: ndefpclib.message.Text +// +// summary: . +namespace ndefpclib.message.Text +{ + using ndefpclib.type; + + /// A text message. + /// Stubbfel, 23.10.2013. + /// + public class TextMessage : NDEFMessage + { + /// Initializes a new instance of the TextMessage class. + /// Stubbfel, 23.10.2013. + /// The content. + /// The encoding. + /// The language. + public TextMessage(string content, string encoding, string lang) + : base(content, new TextType(encoding,lang)) + { + } + } +} diff --git a/src/ndefpclib/ndefpclib.csproj b/src/ndefpclib/ndefpclib.csproj index 58479f3..4687409 100644 --- a/src/ndefpclib/ndefpclib.csproj +++ b/src/ndefpclib/ndefpclib.csproj @@ -38,6 +38,9 @@ + + + @@ -46,6 +49,7 @@ +