コード例 #1
0
ファイル: TagNXP.cs プロジェクト: JaegarSarauer/DCOMM-Assign2
 public NXPTag(TagType type)
 {
     tag = new Tag();
     tag.Type = type;
     password = new byte[4] { 0, 0, 0, 0 };
     retries = 1;
 }
コード例 #2
0
 /// <summary>
 /// Gets the next node after the start index
 /// </summary>
 /// <param name="code">The code.</param>
 /// <param name="startIndex">The index from which to start searching.</param>
 /// <param name="tagType">Returns next tag type</param>
 /// <param name="previousTag">The previous tag in the stack.</param>
 /// <param name="isParseContent">If the content of the last opening node should be parsed. In Html all the content is parsed.</param>        
 protected override SyntaxNode GetNextNode(string code, ref int startIndex, out TagType tagType, Tag previousTag, bool isParseContent)
 {
     string currentSubstring = code.Substring(startIndex);
     //in the regex I won't work with h1, h2... and such tags!
     string regexPattern = previousTag == null || isParseContent ? @"</?[a-zA-Z]+[^<>]*/?>" : @"<" + previousTag.CloseTag + @">";
     Match tag = Regex.Match(currentSubstring, regexPattern);
     Tag registeredTag = null;
     tagType = TagType.Open; //we just set it here and when needed will do it later
     while (tag.Success && (registeredTag = GetTagByValue(tag.Value)) == null)//getting tags, but they are not registered.
     {
         tag = tag.NextMatch();
     }
     if (!tag.Success) //didn't find a registered tag until the end - return everything left as a text node
     {
         startIndex += currentSubstring.Length;
         return new TextSyntaxNode(currentSubstring);
     }
     if (tag.Index == 0) //if the string given to the matcher was something like '<strong>...'
     {
         if (tag.Value.StartsWith("</"))
         {
             tagType = TagType.Close;
         }
         else if (tag.Value.EndsWith("/>"))
         {
             tagType = TagType.SelfClose;
         }
         startIndex += tag.Value.Length;
         return new HtmlSyntaxNode(registeredTag as HtmlTag, tag.Value);
     }
     //there has been some text before the tag that I found...
     startIndex += tag.Index; //move the start index for the other iterations
     return new TextSyntaxNode(currentSubstring.Substring(0, tag.Index));
 }
コード例 #3
0
    protected ITag ReadTag(ReadTagOptions options, TagType defaultTagType)
    {
      ITag result;
      TagType type;

      this.InitializeReader();

      type = this.ReadTagType(defaultTagType);
      result = TagFactory.CreateTag(type);

      if ((options & ReadTagOptions.IgnoreName) == 0)
      {
        string name;

        name = _reader.GetAttribute("name");
        if (string.IsNullOrEmpty(name))
        {
          name = _reader.Name;
        }

        result.Name = name;
      }

      if ((options & ReadTagOptions.IgnoreValue) == 0)
      {
        result.Value = this.ReadTagValue(result);
      }

      return result;
    }
コード例 #4
0
 public override bool CanCreateTag(TagType type)
 {
     if (Tag.Count > 0)
         return Tag.ValueType == type;
     else
         return Enum.IsDefined(typeof(TagType), type) && type != TagType.TAG_END;
 }
コード例 #5
0
ファイル: TestMp3File.cs プロジェクト: Confirmit/Students
 public string this[TagType type]
 {
     get { return GetId3Data()[type]; }
     set
     {
         switch (type)
         {
             case TagType.Artist:
                 Artist = value;
                 break;
             case TagType.Id:
                 TrackId = value;
                 break;
             case TagType.Title:
                 Title = value;
                 break;
             case TagType.Album:
                 Album = value;
                 break;
             case TagType.Genre:
                 Genre = value;
                 break;
             case TagType.Year:
                 Year = value;
                 break;
             case TagType.Comment:
                 Comment = value;
                 break;
             default:
                 throw new ArgumentOutOfRangeException(type.ToString(), type, null);
         }
     }
 }
コード例 #6
0
        //TODO: move to separate class {READY}
        public UserData GetInfoFromUser(TagType tag, Diff diff, IMp3File file, ICommunication communication)
        {
            communication.SendMessage($"File: {file.FilePath}");
            communication.SendMessage($"There is a problem with tag \"{tag}\". ");
            communication.SendMessage(
                $"You can enter tag from: \n\t1) File name (Data: \"{diff.FileNameValue}\"), \n\t2) Mp3 Tags (Data: \"{diff.TagValue}\"), \n\t3) Manual");

            while (true)
            {
                communication.SendMessage("Your choise (number): ");
                SyncActions inputData;
                var choiseCorrect = Enum.TryParse(communication.GetResponse(), out inputData);
                if (!choiseCorrect)
                {
                    communication.SendMessage("Wrong input!");
                    communication.SendMessage("You sholud enter number with action!");
                    continue;
                }

                switch (inputData)
                {
                    case SyncActions.FromFileName:
                        return new UserData(inputData, diff.FileNameValue);
                    case SyncActions.FromTags:
                        return new UserData(inputData, diff.TagValue);
                    case SyncActions.Manual:
                        communication.SendMessage("Enter text for tag \"" + tag + "\"");
                        return new UserData(inputData, communication.GetResponse());
                }
            }
        }
