public override void Close()
			{
				int num = 3;
				for (int i = 0; i < num; i++)
				{
					bool flag = i == num - 1;
					try
					{
						HeaderList headerList = new HeaderList();
						headerList.Add("content-type", this.contentType);
						headerList.Add("x-amz-acl", "public-read");
						this.s3OutputMethod.s3adaptor.put(this.s3OutputMethod.bucketName, this.s3key, new S3Content(this.ToArray()), headerList);
						break;
					}
					catch (WebException)
					{
						if (flag)
						{
							throw;
						}
					}
					catch (SoapException)
					{
						if (flag)
						{
							throw;
						}
					}
				}
				base.Close();
			}
Example #2
0
        public void TestReplacingHeaders()
        {
            const string ReplacedContentType        = "text/plain; charset=iso-8859-1; name=body.txt";
            const string ReplacedContentDisposition = "inline; filename=body.txt";
            const string ReplacedContentId          = "<content.id.2@localhost>";
            var          headers = new HeaderList();

            headers.Add("Content-Type", "text/plain");
            headers.Add("Content-Disposition", "attachment");
            headers.Add("Content-Id", "<content-id.1@localhost>");

            headers.Replace("Content-Disposition", ReplacedContentDisposition);
            Assert.AreEqual(3, headers.Count, "Unexpected number of headers after replacing Content-Disposition.");
            Assert.AreEqual(ReplacedContentDisposition, headers["Content-Disposition"], "Content-Disposition has unexpected value after replacing it.");
            Assert.AreEqual(1, headers.IndexOf("Content-Disposition"), "Replaced Content-Disposition not in the expected position.");

            headers.Replace("Content-Type", ReplacedContentType);
            Assert.AreEqual(3, headers.Count, "Unexpected number of headers after replacing Content-Type.");
            Assert.AreEqual(ReplacedContentType, headers["Content-Type"], "Content-Type has unexpected value after replacing it.");
            Assert.AreEqual(0, headers.IndexOf("Content-Type"), "Replaced Content-Type not in the expected position.");

            headers.Replace("Content-Id", ReplacedContentId);
            Assert.AreEqual(3, headers.Count, "Unexpected number of headers after replacing Content-Id.");
            Assert.AreEqual(ReplacedContentId, headers["Content-Id"], "Content-Id has unexpected value after replacing it.");
            Assert.AreEqual(2, headers.IndexOf("Content-Id"), "Replaced Content-Id not in the expected position.");
        }
Example #3
0
        public void TestReplacingHeaders()
        {
            const string ReplacedContentType = "text/plain; charset=iso-8859-1; name=body.txt";
            const string ReplacedContentDisposition = "inline; filename=body.txt";
            const string ReplacedContentId = "<content.id.2@localhost>";
            var headers = new HeaderList ();

            headers.Add ("Content-Type", "text/plain");
            headers.Add ("Content-Disposition", "attachment");
            headers.Add ("Content-Id", "<content-id.1@localhost>");

            headers.Replace ("Content-Disposition", ReplacedContentDisposition);
            Assert.AreEqual (3, headers.Count, "Unexpected number of headers after replacing Content-Disposition.");
            Assert.AreEqual (ReplacedContentDisposition, headers["Content-Disposition"], "Content-Disposition has unexpected value after replacing it.");
            Assert.AreEqual (1, headers.IndexOf ("Content-Disposition"), "Replaced Content-Disposition not in the expected position.");

            headers.Replace ("Content-Type", ReplacedContentType);
            Assert.AreEqual (3, headers.Count, "Unexpected number of headers after replacing Content-Type.");
            Assert.AreEqual (ReplacedContentType, headers["Content-Type"], "Content-Type has unexpected value after replacing it.");
            Assert.AreEqual (0, headers.IndexOf ("Content-Type"), "Replaced Content-Type not in the expected position.");

            headers.Replace ("Content-Id", ReplacedContentId);
            Assert.AreEqual (3, headers.Count, "Unexpected number of headers after replacing Content-Id.");
            Assert.AreEqual (ReplacedContentId, headers["Content-Id"], "Content-Id has unexpected value after replacing it.");
            Assert.AreEqual (2, headers.IndexOf ("Content-Id"), "Replaced Content-Id not in the expected position.");
        }
        public void TestSerializedContent()
        {
            const string expected  = "Reporting-MTA: dns; mm1\nArrival-Date: Mon, 29 Jul 1996 02:12:50 -0700\n\nFinal-Recipient: RFC822; [email protected]\nAction: failed\nDiagnostic-Code: X-LOCAL; 500 (err.nosuchuser)\n\n";
            var          mds       = new MessageDeliveryStatus();
            var          recipient = new HeaderList();
            var          status    = new HeaderList();

            status.Add("Reporting-MTA", "dns; mm1");
            status.Add("Arrival-Date", DateUtils.FormatDate(new DateTimeOffset(1996, 7, 29, 2, 12, 50, new TimeSpan(-7, 0, 0))));

            recipient.Add("Final-Recipient", "RFC822; [email protected]");
            recipient.Add("Action", "failed");
            recipient.Add("Diagnostic-Code", "X-LOCAL; 500 (err.nosuchuser)");

            mds.StatusGroups.Add(status);
            mds.StatusGroups.Add(recipient);

            Assert.IsTrue(mds.StatusGroups.Contains(status), "Expected the groups to contain the per-message status group.");
            Assert.IsTrue(mds.StatusGroups.Contains(recipient), "Expected the groups to contain the recipient status group.");
            Assert.IsFalse(mds.StatusGroups.IsReadOnly, "The status groups should not be read-only.");

            using (var memory = new MemoryStream()) {
                mds.ContentObject.DecodeTo(memory);

                var text = Encoding.ASCII.GetString(memory.GetBuffer(), 0, (int)memory.Length).Replace("\r\n", "\n");
                Assert.AreEqual(expected, text);
            }

            var dummy = new HeaderList();

            dummy.Add("Dummy-Header", "dummy value");

            mds.StatusGroups.Add(dummy);

            Assert.IsTrue(mds.StatusGroups.Contains(dummy), "Expected the groups to contain the dummy group.");
            Assert.IsTrue(mds.StatusGroups.Remove(dummy), "Expected removal of the dummy group to be successful.");

            var expectedContent = mds.ContentObject;

            dummy.Add("Bogus-Header", "bogus value");

            Assert.AreEqual(expectedContent, mds.ContentObject, "The content should not have changed since the dummy group has been removed.");

            mds.StatusGroups.Clear();

            using (var memory = new MemoryStream()) {
                mds.ContentObject.DecodeTo(memory);

                var text = Encoding.ASCII.GetString(memory.GetBuffer(), 0, (int)memory.Length).Replace("\r\n", "\n");

                Assert.AreEqual(string.Empty, text);
            }
        }
		public void TestSerializedContent ()
		{
			const string expected = "Reporting-MTA: dns; mm1\nArrival-Date: Mon, 29 Jul 1996 02:12:50 -0700\n\nFinal-Recipient: RFC822; [email protected]\nAction: failed\nDiagnostic-Code: X-LOCAL; 500 (err.nosuchuser)\n\n";
			var mds = new MessageDeliveryStatus ();
			var recipient = new HeaderList ();
			var status = new HeaderList ();

			status.Add ("Reporting-MTA", "dns; mm1");
			status.Add ("Arrival-Date", DateUtils.FormatDate (new DateTimeOffset (1996, 7, 29, 2, 12, 50, new TimeSpan (-7, 0, 0))));

			recipient.Add ("Final-Recipient", "RFC822; [email protected]");
			recipient.Add ("Action", "failed");
			recipient.Add ("Diagnostic-Code", "X-LOCAL; 500 (err.nosuchuser)");

			mds.StatusGroups.Add (status);
			mds.StatusGroups.Add (recipient);

			Assert.IsTrue (mds.StatusGroups.Contains (status), "Expected the groups to contain the per-message status group.");
			Assert.IsTrue (mds.StatusGroups.Contains (recipient), "Expected the groups to contain the recipient status group.");
			Assert.IsFalse (mds.StatusGroups.IsReadOnly, "The status groups should not be read-only.");

			using (var memory = new MemoryStream ()) {
				mds.ContentObject.DecodeTo (memory);

				var text = Encoding.ASCII.GetString (memory.GetBuffer (), 0, (int) memory.Length).Replace ("\r\n", "\n");
				Assert.AreEqual (expected, text);
			}

			var dummy = new HeaderList ();
			dummy.Add ("Dummy-Header", "dummy value");

			mds.StatusGroups.Add (dummy);

			Assert.IsTrue (mds.StatusGroups.Contains (dummy), "Expected the groups to contain the dummy group.");
			Assert.IsTrue (mds.StatusGroups.Remove (dummy), "Expected removal of the dummy group to be successful.");

			var expectedContent = mds.ContentObject;

			dummy.Add ("Bogus-Header", "bogus value");

			Assert.AreEqual (expectedContent, mds.ContentObject, "The content should not have changed since the dummy group has been removed.");

			mds.StatusGroups.Clear ();

			using (var memory = new MemoryStream ()) {
				mds.ContentObject.DecodeTo (memory);

				var text = Encoding.ASCII.GetString (memory.GetBuffer (), 0, (int) memory.Length).Replace ("\r\n", "\n");

				Assert.AreEqual (string.Empty, text);
			}
		}
