コード例 #1
0
        private void EnterText(string line)
        {
            int equalsIndex = line.IndexOf('=');

            if (equalsIndex < 0)
            {
                throw RuntimeFailure.PropertyDeclarationMissingKey();
            }

            string newKey   = null;
            string newValue = null;

            if (equalsIndex == line.Length - 1)
            {
                newKey   = line.Substring(0, line.Length - 1);
                newValue = string.Empty;
            }
            else
            {
                newKey   = line.Substring(0, equalsIndex);
                newValue = line.Substring(equalsIndex + 1).Trim();
            }

            _key      = newKey;
            _value    = StringUnescaper.Unescape(newValue);
            _nodeKind = PropertyNodeKind.Property;
        }
コード例 #2
0
 private void EnterCategory(string categoryDeclaration)
 {
     _key   = PropertiesReader.CategoryKey;
     _value = _category =
         categoryDeclaration.Substring(1, categoryDeclaration.Length - 2);
     _nodeKind = PropertyNodeKind.Category;
 }
コード例 #3
0
 private void EnterComment(string commentLine)
 {
     _nodeKind = PropertyNodeKind.Annotation;
     _key      = PropertiesReader.AnnotationKey;
     if (commentLine.Length == 1)
     {
         _value = string.Empty;
     }
     else
     {
         _value = commentLine.Substring(1);
     }
 }
コード例 #4
0
        private void EnterText(string line)
        {
            int equalsIndex = line.IndexOf('=');
            if (equalsIndex < 0) {
                throw RuntimeFailure.PropertyDeclarationMissingKey();
            }

            string newKey = null;
            string newValue = null;
            if (equalsIndex == line.Length - 1) {
                newKey = line.Substring(0, line.Length - 1);
                newValue = string.Empty;

            } else {
                newKey = line.Substring(0, equalsIndex);
                newValue = line.Substring(equalsIndex + 1).Trim();
            }

            this.key = newKey;
            string url;
            if (this.AllowUriDereferences && TryUrlSyntax(newValue, out url)) {
                this.value = this.streamContext.ChangePath(url).ReadAllText();

            } else {
                this.value = Utility.Unescape(newValue);
            }

            this.nodeKind = PropertyNodeKind.Property;
        }
コード例 #5
0
        private void EnterComment(string commentLine)
        {
            this.nodeKind = PropertyNodeKind.Annotation;
            this.key = PropertiesReader.AnnotationKey;
            if (commentLine.Length == 1) {
                this.value = string.Empty;

            } else {
                this.value = commentLine.Substring(1);
            }
        }
コード例 #6
0
 private void EnterCategory(string categoryDeclaration)
 {
     this.key = PropertiesReader.CategoryKey;
     this.value = this.category =
         categoryDeclaration.Substring(1, categoryDeclaration.Length - 2);
     this.nodeKind = PropertyNodeKind.Category;
 }