コード例 #7
0
ファイル: OpenTag.cs プロジェクト: mclark4386/SaintCoinach
 public OpenTag(TagType tag, IEnumerable<IExpression> arguments) {
     _Tag = tag;
     if (arguments == null)
         _Arguments = new IExpression[0];
     else
         _Arguments = arguments.ToArray();
 }
コード例 #8
0
ファイル: TagNodeByte.cs プロジェクト: tofurama3000/Substrate
 /// <summary>
 /// Checks if the node is castable to another node of a given tag type.
 /// </summary>
 /// <param name="type">An NBT tag type.</param>
 /// <returns>Status indicating whether this object could be cast to a node type represented by the given tag type.</returns>
 public override bool IsCastableTo (TagType type)
 {
     return (type == TagType.TAG_BYTE ||
         type == TagType.TAG_SHORT ||
         type == TagType.TAG_INT ||
         type == TagType.TAG_LONG);
 }
コード例 #9
0
 /// <summary>
 /// Gets the next node after the start index.
 /// </summary>
 /// <param name="code">The code.</param>
 /// <param name="startIndex">The index from which to start searching.</param>
 /// <param name="tagType">Returns the next tag type</param>
 /// <param name="previousTag">The previous tag in the stack.</param>
 /// <param name="isParseContent">If the content of the last opening node should be parsed.</param>
 /// <returns></returns>
 protected override SyntaxNode GetNextNode(string code, ref int startIndex, out TagType tagType, Tag previousTag, bool isParseContent)
 {
     string currentSubstring = code.Substring(startIndex);
     string regexPattern = previousTag == null || isParseContent ? @"\[/?[a-z*][a-z0-9]*(=[^\[\]\n\r\v\f]+)?\]" : @"\[" + previousTag.CloseTag + @"\]"; //the close tag has /
     Match tag = Regex.Match(currentSubstring, regexPattern);
     Tag registeredTag = null;
     tagType = TagType.Open; //we just set it here and when needed will do it later
     while (tag.Success && (registeredTag = GetTagByValue(tag.Value)) == null)//getting tags, but they are not registered.
     {
         tag = tag.NextMatch();
     }
     if (!tag.Success) //didn't find a registered tag until the end - return everything left as a text node
     {
         startIndex += currentSubstring.Length;
         return new TextSyntaxNode(currentSubstring);
     }
     if (tag.Index == 0) //if the string given to the matcher was something like '[b]...'
     {
         if (tag.Value.StartsWith("[/")) tagType = TagType.Close;
         startIndex += tag.Value.Length;
         return new BBCodeSyntaxNode(registeredTag as BBTag, tag.Value);
     }
     //there has been some text before the tag that I found...
     startIndex += tag.Index; //move the start index for the other iterations
     return new TextSyntaxNode(currentSubstring.Substring(0, tag.Index));
 }
コード例 #10
0
ファイル: TagData.cs プロジェクト: Kuzq/gitter
        public TagData(string name, Hash sha1, TagType tagType)
        {
            Verify.Argument.IsNeitherNullNorWhitespace(name, "name");

            _name    = name;
            _sha1    = sha1;
            _tagType = tagType;
        }
コード例 #11
0
ファイル: TagsManager.cs プロジェクト: higankanshi/xZune.Bass
        public static TagsManager CreateFormFile(String file, TagType type = TagType.Automatic, bool parseTags = true)
        {
            var handle = TagsLibCoreModule.CreateFunction.Delegate();
            var result = new TagsManager(handle);

            TagsLibCoreModule.LoadTagsFunction.Delegate(handle, file, type, parseTags);

            return result;
        }
コード例 #12
0
ファイル: TagsManager.cs プロジェクト: higankanshi/xZune.Bass
        public static TagsManager CreateFormMemory(IntPtr memory, ulong size, TagType type = TagType.Automatic, bool parseTags = true)
        {
            var handle = TagsLibCoreModule.CreateFunction.Delegate();
            var result = new TagsManager(handle);

            TagsLibCoreModule.LoadTagsFormMemoryFunction.Delegate(handle, memory, size, type, parseTags);

            return result;
        }
コード例 #13
0
ファイル: IfElement.cs プロジェクト: drmcknight/SaintCoinach
 public IfElement(TagType tag, INode condition, INode trueValue, INode falseValue)
 {
     if (condition == null)
         throw new ArgumentNullException("condition");
     _Tag = tag;
     _Condition = condition;
     _TrueValue = trueValue;
     _FalseValue = falseValue;
 }
コード例 #14
0
ファイル: CreateNode.cs プロジェクト: hach-que/NBTExplorer
        public CreateNodeForm(TagType tagType, bool hasName)
        {
            InitializeComponent();

            _type = tagType;
            _hasName = hasName;

            SetNameBoxState();
            SetSizeBoxState();
        }
コード例 #15
0
 public SwitchElement(TagType tag, INode caseSwitch, IDictionary<int, INode> cases)
 {
     if (caseSwitch == null)
         throw new ArgumentNullException("caseSwitch");
     if (cases == null)
         throw new ArgumentNullException("cases");
     _Tag = tag;
     _CaseSwitch = caseSwitch;
     _Cases = new ReadOnlyDictionary<int, INode>(cases);
 }