Example #6
0
        public object Get()
        {
            HeaderList          list    = new HeaderList();
            NameValueCollection headers = HttpContext.Current.Request.Headers;

            foreach (string header in headers.AllKeys)
            {
                list.Add(string.Format("{0}: {1}", header, headers[header]));
            }

            list.Add("Method: " + CommunicationContext.Request.HttpMethod);
            return(list);
        }
Example #7
0
        public object Get()
        {
            HeaderList list = new HeaderList();
              NameValueCollection headers = HttpContext.Current.Request.Headers;

              foreach (string header in headers.AllKeys)
              {
            list.Add(string.Format("{0}: {1}", header, headers[header]));
              }

              list.Add("Method: " + CommunicationContext.Request.HttpMethod);
              return list;
        }
        protected bool ParseHeader()
        {
            var name = ParseFieldName();

            if (name == null)
            {
                return(false);
            }
            if (c == ':')
            {
                c = TextStore.ReadChar();
            }
            else
            {
                throw new Exception(string.Format(ERROR_MALFORMED_HEADER, Name));
            }
            try
            {
                var value = ParseFieldValue();
                ParseCRLF();
                var h = HeaderList.Add(name, value.Trim());
                if (h.Name == HttpHeaderContentType.NAME)
                {
                    CheckEncoding(((HttpHeaderContentType)h).CharSet);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format(ERROR_MALFORMED_HEADER, Name), ex);
            }
            return(true);
        }
Example #9
0
        public void TestReplacingMultipleHeaders()
        {
            const string CombinedRecpients = "first@localhost, second@localhost, third@localhost";
            var          headers           = new HeaderList();

            headers.Add("From", "sender@localhost");
            headers.Add("To", "first@localhost");
            headers.Add("To", "second@localhost");
            headers.Add("To", "third@localhost");
            headers.Add("Cc", "carbon.copy@localhost");

            headers.Replace("To", CombinedRecpients);
            Assert.AreEqual(3, headers.Count, "Unexpected number of headers after replacing To header.");
            Assert.AreEqual(CombinedRecpients, headers["To"], "To header has unexpected value after being replaced.");
            Assert.AreEqual(1, headers.IndexOf("To"), "Replaced To header not in the expected position.");
            Assert.AreEqual(0, headers.IndexOf("From"), "From header not in the expected position.");
            Assert.AreEqual(2, headers.IndexOf("Cc"), "Cc header not in the expected position.");
        }
