本文整理汇总了C#中MutableString.ConvertToBytes方法的典型用法代码示例。如果您正苦于以下问题:C# MutableString.ConvertToBytes方法的具体用法?C# MutableString.ConvertToBytes怎么用?C# MutableString.ConvertToBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MutableString
的用法示例。
在下文中一共展示了MutableString.ConvertToBytes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Digest
internal static byte[] Digest(DigestFactory.Digest digest, MutableString key, MutableString data) {
// TODO: does MRI really modify the digest object?
digest.Algorithm.Key = key.ConvertToBytes();
byte[] hash = digest.Algorithm.ComputeHash(data.ConvertToBytes());
return hash;
}
示例2: ToYamlNode
public static Node ToYamlNode(MutableString/*!*/ self, [NotNull]RubyRepresenter/*!*/ rep) {
if (RubyOps.IsTrue(_IsBinaryData.Target(_IsBinaryData, rep.Context, self))) {
return rep.BaseCreateNode(self.ConvertToBytes());
}
string str = self.ConvertToString();
RubyArray props = RubyRepresenter.ToYamlProperties(rep.Context, self);
if (props.Count == 0) {
MutableString taguri = RubyRepresenter.TagUri(rep.Context, self);
char style = (char)0;
if (str.StartsWith(":")) {
style = '"';
} else {
MutableString styleStr = RubyRepresenter.ToYamlStyle(rep.Context, self) as MutableString;
if (styleStr != null && styleStr.Length > 0) {
style = styleStr.GetChar(0);
}
}
return rep.Scalar(taguri != null ? taguri.ConvertToString() : "", str, style);
}
Hash map = new Hash(rep.Context);
map.Add(MutableString.Create("str"), str);
RubyRepresenter.AddYamlProperties(rep.Context, self, map, props);
return rep.Map(self, map);
}
示例3: ToYamlNode
public static Node/*!*/ ToYamlNode(UnaryOpStorage/*!*/ isBinaryDataStorage, MutableString/*!*/ self, [NotNull]RubyRepresenter/*!*/ rep) {
var site = isBinaryDataStorage.GetCallSite("is_binary_data?");
if (RubyOps.IsTrue(site.Target(site, rep.Context, self))) {
return rep.BaseCreateNode(self.ConvertToBytes());
}
string str = self.ConvertToString();
RubyArray props = rep.ToYamlProperties(self);
if (props.Count == 0) {
MutableString taguri = rep.GetTagUri(self);
char style = '\0';
if (str.StartsWith(":")) {
style = '"';
} else {
MutableString styleStr = rep.ToYamlStyle(self);
if (styleStr != null && styleStr.Length > 0) {
style = styleStr.GetChar(0);
}
}
return rep.Scalar(taguri != null ? taguri.ConvertToString() : "", str, style);
}
var map = new Dictionary<MutableString, object>() {
{ MutableString.Create("str"), str }
};
rep.AddYamlProperties(self, map, props);
return rep.Map(self, map);
}
示例4: HexEncode
/*!*/
internal static MutableString HexEncode(MutableString/*!*/ str)
{
return Bytes2Hex(str.ConvertToBytes());
}
示例5: UnpackSockAddr
internal static IPEndPoint/*!*/ UnpackSockAddr(MutableString/*!*/ stringAddress) {
byte[] bytes = stringAddress.ConvertToBytes();
SocketAddress addr = new SocketAddress(AddressFamily.InterNetwork, bytes.Length);
for (int i = 0; i < bytes.Length; ++i) {
addr[i] = bytes[i];
}
IPEndPoint ep = new IPEndPoint(0, 0);
return (IPEndPoint)ep.Create(addr);
}