コード例 #16
0
ファイル: TagDao.cs プロジェクト: huchao007/bbsmax
		public override TagCollection GetUserTags(int userID, TagType type)
		{
			switch (type)
			{
				case TagType.Blog:
					return GetUserBlogTags(userID);

				default:
					return new TagCollection();
			}
		}
コード例 #17
0
ファイル: Tag.cs プロジェクト: ridhouan/teamlab.v6.5
 public Tag(string name, TagType type, Guid owner, FileEntry entry)
 {
     TagName = name;
     TagType = type;
     Owner = owner;
     if (entry != null)
     {
         EntryId = entry.ID;
         EntryType = entry is File ? FileEntryType.File : FileEntryType.Folder;
     }
 }
コード例 #18
0
        public override bool CreateNode(TagType type)
        {
            if (!CanCreateTag(type))
                return false;

            if (Tag.Count == 0) {
                Tag.ChangeValueType(type);
            }

            AppendTag(TagDataNode.DefaultTag(type));
            return true;
        }
コード例 #19
0
ファイル: TagDao.cs プロジェクト: ridhouan/teamlab.v6.5
        public IEnumerable<Tag> GetTags(Guid owner, TagType tagType)
        {
            var q = Query("files_tag t")
                .InnerJoin("files_tag_link l", Exp.EqColumns("l.tag_id", "t.id"))
                .Select("t.name", "t.flag", "t.owner", "entry_id", "entry_type", "t.id")
                .Where("l.tenant_id", TenantID)
                .Where("t.owner", owner.ToString())
                .Where("t.flag", (int)tagType);

            return SelectTagByQuery(q);

        }
コード例 #20
0
ファイル: CompoundTag.cs プロジェクト: stwalkerster/LibNBT
        public CompoundTag(StreamReader sr, string name, TagType type)
            : base(sr, name, type)
        {
            while (true)
            {
                var t = parse(sr);

                if (t.type == TagType.TagEnd) break;

                subtags.Add((NamedTag) t);
            }
        }
コード例 #21
0
ファイル: TagDao.cs プロジェクト: vlslavik/teamlab.v7.5
        public IEnumerable<Tag> GetTags(object entryID, FileEntryType entryType, TagType tagType)
        {
            var q = Query("files_tag t")
                .InnerJoin("files_tag_link l", Exp.EqColumns("l.tag_id", "t.id"))
                .Select("t.name", "t.flag", "t.owner", "entry_id", "entry_type", "tag_count", "t.id")
                .Where("l.tenant_id", TenantID)
                .Where("l.entry_type", (int) entryType)
                .Where(Exp.Eq("l.entry_id", MappingID(entryID)))
                .Where("t.flag", (int) tagType);

            return SelectTagByQuery(q);
        }
コード例 #22
0
 public static String GetFormDataTag(TagType type, IForm fd)
 {
     switch (type)
     {
         case TagType.Tile:
             return String.Format("tile-data-{0}-form_type-{1}", fd.id, fd.form.form_type_id);
         case TagType.Document:
             return String.Format("doc-data-{0}-form_type-{1}", fd.id, fd.form.form_type_id);
         case TagType.Container:
             return String.Format("container-data-{0}-form_type-{1}", fd.id, fd.form.form_type_id);
         default:
             return null;
     }
 }
コード例 #23
0
ファイル: TagDao.cs プロジェクト: vlslavik/teamlab.v7.5
        public IEnumerable<Tag> GetTags(string[] names, TagType tagType)
        {
            if (names == null) throw new ArgumentNullException("names");

            var q = Query("files_tag t")
                .InnerJoin("files_tag_link l", Exp.EqColumns("l.tag_id", "t.id"))
                .Select("t.name", "t.flag", "t.owner", "entry_id", "entry_type", "tag_count", "t.id")
                .Where("l.tenant_id", TenantID)
                .Where("t.owner", Guid.Empty.ToString())
                .Where(Exp.In("t.name", names))
                .Where("t.flag", (int) tagType);

            return SelectTagByQuery(q);
        }
コード例 #24
0
 public static string LKTag(TagType eTagType, string context, IDictionary<string, object> htmlattributes)
 {
     TagBuilder tag = new TagBuilder(eTagType.ToString().ToLower());
     tag.MergeAttributes(htmlattributes);
     tag.InnerHtml = context;
     string sHtml = "";
     switch (eTagType)
     {
         case TagType.IMG:
             sHtml = tag.ToString(TagRenderMode.SelfClosing);
             break;
         default:
             sHtml = tag.ToString(TagRenderMode.Normal);
             break;
     }
     return sHtml;
 }
コード例 #25
0
ファイル: NamedTag.cs プロジェクト: stwalkerster/LibNBT
        public static NamedTag parse(StreamReader sr, TagType type)
        {
            var name = "";

            //read the name length
            var buffer = new char[2];
            sr.ReadBlock(buffer, 0, 2);
            var bytebuf = new byte[] {(byte) buffer[1], (byte) buffer[0]};
            short length = BitConverter.ToInt16(bytebuf, 0);

            buffer = new char[length];
            sr.ReadBlock(buffer, 0, length);
            name = new string(buffer);

            Type t = GetClrTypeForTag(type);
            return (NamedTag)Activator.CreateInstance(t, sr, name, type);
        }
