Beispiel #1
0
 public EscapeData(EscapeType EscapeType, string MetaData)
 {
     if (EscapeType == EscapeType.NotAnEscape)
     {
         throw new PeterPiperArgumentException(String.Format("EscapeMetaData's EscapeType argument can not be set to '{0}', maybe you should choose '{1}'", EscapeType.NotAnEscape.ToString(), EscapeType.Unknown.ToString()));
     }
     this._EscapeType         = EscapeType;
     this._EscapeTypeCharater = Escapes.ResolveEscapeChararter(_EscapeType);
     this._MetaData           = MetaData;
 }
Beispiel #2
0
        public EscapeData(string ContentEscapeString)
        {
            if (ContentEscapeString == String.Empty)
            {
                throw new PeterPiperArgumentException("EscapeMetaData supplied string was empty, this is not allowed.");
            }

            this._EscapeType = Escapes.ResolveEscapeType(ContentEscapeString);
            if (_EscapeType != EscapeType.Unknown)
            {
                this._EscapeTypeCharater = Escapes.ResolveEscapeChararter(_EscapeType);
            }
            else
            {
                this._EscapeTypeCharater = ContentEscapeString.ToCharArray()[0].ToString();
            }

            if (ContentEscapeString.Length > 1)
            {
                if (ContentEscapeString.StartsWith("."))
                {
                    if (ContentEscapeString.Length > 3)
                    {
                        this._MetaData = ContentEscapeString.Substring(3, ContentEscapeString.Length - 3);
                    }
                    else
                    {
                        this._MetaData = String.Empty;
                    }
                }
                else
                {
                    this._MetaData = ContentEscapeString.Substring(1, ContentEscapeString.Length - 1);
                }
            }
            else
            {
                this._MetaData = String.Empty;
            }
        }