当前位置: 首页>>代码示例>>C#>>正文


C# MutableString.ConvertToBytes方法代码示例

本文整理汇总了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;
 }
开发者ID:jschementi,项目名称:iron,代码行数:6,代码来源:OpenSSL.cs

示例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);
        }
开发者ID:bclubb,项目名称:ironruby,代码行数:28,代码来源:BuiltinsOps.cs

示例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);
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:31,代码来源:BuiltinsOps.cs

示例4: HexEncode

 /*!*/
 internal static MutableString HexEncode(MutableString/*!*/ str)
 {
     return Bytes2Hex(str.ConvertToBytes());
 }
开发者ID:TerabyteX,项目名称:main,代码行数:5,代码来源:Digest.cs

示例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);
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:9,代码来源:Socket.cs


注:本文中的MutableString.ConvertToBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。