コード例 #26
0
ファイル: TagDao.cs プロジェクト: haoasqui/ONLYOFFICE-Server
        public IEnumerable<Tag> GetTags(TagType tagType, params FileEntry[] fileEntries)
        {
            var filesId = fileEntries.Where(e => e is File).Select(e => MappingID(e.ID)).ToArray();
            var foldersId = fileEntries.Where(e => e is Folder).Select(e => MappingID(e.ID)).ToArray();

            var q = Query("files_tag t")
                .InnerJoin("files_tag_link l",
                           Exp.EqColumns("l.tenant_id", "t.tenant_id") &
                           Exp.EqColumns("l.tag_id", "t.id"))
                .Select("t.name", "t.flag", "t.owner", "entry_id", "entry_type", "tag_count", "t.id")
                .Where("l.tenant_id", TenantID)
                .Where((Exp.Eq("l.entry_type", (int)FileEntryType.File) & Exp.In("l.entry_id", filesId))
                       | (Exp.Eq("l.entry_type", (int)FileEntryType.Folder) & Exp.In("l.entry_id", foldersId)))
                .Where("t.flag", (int)tagType);

            return SelectTagByQuery(q);
        }
コード例 #27
0
ファイル: DefineTextTag.cs プロジェクト: Hamsand/Swf2XNA
        public DefineTextTag(SwfReader r, bool useAlpha)
        {
            if (useAlpha)
            {
                tagType = TagType.DefineText2;
            }
            CharacterId = r.GetUI16();
            TextBounds = new Rect(r);
            TextMatrix = new Matrix(r);
            glyphBits = (uint)r.GetByte();
            advanceBits = (uint)r.GetByte();

            while (r.PeekByte() != 0x00)
            {
                TextRecords.Add(new TextRecord(r, glyphBits, advanceBits, useAlpha));
            }
            byte end = r.GetByte();
        }
コード例 #28
0
 public static String GetTag(TagType type, object obj, string addon = "")
 {
     var tag = String.Format("{0}-{1}", (
         obj is region ? REGION + "-" + ((region)obj).region_id :
         obj is edu ? EDU + "-"+((edu)obj).edu_id 
         : obj is municipality ? MUNICIPALITY + "-"+((municipality)obj).municipality_id 
         : obj is edu_kind ? EDU_TYPE + "-"+((edu_kind)obj).edu_kind_id : "ent"), addon);
     switch (type)
     {
         case TagType.Tile:
             return "tile-" + tag;
         case TagType.Document:
             return "doc-" + tag;
         case TagType.Container:
             return "container-" + tag;
         default:
             return null;
     }
 }
コード例 #29
0
        public override bool VisitMethodDecl(Method method)
        {
            if (!method.IsConstructor)
                return false;
            if (method.IsCopyConstructor)
                return false;
            if (method.Parameters.Count != 1)
                return false;
            var parameter = method.Parameters[0];
            var parameterType = parameter.Type as PointerType;
            if (parameterType == null)
                return false;
            if (!parameterType.IsReference)
                return false;
            var qualifiedPointee = parameterType.QualifiedPointee;
            Class castFromClass;
            if (!qualifiedPointee.Type.TryGetClass(out castFromClass))
                return false;
            var castToClass = method.OriginalNamespace as Class;
            if (castToClass == null)
                return false;
            if (castFromClass == castToClass)
                return false;

            var operatorKind = method.IsExplicit
                ? CXXOperatorKind.ExplicitConversion
                : CXXOperatorKind.Conversion;
            var castToType = new TagType(castToClass);
            var qualifiedCastToType = new QualifiedType(castToType);
            var conversionOperator = new Method()
            {
                Name = Operators.GetOperatorIdentifier(operatorKind),
                Namespace = castFromClass,
                Kind = CXXMethodKind.Conversion,
                IsSynthetized = true,
                ConversionType = qualifiedCastToType,
                ReturnType = qualifiedCastToType
            };
            conversionOperator.OperatorKind = operatorKind;

            castFromClass.Methods.Add(conversionOperator);
            return true;
        }
コード例 #30
0
        public override bool CreateNode(TagType type)
        {
            if (!CanCreateTag(type))
                return false;

            if (FormRegistry.CreateNode != null) {
                CreateTagFormData data = new CreateTagFormData() {
                    TagType = type, HasName = true,
                };
                data.RestrictedNames.AddRange(_container.TagNamesInUse);

                if (FormRegistry.CreateNode(data)) {
                    AddTag(data.TagNode, data.TagName);
                    return true;
                }
            }

            return false;
        }
コード例 #31
0
ファイル: ProviderTagDao.cs プロジェクト: ztcyun/AppServer
 public IEnumerable <Tag> GetTags(TagType tagType, IEnumerable <FileEntry <string> > fileEntries)
 {
     return(TagDao.GetTags(tagType, fileEntries));
 }