Example #10
0
		public void TestReplacingMultipleHeaders ()
		{
			const string CombinedRecpients = "first@localhost, second@localhost, third@localhost";
			var headers = new HeaderList ();

			headers.Add ("From", "sender@localhost");
			headers.Add ("To", "first@localhost");
			headers.Add ("To", "second@localhost");
			headers.Add ("To", "third@localhost");
			headers.Add ("Cc", "carbon.copy@localhost");

			headers.Replace ("To", CombinedRecpients);
			Assert.AreEqual (3, headers.Count, "Unexpected number of headers after replacing To header.");
			Assert.AreEqual (CombinedRecpients, headers["To"], "To header has unexpected value after being replaced.");
			Assert.AreEqual (1, headers.IndexOf ("To"), "Replaced To header not in the expected position.");
			Assert.AreEqual (0, headers.IndexOf ("From"), "From header not in the expected position.");
			Assert.AreEqual (2, headers.IndexOf ("Cc"), "Cc header not in the expected position.");
		}
Example #11
0
		public void TestReplacingHeaders ()
		{
			const string ReplacedContentType = "text/plain; charset=iso-8859-1; name=body.txt";
			const string ReplacedContentDisposition = "inline; filename=body.txt";
			const string ReplacedContentLocation = "http://www.example.com/location";
			const string ReplacedContentId = "<content.id.2@localhost>";
			var headers = new HeaderList ();

			headers.Add (HeaderId.ContentId, "<content-id.1@localhost>");
			headers.Add ("Content-Location", "http://www.location.com");
			headers.Insert (0, HeaderId.ContentDisposition, "attachment");
			headers.Insert (0, "Content-Type", "text/plain");

			Assert.IsTrue (headers.Contains (HeaderId.ContentType), "Expected the list of headers to contain HeaderId.ContentType.");
			Assert.IsTrue (headers.Contains ("Content-Type"), "Expected the list of headers to contain a Content-Type header.");
			Assert.AreEqual (0, headers.LastIndexOf (HeaderId.ContentType), "Expected the Content-Type header to be the first header.");

			headers.Replace ("Content-Disposition", ReplacedContentDisposition);
			Assert.AreEqual (4, headers.Count, "Unexpected number of headers after replacing Content-Disposition.");
			Assert.AreEqual (ReplacedContentDisposition, headers["Content-Disposition"], "Content-Disposition has unexpected value after replacing it.");
			Assert.AreEqual (1, headers.IndexOf ("Content-Disposition"), "Replaced Content-Disposition not in the expected position.");

			headers.Replace (HeaderId.ContentType, ReplacedContentType);
			Assert.AreEqual (4, headers.Count, "Unexpected number of headers after replacing Content-Type.");
			Assert.AreEqual (ReplacedContentType, headers["Content-Type"], "Content-Type has unexpected value after replacing it.");
			Assert.AreEqual (0, headers.IndexOf ("Content-Type"), "Replaced Content-Type not in the expected position.");

			headers.Replace (HeaderId.ContentId, Encoding.UTF8, ReplacedContentId);
			Assert.AreEqual (4, headers.Count, "Unexpected number of headers after replacing Content-Id.");
			Assert.AreEqual (ReplacedContentId, headers["Content-Id"], "Content-Id has unexpected value after replacing it.");
			Assert.AreEqual (2, headers.IndexOf ("Content-Id"), "Replaced Content-Id not in the expected position.");

			headers.Replace ("Content-Location", Encoding.UTF8, ReplacedContentLocation);
			Assert.AreEqual (4, headers.Count, "Unexpected number of headers after replacing Content-Location.");
			Assert.AreEqual (ReplacedContentLocation, headers["Content-Location"], "Content-Location has unexpected value after replacing it.");
			Assert.AreEqual (3, headers.IndexOf ("Content-Location"), "Replaced Content-Location not in the expected position.");

			headers.RemoveAll ("Content-Location");
			Assert.AreEqual (3, headers.Count, "Unexpected number of headers after removing Content-Location.");
		}
Example #12
0
        public void TestReplacingHeaders()
        {
            const string ReplacedContentType        = "text/plain; charset=iso-8859-1; name=body.txt";
            const string ReplacedContentDisposition = "inline; filename=body.txt";
            const string ReplacedContentLocation    = "http://www.example.com/location";
            const string ReplacedContentId          = "<content.id.2@localhost>";
            var          headers = new HeaderList();

            headers.Add(HeaderId.ContentId, "<content-id.1@localhost>");
            headers.Add("Content-Location", "http://www.location.com");
            headers.Insert(0, HeaderId.ContentDisposition, "attachment");
            headers.Insert(0, "Content-Type", "text/plain");

            Assert.IsTrue(headers.Contains(HeaderId.ContentType), "Expected the list of headers to contain HeaderId.ContentType.");
            Assert.IsTrue(headers.Contains("Content-Type"), "Expected the list of headers to contain a Content-Type header.");
            Assert.AreEqual(0, headers.LastIndexOf(HeaderId.ContentType), "Expected the Content-Type header to be the first header.");

            headers.Replace("Content-Disposition", ReplacedContentDisposition);
            Assert.AreEqual(4, headers.Count, "Unexpected number of headers after replacing Content-Disposition.");
            Assert.AreEqual(ReplacedContentDisposition, headers["Content-Disposition"], "Content-Disposition has unexpected value after replacing it.");
            Assert.AreEqual(1, headers.IndexOf("Content-Disposition"), "Replaced Content-Disposition not in the expected position.");

            headers.Replace(HeaderId.ContentType, ReplacedContentType);
            Assert.AreEqual(4, headers.Count, "Unexpected number of headers after replacing Content-Type.");
            Assert.AreEqual(ReplacedContentType, headers["Content-Type"], "Content-Type has unexpected value after replacing it.");
            Assert.AreEqual(0, headers.IndexOf("Content-Type"), "Replaced Content-Type not in the expected position.");

            headers.Replace(HeaderId.ContentId, Encoding.UTF8, ReplacedContentId);
            Assert.AreEqual(4, headers.Count, "Unexpected number of headers after replacing Content-Id.");
            Assert.AreEqual(ReplacedContentId, headers["Content-Id"], "Content-Id has unexpected value after replacing it.");
            Assert.AreEqual(2, headers.IndexOf("Content-Id"), "Replaced Content-Id not in the expected position.");

            headers.Replace("Content-Location", Encoding.UTF8, ReplacedContentLocation);
            Assert.AreEqual(4, headers.Count, "Unexpected number of headers after replacing Content-Location.");
            Assert.AreEqual(ReplacedContentLocation, headers["Content-Location"], "Content-Location has unexpected value after replacing it.");
            Assert.AreEqual(3, headers.IndexOf("Content-Location"), "Replaced Content-Location not in the expected position.");

            headers.RemoveAll("Content-Location");
            Assert.AreEqual(3, headers.Count, "Unexpected number of headers after removing Content-Location.");
        }
        private static HeaderList GenerateHeadersList(MailKit.IMessageSummary headers)
        {
            var headerList = new HeaderList();

            foreach (var CcAddress in headers.Envelope.Cc)
            {
                headerList.Add("CC", CcAddress.ToString());
            }
            foreach (var CcAddress in headers.Envelope.Bcc)
            {
                headerList.Add("BCC", CcAddress.ToString());
            }
            foreach (var CcAddress in headers.Envelope.From)
            {
                headerList.Add("From", CcAddress.ToString());
            }
            foreach (var CcAddress in headers.Envelope.Sender)
            {
                headerList.Add("Sender", CcAddress.ToString());
            }
            headerList.Add("Subject", headers.Envelope.Subject);

            if (headers.Envelope.Date != null)
            {
                headerList.Add("Date", MimeKit.Utils.DateUtils.FormatDate(headers.Date));
            }
            return(headerList);
        }
