/// <summary> /// creates new instance of AbstratData derived class from <c>inStream</c> /// inStream position should be in the beginning of data of pointer to data /// </summary> /// <param name="type">type to read</param> /// <param name="inStream">strem to read from</param> /// <param name="options">null or list of params required to read dat aof type <c>type</c></param> /// <returns></returns> public static AbstractData CreateData(BaseDataType type, BinaryReader inStream, Dictionary <string, object> options) { // check if list type var listDataType = type as ListDataType; if (listDataType != null) // list type data { return(new ListData(listDataType, inStream, options)); } // check if pointer type var pointerDataType = type as PointerDataType; if (pointerDataType != null) // pointer type data { return(new PointerData(pointerDataType, inStream, options)); } // value type data AbstractData data; switch (type.Name) { case "bool": data = new ValueData <bool>(type, inStream, options); break; case "byte": data = new ValueData <byte>(type, inStream, options); break; case "short": data = new ValueData <short>(type, inStream, options); break; case "int": data = new Int32Data(type, inStream, options); break; case "uint": data = new ValueData <uint>(type, inStream, options); break; case "long": data = new Int64Data(type, inStream, options); break; case "ulong": data = new ValueData <ulong>(type, inStream, options); break; case "string": data = new StringData(type, inStream, options); break; default: throw new Exception("Unknown value type name: " + type.Name); } return(data); }
/// <summary> /// 将远端对应的物体销毁,脱离服务端,使用外部销毁队列销毁 /// </summary> public void RequestDestroy(Action act) { //如果未处于连接状态则直接返回 if (!isConnectNetScene) { return; } EventDispatcher.TriggerEvent <NetBehavior>(NetSceneEvent.NetBehaviorRemoveFromScene, this); Int32Data instanceId = new Int32Data(); instanceId.Value = this.instanceId; Debug.Log("请求销毁:" + gameObject.name); NetSceneManager.Instance .Request(HandlerConst.RequestId.NetObjectRemoveHandler, instanceId, (res) => { BoolData isSucc = res.GetValue <BoolData>(); if (isSucc.Value) { Debug.logger.Log("成功将NetBehavior:" + gameObject.name + "移除场景 " + chnId); } else { Debug.logger.LogError("NetPost", "将NetBehavior:" + gameObject.name + "移除场景失败 " + chnId); } isConnectNetScene = false; act(); }); }
// Token: 0x060016EE RID: 5870 RVA: 0x00089B40 File Offset: 0x00087D40 public void DeserializeData(BinaryReader reader, ComponentDataPool componentDataPool) { Int32Data int32DataInstance = componentDataPool.GetInt32DataInstance(); int32DataInstance.DeserializeData(reader, componentDataPool); this.cacheEntryId = int32DataInstance.Data; }
public void StartScene(int sceneId) { currentSceneId = sceneId; currentServer = new BaseServer(); currentServer.Connect(ServerConst.ServerAddress, ServerConst.TcpRemotePort, ServerConst.UdpRemotePort, ServerConst.UdpLocalPort, true); Int32Data sceneIdData = new Int32Data(); sceneIdData.Value = sceneId; currentServer.Request(HandlerConst.RequestId.RequsetSceneHandler, -1, sceneIdData, SendType.TCP, (reqSceneRes) => { if (reqSceneRes.GetValue <BoolData>().Value == true) { Debug.logger.Log("请求场景成功"); currentServer.Regist(new List <int> { currentSceneId }, new List <int>(), (pkg) => { Debug.logger.Log("频道注册成功"); EventDispatcher.AddEventListener <NetBehavior>(NetSceneEvent.NetBehaviorAddToScene, AddNetBehavior); EventDispatcher.AddEventListener <NetBehavior>(NetSceneEvent.NetBehaviorRemoveFromScene, RemoveNetBehavior); sceneConnected = true; }); } else { Debug.logger.LogError("NetPost", "请求场景失败"); } }); }
public void DeserializeData(BinaryReader reader, ComponentDataPool componentDataPool) { DerivedData <ISyncItemId> derivedData = new DerivedData <ISyncItemId>(); derivedData.DeserializeData(reader, componentDataPool); this.ParentId = derivedData.Data; GenericListData <DerivedData <ISyncItemId>, ISyncItemId> genericListData = new GenericListData <DerivedData <ISyncItemId>, ISyncItemId>(); genericListData.DeserializeData(reader, componentDataPool); this.Children = genericListData.Data; BooleanData booleanDataInstance = componentDataPool.GetBooleanDataInstance(); booleanDataInstance.DeserializeData(reader, componentDataPool); this.hidden = booleanDataInstance.Data; booleanDataInstance.DeserializeData(reader, componentDataPool); this.HiddenDueToParent = booleanDataInstance.Data; Int32Data int32DataInstance = componentDataPool.GetInt32DataInstance(); int32DataInstance.DeserializeData(reader, componentDataPool); this.Permissions = (SyncPermissions)int32DataInstance.Data; StringData stringDataInstance = componentDataPool.GetStringDataInstance(); stringDataInstance.DeserializeData(reader, componentDataPool); this.Owner = stringDataInstance.Data; }
static Settings() { var settingsFile = new IniFile("Settings.ini"); IniSection settingsSection = settingsFile["Settings"], proxySection = settingsFile["Proxy"]; DownloadPathData = new StringData(settingsSection, "DownloadPath", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Downloads")); VideoFileNameData = new StringData(settingsSection, "VideoFileName", "%T%E"); ProxyHostData = new StringData(proxySection, "Host", "127.0.0.1"); MaxTasksData = new Int32Data(settingsSection, "MaxTasks", 50); ProxyPortData = new Int32Data(proxySection, "Port", 8087); UseProxyData = new BooleanData(proxySection, "UseProxy", false); }
/// <summary> /// 断开场景 /// </summary> public void Disconnect(System.Action onDisconnect = null) { if (sceneConnected == false) { Debug.unityLogger.LogError("NetPost", "当前不存在连接"); return; } currentScene.OnBeforeDisconnect(); sceneConnected = false; Int32Data sceneIdData = new Int32Data(); sceneIdData.Value = currentSceneId; ActionQueue destroyQueue = new ActionQueue(); //添加删除物体的行为 foreach (var kvp in clientNetBehaviorDict) { Debug.Log(kvp.Value.gameObject.name); destroyQueue.AddAction((act) => { kvp.Value.RequestDestroy(act); }); } //添加最终断开场景的行为 destroyQueue.AddAction((act) => { currentServer.Request(HandlerConst.RequestId.DisconnectSceneHandler, -1, sceneIdData, SendType.TCP, (pkg) => { bool result = pkg.GetValue <BoolData>().Value; if (result == true) { Debug.unityLogger.Log("成功断开场景"); } else { Debug.unityLogger.Log("断开场景失败"); } currentScene.OnAfterDisconnect(result); act(); }, () => { Debug.unityLogger.LogError("NetPost", "断开场景超时"); }); }); destroyQueue.AddAction(OnDestroy); if (onDisconnect != null) { destroyQueue.AddAction(onDisconnect); } }
void PerformanceTest() { Int32Data d = new Int32Data(); FieldData da = d as FieldData; for (int i = 0; i < 100000; i++) { FieldType t = da.Type; switch (t) { case FieldType.Int32: Int32Data id = da as Int32Data; break; } } }
// Token: 0x0600056E RID: 1390 RVA: 0x0002058C File Offset: 0x0001E78C internal void DeserializeData(BinaryReader reader, ComponentDataPool componentDataPool) { lock (this.instanceLock) { GenericListData <DateTimeData, ExDateTime> genericListData = new GenericListData <DateTimeData, ExDateTime>(); genericListData.DeserializeData(reader, componentDataPool); this.userAgentTimes = genericListData.Data; GenericListData <StringData, string> genericListData2 = new GenericListData <StringData, string>(); genericListData2.DeserializeData(reader, componentDataPool); this.userAgentStrings = genericListData2.Data; GenericListData <DateTimeData, ExDateTime> genericListData3 = new GenericListData <DateTimeData, ExDateTime>(); genericListData3.DeserializeData(reader, componentDataPool); this.recentCommandTimes = genericListData3.Data; GenericListData <Int32Data, int> genericListData4 = new GenericListData <Int32Data, int>(); genericListData4.DeserializeData(reader, componentDataPool); this.recentCommandHashCodes = genericListData4.Data; GenericListData <DateTimeData, ExDateTime> genericListData5 = new GenericListData <DateTimeData, ExDateTime>(); genericListData5.DeserializeData(reader, componentDataPool); this.watsons = genericListData5.Data; GenericListData <DateTimeData, ExDateTime> genericListData6 = new GenericListData <DateTimeData, ExDateTime>(); genericListData6.DeserializeData(reader, componentDataPool); this.outOfBudgets = genericListData6.Data; GenericListData <DateTimeData, ExDateTime> genericListData7 = new GenericListData <DateTimeData, ExDateTime>(); genericListData7.DeserializeData(reader, componentDataPool); this.syncTimes = genericListData7.Data; GenericListData <Int32Data, int> genericListData8 = new GenericListData <Int32Data, int>(); genericListData8.DeserializeData(reader, componentDataPool); this.syncKeys = genericListData8.Data; DateTimeData dateTimeDataInstance = componentDataPool.GetDateTimeDataInstance(); dateTimeDataInstance.DeserializeData(reader, componentDataPool); this.blockTime = dateTimeDataInstance.Data; DateTimeData dateTimeDataInstance2 = componentDataPool.GetDateTimeDataInstance(); dateTimeDataInstance2.DeserializeData(reader, componentDataPool); this.nextUnblockTime = dateTimeDataInstance2.Data; Int32Data int32DataInstance = componentDataPool.GetInt32DataInstance(); int32DataInstance.DeserializeData(reader, componentDataPool); this.autoBlockReason = (DeviceAccessStateReason)int32DataInstance.Data; DateTimeData dateTimeDataInstance3 = componentDataPool.GetDateTimeDataInstance(); dateTimeDataInstance3.DeserializeData(reader, componentDataPool); this.timeToUpdateAD = dateTimeDataInstance3.Data; if (!this.Validate()) { throw new CorruptSyncStateException(new LocalizedString("DeviceBehavior.DeserializeData"), null); } } }
// Token: 0x060015CE RID: 5582 RVA: 0x0008106C File Offset: 0x0007F26C protected virtual void VerifySyncState(Dictionary <string, DerivedData <ICustomSerializableBuilder> > obj) { StringData stringData = obj["{9150227d-9140-45d0-b4c2-e987f59cfc46}SyncCalendar.SyncStateCanary"].Data as StringData; StoreObjectIdData storeObjectIdData = obj["{9150227d-9140-45d0-b4c2-e987f59cfc46}SyncCalendar.SyncStateFolderId"].Data as StoreObjectIdData; Int32Data int32Data = obj["{9150227d-9140-45d0-b4c2-e987f59cfc46}SyncCalendar.SyncStateVersion"].Data as Int32Data; if (stringData == null || !this.SyncStateTag.Data.Equals(stringData.Data)) { throw new CorruptSyncStateException("tagKey is invalid", null); } if (storeObjectIdData == null || !this.SyncStoreFolderId.Data.Equals(storeObjectIdData.Data)) { throw new CorruptSyncStateException("storeId is invalid", null); } if (int32Data == null) { throw new CorruptSyncStateException("storedVersion is invalid", null); } this.Version = int32Data.Data; }
/// <summary> /// 销毁 /// </summary> public void RequestDestroy() { Int32Data instanceId = new Int32Data(); instanceId.Value = this.instanceId; int chnId = NetSceneManager.Instance.currentSceneId; NetSceneManager.Instance.currentServer .Request(HandlerConst.RequestId.NetObjectRemoveHandler, chnId, instanceId, SendType.TCP, (res) => { BoolData isSucc = res.GetValue <BoolData>(); if (isSucc.Value) { Debug.logger.Log("成功将NetBehavior移除场景" + chnId); } else { Debug.logger.LogError("NetPost", "将NetBehavior移除场景失败" + chnId); } }); }
public void VisitInt32(Int32Data field) { SeekToOffset(field.Offset); field.Value = _reader.ReadInt32(); }
public void VisitInt32(Int32Data field) { if (!FilterString(field, field.Name)) FilterNumber(field, field.Value); }
public void VisitInt32(Int32Data field) { SeekToOffset(field.Offset); _writer.WriteInt32(field.Value); }
public void VisitInt32(Int32Data field) { }
public void VisitInt32(Int32Data field) { AddWidth(_intControl.Width); }
// Token: 0x060008FD RID: 2301 RVA: 0x00035984 File Offset: 0x00033B84 internal static void HandlerCustomDataVersioning(FolderSyncState syncState) { if (syncState == null) { throw new ArgumentNullException("syncState"); } if (syncState.CustomVersion == null && syncState.SyncStateIsNew) { return; } bool flag = true; if (syncState.CustomVersion == null || syncState.CustomVersion <= 2 || syncState.CustomVersion > 9) { flag = false; } else if (syncState.CustomVersion.Value != 9) { switch (syncState.CustomVersion.Value) { case 3: syncState["CachedOptionsNode"] = null; break; case 4: break; case 5: goto IL_117; case 6: goto IL_12C; case 7: goto IL_13D; case 8: goto IL_143; default: flag = false; goto IL_158; } object obj = syncState[CustomStateDatumType.AirSyncProtocolVersion]; if (obj is ConstStringData) { string data = syncState.GetData <ConstStringData, string>(CustomStateDatumType.AirSyncProtocolVersion, null); int data2 = 20; if (data != null) { data2 = AirSyncUtility.ParseVersionString(data); } syncState[CustomStateDatumType.AirSyncProtocolVersion] = new Int32Data(data2); } IL_117: syncState["MaxItems"] = new Int32Data(int.MaxValue); IL_12C: syncState["ConversationMode"] = new BooleanData(false); IL_13D: FolderSyncStateCustomDataInfo.ConvertV7StickyOptions(syncState); IL_143: syncState["Permissions"] = new Int32Data(0); } IL_158: if (!flag) { syncState.HandleCorruptSyncState(); } }
internal static void HandlerCustomDataVersioning(FolderHierarchySyncState syncState) { if (syncState == null) { throw new ArgumentNullException("syncState"); } if (syncState.CustomVersion == null) { return; } bool flag = true; if (syncState.CustomVersion < 2 || syncState.CustomVersion > 5) { flag = false; } else if (syncState.CustomVersion.Value != 5) { int valueOrDefault = syncState.CustomVersion.GetValueOrDefault(); int?num; if (num != null) { switch (valueOrDefault) { case 2: syncState["RecoverySyncKey"] = new Int32Data(0); break; case 3: break; case 4: goto IL_DD; default: goto IL_11E; } syncState[CustomStateDatumType.AirSyncProtocolVersion] = new ConstStringData(StaticStringPool.Instance.Intern("2.0")); IL_DD: object obj = syncState[CustomStateDatumType.AirSyncProtocolVersion]; if (obj is ConstStringData) { string data = syncState.GetData <ConstStringData, string>(CustomStateDatumType.AirSyncProtocolVersion, null); int data2 = 20; if (data != null) { data2 = AirSyncUtility.ParseVersionString(data); } syncState[CustomStateDatumType.AirSyncProtocolVersion] = new Int32Data(data2); goto IL_120; } goto IL_120; } IL_11E: flag = false; } IL_120: if (!flag) { syncState.HandleCorruptSyncState(); } }
public override void HandleSyncStateVersioning(SyncState syncState) { if (syncState == null) { throw new ArgumentNullException("syncState"); } if (syncState.BackendVersion == null) { return; } bool flag = true; if (syncState.BackendVersion < 2 || syncState.BackendVersion > this.Version) { flag = false; } else if (syncState.BackendVersion.Value != this.Version) { string text = null; switch (syncState.BackendVersion.Value) { case 2: syncState["WipeConfirmationAddresses"] = null; break; case 3: break; case 4: goto IL_14F; case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: goto IL_3B6; case 20: goto IL_16C; case 21: goto IL_184; case 22: goto IL_1A6; case 23: goto IL_1D2; case 24: goto IL_1EF; case 25: goto IL_1FA; case 26: goto IL_212; case 27: goto IL_259; case 28: goto IL_2D8; case 29: goto IL_2E4; case 30: goto IL_2EF; case 31: goto IL_2FB; case 32: goto IL_306; case 33: goto IL_312; case 34: goto IL_31E; case 35: goto IL_32A; case 36: goto IL_358; case 37: goto IL_39E; default: goto IL_3B6; } syncState[CustomStateDatumType.UserAgent] = null; IL_14F: syncState["LastAdUpdateTime"] = null; syncState["DeviceHealth"] = new Int32Data(0); IL_16C: text = syncState.GetData <StringData, string>("LastPolicyXML", null); syncState.Remove("LastPolicyXML"); IL_184: syncState["ProvisionSupported"] = new BooleanData(syncState.GetData <UInt32Data, uint>("PolicyKeyOnDevice", 0U) != 0U); IL_1A6: syncState["LastPolicyXMLHash"] = ((text == null) ? null : new NullableData <Int32Data, int>(new int?(PolicyData.GetPolicyHashCode(text + true)))); IL_1D2: syncState["DeviceEnableOutboundSMS"] = new BooleanData(false); syncState["DeviceMobileOperator"] = null; IL_1EF: syncState.Remove("LastAdUpdateTime"); IL_1FA: syncState["ClientAlternateMailboxInformationVersion"] = null; syncState["DeviceUMRegisteredPhoneNumber"] = null; IL_212: syncState["HaveSentBoostrapMailForWM61"] = new BooleanData(false); if (syncState.BackendVersion.Value < 20) { syncState["SSUpgradeDateTime"] = new DateTimeData(ExDateTime.UtcNow); } else { syncState["SSUpgradeDateTime"] = null; } IL_259: syncState.Remove("DeviceHealth"); syncState["DeviceAccessState"] = new Int32Data(0); syncState["DeviceAccessStateReason"] = new Int32Data(0); syncState["DevicePolicyApplied"] = null; syncState["DevicePolicyApplicationStatus"] = new Int32Data(0); syncState["LastDeviceWipeRequestor"] = null; syncState["DeviceActiveSyncVersion"] = null; syncState["ADDeviceInfoHash"] = null; syncState["DeviceInformationReceived"] = new BooleanData(false); IL_2D8: syncState["ADCreationTime"] = null; IL_2E4: syncState.Remove("DeviceUMRegisteredPhoneNumber"); IL_2EF: syncState["NextTimeToClearMailboxLogs"] = null; IL_2FB: syncState.Remove("ClientAlternateMailboxInformationVersion"); IL_306: syncState["DeviceADObjectId"] = null; IL_312: syncState["BootstrapMailForWM61TriggeredTime"] = null; IL_31E: syncState["UserADObjectId"] = null; IL_32A: syncState["ABQMailId"] = null; syncState["ABQMailState"] = new Int32Data(0); syncState["DeviceInformationPromoted"] = new BooleanData(false); IL_358: syncState["DevicePhoneNumberForSms"] = ((syncState["DevicePhoneNumber"] != null) ? new StringData(((StringData)syncState["DevicePhoneNumber"]).Data) : null); syncState["SmsSearchFolderCreated"] = new BooleanData(false); IL_39E: syncState["DeviceBehavior"] = new DeviceBehaviorData(new DeviceBehavior(true)); goto IL_3B8; IL_3B6: flag = false; } IL_3B8: if (!flag) { syncState.HandleCorruptSyncState(); } }
public Int32Field(string objectName, string fieldName, int defaultValue) { //this.objectName = objectName; //this.name = fieldName; data = PersistentData.GetData <Int32Data>(objectName, fieldName); }