コード例 #32
0
        public virtual void RenderBeginTag(HtmlTextWriterTag tagKey)
        {
            this.TagKey = tagKey;
            bool renderTag = true;

            if (_isDescendant)
            {
                renderTag = OnTagRender(_tagName, _tagKey);

                // Inherited renderers will be expecting to be able to filter any of the attributes at this point
                FilterAttributes();

                // write text before begin tag
                string textBeforeTag = RenderBeforeTag();
                if (textBeforeTag != null)
                {
                    if (tabsPending)
                    {
                        OutputTabs();
                    }
                    writer.Write(textBeforeTag);
                }
            }

            // gather information about this tag.
            TagInformation tagInfo      = _tagNameLookupArray[_tagIndex];
            TagType        tagType      = tagInfo.tagType;
            bool           renderEndTag = renderTag && (tagType != TagType.NonClosing);
            string         endTag       = renderEndTag ? tagInfo.closingTag : null;

            // write the begin tag
            if (renderTag)
            {
                if (tabsPending)
                {
                    OutputTabs();
                }
                writer.Write(TagLeftChar);
                writer.Write(_tagName);

                for (int i = 0; i < _attrCount; i++)
                {
                    RenderAttribute attr = _attrList[i];
                    writer.Write(SpaceChar);
                    writer.Write(attr.name);
                    if (attr.value != null)
                    {
                        writer.Write(EqualsDoubleQuoteString);

                        string attrValue = attr.value;
                        if (attr.isUrl)
                        {
                            if (attr.key != HtmlTextWriterAttribute.Href || !attrValue.StartsWith("javascript:", StringComparison.Ordinal))
                            {
                                attrValue = EncodeUrl(attrValue);
                            }
                        }
                        if (attr.encode)
                        {
                            WriteHtmlAttributeEncode(attrValue);
                        }
                        else
                        {
                            writer.Write(attrValue);
                        }
                        writer.Write(DoubleQuoteChar);
                    }
                }


                if (tagType == TagType.NonClosing)
                {
                    writer.Write(SelfClosingTagEnd);
                }
                else
                {
                    writer.Write(TagRightChar);
                }
            }

            string textBeforeContent = RenderBeforeContent();

            if (textBeforeContent != null)
            {
                if (tabsPending)
                {
                    OutputTabs();
                }
                writer.Write(textBeforeContent);
            }

            // write text before the content
            if (renderEndTag)
            {
                if (tagType == TagType.Inline)
                {
                    _inlineCount += 1;
                }
                else
                {
                    // writeline and indent before rendering content
                    WriteLine();
                    Indent++;
                }
                // Manually build end tags for unknown tag types.
                if (endTag == null)
                {
                    endTag = EndTagLeftChars + _tagName + TagRightChar.ToString();
                }
            }

            if (_isDescendant)
            {
                // append text after the tag
                string textAfterTag = RenderAfterTag();
                if (textAfterTag != null)
                {
                    endTag = (endTag == null) ? textAfterTag : textAfterTag + endTag;
                }

                // build end content and push it on stack to write in RenderEndTag
                // prepend text after the content
                string textAfterContent = RenderAfterContent();
                if (textAfterContent != null)
                {
                    endTag = (endTag == null) ? textAfterContent : textAfterContent + endTag;
                }
            }

            // push end tag onto stack
            PushEndTag(endTag);

            // flush attribute and style lists for next tag
            _attrCount = 0;
        }
コード例 #33
0
 public IEnumerable <Tag> GetTags(Guid owner, TagType tagType)
 {
     return(null);
 }
コード例 #34
0
 public IEnumerable <Tag> GetTags(string[] names, TagType tagType)
 {
     return(new List <Tag>());
 }
コード例 #35
0
 public override bool CanCreateTag(TagType type)
 {
     return(_tree != null && _tree.Root != null && Enum.IsDefined(typeof(TagType), type) && type != TagType.TAG_END);
 }
コード例 #36
0
 public IEnumerable <Tag> GetTags(TagType tagType, params FileEntry[] fileEntries)
 {
     return(null);
 }
コード例 #37
0
 /// <summary>
 /// Constructs a new <see cref="SchemaNodeList"/> with additional options.
 /// </summary>
 /// <param name="name">The name of the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="type">The type of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="options">One or more option flags modifying the processing of this node.</param>
 public SchemaNodeList(string name, TagType type, SchemaOptions options)
     : base(name, options)
 {
     _type = type;
 }
コード例 #38
0
ファイル: ProviderTagDao.cs プロジェクト: ztcyun/AppServer
 public IEnumerable <Tag> GetTags(Guid subject, TagType tagType, IEnumerable <FileEntry <string> > fileEntries)
 {
     return(TagDao.GetTags(subject, tagType, fileEntries));
 }
コード例 #39
0
 /// <summary>
 /// Constructs a new <see cref="SchemaNodeList"/> representing a <see cref="TagNodeList"/> named <paramref name="name"/> containing items of type <paramref name="type"/> matching the given schema.
 /// </summary>
 /// <param name="name">The name of the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="type">The type of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="subschema">A <see cref="SchemaNode"/> representing a schema to verify against items contained in the corresponding <see cref="TagNodeList"/>.</param>
 public SchemaNodeList(string name, TagType type, SchemaNode subschema)
     : base(name)
 {
     _type      = type;
     _subschema = subschema;
 }
