public void SetText(int index, string text) { api.DeleteTexture(ref Textures[index]); DrawTextArgs args = new DrawTextArgs(text, font, true); linkData[index] = default(LinkData); LinkFlags prevFlags = index > 0 ? linkData[index - 1].flags : 0; if (!String.IsNullOrEmpty(text)) { Texture tex = NextToken(text, 0, ref prevFlags) == -1 ? DrawSimple(ref args) : DrawAdvanced(ref args, index, text); game.Drawer2D.ReducePadding(ref tex, Utils.Floor(args.Font.Size), 3); tex.X1 = CalcOffset(game.Width, tex.Width, XOffset, HorizontalAnchor); tex.Y1 = CalcY(index, tex.Height); Textures[index] = tex; lines[index] = text; } else { int height = PlaceholderHeight[index] ? defaultHeight : 0; int y = CalcY(index, height); Textures[index] = new Texture(-1, 0, y, 0, height, 0, 0); lines[index] = null; } UpdateDimensions(); }
public FileDescriptor(Stream stream, uint index, long tableOffset) { Index = index; Flags = (CABFlags)stream.ReadUInt16(); ExpandedSize = stream.ReadUInt32(); stream.Position += 4; CompressedSize = stream.ReadUInt32(); stream.Position += 4; DataOffset = stream.ReadUInt32(); stream.Position += 4; MD5 = stream.ReadBytes(16); stream.Position += 16; NameOffset = stream.ReadUInt32(); DirectoryIndex = stream.ReadUInt16(); stream.Position += 12; LinkToPrevious = stream.ReadUInt32(); LinkToNext = stream.ReadUInt32(); LinkFlags = (LinkFlags)stream.ReadUInt8(); Volume = stream.ReadUInt16(); var pos = stream.Position; stream.Position = tableOffset + NameOffset; Filename = stream.ReadASCIIZ(); stream.Position = pos; }
public static void DrawGhost_Postfix(ThingDef ____thingDef, LinkFlags __state) { if (__state != LinkFlags.None) { ____thingDef.graphicData.linkFlags = __state; } }
private void _read() { _lenHeader = m_io.ReadBytes(4); if (!((KaitaiStream.ByteArrayCompare(LenHeader, new byte[] { 76, 0, 0, 0 }) == 0))) { throw new ValidationNotEqualError(new byte[] { 76, 0, 0, 0 }, LenHeader, M_Io, "/types/file_header/seq/0"); } _linkClsid = m_io.ReadBytes(16); if (!((KaitaiStream.ByteArrayCompare(LinkClsid, new byte[] { 1, 20, 2, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70 }) == 0))) { throw new ValidationNotEqualError(new byte[] { 1, 20, 2, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70 }, LinkClsid, M_Io, "/types/file_header/seq/1"); } __raw_flags = m_io.ReadBytes(4); var io___raw_flags = new KaitaiStream(__raw_flags); _flags = new LinkFlags(io___raw_flags, this, m_root); _fileAttrs = m_io.ReadU4le(); _timeCreation = m_io.ReadU8le(); _timeAccess = m_io.ReadU8le(); _timeWrite = m_io.ReadU8le(); _targetFileSize = m_io.ReadU4le(); _iconIndex = m_io.ReadS4le(); _showCommand = ((WindowsLnkFile.WindowState) m_io.ReadU4le()); _hotkey = m_io.ReadU2le(); _reserved = m_io.ReadBytes(10); if (!((KaitaiStream.ByteArrayCompare(Reserved, new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }) == 0))) { throw new ValidationNotEqualError(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, Reserved, M_Io, "/types/file_header/seq/11"); } }
public static void DrawGhost_Prefix(ThingDef ____thingDef, ref LinkFlags __state) { if (____thingDef.thingClass == typeof(Building_Window)) { __state = ____thingDef.graphicData.linkFlags; ____thingDef.graphicData.linkFlags = LinkFlags.None; } }
private void WriteStringData(string value, BinaryWriter writer, LinkFlags mask) { var enc = ((Item.Header.LinkFlags & LinkFlags.IsUnicode) != 0) ? Encoding.Unicode : Encoding.Default; if ((Item.Header.LinkFlags & mask) != 0) { writer.WriteSTDATA(value, enc); } }
private void UpdateHeaderFlags(object item, LinkFlags flag) { if (((item is string) && string.IsNullOrEmpty(item as string)) || (item == null)) { Header.LinkFlags &= ~flag; } else { Header.LinkFlags |= flag; } }
internal SectorLinkBlockBase(BinaryReader binaryReader) { this.vertex1 = binaryReader.ReadInt16(); this.vertex2 = binaryReader.ReadInt16(); this.linkFlags = (LinkFlags)binaryReader.ReadInt16(); this.hintIndex = binaryReader.ReadInt16(); this.forwardLink = binaryReader.ReadInt16(); this.reverseLink = binaryReader.ReadInt16(); this.leftSector = binaryReader.ReadInt16(); this.rightSector = binaryReader.ReadInt16(); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Vertex1 = binaryReader.ReadInt16(); this.Vertex2 = binaryReader.ReadInt16(); this.SectorLinkLinkFlags = ((LinkFlags)(binaryReader.ReadInt16())); this.HintIndex = binaryReader.ReadInt16(); this.ForwardLink = binaryReader.ReadInt16(); this.ReverseLink = binaryReader.ReadInt16(); this.LeftSector = binaryReader.ReadInt16(); this.RightSector = binaryReader.ReadInt16(); return(pointerQueue); }
public override bool ForceAllowPlaceOver(BuildableDef other) { if (other is ThingDef def) { if (def.graphicData != null) { LinkFlags linkFlags = def.graphicData.linkFlags; if (linkFlags.HasFlag(LinkFlags.Barricades) || linkFlags.HasFlag(LinkFlags.Sandbags)) { return(true); } } } return(base.ForceAllowPlaceOver(other)); }
public void CopyFrom(GraphicData other) { this.texPath = other.texPath; this.graphicClass = other.graphicClass; this.shaderType = other.shaderType; this.color = other.color; this.colorTwo = other.colorTwo; this.drawSize = other.drawSize; this.onGroundRandomRotateAngle = other.onGroundRandomRotateAngle; this.drawRotated = other.drawRotated; this.allowFlip = other.allowFlip; this.flipExtraRotation = other.flipExtraRotation; this.shadowData = other.shadowData; this.damageData = other.damageData; this.linkType = other.linkType; this.linkFlags = other.linkFlags; }
LinkData Split(int index, string line) { int start = 0, lastEnd = 0, count = 0; LinkData data = default(LinkData); data.parts = new string[GetTokensCount(index, line)]; data.urls = new string[data.parts.Length]; data.bounds = new Rectangle[data.parts.Length]; LinkFlags prevFlags = index > 0 ? linkData[index - 1].flags : 0; while ((start = NextToken(line, start, ref prevFlags)) >= 0) { int nextEnd = line.IndexOf(' ', start); if (nextEnd == -1) { nextEnd = line.Length; data.flags |= LinkFlags.Continue; } data.AddPart(count, GetPart(line, lastEnd, start)); // word bit data.AddPart(count + 1, GetPart(line, start, nextEnd)); // url bit count += 2; if ((prevFlags & LinkFlags.Append) != 0) { string url = linkData[index - 1].LastUrl + data.urls[count - 1]; data.urls[count - 1] = url; data.parts[count - 2] = ""; UpdatePreviousUrls(index - 1, url); } if ((prevFlags & LinkFlags.NewLink) != 0) { data.flags |= LinkFlags.NewLink; } start = nextEnd; lastEnd = nextEnd; } if (lastEnd < line.Length) { data.AddPart(count, GetPart(line, lastEnd, line.Length)); // word bit } return(data); }
public void Notify_LinkerCreatedOrDestroyed(Thing linker) { CellIndices cellIndices = map.cellIndices; foreach (IntVec3 item in linker.OccupiedRect()) { LinkFlags linkFlags = LinkFlags.None; List <Thing> list = map.thingGrid.ThingsListAt(item); for (int i = 0; i < list.Count; i++) { if (list[i].def.graphicData != null) { linkFlags |= list[i].def.graphicData.linkFlags; } } linkGrid[cellIndices.CellToIndex(item)] = linkFlags; } }
private void _read() { _lenHeader = m_io.EnsureFixedContents(new byte[] { 76, 0, 0, 0 }); _linkClsid = m_io.EnsureFixedContents(new byte[] { 1, 20, 2, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70 }); __raw_flags = m_io.ReadBytes(4); var io___raw_flags = new KaitaiStream(__raw_flags); _flags = new LinkFlags(io___raw_flags, this, m_root); _fileAttrs = m_io.ReadU4le(); _timeCreation = m_io.ReadU8le(); _timeAccess = m_io.ReadU8le(); _timeWrite = m_io.ReadU8le(); _targetFileSize = m_io.ReadU4le(); _iconIndex = m_io.ReadS4le(); _showCommand = ((WindowsLnkFile.WindowState)m_io.ReadU4le()); _hotkey = m_io.ReadU2le(); _reserved = m_io.EnsureFixedContents(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); }
Texture MakeTexture(int index, string text) { DrawTextArgs args = new DrawTextArgs(text, font, true); LinkFlags prevFlags = index > 0 ? linkData[index - 1].flags : 0; Texture tex; if (game.ClassicMode || NextToken(text, 0, ref prevFlags) == -1) { tex = game.Drawer2D.MakeTextTexture(ref args, 0, 0); } else { tex = DrawAdvanced(ref args, index, text); } game.Drawer2D.ReducePadding(ref tex, Utils.Floor(args.Font.Size), 3); return(tex); }
static void CreateSymlinkInternal(string symlink, string target, LinkFlags fileOrDirectory) { if (symlink == target) { throw new ArgumentException("Source and Target are the same"); } var extraFlags = Volatile.Read(ref ExtraFlags); if (extraFlags == null) { var flags = fileOrDirectory | LinkFlags.AllowUnprivileged; if (CreateSymbolicLink(symlink, target, flags)) { // remember we can use AllowUnprivileged extraFlags = new LinkFlagsContainer { Value = LinkFlags.AllowUnprivileged }; Volatile.Write(ref ExtraFlags, extraFlags); return; } int error = Marshal.GetLastWin32Error(); if (CreateSymbolicLink(symlink, target, fileOrDirectory)) { // remember we can't use AllowUnprivileged extraFlags = new LinkFlagsContainer(); Volatile.Write(ref ExtraFlags, extraFlags); return; } throw GetSymlinkError(); } if (CreateSymbolicLink(symlink, target, fileOrDirectory | extraFlags.Value)) { return; } throw GetSymlinkError(); }
public static void Postfix(BuildableDef newEntDef, BuildableDef oldEntDef, ref bool __result) { if (__result && newEntDef is ThingDef newDef && oldEntDef is ThingDef oldDef) { if (newDef.tradeTags.NullOrEmpty() || !newDef.tradeTags.Contains("OG_Mounted_Weapon")) { return; } if (oldDef.graphicData != null) { LinkFlags linkFlags = oldDef.graphicData.linkFlags; if (linkFlags.HasFlag(LinkFlags.Barricades) || linkFlags.HasFlag(LinkFlags.Sandbags)) { Log.Message("SpawningWipes linkFlags " + oldDef); __result = false; return; } } } }
public void Notify_LinkerCreatedOrDestroyed(Thing linker) { CellIndices cellIndices = map.cellIndices; CellRect.CellRectIterator iterator = linker.OccupiedRect().GetIterator(); while (!iterator.Done()) { IntVec3 current = iterator.Current; LinkFlags linkFlags = LinkFlags.None; List <Thing> list = map.thingGrid.ThingsListAt(current); for (int i = 0; i < list.Count; i++) { if (list[i].def.graphicData != null) { linkFlags |= list[i].def.graphicData.linkFlags; } } linkGrid[cellIndices.CellToIndex(current)] = linkFlags; iterator.MoveNext(); } }
protected void AddTypeLink(ITypeSymbol typeSymbol, LinkFlags flags) { if (typeSymbol.TypeKind == TypeKind.Unknown || typeSymbol.TypeKind == TypeKind.Error || typeSymbol.TypeKind == TypeKind.TypeParameter || typeSymbol.SpecialType == SpecialType.System_Void) { AddName(typeSymbol.ToDisplayString(s_typeDisplay)); return; } var useSpecialTypes = (flags & LinkFlags.ExpandPredefinedTypes) == 0; var splitLink = !useSpecialTypes & (flags & LinkFlags.SplitNamespaceAndType) != 0; if (splitLink && !typeSymbol.ContainingNamespace.IsGlobalNamespace) { AddNamespaceLink(typeSymbol.ContainingNamespace); AddText("."); } var typeQualificationStyle = splitLink ? SymbolDisplayTypeQualificationStyle.NameAndContainingTypes : SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces; var miscellaneousOptions = useSpecialTypes ? SymbolDisplayMiscellaneousOptions.UseSpecialTypes : SymbolDisplayMiscellaneousOptions.ExpandNullable; var typeDisplayFormat = new SymbolDisplayFormat( typeQualificationStyle: typeQualificationStyle, genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters | SymbolDisplayGenericsOptions.IncludeVariance, miscellaneousOptions: miscellaneousOptions); var text = typeSymbol.ToDisplayString(typeDisplayFormat); var navInfo = _libraryManager.GetTypeNavInfo(typeSymbol, _project, GetCompilation(), useExpandedHierarchy: false); _description.AddDescriptionText3(text, VSOBDESCRIPTIONSECTION.OBDS_TYPE, navInfo); }
public void CopyFrom(GraphicData other) { texPath = other.texPath; graphicClass = other.graphicClass; shaderType = other.shaderType; color = other.color; colorTwo = other.colorTwo; drawSize = other.drawSize; drawOffset = other.drawOffset; drawOffsetNorth = other.drawOffsetNorth; drawOffsetEast = other.drawOffsetEast; drawOffsetSouth = other.drawOffsetSouth; drawOffsetWest = other.drawOffsetSouth; onGroundRandomRotateAngle = other.onGroundRandomRotateAngle; drawRotated = other.drawRotated; allowFlip = other.allowFlip; flipExtraRotation = other.flipExtraRotation; shadowData = other.shadowData; damageData = other.damageData; linkType = other.linkType; linkFlags = other.linkFlags; cachedGraphic = null; }
public GraphicDataStats(GraphicData d) { this.texPath = d.texPath; //this.graphicClass = d.graphicClass; Util.AssignDefStat(d.shaderType, out this.shaderType); this.color = new ColorStats(d.color); this.colorTwo = new ColorStats(d.colorTwo); this.drawSize = new Vector2Stats(d.drawSize); this.onGroundRandomRotateAngle = d.onGroundRandomRotateAngle; this.drawRotated = d.drawRotated; this.allowFlip = d.allowFlip; this.flipExtraRotation = d.flipExtraRotation; if (d.shadowData != null) { this.shadowData = new ShadowDataStats(d.shadowData); } if (d.damageData != null) { this.damageData = new DamageGraphicDataStats(d.damageData); } this.linkType = d.linkType; this.linkFlags = d.linkFlags; }
int NextToken(string line, int start, ref LinkFlags prevFlags) { bool isWrapped = start == 0 && line.StartsWith("> "); if ((prevFlags & LinkFlags.Continue) != 0 && isWrapped) { prevFlags = 0; if (!Utils.IsUrlPrefix(Utils.StripColours(line), 2)) { prevFlags |= LinkFlags.Append; } else { prevFlags |= LinkFlags.NewLink; } return(2); } prevFlags = LinkFlags.NewLink; int nextHttp = line.IndexOf("http://", start); int nextHttps = line.IndexOf("https://", start); return(nextHttp == -1 ? nextHttps : nextHttp); }
public void CopyFrom(AvaliGraphicData other) { this.texPath = other.texPath; this.graphicClass = other.graphicClass; this.shaderType = other.shaderType; this.color = other.color; this.colorTwo = other.colorTwo; this.colorThree = other.colorThree; this.drawSize = other.drawSize; this.drawOffset = other.drawOffset; this.drawOffsetNorth = other.drawOffsetNorth; this.drawOffsetEast = other.drawOffsetEast; this.drawOffsetSouth = other.drawOffsetSouth; this.drawOffsetWest = other.drawOffsetSouth; this.onGroundRandomRotateAngle = other.onGroundRandomRotateAngle; this.drawRotated = other.drawRotated; this.allowFlip = other.allowFlip; this.flipExtraRotation = other.flipExtraRotation; this.shadowData = other.shadowData; this.damageData = other.damageData; this.linkType = other.linkType; this.linkFlags = other.linkFlags; this.cachedGraphic = (AvaliGraphic)null; }
int GetTokensCount(int index, string line) { int start = 0, lastEnd = 0, count = 0; LinkFlags prevFlags = index > 0 ? linkData[index - 1].flags : 0; while ((start = NextToken(line, start, ref prevFlags)) >= 0) { int nextEnd = line.IndexOf(' ', start); if (nextEnd == -1) { nextEnd = line.Length; } start = nextEnd; lastEnd = nextEnd; count += 2; } if (lastEnd < line.Length) { count++; } return(count); }
private static Option CreateHeaderFlagOption(string tag, LinkFlags flag) { string description = $"Set/Unset {flag} flag (true/false)."; return(new HeaderFlagOption(tag, description, WriteCommands, flag)); }
public SectorLinkBlock(BinaryReader binaryReader) { this.vertex1 = binaryReader.ReadInt16(); this.vertex2 = binaryReader.ReadInt16(); this.linkFlags = (LinkFlags)binaryReader.ReadInt16(); this.hintIndex = binaryReader.ReadInt16(); this.forwardLink = binaryReader.ReadInt16(); this.reverseLink = binaryReader.ReadInt16(); this.leftSector = binaryReader.ReadInt16(); this.rightSector = binaryReader.ReadInt16(); }
private void UpdateHeaderFlags(object item, LinkFlags flag) { if (((item is string) && string.IsNullOrEmpty(item as string)) || (item == null)) { Header.LinkFlags &= ~flag; } else { Header.LinkFlags |= flag; } }
int NextToken( string line, int start, ref LinkFlags prevFlags ) { bool isWrapped = start == 0 && line.StartsWith( "> " ); if( (prevFlags & LinkFlags.Continue) != 0 && isWrapped ) { prevFlags = 0; if( !Utils.IsUrlPrefix( Utils.StripColours( line ), 2 ) ) prevFlags |= LinkFlags.Append; else prevFlags |= LinkFlags.NewLink; return 2; } prevFlags = 0; int nextHttp = line.IndexOf( "http://", start ); int nextHttps = line.IndexOf( "https://", start ); return nextHttp == -1 ? nextHttps : nextHttp; }
protected void AddTypeLink(ITypeSymbol typeSymbol, LinkFlags flags) { if (typeSymbol.TypeKind == TypeKind.Unknown || typeSymbol.TypeKind == TypeKind.Error || typeSymbol.TypeKind == TypeKind.TypeParameter || typeSymbol.SpecialType == SpecialType.System_Void) { AddName(typeSymbol.ToDisplayString(s_typeDisplay)); return; } var useSpecialTypes = (flags & LinkFlags.ExpandPredefinedTypes) == 0; var splitLink = !useSpecialTypes & (flags & LinkFlags.SplitNamespaceAndType) != 0; if (splitLink && !typeSymbol.ContainingNamespace.IsGlobalNamespace) { AddNamespaceLink(typeSymbol.ContainingNamespace); AddText("."); } var typeQualificationStyle = splitLink ? SymbolDisplayTypeQualificationStyle.NameAndContainingTypes : SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces; var miscellaneousOptions = useSpecialTypes ? SymbolDisplayMiscellaneousOptions.UseSpecialTypes : SymbolDisplayMiscellaneousOptions.ExpandNullable; var typeDisplayFormat = new SymbolDisplayFormat( typeQualificationStyle: typeQualificationStyle, genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters | SymbolDisplayGenericsOptions.IncludeVariance, miscellaneousOptions: miscellaneousOptions); var text = typeSymbol.ToDisplayString(typeDisplayFormat); var navInfo = _libraryManager.GetTypeNavInfo(typeSymbol, _project, GetCompilation(), useExpandedHierarchy: false); _description.AddDescriptionText3(text, VSOBDESCRIPTIONSECTION.OBDS_TYPE, navInfo); }
private string ReadStringData(BinaryReader reader, LinkFlags mask) { var enc = ((Item.Header.LinkFlags & LinkFlags.IsUnicode) != 0) ? Encoding.Unicode : Encoding.Default; return((Item.Header.LinkFlags & mask) != 0 ? reader.ReadSTDATA(enc) : null); }
/// <summary> /// Determines whether the specified flag is flag. /// </summary> /// <param name="flag">The flag.</param> /// <returns></returns> private bool CheckFlag(LinkFlags flag) { return (this._flags & (int)flag) > 0; }
private string ReadStringData(BinaryReader reader, LinkFlags mask) { Encoding enc = ((Item.Header.LinkFlags & LinkFlags.IsUnicode) != 0) ? Encoding.Unicode : Encoding.Default; if ((Item.Header.LinkFlags & mask) != 0) { return reader.ReadSTDATA(enc); } return null; }
/// <summary> /// Determines whether the specified flag is flag. /// </summary> /// <param name="flag">The flag.</param> /// <returns></returns> private bool CheckFlag(LinkFlags flag) { return((this._flags & (int)flag) > 0); }
public HeaderFlagOption(string tag, string description, IList<Command> applies, LinkFlags flag) : base(tag, description, 1, applies) { Flag = flag; }
private void WriteStringData(string value, BinaryWriter writer, LinkFlags mask) { Encoding enc = ((Item.Header.LinkFlags & LinkFlags.IsUnicode) != 0) ? Encoding.Unicode : Encoding.Default; if ((Item.Header.LinkFlags & mask) != 0) { writer.WriteSTDATA(value, enc); } }
static extern bool CreateSymbolicLink(string symlink, string target, LinkFlags flags);
public HeaderFlagOption(string tag, string description, IList <Command> applies, LinkFlags flag) : base(tag, description, 1, applies) { Flag = flag; }
public FileDescriptor(Stream stream, uint index, long tableOffset) { Index = index; Flags = (CABFlags)stream.ReadUInt16(); ExpandedSize = stream.ReadUInt32(); stream.Position += 4; CompressedSize = stream.ReadUInt32(); stream.Position += 4; DataOffset = stream.ReadUInt32(); stream.Position += 4; MD5 = stream.ReadBytes(16); stream.Position += 16; NameOffset = stream.ReadUInt32(); DirectoryIndex = stream.ReadUInt16(); stream.Position += 12; LinkToPrevious = stream.ReadUInt32(); LinkToNext = stream.ReadUInt32(); LinkFlags = (LinkFlags)stream.ReadUInt8(); Volume = stream.ReadUInt16(); var pos = stream.Position; stream.Position = tableOffset + NameOffset; Filename = stream.ReadASCIIZ(); stream.Position = pos; }