Example #14
0
        public void TestRemovingHeaders()
        {
            var headers = new HeaderList();

            headers.Add("From", "sender@localhost");
            headers.Add("To", "first@localhost");
            headers.Add("To", "second@localhost");
            headers.Add("To", "third@localhost");
            headers.Add("To", "fourth@localhost");
            headers.Add("Cc", "carbon.copy@localhost");

            Assert.IsFalse(headers.IsReadOnly);
            Assert.IsFalse(headers.Contains(new Header(HeaderId.Received, "value")));
            Assert.AreEqual(-1, headers.IndexOf(new Header(HeaderId.Received, "value")));
            Assert.AreEqual(-1, headers.IndexOf("Received"));
            Assert.AreEqual(-1, headers.LastIndexOf(HeaderId.Received));
            Assert.AreEqual(null, headers[HeaderId.Received]);

            Assert.IsTrue(headers.Remove("Cc"));

            // try removing a header that no longer exists
            Assert.IsFalse(headers.Remove(new Header(HeaderId.Cc, "value")));
            Assert.IsFalse(headers.Remove(HeaderId.Cc));
            Assert.IsFalse(headers.Remove("Cc"));

            // removing this will change the result of headers[HeaderId.To]
            Assert.AreEqual("first@localhost", headers[HeaderId.To]);
            Assert.IsTrue(headers.Remove(HeaderId.To));
            Assert.AreEqual("second@localhost", headers[HeaderId.To]);
            Assert.IsTrue(headers.Remove("To"));
            Assert.AreEqual("third@localhost", headers[HeaderId.To]);
            headers.RemoveAt(headers.IndexOf("To"));
            Assert.AreEqual("fourth@localhost", headers[HeaderId.To]);
        }
Example #15
0
        public void TestRemovingHeaders()
        {
            var headers = new HeaderList();

            headers.Add("From", "sender@localhost");
            headers.Add("To", "first@localhost");
            headers.Add("To", "second@localhost");
            headers.Add("To", "third@localhost");
            headers.Add("Cc", "carbon.copy@localhost");

            Assert.IsTrue(headers.Remove("Cc"));

            // try removing a header that no longer exists
            Assert.IsFalse(headers.Remove(HeaderId.Cc));
            Assert.IsFalse(headers.Remove("Cc"));

            // removing this will change the result of headers[HeaderId.To]
            Assert.AreEqual("first@localhost", headers[HeaderId.To]);
            Assert.IsTrue(headers.Remove(HeaderId.To));
            Assert.AreEqual("second@localhost", headers[HeaderId.To]);
            Assert.IsTrue(headers.Remove("To"));
            Assert.AreEqual("third@localhost", headers[HeaderId.To]);
        }
Example #16
0
		/// <summary>
		/// Initializes a new instance of the <see cref="MimeKit.MimeEntity"/> class
		/// based on the <see cref="MimeEntityConstructorInfo"/>.
		/// </summary>
		/// <remarks>
		/// Custom <see cref="MimeEntity"/> subclasses MUST implement this constructor
		/// in order to register it using <see cref="ParserOptions.RegisterMimeType"/>.
		/// </remarks>
		/// <param name="entity">Information used by the constructor.</param>
		protected MimeEntity (MimeEntityConstructorInfo entity)
		{
			if (entity == null)
				throw new ArgumentNullException ("entity");

			Headers = new HeaderList (entity.ParserOptions);
			ContentType = entity.ContentType;

			ContentType.Changed += ContentTypeChanged;
			Headers.Changed += HeadersChanged;

			foreach (var header in entity.Headers) {
				if (entity.IsTopLevel && !header.Field.StartsWith ("Content-", StringComparison.OrdinalIgnoreCase))
					continue;

				Headers.Add (header);
			}
		}
        public void SetField(string fieldName, IValue value, InternetMailMessageNonAsciiSymbolsEncodingMode?encodingMode = null)
        {
            if (encodingMode == null)
            {
                encodingMode = NonAsciiSymbolsEncodingMode;
            }

            var stringValue = value.AsString();

            headers.Add(fieldName, stringValue);
            if (fieldName.Equals("BCC", StringComparison.InvariantCultureIgnoreCase))
            {
                Bcc.Add(stringValue);
            }

            else if (fieldName.Equals("CC", StringComparison.InvariantCultureIgnoreCase))
            {
                Cc.Add(stringValue);
            }

            else if (fieldName.Equals("Date", StringComparison.InvariantCultureIgnoreCase))
            {
                DateTimeOffset res;
                if (MimeKit.Utils.DateUtils.TryParse(stringValue, out res))
                {
                    PostingDate       = res.DateTime;
                    PostingDateOffset = new Decimal(res.Offset.TotalSeconds);
                }
            }
            else if (fieldName.Equals("From", StringComparison.InvariantCultureIgnoreCase))
            {
                Sender = value;
            }

            else if (fieldName.Equals("Sender", StringComparison.InvariantCultureIgnoreCase))
            {
                SenderName = stringValue;
            }

            else if (fieldName.Equals("Subject", StringComparison.InvariantCultureIgnoreCase))
            {
                Theme = stringValue;
            }
        }