コード例 #40
0
ファイル: ProviderTagDao.cs プロジェクト: ztcyun/AppServer
 public IEnumerable <Tag> GetTags(string entryID, FileEntryType entryType, TagType tagType)
 {
     return(TagDao.GetTags(entryID, entryType, tagType));
 }
コード例 #41
0
 public IfEqualsElement(TagType tag, INode leftValue, INode rightValue, INode trueValue, INode falseValue)
     : base(tag, new Comparison(DecodeExpressionType.Equal, leftValue, rightValue), trueValue, rightValue)
 {
 }
コード例 #42
0
ファイル: TypeExtensions.cs プロジェクト: zanjs/CppSharp
        public static bool TryGetDeclaration <T>(this Type t, out T decl, T value = null) where T : Declaration
        {
            t = t.Desugar();

            TagType tagType = null;
            var     type    = t as TemplateSpecializationType;

            if (type != null)
            {
                if (type.IsDependent)
                {
                    if (type.Template is TypeAliasTemplate)
                    {
                        type.Desugared.Type.TryGetDeclaration(out decl, value);
                        decl = decl as T;
                        return(decl != null);
                    }

                    var classTemplate = type.Template as ClassTemplate;
                    if (classTemplate != null)
                    {
                        var templatedClass = classTemplate.TemplatedClass;
                        decl = templatedClass.CompleteDeclaration == null
                            ? templatedClass as T
                            : (T)templatedClass.CompleteDeclaration;
                        if (decl != null)
                        {
                            if (value != null)
                            {
                                type.Template = new ClassTemplate {
                                    TemplatedDecl = value
                                }
                            }
                            ;
                            return(true);
                        }
                        return(false);
                    }

                    var templateTemplateParameter = type.Template as TemplateTemplateParameter;
                    if (templateTemplateParameter != null)
                    {
                        return((decl = templateTemplateParameter.TemplatedDecl as T) != null);
                    }
                }
                tagType = (type.Desugared.Type.GetFinalPointee() ?? type.Desugared.Type) as TagType;
            }
            else
            {
                tagType = t as TagType;
            }

            if (tagType != null)
            {
                decl = tagType.Declaration as T;
                if (decl != null)
                {
                    if (value != null)
                    {
                        tagType.Declaration = value;
                    }
                    return(true);
                }
                return(false);
            }

            decl = null;
            return(false);
        }
コード例 #43
0
        public string Parse(string template, Dictionary <string, string> context)
        {
            if (context == null)
            {
                context = new Dictionary <string, string>();
            }

            if (template == null)
            {
                return("");
            }

            State   state        = State.ECHO;
            TagType tagType      = TagType.NONE;
            string  retval       = "";
            string  tag          = "";
            string  subTemplate  = "";
            string  temp         = "";
            string  unhandledTag = "";
            int     nestingLevel = 0;

            foreach (char c in template)
            {
                if (tagType == TagType.NONE)
                {
                    switch (state)
                    {
                    case State.ERROR:
                    {
                        break;
                    }

                    case State.ECHO:
                    {
                        if (c == '{')
                        {
                            temp          = "{";
                            unhandledTag  = "";
                            unhandledTag += c;
                            state         = State.TAG_OPENING;
                        }
                        else
                        {
                            retval += c;
                        }
                        break;
                    }

                    case State.TAG_OPENING:
                    {
                        if (c == '=')
                        {
                            if (tagType == TagType.NONE)
                            {
                                tagType = TagType.SUBSTITUTION;
                            }
                            unhandledTag += c;
                            state         = State.SKIP;
                        }
                        else if (c == '@')
                        {
                            unhandledTag += c;
                            tagType       = TagType.ACTION;
                            state         = State.SKIP;
                            nestingLevel++;
                        }
                        else if (c == '{')
                        {
                            unhandledTag  = "";
                            unhandledTag += c;
                            retval       += temp;
                        }
                        else
                        {
                            retval += temp;
                            retval += c;
                            if (tagType != TagType.ACTION)
                            {
                                state = State.ECHO;
                            }
                        }
                        break;
                    }
                    }
                }
                else if (tagType == TagType.SUBSTITUTION)
                {
                    switch (state)
                    {
                    case State.ERROR:
                    {
                        break;
                    }

                    case State.SKIP:
                    {
                        unhandledTag += c;
                        if ("\r\n\t ".IndexOf(c) == -1)
                        {
                            state = State.READ_TAG_DATA;
                            tag  += c;
                        }
                        break;
                    }

                    case State.READ_TAG_DATA:
                    {
                        unhandledTag += c;
                        if (c == ':')
                        {
                            state = State.TAG_CLOSING;
                            temp  = ":";
                        }
                        else
                        {
                            tag += c;
                        }
                        break;
                    }

                    case State.TAG_CLOSING:
                    {
                        if (c == '}')
                        {
                            if (context.ContainsKey(tag.Trim()))
                            {
                                retval += context[tag.Trim()];
                            }
                            else
                            {
                                retval += unhandledTag + c;
                            }
                            state        = State.ECHO;
                            tag          = "";
                            unhandledTag = "";
                            tagType      = TagType.NONE;
                        }
                        else
                        {
                            unhandledTag += temp + c;
                            tag          += temp + c;
                            state         = State.READ_TAG_DATA;
                        }
                        break;
                    }
                    }
                }
                else if (tagType == TagType.ACTION)
                {
                    switch (state)
                    {
                    case State.ERROR:
                    {
                        break;
                    }

                    case State.SKIP:
                    {
                        unhandledTag += c;
                        if ("\r\n\t ".IndexOf(c) == -1)
                        {
                            state = State.READ_TAG_DATA;
                            tag  += c;
                        }
                        break;
                    }

                    case State.TAG_OPENING:
                    {
                        unhandledTag += c;
                        subTemplate  += temp + c;
                        if (c == '@' || c == '=')
                        {
                            nestingLevel++;
                        }
                        state = State.READ_SUB_TEMPLATE;
                        break;
                    }

                    case State.READ_SUB_TEMPLATE:
                    {
                        unhandledTag += c;
                        if (c == ':')
                        {
                            temp  = ":";
                            state = State.TAG_CLOSING;
                        }
                        else if (c == '{')
                        {
                            temp  = "{";
                            state = State.TAG_OPENING;
                        }
                        else
                        {
                            subTemplate += c;
                        }
                        break;
                    }

                    case State.READ_TAG_DATA:
                    {
                        unhandledTag += c;
                        if ("\r\n\t{ ".IndexOf(c) != -1)
                        {
                            if (c == '{')
                            {
                                temp  = "{";
                                state = State.TAG_OPENING;
                            }
                            else
                            {
                                subTemplate += c;
                                state        = State.READ_SUB_TEMPLATE;
                            }
                        }
                        else
                        {
                            tag += c;
                        }
                        break;
                    }

                    case State.TAG_CLOSING:
                    {
                        unhandledTag += c;
                        if (c == '}')
                        {
                            nestingLevel--;
                            if (nestingLevel == 0)
                            {
                                // TODO :: we need to do the callback
                                if (TemplateActions.ContainsKey(tag) == true)
                                {
                                    retval += TemplateActions[tag].Run(subTemplate, context);
                                    //retval += unhandledTag + c;
                                }
                                else
                                {
                                    retval += unhandledTag + c;
                                }
                                tag          = "";
                                subTemplate  = "";
                                temp         = "";
                                unhandledTag = "";
                                state        = State.ECHO;
                                tagType      = TagType.NONE;
                            }
                            else
                            {
                                subTemplate += temp + c;
                                state        = State.READ_SUB_TEMPLATE;
                            }
                        }
                        else
                        {
                            state        = State.READ_SUB_TEMPLATE;
                            subTemplate += temp + c;
                        }
                        break;
                    }
                    }
                }
            }

            if (state != State.ECHO)
            {
                throw new Exception(string.Format("Parser Finished in a Bad STATE {0}", state));
            }
            return(retval);
        }
