public override int GetHashCode() { unchecked { var result = GuidValue.GetHashCode(); result = (result * 397) ^ (StringValue != null ? StringValue.GetHashCode() : 0); result = (result * 397) ^ IntValue; result = (result * 397) ^ LongValue.GetHashCode(); result = (result * 397) ^ BoolValue.GetHashCode(); result = (result * 397) ^ ByteValue.GetHashCode(); result = (result * 397) ^ DecimalValue.GetHashCode(); result = (result * 397) ^ DoubleValue.GetHashCode(); result = (result * 397) ^ DateTimeValue.GetHashCode(); result = (result * 397) ^ MaybeMoney.GetHashCode(); result = (result * 397) ^ TimeSpanValue.GetHashCode(); return(result); } }
public bool mkdir(Env env, StringValue path, LongValue mode, LongValue options) { // creating an uninitialized object makes no sense but it's here // to match PHP 5.3.8 behavior for drupal-7.12 // php/1e22 Value obj = _qClass.createObject(env); AbstractFunction function = _qClass.findFunction("mkdir"); if (function == null) { return(false); } Value result = function.callMethod(env, _qClass, obj, path, mode, options); return(result.toBoolean()); }
/** * Reads a Binary string. */ public StringValue read(int length) { Value output; if (_env.isUnicodeSemantics()) { output = _wrapper.callMethod(_env, STREAM_READ_U, LongValue.create(length)); } else { output = _wrapper.callMethod(_env, STREAM_READ, LongValue.create(length)); } return(output.toBinaryValue(_env)); }
public override string ToString() { switch (Type) { case PrimitiveType.IntegerLong: return(LongValue.ToString(CultureInfo.InvariantCulture)); case PrimitiveType.IntegerBig: return(BigIntegerValue.ToString(CultureInfo.InvariantCulture)); case PrimitiveType.Decimal: return(DecimalValue.ToString(CultureInfo.InvariantCulture)); default: Debug.Fail($"Cannot handle unknown primitive type {Type}."); return(null); } }
public override string ToString() { var type = "SABILFDT"[(int)Type]; string value; switch (Type) { case IndexValueType.String: value = StringValue; break; case IndexValueType.StringArray: throw new NotSupportedException(); case IndexValueType.Bool: value = BooleanValue ? IndexValue.Yes : IndexValue.No; break; case IndexValueType.Int: value = IntegerValue.ToString(CultureInfo.InvariantCulture); break; case IndexValueType.Long: value = LongValue.ToString(CultureInfo.InvariantCulture); break; case IndexValueType.Float: value = SingleValue.ToString(CultureInfo.InvariantCulture); break; case IndexValueType.Double: value = DoubleValue.ToString(CultureInfo.InvariantCulture); break; case IndexValueType.DateTime: value = DateTimeValue.ToString("yyyy-MM-dd HH:mm:ss.ffff"); break; default: throw new ArgumentOutOfRangeException(); } return($"{value}:{type}"); }
public override int GetHashCode() { int hash = 1; if (EventId != 0UL) { hash ^= EventId.GetHashCode(); } if (EventType != 0) { hash ^= EventType.GetHashCode(); } if (valueTypeCase_ == ValueTypeOneofCase.LongValue) { hash ^= LongValue.GetHashCode(); } if (valueTypeCase_ == ValueTypeOneofCase.DoubleValue) { hash ^= DoubleValue.GetHashCode(); } if (valueTypeCase_ == ValueTypeOneofCase.SkeletonValue) { hash ^= SkeletonValue.GetHashCode(); } if (valueTypeCase_ == ValueTypeOneofCase.ObjectValue) { hash ^= ObjectValue.GetHashCode(); } if (valueTypeCase_ == ValueTypeOneofCase.StringValue) { hash ^= StringValue.GetHashCode(); } if (valueTypeCase_ == ValueTypeOneofCase.CustomValue) { hash ^= CustomValue.GetHashCode(); } if (appTypeCase_ == AppTypeOneofCase.AppId) { hash ^= AppId.GetHashCode(); } hash ^= (int)valueTypeCase_; hash ^= (int)appTypeCase_; return(hash); }
public BinaryStream fopen(Env env, StringValue path, StringValue mode, LongValue options) { bool useIncludePath = (options.toLong() & StreamModule.STREAM_USE_PATH) != 0; Value pathComponent = UrlModule.parse_url(env, path, UrlModule.PHP_URL_PATH); if (!pathComponent.isset()) { log.info(L.l("no path component found in '{0}'", path.ToString())); return(null); } return(ZlibModule.gzopen(env, pathComponent.ToStringValue(), mode.ToString(), useIncludePath)); }
public BinaryStream fopen(Env env, StringValue pathV, StringValue mode, LongValue options) { string path = pathV.ToString(); if (path.equals("php://output")) { return(new PhpBinaryOutput(env)); } else if (path.equals("php://input")) { return(new PhpBinaryInput(env)); } else if (path.equals("php://stdout")) { return(new PhpStdout()); } else if (path.equals("php://stderr")) { return(new PhpStderr()); } else if (path.equals("php://stdin")) { return(new PhpStdin(env)); } else if (path.equals("php://memory")) { return(new ByteArrayBinaryStream(env)); } else if (path.equals("php://temp")) { return(FileModule.tmpfile(env)); } else { env.warning(L.l("{0} @is an unsupported or unknown path for this protocol", path)); return(null); } }
public override int GetHashCode() { int hashCode = 0; if (this.GetType() == typeof(LongPropertyValue)) { hashCode = LongValue.GetHashCode(); } else if (this.GetType() == typeof(LongPropertyValues)) { foreach (long longValue in LongValues) { hashCode += longValue.GetHashCode(); } } else if (this.GetType() == typeof(FloatPropertyValue)) { hashCode = FloatValue.GetHashCode(); } else if (this.GetType() == typeof(StringPropertyValue)) { hashCode = StringValue.GetHashCode(); } else if (this.GetType() == typeof(FloatPropertyValues)) { foreach (float floatValue in FloatValues) { hashCode += floatValue.GetHashCode(); } } else if (this.GetType() == typeof(StringPropertyValues)) { foreach (String stringValue in StringValues) { hashCode += stringValue.GetHashCode(); } } return(hashCode); }
public override int GetHashCode() { unchecked { var hashCode = CharValue.GetHashCode(); hashCode = (hashCode * 397) ^ ByteValue.GetHashCode(); hashCode = (hashCode * 397) ^ SByteValue.GetHashCode(); hashCode = (hashCode * 397) ^ ShortValue.GetHashCode(); hashCode = (hashCode * 397) ^ UShortValue.GetHashCode(); hashCode = (hashCode * 397) ^ IntValue; hashCode = (hashCode * 397) ^ (int)UIntValue; hashCode = (hashCode * 397) ^ LongValue.GetHashCode(); hashCode = (hashCode * 397) ^ ULongValue.GetHashCode(); hashCode = (hashCode * 397) ^ FloatValue.GetHashCode(); hashCode = (hashCode * 397) ^ DoubleValue.GetHashCode(); hashCode = (hashCode * 397) ^ DecimalValue.GetHashCode(); hashCode = (hashCode * 397) ^ DateTimeValue.GetHashCode(); hashCode = (hashCode * 397) ^ GuidValue.GetHashCode(); hashCode = (hashCode * 397) ^ StringValue.GetHashCode(); return(hashCode); } }
private static Object ParseIntLongByte(String arg, int factor) { // try to parse as an int first, else try to parse as a long try { return IntValue.ParseString(arg)*factor; } catch (OverflowException e1) { try { return (Int64) (LongValue.ParseString(arg)*factor); } catch { } throw; } catch (FormatException e1) { try { return (Int64) (LongValue.ParseString(arg)*factor); } catch (Exception) { try { return (Byte) (ByteValue.ParseString(arg)*factor); } catch (Exception) { throw e1; } } } }
public WrappedStream(Env env, QuercusClass qClass, StringValue path, StringValue mode, LongValue options) { _env = env; _lineReader = new LineReader(env); _wrapper = qClass.callNew(env, Value.NULL_ARGS); if (env.isUnicodeSemantics()) { _wrapper.callMethod(env, STREAM_OPEN_U, path, mode, options, NullValue.NULL); } else { _wrapper.callMethod(env, STREAM_OPEN, path, mode, options, NullValue.NULL); } }
/** * Parses the string. */ public static ArrayValue token_get_all(Env env, StringValue s) { ArrayValue result = new ArrayValueImpl(); Token lexer = new Token(env, s); int token; while ((token = lexer.nextToken()) >= 0) { if (0x20 <= token && token <= 0x7f) { result.put(env.createString((char)token)); } else { result.put(new ArrayValueImpl() .append(LongValue.create(token)) .append(lexer.getLexeme())); } } return(result); }
public Value readInfo(Env env, Value msgsInQueue) { if (_msgQueue.size() == 0) { return(BooleanValue.FALSE); } StringValue msgStr = env.createString("msg"); StringValue resultStr = env.createString("result"); StringValue handleStr = env.createString("handle"); CurlResource curl = _msgQueue.remove(0); ArrayValue array = new ArrayValueImpl(); array.put(msgStr, LongValue.create(CurlModule.CURLMSG_DONE)); array.put(resultStr, LongValue.create(CurlModule.CURLE_OK)); array.put(handleStr, curl); msgsInQueue.set(LongValue.create(_msgQueue.size())); return(array); }
public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (valueCase_ == ValueOneofCase.LongValue) { hash ^= LongValue.GetHashCode(); } if (valueCase_ == ValueOneofCase.DoubleValue) { hash ^= DoubleValue.GetHashCode(); } if (valueCase_ == ValueOneofCase.StringValue) { hash ^= StringValue.GetHashCode(); } hash ^= (int)valueCase_; return(hash); }
protected override bool prepareForExecute(Env env) { int size = _preparedMapping.size(); for (int i = 0; i < size; i++) { LongValue param = _preparedMapping.get(i); Value paramV = getParam(param.toInt() - 1); if (paramV.equals(UnsetValue.UNSET)) { env.warning(L.l("Not all parameters are bound")); return(false); } Object object = paramV.toJavaObject(); setObject(i + 1, object); } return(true); }
public override string ToString() { switch (_type) { case Type.Int: return(IntValue.ToString()); case Type.Short: return(ShortValue.ToString()); case Type.UInt: return(UIntValue.ToString()); case Type.ULong: return(ULongValue.ToString()); case Type.UShort: return(UShortValue.ToString()); case Type.Long: default: return(LongValue.ToString()); } }
public override Value key(Env env) { return(LongValue.create(_iterCount)); }
/** * Add an ini default for an ini that has a long value. */ public IniDefinition add(String name, long deflt, int scope) { return(add(name, IniDefinition.Type.LONG, LongValue.create(deflt), scope)); }
public Value opendir(Env env, StringValue path, LongValue flags) { env.warning(L.l("opendir not supported by protocol")); return(BooleanValue.FALSE); }
public StreamBucket(Env env, BinaryValue data) { putField(env, "data", data); putField(env, "datalen", LongValue.create(data.length())); }
public Value url_stat(Env env, StringValue path, LongValue flags) { env.warning(L.l("stat not supported by protocol")); return(BooleanValue.FALSE); }
public bool rmdir(Env env, StringValue path, LongValue options) { env.warning(L.l("rmdir not supported by protocol")); return(false); }
public LiteralLongExpr(Location location, long value) { super(location); _value = value; _objValue = LongValue.create(_value); }
public bool Equals(ByteMessage other) { return(UtcTime.Equals(other.UtcTime) && LongValue.Equals(other.LongValue) && ByteValue.Equals(other.ByteValue)); }
public override Value toValue(Env env, string encoding) { return(LongValue.create(_index)); }
/// <summary> /// Mathematical functions /// </summary> static Value MathOp(Env environment, Value arguments, string op) { SExprValue sexprValue = arguments.As <SExprValue>(); Debug.Assert(sexprValue != null, "Non s-expr"); // Ensure all numbers var check = ArgumentsAllOfType(sexprValue, LongValue.TYPE, op); if (check != null) { return(check); } // Pop the first element Value xBase = sexprValue.Cell[0]; LongValue x = xBase.As <LongValue>(); sexprValue.Cell.RemoveAt(0); // If no arguments and sub then perform unary negation if (op.Equals("-", StringComparison.Ordinal) && sexprValue.Cell.Count == 0) { x.Value = -x.Value; } // While there are still elements remaining while (sexprValue.Cell.Count > 0) { // Pop the next element LongValue y = sexprValue.Cell[0].As <LongValue>(); sexprValue.Cell.RemoveAt(0); if (op.Equals("+", StringComparison.Ordinal)) { x.Value += y.Value; } else if (op.Equals("-", StringComparison.Ordinal)) { x.Value -= y.Value; } else if (op.Equals("*", StringComparison.Ordinal)) { x.Value *= y.Value; } else if (op.Equals("/", StringComparison.Ordinal)) { if (y.Value == 0) { xBase = new ErrorValue("Division By Zero."); break; } x.Value /= y.Value; } else if (op.Equals("%", StringComparison.Ordinal)) { if (y.Value == 0) { xBase = new ErrorValue("Division By Zero."); break; } x.Value %= y.Value; } else if (op.Equals("^", StringComparison.Ordinal)) { x.Value = (long)Math.Pow(x.Value, y.Value); } } return(xBase); }
protected override void SetLongField(LongValue value) { SetTextField(value.TextValue); }
/** * Evaluates the expression. * * @param env the calling environment. * * @return the expression value. */ public Value eval(Env env) { return(LongValue.create(_expr.evalLong(env))); }
// Update is called once per frame void Update() { if (Input.GetKeyUp(KeyCode.Escape)) { if (DialogBase.Actived()) { DebugConsole.Log("Hide"); DialogBase.Hide(); } else { DebugConsole.Log("Show"); DialogBase.Show("ESC", "Are you sure to exit game?", QuitGame); } } if (m_broadcastMsg != "") { // 有系统消息,平移吧 GameObject goBroadcast = GameObject.Find("BroadcastText"); Vector3 pos = goBroadcast.transform.localPosition; pos.x -= 50 * Time.deltaTime; goBroadcast.transform.localPosition = pos; // 从600~-600 if (goBroadcast.transform.localPosition.x < -600) { m_broadcastMsg = ""; } } else { m_broadcastMsg = Lobby.getInstance().GetBroadcast(); if (m_broadcastMsg != "") { GameObject goBroadcast = GameObject.Find("BroadcastText"); goBroadcast.GetComponent <Text>().text = m_broadcastMsg; goBroadcast.transform.localPosition = new Vector3(600, 0, 0); } } if (m_net == null || !m_net.IsRunning()) { // 主动结束了 return; } if (m_net.CheckReconnect()) { CheckLogin(); DialogReconnect.Hide(); } ProtoPacket packet = new ProtoPacket(); if (m_net.RecvTryDequeue(ref packet)) { DebugConsole.Log("Reception handle cmdId:" + packet.cmdId); switch (packet.cmdId) { case Constants.Lion_QuickLoginInfo: { Lobby.getInstance().UserInfo = (LionUserInfo)packet.proto; // 更新LionUser m_login = true; UpdateUserInfoUI(); // 更新大厅主界面中信息 if (packet.callback != null) { packet.callback(); } } break; case Constants.Lion_GetProfile: { LionUserInfo usrInfo = (LionUserInfo)packet.proto; // 更新LionUser if (usrInfo.UserId == Lobby.getInstance().UId) { Lobby.getInstance().UserInfo = usrInfo; } Lobby.getInstance().QueryUserInfo = usrInfo; if (packet.callback != null) { // 通常这里显示个人信息对话框 packet.callback(); } } break; case Constants.Lion_GetTigerStat: { Lobby.getInstance().TigerStatInfo = (TigerStat)packet.proto; if (packet.callback != null) { packet.callback(); } } break; case Constants.Lion_GetFriendRequests: case Constants.Lion_GetFriends: { Lobby.getInstance().FriendIDArray = (LongArray)packet.proto; if (packet.callback != null) { GetFriendSummary(packet.callback); } else { GetFriendSummary(ShowFriendsDlg); } } break; case Constants.Lion_GetFriendSummary: { Lobby.getInstance().CurrentSummaryList = (FriendSummaryList)packet.proto; DebugConsole.Log("Summary count:" + Lobby.getInstance().CurrentSummaryList.Data.Count); if (packet.callback != null) { packet.callback(); } } break; case Constants.Lion_IgnoreFriend: case Constants.Lion_AcceptFriend: case Constants.Lion_AddFriend: case Constants.Lion_DeleteFriend: { Status stat = (Status)packet.proto; if (stat.Code == 0) // successful { if (packet.callback != null) { packet.callback(); } } else { DebugConsole.Log(stat.Desc); } } break; case Constants.Lion_Redirect: { Lobby.getInstance().RedirectInfo = (RedirectResp)packet.proto; // 切换到游戏场景中 //m_net.Close(); DebugConsole.Log("Reception enter slot scene"); Global.NextSceneName = "slot"; SceneManager.LoadScene("loading"); } break; case Constants.Lion_UpdateProfile: { DebugConsole.Log("Lion_UpdateProfile"); Status stat = (Status)packet.proto; if (stat.Code == 0) // successful { if (packet.callback != null) { packet.callback(); } } else { DebugConsole.Log(stat.Desc); } } break; case Constants.Lion_NotifyWeeklyLogin: { // 连续登录奖励 // NotifyWeeklyLogin 返回的intvalue是0-6,0表示今天登陆了(昨天没登录) IntValue iv = (IntValue)packet.proto; DialogDailyBonus.Show(iv.Value); //ExplodeCoin.Show(); } break; case Constants.Lion_TakeLoginBonus: { LongArray la = (LongArray)packet.proto; // la[0] 奖励金币数 // la[1] 最终总数 if (la.Data.Count >= 2) { Lobby.getInstance().UserInfo.Gold = la.Data[1]; // 若有动画,在此添加 JumpAndMoveCoins(6, UpdateUserInfoUI); } } break; case Constants.Lion_NotifyFreeBonus: { // 第一次登陆的时候,数据库里面没有数据,所以返回0 // 后端推送,倒计时剩余时间长度(毫秒),如果小于等于0,直接显示奖励 // 免费奖励 LongValue lv = (LongValue)packet.proto; long curEpoch = (System.DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000; Lobby.getInstance().FreeBonusEpoch = curEpoch + lv.Value; UpdateCountDown(); } break; case Constants.Lion_TakeFreeBonus: { LongArray la = (LongArray)packet.proto; if (la.Data.Count >= 2) { Lobby.getInstance().UserInfo.Gold = la.Data[1]; // 若有动画,在此添加 FlyCoin(Constants.Bonus_Free); UpdateUserInfoUI(); } } break; case Constants.Lion_BuyItem: { Status stat = (Status)packet.proto; // 更新购买相关的:金币 or 背包 DebugConsole.Log("Buy item return:" + stat.Code.ToString()); if (stat.Code == 0) // successful { if (packet.callback != null) { packet.callback(); } } else { DebugConsole.Log(stat.Desc); } } break; case Constants.Lion_Register: { Status stat = (Status)packet.proto; DebugConsole.Log("Register by email return:" + stat.Code.ToString()); if (stat.Code == 0) // successful { if (packet.callback != null) { packet.callback(); } } else { DebugConsole.Log(stat.Desc); DialogBase.Show("Register by email", "Error:" + stat.Desc); } } break; case Constants.Lion_ModPass: { Status stat = (Status)packet.proto; DebugConsole.Log("Modify password return:" + stat.Code.ToString()); if (stat.Code == 0) // successful { if (packet.callback != null) { packet.callback(); } } else { DebugConsole.Log(stat.Desc); DialogBase.Show("Modify password", "Error:" + stat.Desc); } } break; case Constants.Lion_RefreshGold: { LongValue lv = (LongValue)packet.proto; DebugConsole.Log("Refresh gold:" + lv.ToString()); Lobby.getInstance().UserInfo.Gold = lv.Value; UpdateUserInfoUI(); } break; case Constants.Lion_GetShopItems: { Lobby.getInstance().ShopList = (ShopList)packet.proto; DebugConsole.Log("ShopName:" + Lobby.getInstance().ShopList.ShopName); if (packet.callback != null) { packet.callback(); } } break; case Constants.Lion_BroadcastSystemMessage: { Tools.PlayNotification(Constants.Audio.Audio_Notification); StringValue sv = (StringValue)packet.proto; Lobby.getInstance().AddBroadcast(sv.Value); } break; case Constants.Lion_GetItems: { // Lobby.getInstance().UserItemList = (UserItemList)packet.proto; if (packet.callback != null) { packet.callback(); } else { DialogBag.Show(null); } } break; case Constants.Reconnect: { // 展示重连对话框,直到重连成功 if (packet.msgId == 1) { ProtoNet.WriteLog("Reconnecting..."); // 3s后Display中重连 m_net.CheckReconnect(3); DialogReconnect.Show(); } } break; case Constants.Error: { // 展示错误 Status stat = (Status)packet.proto; string err = "Error:" + stat.Code.ToString() + "-" + stat.Desc; DialogBase.Show("ERROR", err); } break; default: { DebugConsole.Log("Reception invalid cmdId:" + packet.cmdId); } break; } } }