internal void WriteBytes(ref SubString value, UnmanagedStream stream) { if (value.Length != 0) { fixed(char *valueFixed = value.String) WriteBytes(valueFixed + value.Start, value.Length, stream); } }
/// <summary> /// 写字符串 /// </summary> /// <param name="value">字符串</param> public unsafe void Write(ref SubString value) { if (value.Length != 0) { WriteNotEmpty(ref value); } }
/// <summary> /// 写字符串 /// </summary> /// <param name="value">字符串</param> internal unsafe void WriteNotEmpty(ref SubString value) { int length = value.Length << 1; prepSize(length); fixed(char *valueFixed = value.String) AutoCSer.Memory.CopyNotNull(valueFixed + value.Start, Data.Byte + ByteSize, length); ByteSize += length; }
public void CallSerialize(SubString value) { if (value.String == null) { CharStream.WriteJsonNull(); } else { CharStream.WriteJson(ref value, Config.NullChar); } }
public void CallSerialize(SubString value) { if (value.Length == 0) { if (value.String != null) { emptyString(); } } else { fixed(char *valueFixed = value.GetFixedBuffer()) serialize(valueFixed + value.Start, value.Length); } }
/// <summary> /// 比较字符串大小 /// </summary> /// <param name="other"></param> /// <returns></returns> internal int CompareTo(ref SubString other) { int size = Math.Min(Length, other.Length); if (size == 0) { if (Length == 0) { if (other.Length == 0) { if (String == null) { return(other.String == null ? 0 : -1); } return(other.String == null ? 1 : 0); } return(-1); } return(1); } fixed(char *stringFixed = String, otherStringFixed = other.String) { char *start = stringFixed + Start, end = start + size, otherStart = otherStringFixed + other.Start; do { if (*start != *otherStart) { return(*start - *otherStart); } ++otherStart; }while (++start != end); } return(Length - other.Length); }
protected override void ajax(AutoCSer.Memory.CharStream _js_) { _js_.Write(@"{Items:"); { AutoCSer.Web.SearchServer.SearchItem[] _value1_ = Items; if (_value1_ == null) { _js_.WriteJsonNull(); } else { _js_.Write(@"["); { int _loopIndex1_ = _loopIndex_; _loopIndex_ = 0; foreach (AutoCSer.Web.SearchServer.SearchItem _value2_ in _value1_) { if (_loopIndex_ == 0) { _js_.Write('"'); _js_.Write("@.AutoCSerWeb.SearchItem,,DataKey[Id,Type]Html[Title,Url]Indexs[[Key,Value]]Remote[ImageUrl]Text"); _js_.Write('"'); } _js_.Write(','); _js_.Write(@"["); { AutoCSer.Web.SearchServer.DataKey _value3_ = _value2_.DataKey; _js_.Write(@"["); { int _value4_ = _value3_.Id; _js_.WriteWebViewJson((int)_value4_); } _js_.Write(@","); { AutoCSer.Web.SearchServer.DataType _value4_ = _value3_.Type; _js_.WriteQuote(_value4_.ToString()); } _js_.Write(@"]"); } _js_.Write(@","); { AutoCSer.Web.SearchServer.Html _value3_ = _value2_.Html; if (_value3_ == null) { _js_.WriteJsonNull(); } else { _js_.Write(@"["); { string _value4_ = _value3_.Title; if (_value4_ == null) { _js_.WriteJsonNull(); } else { _js_.WriteWebViewJson(_value4_); } } _js_.Write(@","); { string _value4_ = _value3_.Url; if (_value4_ == null) { _js_.WriteJsonNull(); } else { _js_.WriteWebViewJson(_value4_); } } _js_.Write(@"]"); } } _js_.Write(@","); { AutoCSer.KeyValue <int, int>[] _value3_ = _value2_.Indexs; if (_value3_ == null) { _js_.WriteJsonNull(); } else { _js_.Write(@"[["); { int _loopIndex3_ = _loopIndex_; _loopIndex_ = 0; foreach (AutoCSer.KeyValue <int, int> _value4_ in _value3_) { if (_loopIndex_ != 0) { _js_.Write(','); } _js_.Write('['); _js_.Write(@""); { int _value5_ = _value4_.Key; _js_.WriteWebViewJson((int)_value5_); } _js_.Write(@","); { int _value5_ = _value4_.Value; _js_.WriteWebViewJson((int)_value5_); } _js_.Write(@"]"); ++_loopIndex_; } _loopIndex_ = _loopIndex3_; } _js_.Write(@"]]"); } } _js_.Write(@","); { AutoCSer.Web.SearchServer.SearchItem.RemoteExtension _value3_ = _value2_.Remote; _js_.Write(@"["); { string _value4_ = _value3_.ImageUrl; if (_value4_ == null) { _js_.WriteJsonNull(); } else { _js_.WriteWebViewJson(_value4_); } } _js_.Write(@"]"); } _js_.Write(@","); { AutoCSer.SubString _value3_ = _value2_.Text; _js_.WriteWebViewJson(_value3_); } _js_.Write(@"]"); ++_loopIndex_; } _loopIndex_ = _loopIndex1_; } _js_.Write(@"].FormatView()"); } } _js_.Write(@",Key:"); { string _value1_ = Key; if (_value1_ == null) { _js_.WriteJsonNull(); } else { _js_.WriteWebViewJson(_value1_); } } _js_.Write(@"}"); }
public void WriteJson(SubString value) { fixed(char *valueFixed = value.String) WriteJson(valueFixed + value.Start, value.Length, ' '); }
internal static bool IsOutputSubString(XmlSerializer xmlSerializer, SubString value) { return(value.Length != 0 || xmlSerializer.Config.IsOutputEmptyString); }
public void CallDeSerialize(ref SubString value) { space(); if (State != DeSerializeState.Success) { return; } if (*current == '<') { if (*(current + 1) == '!') { searchCData2(); if (State == DeSerializeState.Success) { if (valueSize == 0) { value.Set(string.Empty, 0, 0); } else { value.Set(xml, (int)(valueStart - xmlFixed), valueSize); } } } else { value.Set(string.Empty, 0, 0); } } else { valueStart = current; valueSize = 0; do { if (*current == '<') { int length = (int)(endSpace() - valueStart); if (valueSize == 0) { value.Set(xml, (int)(valueStart - xmlFixed), length); } else if (Config.IsTempString) { value.Set(xml, (int)(valueStart - xmlFixed), length - valueSize); while (*valueStart != '&') { ++valueStart; } decodeString(valueStart, xmlFixed + value.Start + value.Length); } else { string decodeValue = AutoCSer.Extensions.StringExtension.FastAllocateString(length - valueSize); fixed(char *valueFixed = decodeValue) decodeString(valueFixed, valueFixed + decodeValue.Length); value.Set(decodeValue, 0, decodeValue.Length); } return; } if (*current == '&') { do { ++valueSize; if (*++current == ';') { break; } if (*current == '<') { State = DeSerializeState.DecodeError; return; } }while (true); } ++current; }while (true); } }
/// <summary> /// 字符串 HASH /// </summary> /// <param name="value"></param> public HashString(ref SubString value) { String = value; HashCode = value.Length == 0 ? 0 : (value.GetHashCode() ^ Random.Hash); }
/// <summary> /// 字符串 HASH /// </summary> /// <param name="value"></param> public HashString(SubString value) : this(ref value) { }
public bool Equals(SubString other) { return(String.Equals(ref other)); }
/// <summary> /// 字符串 HASH /// </summary> /// <param name="value"></param> public HashString(ref SubString value) { this.String = value; hashCode = value == null ? 0 : (value.GetHashCode() ^ Random.Hash); }
public void CallSerialize(SubString value) { Serialize(Stream, ref value); }
/// <summary> /// /// </summary> /// <param name="value"></param> private void serialize(ref Node value) { switch (value.Type) { case NodeType.Dictionary: CharStream.Write('{'); if ((int)value.Int64 != 0) { KeyValue <Node, Node>[] array = value.DictionaryArray; for (int index = 0; index != (int)value.Int64; ++index) { if (index != 0) { CharStream.Write(','); } serialize(ref array[index].Key); CharStream.Write(':'); serialize(ref array[index].Value); } } CharStream.Write('}'); return; case NodeType.Array: CharStream.Write('['); if ((int)value.Int64 != 0) { Node[] array = value.ListArray; for (int index = 0; index != (int)value.Int64; ++index) { if (index != 0) { CharStream.Write(','); } serialize(ref array[index]); CharStream.Write(':'); serialize(ref array[index]); } } CharStream.Write(']'); return; case NodeType.String: { SubString subString = value.SubString; CharStream.WriteJson(ref subString, Config.NullChar); } return; case NodeType.QuoteString: case NodeType.ErrorQuoteString: CharStream.PrepCharSize(value.SubString.Length + 2); CharStream.Data.Write((char)value.Int64); CharStream.Write(ref value.SubString); CharStream.Data.Write((char)value.Int64); return; case NodeType.NumberString: if ((int)value.Int64 == 0) { CharStream.Write(ref value.SubString); } else { CharStream.PrepCharSize(value.SubString.Length + 2); CharStream.Data.Write((char)value.Int64); CharStream.Write(ref value.SubString); CharStream.Data.Write((char)value.Int64); } return; case NodeType.Bool: CallSerialize((int)value.Int64 != 0); return; case NodeType.DateTimeTick: CallSerialize(new DateTime(value.Int64, DateTimeKind.Local)); return; case NodeType.NaN: CharStream.WriteJsonNaN(); return; case NodeType.PositiveInfinity: if (Config.IsInfinityToNaN) { CharStream.WriteJsonNaN(); } else { CharStream.WritePositiveInfinity(); } return; case NodeType.NegativeInfinity: if (Config.IsInfinityToNaN) { CharStream.WriteJsonNaN(); } else { CharStream.WriteNegativeInfinity(); } return; default: CharStream.WriteJsonNull(); return; } }