コード例 #44
0
 /// <summary>
 /// Constructs a new <see cref="SchemaNodeList"/> representing a <see cref="TagNodeList"/> named <paramref name="name"/> containing <paramref name="length"/> items of type <paramref name="type"/>.
 /// </summary>
 /// <param name="name">The name of the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="type">The type of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="length">The number of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 public SchemaNodeList(string name, TagType type, int length)
     : base(name)
 {
     _type   = type;
     _length = length;
 }
コード例 #45
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((Name != null ? Name.GetHashCode() : 0) * 397) ^ (TagType != null ? TagType.GetHashCode() : 0));
     }
 }
コード例 #46
0
 public IEnumerable <Tag> GetTags(object entryID, FileEntryType entryType, TagType tagType)
 {
     return(null);
 }
コード例 #47
0
 public TagInformation(string name, TagType tagType, string closingTag)
 {
     this.name       = name;
     this.tagType    = tagType;
     this.closingTag = closingTag;
 }
コード例 #48
0
 /// <summary>
 /// Constructs a new <see cref="SchemaNodeList"/> representing a <see cref="TagNodeList"/> named <paramref name="name"/> containing items of type <paramref name="type"/>.
 /// </summary>
 /// <param name="name">The name of the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="type">The type of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 public SchemaNodeList(string name, TagType type)
     : base(name)
 {
     _type = type;
 }
コード例 #49
0
ファイル: TagNodeFloat.cs プロジェクト: JLChnToZ/Substrate
 /// <summary>
 /// Checks if the node is castable to another node of a given tag type.
 /// </summary>
 /// <param name="type">An NBT tag type.</param>
 /// <returns>Status indicating whether this object could be cast to a node type represented by the given tag type.</returns>
 public override bool IsCastableTo(TagType type)
 {
     return(type == TagType.TAG_FLOAT ||
            type == TagType.TAG_DOUBLE);
 }
コード例 #50
0
 public IEnumerable <Tag> GetTags(TagType tagType, IEnumerable <FileEntry <string> > fileEntries)
 {
     return(new List <Tag>());
 }
