//Adult portrait example: PORTRAIT_italiangfx_male2 //Child portrait example: PORTRAIT_italiangfx_child_male public string GetChildSpriteName() { var sEarly = "_early".AsSpan(); var sLate = "_late".AsSpan(); var sAgeSuffixes = "12".AsSpan(); var ns = Name.AsSpan(); //remove age modifiers ns = ns.TrimEnd(sAgeSuffixes); //remove period modifiers if (ns.EndsWith(sEarly)) { ns = ns.Slice(0, ns.Length - sEarly.Length); } if (ns.EndsWith(sLate)) { ns = ns.Slice(0, ns.Length - sLate.Length); } var lastSeparator = ns.LastIndexOf('_'); var @base = ns.Slice(0, lastSeparator); var sex = ns.Slice(lastSeparator + 1); //FIXME return(@base.ToString() + "_child_" + sex.ToString()); }
public override bool TryFormat(Span <char> span) { var isCommentNull = string.IsNullOrWhiteSpace(Comment); var len = NameSize + RawValue.AsSpan().StringSizeWithQuoteReplacement(0) + 2; if (span.Length < EntrySizeInBytes) { return(false); } span.Slice(0, EntrySizeInBytes).Fill(' '); Name.AsSpan().CopyTo(span); //span[EqualsPos] = '='; if (!RawValue.AsSpan().TryGetCompatibleString(span.Slice(ValueStart), 0)) { span.Slice(0, EntrySizeInBytes).Fill(' '); return(false); } if (isCommentNull) { return(true); } Comment.AsSpan().CopyTo(span.Slice(len + 2)); span[len + 1] = '/'; return(true); }
public override bool TryFormat(Span <char> span) { if (span.Length < EntrySizeInBytes) { return(false); } var isCommentNull = string.IsNullOrWhiteSpace(Comment); span.Slice(0, EntrySizeInBytes).Fill(' '); Name.AsSpan().CopyTo(span); if (isCommentNull) { return(true); } //Comment.AsSpan().CopyTo(span.Slice(ValueStart)); // This accounts for the absence of `= ` in special keys Comment.AsSpan().CopyTo(span.Slice(ValueStart - 1)); return(true); }
public bool TryWrite(object obj, Span <byte> span, bool commaPrefix, out int bytesWritten) => TagHelpers.TryWriteGuid(Name.AsSpan(), Getter(obj), span, out bytesWritten);
public bool TryWrite(object obj, Span <byte> span, bool commaPrefix, out int bytesWritten) { return(FieldHelpers.Write(Name.AsSpan(), Getter(obj), commaPrefix, span, out bytesWritten)); }
public bool TryWrite(object obj, Span <byte> span, bool commaPrefix, out int bytesWritten) => TagHelpers.TryWriteDateTime(Name.AsSpan(), Getter(obj).GetValueOrDefault(), span, out bytesWritten);