public Tag FindTag(string name, TagKind kind, Project project) { string tagsDir = Path.Combine(project.BaseDirectory, ".tags"); string tagsFile = Path.Combine(tagsDir, "tags"); if (!File.Exists(tagsFile)) { throw new IOException("Tags file does not exist for project: " + project.Name); } Tag tag; string tagEntry; using (StreamReader reader = new StreamReader(tagsFile)) { while ((tagEntry = reader.ReadLine()) != null) { if (tagEntry.StartsWith("!_")) { continue; } if (tagEntry.Substring(0, tagEntry.IndexOf('\t')).Equals(name)) { tag = ParseTag(tagEntry); if (tag.Kind == kind) { return(tag); } } } return(null); } }
public Tag FindTag(string name, TagKind kind, string ctags_output) { Tag tag; string tagEntry; using (StringReader reader = new StringReader(ctags_output)) { while ((tagEntry = reader.ReadLine()) != null) { if (tagEntry.StartsWith("!_")) { continue; } if (tagEntry.Substring(0, tagEntry.IndexOf('\t')).Equals(name)) { tag = ParseTag(tagEntry); if (tag.Kind == kind) { return(tag); } } } return(null); } }
public override Tag ParseTag(string tagEntry) { try { Match tagMatch = tagExpression.Match(tagEntry); if (tagMatch == null) { return(null); } TagKind kind = TagKind.Member; string signature = tagMatch.Groups["raw"].Value; int start = signature.IndexOf('('); int end = signature.LastIndexOf(')'); if (start >= 0 && end > start) { // Attempt to parse out method parameter block signature = signature.Substring(start, end - start + 1); kind = TagKind.Function; // TODO: improve kind guessing } return(new Tag(tagMatch.Groups["symbol"].Value, tagMatch.Groups["file"].Value, ulong.Parse(tagMatch.Groups["line"].Value) + 1, kind, AccessModifier.Public, null, null, null, null, null, signature)); } catch (Exception ex) { LoggingService.LogWarning(string.Format("Error parsing tag {0}", tagEntry), ex); } return(null); }
private void ResolveKind() { string tag = _tag; if (Tag.IsIfTag(tag)) //# if logic tag (boolean switch) { _kind = TagKind.If; } else if (Tag.IsEndIfTag(tag)) //end if { _kind = TagKind.EndIf; } else if (Tag.IsEachTag(tag)) //#each enumeration { _kind = TagKind.Each; } else if (Tag.IsEndEachTag(tag)) //end each { _kind = TagKind.EndEach; } else if (Tag.IsWithTag(tag)) //#with tag { _kind = TagKind.With; } else if (Tag.IsEndWithTag(tag)) //end with { _kind = TagKind.EndWith; } else if (Tag.IsPartialTag(tag)) //sub template tag { _kind = TagKind.Partial; } else if (Tag.IsVariableDeclareTag(tag)) //variable declaratino { _kind = TagKind.VarDeclare; } else if (Tag.IsVariableAssignTag(tag)) //variable assignment { _kind = TagKind.VarAssign; } else if (Tag.IsCommentTag(tag)) //comment tag { _kind = TagKind.Comment; } else //simple tag { _kind = TagKind.Simple; } }
public Tag(Guid id, TagKind kind, string name, string description = null, string picture = null) { Id = id; SetKind(kind); SetName(name); SetPicture(picture); SetDescription(description); }
public Tag(string tag, bool forceTrim) { _tag = tag; _tagLength = tag.Length; _kind = TagKind.Simple; _markers = TrimMark.None; _forceTrim = forceTrim; this.Init(); }
public async Task GetByName_Success(Type booruType, string name, TagKind kind) { var booru = BooruHelper.CreateBooru <IBooruTagByName>(booruType); var tag = await booru.GetTagAsync(name); Assert.AreEqual(name, tag.Name); Assert.AreEqual(kind, tag.Kind); }
public HeaderRecord(FlashReader input) { ushort header = header = input.ReadUInt16(); Kind = (TagKind)(header >> 6); Length = (header & 63); if (Length > MAX_SHORT_LENGTH) { Length = input.ReadInt32(); _isLongTag = (Length <= MAX_SHORT_LENGTH); } }
public void Shot(MoveObject parent, BaseObject target, TagKind tagKind, AttackParams attack) { if (_shoting) { return; } ShotTime = attack.AttackSpeed; _shotTime = ShotTime; _shoting = true; Bullet.Create(parent, target, tagKind, attack); StartCoroutine(DoShot()); }
public Tag FindTag(string name, TagKind kind, string ctags_output) { SemiTag semiTag = new SemiTag(name, kind); if (cache.ContainsKey(semiTag)) { return(cache[semiTag]); } else { string[] ctags_lines = ctags_output.Split('\n'); Tag tag = BinarySearch(ctags_lines, kind, name); cache.Add(semiTag, tag); return(tag); } }
public static void Create(BaseObject moveObject, BaseObject targetObject, TagKind tag, AttackParams attack) { GameObject obj = Instantiate(The.GameLogic.BulletPrefab); obj.transform.position = moveObject.Position + (targetObject.Position - moveObject.Position).normalized * 0.7f + new Vector3(0, 0.5f, 0); Bullet bullet = obj.GetComponent <Bullet>(); bullet.Target = targetObject.Position; bullet._tag = tag == TagKind.Enemy ? "monster" : "enemy"; bullet.tag = "Bullet"; bullet._damage = attack.AttackDamage; IgnoreTag(bullet.tag, bullet); IgnoreTag(tag.ToString(), bullet); if (tag == TagKind.Monster) { IgnoreTag("Cow", bullet); } }
public Tag(string name, string file, string pattern, TagKind kind, AccessModifier access, string field_class, string field_namespace, string field_struct, string field_union, string field_enum, string field_signature) { this.name = name; this.file = file; this.pattern = pattern; this.kind = kind; this.access = access; this.field_class = field_class; this.field_namespace = field_namespace; this.field_struct = field_struct; this.field_union = field_union; this.field_enum = field_enum; this.field_signature = field_signature; }
public Tag (string name, string file, UInt64 line, TagKind kind, AccessModifier access, string field_class, string field_namespace, string field_struct, string field_union, string field_enum, string field_signature) { this.name = name; this.file = file; this.line = line; this.kind = kind; this.access = access; this.field_class = field_class; this.field_namespace = field_namespace; this.field_struct = field_struct; this.field_union = field_union; this.field_enum = field_enum; this.field_signature = field_signature; }
Tag BinarySearch(string[] ctags_lines, TagKind kind, string name) { int low; int high = ctags_lines.Length - 2; // last element is an empty string (because of the Split) int mid; int start_index = 0; // Skip initial comment lines while (ctags_lines[start_index].StartsWith("!_")) { start_index++; } low = start_index; while (low <= high) { mid = (low + high) / 2; string entry = ctags_lines[mid]; string tag_name = entry.Substring(0, entry.IndexOf('\t')); int res = string.CompareOrdinal(tag_name, name); if (res < 0) { low = mid + 1; } else if (res > 0) { high = mid - 1; } else { // The tag we are at has the same name than the one we are looking for // but not necessarily the same type, the actual tag we are looking // for might be higher up or down, so we try both, starting with going down. int save = mid; bool going_down = true; bool eof = false; while (true) { Tag tag = ctags.ParseTag(entry); if (tag == null) { return(null); } if (tag.Kind == kind && tag_name == name) { return(tag); } if (going_down) { mid++; if (mid >= ctags_lines.Length - 1) { eof = true; } if (!eof) { entry = ctags_lines[mid]; tag_name = entry.Substring(0, entry.IndexOf('\t')); if (tag_name != name) { going_down = false; mid = save - 1; } } else { going_down = false; mid = save - 1; } } else // going up { mid--; if (mid < start_index) { return(null); } entry = ctags_lines[mid]; tag_name = entry.Substring(0, entry.IndexOf('\t')); if (tag_name != name) { return(null); } } } } } return(null); }
public string BindAs() { string bindAs = null; TagKind kind = _kind; int start = 0; int len = 0; int maxLen = 0; bool left = this.HasTrimMark(TrimMark.DiscardLeft) || this.HasTrimMark(TrimMark.RetainLeft); bool right = this.HasTrimMark(TrimMark.DiscardRight) || this.HasTrimMark(TrimMark.RetainRight); switch (kind) { case TagKind.Simple: start = 1; maxLen = _tagLength - 2; break; case TagKind.If: start = left ? 5 : 4; maxLen = 7; break; case TagKind.Each: start = left ? 7 : 6; maxLen = 9; break; case TagKind.VarDeclare: start = left ? 6 : 5; maxLen = 8; break; case TagKind.VarAssign: start = left ? 3 : 2; maxLen = 5; break; case TagKind.With: start = left ? 7 : 6; maxLen = 9; break; case TagKind.Partial: start = left ? 3 : 2; maxLen = 5; break; case TagKind.Comment: throw new MergeException($"encountered un-expected TagKind: {kind} ... Comment tags cannot be bound"); } if (kind == TagKind.Simple) //simple tags cannot have trim markers... { len = maxLen; } else if (left && right) { len = (_tagLength - maxLen); } else if (left || right) { len = _tagLength - (maxLen - 1); } else { len = _tagLength - (maxLen - 2); } bindAs = (len > 0) ? new string(_tag.ToCharArray(), start, len) : null; return(bindAs); }
public ImageTag(TagKind kind) : base(kind) { }
public TagTypeNode(TagKind kind) : base(NodeKind.TagType) { this.Tag = kind; }
public void SetKind(TagKind kind) { Kind = kind; }
public TagInfo(TagKind kind, string shortName, string fullname) { this.Kind = kind; this.FullName = fullname; this.ShortName = shortName; }
public TagItem(TagKind kind) : this(new HeaderRecord(kind)) { }
public Tag FindTag (string name, TagKind kind, string ctags_output) { SemiTag semiTag = new SemiTag (name, kind); if (cache.ContainsKey (semiTag)) return cache[semiTag]; else { string[] ctags_lines = ctags_output.Split ('\n'); Tag tag = BinarySearch (ctags_lines, kind, name); cache.Add (semiTag, tag); return tag; } }
public UnknownTag(TagKind kind) : base(kind) { Data = new byte[0]; }
Tag BinarySearch (string[] ctags_lines, TagKind kind, string name) { int low; int high = ctags_lines.Length - 2; // last element is an empty string (because of the Split) int mid; int start_index = 0; // Skip initial comment lines while (ctags_lines[start_index].StartsWith ("!_")) start_index++; low = start_index; while (low <= high) { mid = (low + high) / 2; string entry = ctags_lines[mid]; string tag_name = entry.Substring (0, entry.IndexOf ('\t')); int res = string.CompareOrdinal (tag_name, name); if (res < 0) { low = mid + 1; } else if (res > 0) { high = mid - 1; } else { // The tag we are at has the same name than the one we are looking for // but not necessarily the same type, the actual tag we are looking // for might be higher up or down, so we try both, starting with going down. int save = mid; bool going_down = true; bool eof = false; while (true) { Tag tag = ctags.ParseTag (entry); if (tag == null) return null; if (tag.Kind == kind && tag_name == name) return tag; if (going_down) { mid++; if (mid >= ctags_lines.Length - 1) eof = true; if (!eof) { entry = ctags_lines[mid]; tag_name = entry.Substring (0, entry.IndexOf ('\t')); if (tag_name != name) { going_down = false; mid = save - 1; } } else { going_down = false; mid = save - 1; } } else { // going up mid--; if (mid < start_index) return null; entry = ctags_lines[mid]; tag_name = entry.Substring (0, entry.IndexOf ('\t')); if (tag_name != name) return null; } } } } return null; }
internal SemiTag(string name, TagKind kind) { this.name = name; this.kind = kind; }
public HeaderRecord(TagKind kind) { Kind = kind; }
internal SemiTag (string name, TagKind kind) { this.name = name; this.kind = kind; }
void SetTag() { if (rank.Score.User.Id == FAS.CurrentUser.Id) { tagKind = TagKind.You; guiStyleTag.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.CardBackground); tagString = FresviiGUIText.Get("You"); } else if (rank.Score.User.FriendStatus == Fresvii.AppSteroid.Models.User.FriendStatuses.Friend) { tagKind = TagKind.Friend; guiStyleTag.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.CardText1); tagString = FresviiGUIText.Get("Friend"); } }