コード例 #51
0
        void TagParsed(ILocation location, TagType tagtype, string tagId, TagAttributes attributes)
        {
            switch (tagtype)
            {
            case TagType.Close:
                TagNode tn = currentNode as TagNode;
                if (tn == null)
                {
                    errors.Add(new ParseException(location, "Closing tag '" + tagId + "' does not match an opening tag."));
                }
                else
                {
                    if (tn.TagName == tagId)
                    {
                        tn.EndLocation = location;
                        currentNode    = currentNode.Parent;
                        tn.Close();
                    }
                    else
                    {
                        errors.Add(new ParseException(location, "Closing tag '" + tagId + "' does not match opening tag '" + tn.TagName + "'."));
                        currentNode = currentNode.Parent;
                        TagParsed(location, TagType.Close, tagId, null);
                    }
                }
                break;

            case TagType.CodeRender:
            case TagType.CodeRenderExpression:
            case TagType.DataBinding:
                try
                {
                    AddtoCurrent(location, new ExpressionNode(location, tagId, tagtype == TagType.CodeRenderExpression));
                }
                catch (ParseException ex)
                {
                    errors.Add(ex);
                }
                break;

            case TagType.Directive:
                try
                {
                    AddtoCurrent(location, new DirectiveNode(location, tagId, attributes));
                }
                catch (ParseException ex)
                {
                    errors.Add(ex);
                }
                break;

            case TagType.Include:
                throw new NotImplementedException("Server-side includes have not yet been implemented: " + location.PlainText);

            case TagType.ServerComment:
                //FIXME: the parser doesn't actually return these
                throw new NotImplementedException("Server comments have not yet been implemented: " + location.PlainText);

            case TagType.SelfClosing:
                try
                {
                    tn = new TagNode(location, tagId, attributes);
                    AddtoCurrent(location, tn);
                    tn.Close();
                }
                catch (ParseException ex)
                {
                    errors.Add(ex);
                }
                break;

            case TagType.Tag:
                try
                {
                    //HACK: implicit close on block level in HTML4
                    TagNode prevTag = currentNode as TagNode;
                    if (prevTag != null)
                    {
                        if (Array.IndexOf(implicitCloseOnBlock, prevTag.TagName.ToLowerInvariant()) > -1 &&
                            Array.IndexOf(blockLevel, tagId.ToLowerInvariant()) > -1)
                        {
                            errors.Add(new ParseException(location, "Unclosed " + prevTag.TagName + " tag. Assuming implicitly closed by block level tag."));
                            prevTag.Close();
                            currentNode = currentNode.Parent;
                        }
                    }

                    //create and add the new tag
                    TagNode child = new TagNode(location, tagId, attributes);
                    AddtoCurrent(location, child);

                    //HACK: implicitly closing tags in HTML4
                    if (Array.IndexOf(implicitSelfClosing, tagId.ToLowerInvariant()) > -1)
                    {
                        errors.Add(new ParseException(location, "Unclosed " + tagId + " tag. Assuming implicitly closed."));
                        child.Close();
                    }
                    else
                    {
                        currentNode = child;
                    }
                }
                catch (ParseException ex)
                {
                    errors.Add(ex);
                }
                break;

            case TagType.Text:
                //FIXME: the parser doesn't actually return these
                throw new NotImplementedException("Text tagtypes have not yet been implemented: " + location.PlainText);
            }
        }
コード例 #52
0
        //  [CheckPermission(PageId.Tag, Permission.View)]
        public async Task <IActionResult> GetListSubject(string tenantId, string languageId, TagType type, string subjectId)
        {
            var result = await _tagService.GetListSubject(tenantId, languageId, type, subjectId);

            return(Ok(result));
        }
コード例 #53
0
ファイル: ProviderTagDao.cs プロジェクト: ztcyun/AppServer
 public IEnumerable <Tag> GetTags(Guid owner, TagType tagType)
 {
     return(TagDao.GetTags(owner, tagType));
 }
コード例 #54
0
ファイル: CloseTag.cs プロジェクト: alphaONE2/saint-coinach
 public CloseTag(TagType tag)
 {
     _Tag = tag;
 }
コード例 #55
0
 public IEnumerable <Tag> GetTags(Guid owner, TagType tagType)
 {
     return(new List <Tag>());
 }
コード例 #56
0
ファイル: ProviderTagDao.cs プロジェクト: ztcyun/AppServer
 public IEnumerable <Tag> GetTags(string[] names, TagType tagType)
 {
     return(TagDao.GetTags(names, tagType));
 }
コード例 #57
0
 public bool CanUseInCurrent(TagType tagType)
 {
     return(((int)tagType < 1 || (int)tagType > 6) && tagType != TagType.Bold);
 }
コード例 #58
0
 public IEnumerable <Tag> GetTags(string[] names, TagType tagType)
 {
     return(null);
 }
コード例 #59
0
 /// <summary>
 /// Constructs a new <see cref="SchemaNodeList"/> with additional options.
 /// </summary>
 /// <param name="name">The name of the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="type">The type of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="length">The number of items contained in the corresponding <see cref="TagNodeList"/>.</param>
 /// <param name="options">One or more option flags modifying the processing of this node.</param>
 public SchemaNodeList(string name, TagType type, int length, SchemaOptions options)
     : base(name, options)
 {
     _type   = type;
     _length = length;
 }
コード例 #60
0
        //[CheckPermission(PageId.Tag, Permission.View)]
        public async Task <IActionResult> Search(string tenantId, string languageId, string keyword, TagType type, int page = 1, int pageSize = 20)
        {
            var result = await _tagService.Search(tenantId, languageId, keyword, type, page, pageSize);

            return(Ok(result));
        }