本文整理汇总了C#中ConversionStorage类的典型用法代码示例。如果您正苦于以下问题:C# ConversionStorage类的具体用法?C# ConversionStorage怎么用?C# ConversionStorage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConversionStorage类属于命名空间,在下文中一共展示了ConversionStorage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:jschementi,项目名称:iron,代码行数:7,代码来源:FileTest.cs
示例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);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:7,代码来源:MatchDataOps.cs
示例3: ToPrintedString
public static MutableString/*!*/ ToPrintedString(ConversionStorage<MutableString>/*!*/ tosConversion, object obj) {
if (obj == null) {
return MutableString.CreateAscii("nil");
} else {
return Protocols.ConvertToString(tosConversion, obj);
}
}
开发者ID:rudimk,项目名称:dlr-dotnet,代码行数:7,代码来源:PrintOps.cs
示例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;
}
开发者ID:tnachen,项目名称:ironruby,代码行数:8,代码来源:UDPSocket.cs
示例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);
}
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:PrintOps.cs
示例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();
}
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:Protocols.cs
示例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;
}
开发者ID:kevinkeeney,项目名称:ironruby,代码行数:9,代码来源:TCPSocket.cs
示例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);
}
开发者ID:tnachen,项目名称:ironruby,代码行数:9,代码来源:TCPSocket.cs
示例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);
}
开发者ID:nrk,项目名称:ironruby-hpricot,代码行数:10,代码来源:Hpricot.cs
示例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;
}
}
开发者ID:tnachen,项目名称:ironruby,代码行数:10,代码来源:UDPSocket.cs
示例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;
}
}
开发者ID:atczyc,项目名称:ironruby,代码行数:10,代码来源:UDPSocket.cs
示例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;
}
开发者ID:tnachen,项目名称:ironruby,代码行数:11,代码来源:UDPSocket.cs
示例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)));
}
开发者ID:kevinkeeney,项目名称:ironruby,代码行数:11,代码来源:TCPSocket.cs
示例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);
}
开发者ID:rpattabi,项目名称:ironruby,代码行数:11,代码来源:IoOps.cs
示例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;
}
开发者ID:jschementi,项目名称:iron,代码行数:11,代码来源:HashOps.cs
示例16: Transform
private static MutableString Transform(ConversionStorage<MutableString> toS, IDictionary self, GeneratorState state, int depth)
{
byte[] objectNl = state.ObjectNl.ToByteArray();
byte[] indent = Helpers.Repeat(state.Indent.ToByteArray(), depth + 1);
byte[] spaceBefore = state.SpaceBefore.ToByteArray();
byte[] space = state.Space.ToByteArray();
int subDepth = depth + 1;
MutableString result = MutableString.CreateBinary(2 + self.Count * (12 + indent.Length + spaceBefore.Length + space.Length));
RubyContext context = toS.Context;
result.Append((byte)'{');
result.Append(objectNl);
if (self.Count > 0) {
MutableString json;
int i = 0;
foreach (DictionaryEntry kv in self) {
if (i > 0) {
result.Append(objectNl);
}
if (objectNl.Length != 0) {
result.Append(indent);
}
json = Generator.ToJson(context, Protocols.ConvertToString(toS, kv.Key), state, subDepth);
result.Append(json);
context.TaintObjectBy<Object>(result, json);
result.Append(spaceBefore);
result.Append((byte)':');
result.Append(space);
json = Generator.ToJson(context, kv.Value, state, subDepth);
result.Append(json);
context.TaintObjectBy<Object>(result, json);
if (++i < self.Count) {
result.Append(',');
}
}
if (objectNl.Length != 0) {
result.Append(objectNl);
if (indent.Length != 0) {
for (int n = 0; n < depth; n++) {
result.Append(indent);
}
}
}
}
result.Append((byte)'}');
return result;
}
开发者ID:nrk,项目名称:ironruby-json,代码行数:53,代码来源:Generator.Hash.cs
示例17: ReceiveFrom
public static RubyArray/*!*/ ReceiveFrom(ConversionStorage<int>/*!*/ conversionStorage, RubyContext/*!*/ context, IPSocket/*!*/ self,
int length, [DefaultParameterValue(null)]object/*Numeric*/ flags) {
SocketFlags sFlags = ConvertToSocketFlag(conversionStorage, context, flags);
byte[] buffer = new byte[length];
EndPoint fromEP = new IPEndPoint(IPAddress.Any, 0);
int received = self.Socket.ReceiveFrom(buffer, sFlags, ref fromEP);
MutableString str = MutableString.CreateBinary();
str.Append(buffer, 0, received);
context.SetObjectTaint(str, true);
return RubyOps.MakeArray2(str, GetAddressArray(context, fromEP));
}
开发者ID:joshholmes,项目名称:ironruby,代码行数:12,代码来源:IPSocket.cs
示例18: Bind
public static int Bind(ConversionStorage<MutableString>/*!*/ stringCast, ConversionStorage<int>/*!*/ fixnumCast,
RubyContext/*!*/ context, UDPSocket/*!*/ self, object hostname, object port) {
int iPort = ConvertToPortNum(stringCast, fixnumCast, context, port);
if (hostname == null) {
hostname = MutableString.Create("localhost");
}
MutableString address = GetAddressInternal(context, hostname);
IPEndPoint ep = new IPEndPoint(IPAddress.Parse(address.ConvertToString()), iPort);
self.Socket.Bind(ep);
return 0;
}
开发者ID:joshholmes,项目名称:ironruby,代码行数:12,代码来源:UDPSocket.cs
示例19: BlockReplaceAll
public static object BlockReplaceAll(ConversionStorage<MutableString>/*!*/ tosConversion,
RubyScope/*!*/ scope, [NotNull]BlockParam/*!*/ block, MutableString/*!*/ self,
[NotNull]RubyRegex pattern)
{
object blockResult;
MutableString result;
self.TrackChanges();
object r = BlockReplaceAll(tosConversion, scope, self, block, pattern, out blockResult, out result) ? blockResult : (result ?? self.Clone());
RequireNoVersionChange(self);
return r;
}
开发者ID:TerabyteX,项目名称:main,代码行数:12,代码来源:MutableStringOps.cs
示例20: CreateArray
public static object CreateArray(ConversionStorage<Union<IList, int>>/*!*/ toAryToInt,
BlockParam block, RubyClass/*!*/ self, [NotNull]object/*!*/ arrayOrSize) {
var site = toAryToInt.GetSite(CompositeConversionAction.Make(toAryToInt.Context, CompositeConversion.ToAryToInt));
var union = site.Target(site, arrayOrSize);
if (union.First != null) {
// block ignored
return CreateArray(union.First);
} else if (block != null) {
return CreateArray(block, union.Second);
} else {
return CreateArray(self, union.Second, null);
}
}
开发者ID:toddb,项目名称:ironruby,代码行数:15,代码来源:ArrayOps.cs
注:本文中的ConversionStorage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论