本文整理汇总了C#中ConversionStorage类的典型用法代码示例。如果您正苦于以下问题:C# ConversionStorage类的具体用法?C# ConversionStorage怎么用?C# ConversionStorage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConversionStorage类属于命名空间,在下文中一共展示了ConversionStorage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AreIdentical
public static bool AreIdentical(ConversionStorage<MutableString>/*!*/ toPath, RubyModule/*!*/ self, object path1, object path2) {
FileSystemInfo info1, info2;
return RubyFileOps.RubyStatOps.TryCreate(self.Context, self.Context.DecodePath(Protocols.CastToPath(toPath, path1)), out info1)
&& RubyFileOps.RubyStatOps.TryCreate(self.Context, self.Context.DecodePath(Protocols.CastToPath(toPath, path2)), out info2)
&& RubyFileOps.RubyStatOps.AreIdentical(self.Context, info1, info2);
}
示例2: GetGroup
public static RubyArray GetGroup(ConversionStorage<int>/*!*/ fixnumCast, MatchData/*!*/ self, [NotNull]Range/*!*/ range) {
int begin, count;
if (!IListOps.NormalizeRange(fixnumCast, self.Groups.Count, range, out begin, out count)) {
return null;
}
return GetGroup(fixnumCast.Context, self, begin, count);
}
示例3: ToPrintedString
public static MutableString/*!*/ ToPrintedString(ConversionStorage<MutableString>/*!*/ tosConversion, object obj) {
if (obj == null) {
return MutableString.CreateAscii("nil");
} else {
return Protocols.ConvertToString(tosConversion, obj);
}
}
示例4: Connect
public static int Connect(ConversionStorage<MutableString>/*!*/ stringCast, ConversionStorage<int>/*!*/ fixnumCast,
RubyContext/*!*/ context, UDPSocket/*!*/ self, object hostname, object port) {
string strHostname = ConvertToHostString(stringCast, context, hostname);
int iPort = ConvertToPortNum(stringCast, fixnumCast, context, port);
self.Socket.Connect(strHostname, iPort);
return 0;
}
示例5: PrintFormatted
public static void PrintFormatted(
StringFormatterSiteStorage/*!*/ storage,
ConversionStorage<MutableString>/*!*/ stringCast,
BinaryOpStorage/*!*/ writeStorage,
object/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ format, params object[]/*!*/ args)
{
KernelOps.PrintFormatted(storage, stringCast, writeStorage, null, self, format, args);
}
示例6: CastToInt64Unchecked
public static long CastToInt64Unchecked(ConversionStorage<IntegerValue>/*!*/ integerConversion, object obj)
{
if (obj == null) {
throw RubyExceptions.CreateTypeError("no implicit conversion from nil to integer");
}
return CastToInteger(integerConversion, obj).ToInt64();
}
示例7: Reinitialize
public static TCPServer/*!*/ Reinitialize(ConversionStorage<MutableString>/*!*/ stringCast, ConversionStorage<int>/*!*/ fixnumCast,
TCPServer/*!*/ self,
[DefaultProtocol]MutableString remoteHost, object remotePort,
[DefaultProtocol]MutableString localHost, object localPort) {
self.Socket = CreateSocket(remoteHost, ConvertToPortNum(stringCast, fixnumCast, remotePort));
BindLocalEndPoint(self, localHost, ConvertToPortNum(stringCast, fixnumCast, localPort));
return self;
}
示例8: CreateTCPSocket
public static TCPSocket/*!*/ CreateTCPSocket(ConversionStorage<MutableString>/*!*/ stringCast, ConversionStorage<int>/*!*/ fixnumCast,
RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ remoteHost, object remotePort) {
int port = ConvertToPortNum(stringCast, fixnumCast, self.Context, remotePort);
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(remoteHost.ConvertToString(), port);
return new TCPSocket(self.Context, socket);
}
示例9: Scan
public static Object Scan(ConversionStorage<MutableString>/*!*/ toMutableStringStorage, RespondToStorage/*!*/ respondsTo,
BinaryOpStorage/*!*/ readIOStorage, BlockParam block, RubyModule/*!*/ self, Object/*!*/ source, Hash/*!*/ options)
{
Object elementContent;
if (!self.TryGetConstant(null, "ElementContent", out elementContent) && !(elementContent is Hash)) {
throw new Exception("Hpricot::ElementContent is missing or it is not an Hash");
}
var scanner = new HpricotScanner(toMutableStringStorage, readIOStorage, block);
return scanner.Scan(source, options, elementContent as Hash);
}
示例10: ReceiveFromNonBlocking
public static RubyArray/*!*/ ReceiveFromNonBlocking(ConversionStorage<int>/*!*/ fixnumCast, RubyContext/*!*/ context, IPSocket/*!*/ self, int length, object/*Numeric*/ flags) {
bool blocking = self.Socket.Blocking;
try {
self.Socket.Blocking = false;
return ReceiveFrom(fixnumCast, context, self, length, flags);
} finally {
// Reset the blocking
self.Socket.Blocking = blocking;
}
}
示例11: ReceiveFromNonBlocking
public static RubyArray/*!*/ ReceiveFromNonBlocking(ConversionStorage<int>/*!*/ fixnumCast, IPSocket/*!*/ self, int length) {
bool blocking = self.Socket.Blocking;
try {
self.Socket.Blocking = false;
return ReceiveFrom(fixnumCast, self, length, null);
} finally {
// Reset the blocking
self.Socket.Blocking = blocking;
}
}
示例12: Bind
public static int Bind(ConversionStorage<MutableString>/*!*/ stringCast, ConversionStorage<int>/*!*/ fixnumCast,
RubyContext/*!*/ context, UDPSocket/*!*/ self, object hostNameOrAddress, object port) {
int iPort = ConvertToPortNum(stringCast, fixnumCast, context, port);
IPAddress address = (hostNameOrAddress != null) ?
GetHostAddress(ConvertToHostString(stringCast, context, hostNameOrAddress)) : IPAddress.Loopback;
IPEndPoint ep = new IPEndPoint(address, iPort);
self.Socket.Bind(ep);
return 0;
}
示例13: CreateTCPSocket
public static TCPSocket/*!*/ CreateTCPSocket(ConversionStorage<MutableString>/*!*/ stringCast, ConversionStorage<int>/*!*/ fixnumCast,
RubyClass/*!*/ self, [DefaultProtocol]MutableString remoteHost, object remotePort, [Optional]int localPort) {
// Not sure what the semantics should be in this case but we make sure not to blow up.
// Real-world code (Server.connect_to in memcache.rb in the memcache-client gem) does do "TCPSocket.new(host, port, 0)"
if (localPort != 0) {
throw new NotImplementedError();
}
return new TCPSocket(self.Context, CreateSocket(remoteHost, ConvertToPortNum(stringCast, fixnumCast, remotePort)));
}
示例14: CreateFile
public static RubyIO/*!*/ CreateFile(
ConversionStorage<int?>/*!*/ toInt,
ConversionStorage<IDictionary<object, object>>/*!*/ toHash,
ConversionStorage<MutableString>/*!*/ toStr,
RubyClass/*!*/ self,
object descriptor,
[Optional]object optionsOrMode,
[DefaultParameterValue(null), DefaultProtocol]IDictionary<object, object> options) {
return Reinitialize(toInt, toHash, toStr, new RubyIO(self.Context), descriptor, optionsOrMode, options);
}
示例15: CreateSubclass
public static Hash/*!*/ CreateSubclass(ConversionStorage<IList>/*!*/ toAry, RubyClass/*!*/ self, [NotNull]IList/*!*/ list) {
Hash result = Hash.CreateInstance(self);
var toArySite = toAry.GetSite(TryConvertToArrayAction.Make(toAry.Context));
foreach (object item in list) {
IList pair = toArySite.Target(toArySite, item);
if (pair != null && pair.Count >= 1 && pair.Count <= 2) {
RubyUtils.SetHashElement(self.Context, result, pair[0], (pair.Count == 2) ? pair[1] : null);
}
}
return result;
}