本文整理汇总了C#中Proto类的典型用法代码示例。如果您正苦于以下问题:C# Proto类的具体用法?C# Proto怎么用?C# Proto使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Proto类属于命名空间,在下文中一共展示了Proto类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FromDecimal
public static decimal FromDecimal(Proto.Seto.Decimal sDecimal)
{
var val = new decimal(sDecimal.Value);
// Annoyingly, there is no integer exponentiation
var divisor = new decimal((long)Math.Pow(10, sDecimal.Exponent));
return Math.Round(val / divisor, (int)sDecimal.Exponent);
}
开发者ID:smarkets,项目名称:IronSmarkets,代码行数:7,代码来源:SetoMap.cs
示例2: luaF_freeproto
public static void luaF_freeproto(lua_State L, Proto f)
{
luaM_freearray<Instruction>(L, f.code);
luaM_freearray<Proto>(L, f.p);
luaM_freearray<TValue>(L, f.k);
luaM_freearray<Int32>(L, f.lineinfo);
luaM_freearray<LocVar>(L, f.locvars);
luaM_freearray<TString>(L, f.upvalues);
luaM_free(L, f);
}
开发者ID:raymanyu,项目名称:kopilua,代码行数:10,代码来源:lfunc.cs
示例3: LuaFFreeProto
public static void LuaFFreeProto(LuaState L, Proto f)
{
LuaMFreeArray<Instruction>(L, f.code);
LuaMFreeArray<Proto>(L, f.p);
LuaMFreeArray<TValue>(L, f.k);
LuaMFreeArray<Int32>(L, f.lineinfo);
LuaMFreeArray<LocVar>(L, f.locvars);
LuaMFreeArray<TString>(L, f.upvalues);
LuaMFree(L, f);
}
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:10,代码来源:lfunc.cs
示例4: FromSeto
internal static MarketQuotes FromSeto(Proto.Seto.MarketQuotes setoQuotes)
{
var quantityType = Quantity.QuantityTypeFromSeto(setoQuotes.QuantityType);
var priceType = Price.PriceTypeFromSeto(setoQuotes.PriceType);
return new MarketQuotes(
Uid.FromUuid128(setoQuotes.Market),
ContractQuotesMap.FromSeto(
setoQuotes.ContractQuotes, priceType, quantityType),
priceType,
quantityType);
}
开发者ID:smarkets,项目名称:IronSmarkets,代码行数:11,代码来源:MarketQuotes.cs
示例5: LuaUDump
public static int LuaUDump(LuaState L, Proto f, lua_Writer w, object data, int strip)
{
DumpState D = new DumpState();
D.L=L;
D.writer=w;
D.data=data;
D.strip=strip;
D.status=0;
DumpHeader(D);
DumpFunction(f,null,D);
return D.status;
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:12,代码来源:ldump.cs
示例6: LuaFGetLocalName
/*
** Look for n-th local variable at line `line' in function `func'.
** Returns null if not found.
*/
public static CharPtr LuaFGetLocalName(Proto f, int local_number, int pc)
{
int i;
for (i = 0; i<f.sizelocvars && f.locvars[i].startpc <= pc; i++) {
if (pc < f.locvars[i].endpc) { /* is variable active? */
local_number--;
if (local_number == 0)
return GetStr(f.locvars[i].varname);
}
}
return null; /* not found */
}
开发者ID:GSharpDevs,项目名称:RunG,代码行数:16,代码来源:lfunc.cs
示例7: PrintFunction
public static void PrintFunction(Proto f, int full)
{
int i,n=f.sizep;
PrintHeader(f);
PrintCode(f);
if (full != 0)
{
PrintConstants(f);
PrintLocals(f);
PrintUpvalues(f);
}
for (i=0; i<n; i++) PrintFunction(f.p[i],full);
}
开发者ID:lenzener,项目名称:LuaInterface,代码行数:13,代码来源:print.cs
示例8: PrintConstant
private static void PrintConstant(Proto f, int i)
{
/*const*/ TValue o=f.k[i];
switch (TType(o))
{
case LUA_TNIL:
printf("nil");
break;
case LUA_TBOOLEAN:
printf(BValue(o) != 0 ? "true" : "false");
break;
case LUA_TNUMBER:
printf(LUA_NUMBER_FMT,NValue(o));
break;
case LUA_TSTRING:
PrintString(RawTSValue(o));
break;
default: /* cannot happen */
printf("? type=%d",TType(o));
break;
}
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:22,代码来源:print.cs
示例9: LoadConstants
private static void LoadConstants(LoadState S, Proto f)
{
int i,n;
n=LoadInt(S);
f.k = luaM_newvector<TValue>(S.L, n);
f.sizek=n;
for (i=0; i<n; i++) setnilvalue(f.k[i]);
for (i=0; i<n; i++)
{
TValue o=f.k[i];
int t=LoadChar(S);
switch (t)
{
case LUA_TNIL:
setnilvalue(o);
break;
case LUA_TBOOLEAN:
setbvalue(o, LoadChar(S));
break;
case LUA_TNUMBER:
setnvalue(o, LoadNumber(S));
break;
case LUA_TSTRING:
setsvalue2n(S.L, o, LoadString(S));
break;
default:
error(S,"bad constant");
break;
}
}
n=LoadInt(S);
f.p=luaM_newvector<Proto>(S.L,n);
f.sizep=n;
for (i=0; i<n; i++) f.p[i]=null;
for (i=0; i<n; i++) f.p[i]=LoadFunction(S,f.source);
}
开发者ID:raymanyu,项目名称:kopilua,代码行数:36,代码来源:lundump.cs
示例10: SetPTValue2S
//#define setptvalue2s setptvalue
internal static void SetPTValue2S(LuaState L, TValue obj, Proto x)
{
SetPTValue(L, obj, x);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:5,代码来源:lobject.cs
示例11: DumpConstants
private static void DumpConstants(Proto f, DumpState D)
{
int i,n=f.sizek;
DumpInt(n,D);
for (i=0; i<n; i++)
{
/*const*/ TValue o=f.k[i];
DumpChar(TType(o),D);
switch (TType(o))
{
case LUA_TNIL:
break;
case LUA_TBOOLEAN:
DumpChar(BValue(o),D);
break;
case LUA_TNUMBER:
DumpNumber(NValue(o),D);
break;
case LUA_TSTRING:
DumpString(RawTSValue(o),D);
break;
default:
LuaAssert(0); /* cannot happen */
break;
}
}
n=f.sizep;
DumpInt(n,D);
for (i=0; i<n; i++) DumpFunction(f.p[i],f.source,D);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:30,代码来源:ldump.cs
示例12: DumpDebug
private static void DumpDebug(Proto f, DumpState D)
{
int i,n;
n= (D.strip != 0) ? 0 : f.sizelineinfo;
DumpVector(f.lineinfo, n, D);
n= (D.strip != 0) ? 0 : f.sizelocvars;
DumpInt(n,D);
for (i=0; i<n; i++)
{
DumpString(f.locvars[i].varname,D);
DumpInt(f.locvars[i].startpc,D);
DumpInt(f.locvars[i].endpc,D);
}
n= (D.strip != 0) ? 0 : f.sizeupvalues;
DumpInt(n,D);
for (i=0; i<n; i++) DumpString(f.upvalues[i],D);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:17,代码来源:ldump.cs
示例13: setptvalue
internal static void setptvalue(lua_State L, TValue obj, Proto x)
{
obj.value.gc = x;
obj.tt = LUA_TPROTO;
checkliveness(G(L), obj);
}
开发者ID:raymanyu,项目名称:kopilua,代码行数:6,代码来源:lobject.cs
示例14: Update
internal void Update(Proto.Seto.OrderCancelled message)
{
State.Update(message);
OnStateUpdated();
}
开发者ID:adamashton,项目名称:IronSmarkets,代码行数:5,代码来源:Order.cs
示例15: Deserialize
/// <summary>Helper: put the buffer into a MemoryStream before deserializing</summary>
public static Proto.Test.Nullables.MyMessage Deserialize(byte[] buffer, Proto.Test.Nullables.MyMessage instance)
{
using (var ms = new MemoryStream(buffer))
Deserialize(ms, instance);
return instance;
}
开发者ID:StepWoodProductions,项目名称:ProtoBuf,代码行数:7,代码来源:Nullables.Serializer.cs
示例16: DeserializeLength
/// <summary>Read the given number of bytes from the stream and deserialze it into the instance.</summary>
public static Proto.Test.Nullables.MyMessage DeserializeLength(Stream stream, int length, Proto.Test.Nullables.MyMessage instance)
{
long limit = stream.Position + length;
while (true)
{
if (stream.Position >= limit)
{
if (stream.Position == limit)
break;
else
throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Read past max limit");
}
int keyByte = stream.ReadByte();
if (keyByte == -1)
throw new System.IO.EndOfStreamException();
// Optimized reading of known fields with field ID < 16
switch (keyByte)
{
// Field 1 Varint
case 8:
instance.Foo = (int)global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadUInt64(stream);
continue;
// Field 2 LengthDelimited
case 18:
instance.Bar = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadString(stream);
continue;
}
var key = global::SilentOrbit.ProtocolBuffers.ProtocolParser.ReadKey((byte)keyByte, stream);
// Reading field ID > 16 and unknown field ID/wire type combinations
switch (key.Field)
{
case 0:
throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
default:
global::SilentOrbit.ProtocolBuffers.ProtocolParser.SkipKey(stream, key);
break;
}
}
return instance;
}
开发者ID:StepWoodProductions,项目名称:ProtoBuf,代码行数:44,代码来源:Nullables.Serializer.cs
示例17: FromSeto
internal static Order FromSeto(
Proto.Seto.OrderState state,
Proto.Seto.PriceType priceType,
uint price,
Proto.Seto.Uuid128 market,
Proto.Seto.Uuid128 contract,
Proto.Seto.Side side)
{
return new Order(
new Price(priceType, price),
OrderState.FromSeto(state),
Uid.FromUuid128(market),
Uid.FromUuid128(contract),
SetoMap.Sides.FromSeto(side));
}
开发者ID:adamashton,项目名称:IronSmarkets,代码行数:15,代码来源:Order.cs
示例18: setptvalue2s
//#define setptvalue2s setptvalue
internal static void setptvalue2s(lua_State L, TValue obj, Proto x)
{
setptvalue(L, obj, x);
}
开发者ID:raymanyu,项目名称:kopilua,代码行数:5,代码来源:lobject.cs
示例19: traverseproto
/*
** All marks are conditional because a GC may happen while the
** prototype is still being created
*/
private static void traverseproto(global_State g, Proto f)
{
int i;
if (f.source != null) stringmark(f.source);
for (i=0; i<f.sizek; i++) /* mark literals */
markvalue(g, f.k[i]);
for (i=0; i<f.sizeupvalues; i++) { /* mark upvalue names */
if (f.upvalues[i] != null)
stringmark(f.upvalues[i]);
}
for (i=0; i<f.sizep; i++) { /* mark nested protos */
if (f.p[i] != null)
markobject(g, f.p[i]);
}
for (i=0; i<f.sizelocvars; i++) { /* mark local-variable names */
if (f.locvars[i].varname != null)
stringmark(f.locvars[i].varname);
}
}
开发者ID:raymanyu,项目名称:kopilua,代码行数:23,代码来源:lgc.cs
示例20: DumpFunction
private static void DumpFunction(Proto f, TString p, DumpState D)
{
DumpString( ((f.source==p) || (D.strip!=0)) ? null : f.source, D);
DumpInt(f.linedefined,D);
DumpInt(f.lastlinedefined,D);
DumpChar(f.nups,D);
DumpChar(f.numparams,D);
DumpChar(f.is_vararg,D);
DumpChar(f.maxstacksize,D);
DumpCode(f,D);
DumpConstants(f,D);
DumpDebug(f,D);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:13,代码来源:ldump.cs
注:本文中的Proto类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论