Example #18
0
        public void TestArgumentExceptions()
        {
            var    list = new HeaderList();
            Header header;
            string value;

            using (var stream = new MemoryStream()) {
                Assert.Throws <ArgumentNullException> (() => HeaderList.Load(null, "filename.txt"));
                Assert.Throws <ArgumentNullException> (() => HeaderList.Load(ParserOptions.Default, (string)null));

                Assert.Throws <ArgumentNullException> (() => HeaderList.Load(null, stream));
                Assert.Throws <ArgumentNullException> (() => HeaderList.Load(ParserOptions.Default, (Stream)null));

                Assert.ThrowsAsync <ArgumentNullException> (async() => await HeaderList.LoadAsync(null, "filename.txt"));
                Assert.ThrowsAsync <ArgumentNullException> (async() => await HeaderList.LoadAsync(ParserOptions.Default, (string)null));

                Assert.ThrowsAsync <ArgumentNullException> (async() => await HeaderList.LoadAsync(null, stream));
                Assert.ThrowsAsync <ArgumentNullException> (async() => await HeaderList.LoadAsync(ParserOptions.Default, (Stream)null));
            }

            // Add
            Assert.Throws <ArgumentNullException> (() => list.Add(null));
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Add(HeaderId.Unknown, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Add(HeaderId.AdHoc, null));
            Assert.Throws <ArgumentNullException> (() => list.Add(null, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Add("field", null));
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Add(HeaderId.Unknown, Encoding.UTF8, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Add(HeaderId.AdHoc, null, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Add(HeaderId.AdHoc, Encoding.UTF8, null));
            Assert.Throws <ArgumentNullException> (() => list.Add(null, Encoding.UTF8, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Add("field", null, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Add("field", Encoding.UTF8, null));

            // Contains
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Contains(HeaderId.Unknown));
            Assert.Throws <ArgumentNullException> (() => list.Contains((Header)null));
            Assert.Throws <ArgumentNullException> (() => list.Contains((string)null));

            // CopyTo
            Assert.Throws <ArgumentOutOfRangeException> (() => list.CopyTo(new Header[0], -1));
            Assert.Throws <ArgumentNullException> (() => list.CopyTo(null, 0));

            // IndexOf
            Assert.Throws <ArgumentOutOfRangeException> (() => list.IndexOf(HeaderId.Unknown));
            Assert.Throws <ArgumentNullException> (() => list.IndexOf((Header)null));
            Assert.Throws <ArgumentNullException> (() => list.IndexOf((string)null));

            // Insert
            list.Add("field", "value");
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Insert(-1, new Header(HeaderId.AdHoc, "value")));
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Insert(-1, HeaderId.AdHoc, Encoding.UTF8, "value"));
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Insert(-1, "field", Encoding.UTF8, "value"));
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Insert(-1, HeaderId.AdHoc, "value"));
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Insert(-1, "field", "value"));
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Insert(0, HeaderId.Unknown, Encoding.UTF8, "value"));
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Insert(0, HeaderId.Unknown, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Insert(0, HeaderId.AdHoc, Encoding.UTF8, null));
            Assert.Throws <ArgumentNullException> (() => list.Insert(0, HeaderId.AdHoc, null, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Insert(0, HeaderId.AdHoc, null));
            Assert.Throws <ArgumentNullException> (() => list.Insert(0, null, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Insert(0, "field", null));
            Assert.Throws <ArgumentNullException> (() => list.Insert(0, null));

            // LastIndexOf
            Assert.Throws <ArgumentOutOfRangeException> (() => list.LastIndexOf(HeaderId.Unknown));
            Assert.Throws <ArgumentNullException> (() => list.LastIndexOf((string)null));

            // Remove
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Remove(HeaderId.Unknown));
            Assert.Throws <ArgumentNullException> (() => list.Remove((Header)null));
            Assert.Throws <ArgumentNullException> (() => list.Remove((string)null));

            // RemoveAll
            Assert.Throws <ArgumentOutOfRangeException> (() => list.RemoveAll(HeaderId.Unknown));
            Assert.Throws <ArgumentNullException> (() => list.RemoveAll((string)null));

            // RemoveAt
            Assert.Throws <ArgumentOutOfRangeException> (() => list.RemoveAt(-1));

            // Replace
            Assert.Throws <ArgumentNullException> (() => list.Replace(null));
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Replace(HeaderId.Unknown, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Replace(HeaderId.AdHoc, null));
            Assert.Throws <ArgumentNullException> (() => list.Replace(null, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Replace("field", null));
            Assert.Throws <ArgumentOutOfRangeException> (() => list.Replace(HeaderId.Unknown, Encoding.UTF8, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Replace(HeaderId.AdHoc, null, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Replace(HeaderId.AdHoc, Encoding.UTF8, null));
            Assert.Throws <ArgumentNullException> (() => list.Replace(null, Encoding.UTF8, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Replace("field", null, "value"));
            Assert.Throws <ArgumentNullException> (() => list.Replace("field", Encoding.UTF8, null));

            using (var stream = new MemoryStream()) {
                // Load
                Assert.Throws <ArgumentNullException> (() => HeaderList.Load(ParserOptions.Default, (Stream)null));
                Assert.Throws <ArgumentNullException> (() => HeaderList.Load(ParserOptions.Default, (string)null));
                Assert.Throws <ArgumentNullException> (() => HeaderList.Load(null, stream));
                Assert.Throws <ArgumentNullException> (() => HeaderList.Load((Stream)null));
                Assert.Throws <ArgumentNullException> (() => HeaderList.Load((string)null));

                // LoadAsync
                Assert.ThrowsAsync <ArgumentNullException> (async() => await HeaderList.LoadAsync(ParserOptions.Default, (Stream)null));
                Assert.ThrowsAsync <ArgumentNullException> (async() => await HeaderList.LoadAsync(ParserOptions.Default, (string)null));
                Assert.ThrowsAsync <ArgumentNullException> (async() => await HeaderList.LoadAsync(null, stream));
                Assert.ThrowsAsync <ArgumentNullException> (async() => await HeaderList.LoadAsync((Stream)null));
                Assert.ThrowsAsync <ArgumentNullException> (async() => await HeaderList.LoadAsync((string)null));

                // WriteTo
                Assert.Throws <ArgumentNullException> (() => list.WriteTo(FormatOptions.Default, null));
                Assert.Throws <ArgumentNullException> (() => list.WriteTo(null, stream));
                Assert.Throws <ArgumentNullException> (() => list.WriteTo(null));

                // WriteToAsync
                Assert.ThrowsAsync <ArgumentNullException> (async() => await list.WriteToAsync(FormatOptions.Default, null));
                Assert.ThrowsAsync <ArgumentNullException> (async() => await list.WriteToAsync(null, stream));
                Assert.ThrowsAsync <ArgumentNullException> (async() => await list.WriteToAsync(null));
            }

            // Indexers
            Assert.Throws <ArgumentOutOfRangeException> (() => list[-1] = new Header(HeaderId.AdHoc, "value"));
            Assert.Throws <ArgumentOutOfRangeException> (() => list[HeaderId.Unknown] = "value");
            Assert.Throws <ArgumentOutOfRangeException> (() => value          = list[HeaderId.Unknown]);
            Assert.Throws <ArgumentOutOfRangeException> (() => header         = list[-1]);
            Assert.Throws <ArgumentNullException> (() => list[HeaderId.AdHoc] = null);
            Assert.Throws <ArgumentNullException> (() => value         = list[null]);
            Assert.Throws <ArgumentNullException> (() => list[null]    = "value");
            Assert.Throws <ArgumentNullException> (() => list["field"] = null);
            Assert.Throws <ArgumentNullException> (() => list[0]       = null);
        }
 public void AddParameter(HeaderParameterStructure headerParameterStructure)
 {
     IsHeaderExist(headerParameterStructure.Name);
     HeaderList.Add(headerParameterStructure);
 }
Example #20
0
		private WebRequest BuildWebRequest(string method, string objectPath, HeaderList protoHeaders)
		{
			UriBuilder uriBuilder = new UriBuilder("http", "s3.amazonaws.com", 80, objectPath);
			WebRequest webRequest = WebRequest.Create(uriBuilder.ToString());
			((HttpWebRequest)webRequest).AllowWriteStreamBuffering = false;
			webRequest.Method = method;
			HeaderList headerList = new HeaderList(protoHeaders);
			headerList.AddHeaderIfAbsent("x-amz-date", DateTime.UtcNow.ToString("ddd, dd MMM yyyy HH:mm:ss ", CultureInfo.InvariantCulture) + "GMT");
			for (int i = 0; i < headerList.Count; i++)
			{
				string a = headerList.Keys[i];
				string contentType = headerList.Values[i];
				if (a == "content-type")
				{
					webRequest.ContentType = contentType;
				}
				else
				{
					webRequest.Headers.Add(headerList.Keys[i], headerList.Values[i]);
				}
			}
			StringBuilder stringBuilder = new StringBuilder();
			HeaderList headerList2 = new HeaderList();
			foreach (string current in headerList.Keys)
			{
				string text = current.ToLower();
				if (text == "content-type" || text == "content-md5" || text == "date" || text.StartsWith("x-amz-"))
				{
					headerList2.Add(text, headerList[current]);
				}
			}
			if (headerList2.ContainsKey("x-amz-date"))
			{
				headerList2["date"] = "";
			}
			if (!headerList2.ContainsKey("content-type"))
			{
				headerList2["content-type"] = "";
			}
			if (!headerList2.ContainsKey("content-md5"))
			{
				headerList2["content-md5"] = "";
			}
			stringBuilder.Append(webRequest.Method);
			stringBuilder.Append("\n");
			for (int j = 0; j < headerList2.Count; j++)
			{
				if (headerList2.Keys[j].StartsWith("x-amz-"))
				{
					stringBuilder.Append(headerList2.Keys[j]);
					stringBuilder.Append(":");
					stringBuilder.Append(headerList2.Values[j].Trim());
				}
				else
				{
					stringBuilder.Append(headerList2.Values[j]);
				}
				stringBuilder.Append("\n");
			}
			stringBuilder.Append("/");
			stringBuilder.Append(objectPath);
			string text2 = stringBuilder.ToString();
			Encoding encoding = new UTF8Encoding();
			HMACSHA1 hMACSHA = new HMACSHA1(encoding.GetBytes(this.secretAccessKey));
			byte[] inArray = hMACSHA.ComputeHash(encoding.GetBytes(text2.ToCharArray()));
			string arg = Convert.ToBase64String(inArray);
			webRequest.Headers.Add("Authorization", string.Format("AWS {0}:{1}", this.accessKeyId, arg));
			return webRequest;
		}
Example #21
0
		internal MimeMessage (ParserOptions options, IEnumerable<Header> headers)
		{
			addresses = new Dictionary<string, InternetAddressList> (StringComparer.OrdinalIgnoreCase);
			Headers = new HeaderList (options);

			// initialize our address lists
			foreach (var name in StandardAddressHeaders) {
				var list = new InternetAddressList ();
				list.Changed += InternetAddressListChanged;
				addresses.Add (name, list);
			}

			references = new MessageIdList ();
			references.Changed += ReferencesChanged;
			inreplyto = null;

			Headers.Changed += HeadersChanged;

			// add all of our message headers...
			foreach (var header in headers) {
				if (header.Field.StartsWith ("Content-", StringComparison.OrdinalIgnoreCase))
					continue;

				Headers.Add (header);
			}
		}
Example #22
0
 /// <summary>
 /// 添加Header
 /// </summary>
 public void Addition()
 {
     HeaderList.Add(new Header());
 }
Example #23
0
		public void TestArgumentExceptions ()
		{
			var list = new HeaderList ();
			Header header;
			string value;

			// Add
			Assert.Throws<ArgumentNullException> (() => list.Add (null));
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Add (HeaderId.Unknown, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Add (HeaderId.AdHoc, null));
			Assert.Throws<ArgumentNullException> (() => list.Add (null, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Add ("field", null));
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Add (HeaderId.Unknown, Encoding.UTF8, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Add (HeaderId.AdHoc, null, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Add (HeaderId.AdHoc, Encoding.UTF8, null));
			Assert.Throws<ArgumentNullException> (() => list.Add (null, Encoding.UTF8, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Add ("field", null, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Add ("field", Encoding.UTF8, null));

			// Contains
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Contains (HeaderId.Unknown));
			Assert.Throws<ArgumentNullException> (() => list.Contains ((Header) null));
			Assert.Throws<ArgumentNullException> (() => list.Contains ((string) null));

			// CopyTo
			Assert.Throws<ArgumentOutOfRangeException> (() => list.CopyTo (new Header[0], -1));
			Assert.Throws<ArgumentNullException> (() => list.CopyTo (null, 0));

			// IndexOf
			Assert.Throws<ArgumentOutOfRangeException> (() => list.IndexOf (HeaderId.Unknown));
			Assert.Throws<ArgumentNullException> (() => list.IndexOf ((Header) null));
			Assert.Throws<ArgumentNullException> (() => list.IndexOf ((string) null));

			// Insert
			list.Add ("field", "value");
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Insert (-1, new Header (HeaderId.AdHoc, "value")));
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Insert (-1, HeaderId.AdHoc, Encoding.UTF8, "value"));
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Insert (-1, "field", Encoding.UTF8, "value"));
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Insert (-1, HeaderId.AdHoc, "value"));
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Insert (-1, "field", "value"));
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Insert (0, HeaderId.Unknown, Encoding.UTF8, "value"));
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Insert (0, HeaderId.Unknown, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Insert (0, HeaderId.AdHoc, Encoding.UTF8, null));
			Assert.Throws<ArgumentNullException> (() => list.Insert (0, HeaderId.AdHoc, null, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Insert (0, HeaderId.AdHoc, null));
			Assert.Throws<ArgumentNullException> (() => list.Insert (0, null, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Insert (0, "field", null));
			Assert.Throws<ArgumentNullException> (() => list.Insert (0, null));

			// LastIndexOf
			Assert.Throws<ArgumentOutOfRangeException> (() => list.LastIndexOf (HeaderId.Unknown));
			Assert.Throws<ArgumentNullException> (() => list.LastIndexOf ((string) null));

			// Remove
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Remove (HeaderId.Unknown));
			Assert.Throws<ArgumentNullException> (() => list.Remove ((Header) null));
			Assert.Throws<ArgumentNullException> (() => list.Remove ((string) null));

			// RemoveAll
			Assert.Throws<ArgumentOutOfRangeException> (() => list.RemoveAll (HeaderId.Unknown));
			Assert.Throws<ArgumentNullException> (() => list.RemoveAll ((string) null));

			// RemoveAt
			Assert.Throws<ArgumentOutOfRangeException> (() => list.RemoveAt (-1));

			// Replace
			Assert.Throws<ArgumentNullException> (() => list.Replace (null));
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Replace (HeaderId.Unknown, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Replace (HeaderId.AdHoc, null));
			Assert.Throws<ArgumentNullException> (() => list.Replace (null, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Replace ("field", null));
			Assert.Throws<ArgumentOutOfRangeException> (() => list.Replace (HeaderId.Unknown, Encoding.UTF8, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Replace (HeaderId.AdHoc, null, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Replace (HeaderId.AdHoc, Encoding.UTF8, null));
			Assert.Throws<ArgumentNullException> (() => list.Replace (null, Encoding.UTF8, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Replace ("field", null, "value"));
			Assert.Throws<ArgumentNullException> (() => list.Replace ("field", Encoding.UTF8, null));

			using (var stream = new MemoryStream ()) {
				// Load
				Assert.Throws<ArgumentNullException> (() => HeaderList.Load (ParserOptions.Default, (Stream) null));
				Assert.Throws<ArgumentNullException> (() => HeaderList.Load (ParserOptions.Default, (string) null));
				Assert.Throws<ArgumentNullException> (() => HeaderList.Load (null, stream));
				Assert.Throws<ArgumentNullException> (() => HeaderList.Load ((Stream) null));
				Assert.Throws<ArgumentNullException> (() => HeaderList.Load ((string) null));

				// WriteTo
				Assert.Throws<ArgumentNullException> (() => list.WriteTo (FormatOptions.Default, null));
				Assert.Throws<ArgumentNullException> (() => list.WriteTo (null, stream));
				Assert.Throws<ArgumentNullException> (() => list.WriteTo (null));
			}

			// Indexers
			Assert.Throws<ArgumentOutOfRangeException> (() => list[-1] = new Header (HeaderId.AdHoc, "value"));
			Assert.Throws<ArgumentOutOfRangeException> (() => list[HeaderId.Unknown] = "value");
			Assert.Throws<ArgumentOutOfRangeException> (() => value = list[HeaderId.Unknown]);
			Assert.Throws<ArgumentOutOfRangeException> (() => header = list[-1]);
			Assert.Throws<ArgumentNullException> (() => list[HeaderId.AdHoc] = null);
			Assert.Throws<ArgumentNullException> (() => value = list[null]);
			Assert.Throws<ArgumentNullException> (() => list[null] = "value");
			Assert.Throws<ArgumentNullException> (() => list["field"] = null);
			Assert.Throws<ArgumentNullException> (() => list[0] = null);
		}
Example #24
0
		public void TestRemovingHeaders ()
		{
			var headers = new HeaderList ();

			headers.Add ("From", "sender@localhost");
			headers.Add ("To", "first@localhost");
			headers.Add ("To", "second@localhost");
			headers.Add ("To", "third@localhost");
			headers.Add ("Cc", "carbon.copy@localhost");

			Assert.IsTrue (headers.Remove ("Cc"));

			// try removing a header that no longer exists
			Assert.IsFalse (headers.Remove (HeaderId.Cc));
			Assert.IsFalse (headers.Remove ("Cc"));

			// removing this will change the result of headers[HeaderId.To]
			Assert.AreEqual ("first@localhost", headers[HeaderId.To]);
			Assert.IsTrue (headers.Remove (HeaderId.To));
			Assert.AreEqual ("second@localhost", headers[HeaderId.To]);
			Assert.IsTrue (headers.Remove ("To"));
			Assert.AreEqual ("third@localhost", headers[HeaderId.To]);
		}
Example #25
0
        /// <summary>
        /// Process Token
        /// </summary>
        /// <param name="TokenToAdd"></param>
        /// <param name="InstanceData"></param>
        /// <param name="DataStream"></param>
        void ProcessToken(Token TokenToAdd)
        {
            switch (TokenToAdd.TokenTypeValue)
            {
            case TokenType.ISO1030321:
                Lexer.Tokenizer(DataStream);
                currStatus = ParserStatus.ISO;
                break;

            case TokenType.ISO1030321END:
                Lexer.Tokenizer(DataStream);
                currStatus = ParserStatus.READY;
                break;

            case TokenType.HEADER:
                Lexer.Tokenizer(DataStream);
                //InstanceData.aHeaderSection = new HeaderSection();
                currStatus = ParserStatus.HEADER;

                break;

            case TokenType.ENDSEC:
                Lexer.Tokenizer(DataStream);
                currStatus = ParserStatus.ISO;
                break;

            case TokenType.ENTITYINSTANCENAME:
                switch (currStatus)
                {
                case ParserStatus.DATA:
                    Token oneToken = Lexer.Tokenizer(DataStream);
                    if (oneToken.TokenTypeValue != TokenType.EQUAL)
                    {
                        Console.WriteLine("Syntax Error in Entity Instance : #" + TokenToAdd.IntegerValue.ToString());
                        return;
                    }
                    oneToken = Lexer.Tokenizer(DataStream);
                    if (oneToken.TokenTypeValue == TokenType.KEYWORD)
                    {
                        SortedDictionary <uint, Instance> toAdd = DataList;
                        if (toAdd.ContainsKey((uint)TokenToAdd.IntegerValue))
                        {
                            // when instance is already created by other caller
                            //P21Instance a =   toAdd[(uint)TokenToAdd.IntegerValue];
                            InstanceSimple aSimpleInstance = (InstanceSimple)toAdd[(uint)TokenToAdd.IntegerValue];
                            ModifySimpleInstanceRecord(aSimpleInstance, oneToken.StringValue);
                        }
                        else
                        {
                            // when it is the first time of parsing entity instance name #???
                            InstanceSimple aSimpleInstance = AddSimpleInstance((uint)TokenToAdd.IntegerValue, oneToken.StringValue);
                            toAdd.Add((uint)TokenToAdd.IntegerValue, aSimpleInstance);
                        }


                        // adding instances to instanceByType according to instance type
                        if (InstanceByType.ContainsKey(oneToken.StringValue))
                        {
                            List <uint> existingList = InstanceByType[oneToken.StringValue];
                            existingList.Add((uint)TokenToAdd.IntegerValue);
                        }
                        else
                        {
                            List <uint> newList = new List <uint>();
                            newList.Add((uint)TokenToAdd.IntegerValue);
                            InstanceByType.Add(oneToken.StringValue, newList);
                        }
                    }
                    else if (oneToken.TokenTypeValue == TokenType.LEFTPARENTHESIS)
                    {
                        // need update for complex type
                        SortedDictionary <uint, Instance> toAdd = DataList;
                        InstanceComplex aComplexInstance        = AddComplexInstance((uint)TokenToAdd.IntegerValue);
                        if (toAdd.ContainsKey((uint)TokenToAdd.IntegerValue))
                        {
                            toAdd[(uint)TokenToAdd.IntegerValue] = aComplexInstance;
                        }
                        else
                        {
                            toAdd.Add((uint)TokenToAdd.IntegerValue, aComplexInstance);
                        }
                    }
                    else
                    {
                        Console.WriteLine("Syntax Error at value defintion in Entity Instance : #" + TokenToAdd.IntegerValue.ToString());
                        return;
                    }
                    break;

                default:
                    Console.WriteLine("Parser Error : Not defined parsing condition in Entity Instance Name : " + currStatus);
                    break;
                }
                break;

            case TokenType.KEYWORD:
                switch (currStatus)
                {
                case ParserStatus.HEADER:
                    SimpleRecord aSimpleRecord = AddSimpleRecord(null, TokenToAdd.StringValue);
                    HeaderList.Add(aSimpleRecord);

                    Lexer.Tokenizer(DataStream);         // cleans semicolon at the end of header instance
                    break;

                case ParserStatus.DATA:
                    Console.WriteLine("Syntax Error : Instance without Entity Instance Name");
                    break;

                default:
                    Console.WriteLine("Parser Error : Not defined parsing condition in Keyword");
                    break;
                }
                break;

            case TokenType.DATA:
                Lexer.Tokenizer(DataStream);
                currStatus = ParserStatus.DATA;

                //theDataSet.aDataSectionList.Add(new DataSection());


                break;

            default:
                Console.WriteLine("not defined condition : " + TokenToAdd.TokenTypeValue.ToString());
                break;
            }
        }