private void InitGuidData() { if (m_GuidInitStatus == DataInitStatus.Unload) { if (UserServerConfig.DataStoreAvailable == true) { m_GuidInitStatus = DataInitStatus.Loading; Msg_LD_Load msg = new Msg_LD_Load(); msg.MsgId = (int)DataEnum.TableGuid; GameFrameworkMessage.Msg_LD_SingleLoadRequest slr = new GameFrameworkMessage.Msg_LD_SingleLoadRequest(); slr.MsgId = (int)GameFrameworkData.DataEnum.TableGuid; slr.LoadType = GameFrameworkMessage.Msg_LD_SingleLoadRequest.LoadTypeEnum.LoadAll; slr.Keys.Clear(); msg.LoadRequests.Add(slr); RequestLoad(msg, ((ret) => { if (ret.ErrorNo == Msg_DL_LoadResult.ErrorNoEnum.Success) { List <GuidInfo> guidList = new List <GuidInfo>(); foreach (var singlerow in ret.Results) { object _msg; if (DbDataSerializer.Decode(singlerow.Data, DataEnum2Type.Query(slr.MsgId), out _msg)) { TableGuid dataGuid = _msg as TableGuid; if (null != dataGuid) { GuidInfo guidinfo = new GuidInfo(); guidinfo.GuidType = dataGuid.GuidType; guidinfo.NextGuid = (long)dataGuid.GuidValue; guidList.Add(guidinfo); } } } UserServer.Instance.GlobalProcessThread.InitGuidData(guidList); m_GuidInitStatus = DataInitStatus.Done; LogSys.Log(LOG_TYPE.INFO, ConsoleColor.Green, "Load DataCache global data success. Table:TableGuid"); } else if (ret.ErrorNo == Msg_DL_LoadResult.ErrorNoEnum.NotFound) { //暂时初始化为空列表 List <GuidInfo> guidList = new List <GuidInfo>(); UserServer.Instance.GlobalProcessThread.InitGuidData(guidList); m_GuidInitStatus = DataInitStatus.Done; LogSys.Log(LOG_TYPE.INFO, ConsoleColor.Green, "Load DataCache global data success. Table:TableGuid (empty)"); } else { m_GuidInitStatus = DataInitStatus.Unload; LogSys.Log(LOG_TYPE.ERROR, ConsoleColor.Red, "Load DataCache global data failed. Table: {0}", "TableGuid"); } } )); } else { m_GuidInitStatus = DataInitStatus.Done; LogSys.Log(LOG_TYPE.INFO, "init guid done!"); } } }
/// <include file='doc\ProvideKeyBindingTableAttribute.uex' path='docs/doc[@for="Register"]' /> /// <devdoc> /// Called to register this attribute with the given context. The context /// contains the location where the registration inforomation should be placed. /// it also contains such as the type being registered, and path information. /// /// This method is called both for registration and unregistration. The difference is /// that unregistering just uses a hive that reverses the changes applied to it. /// </devdoc> public override void Register(RegistrationContext context) { context.Log.WriteLine(SR.GetString(SR.Reg_NotifyKeyBinding, TableGuid.ToString("B"), NameResourceID)); using (Key childKey = context.CreateKey(KeyBindingRegKey)) { childKey.SetValue(string.Empty, string.Format(CultureInfo.InvariantCulture, "#{0}", NameResourceID)); childKey.SetValue("Package", context.ComponentType.GUID.ToString("B")); childKey.SetValue("AllowNavKeyBinding", _allowNavKeys ? 1 : 0); } }
internal void SaveGuid(string guidType, ulong guidValue) { try { TableGuid dataGuid = new TableGuid(); dataGuid.GuidType = guidType; dataGuid.GuidValue = guidValue; Msg_LD_Save msg = new Msg_LD_Save(); msg.MsgId = (int)DataEnum.TableGuid; msg.PrimaryKeys.Add(dataGuid.GuidType); msg.Data = DbDataSerializer.Encode(dataGuid); DispatchAction(SaveInternal, msg); } catch (Exception e) { LogSys.Log(LOG_TYPE.ERROR, "DataCache Save ERROR:{0}, Stacktrace:{1}", e.Message, e.StackTrace); } }
internal void SaveGuid(List <GuidInfo> guidList, int saveCount) { try { foreach (var guidinfo in guidList) { TableGuid dataGuid = new TableGuid(); dataGuid.GuidType = guidinfo.GuidType; dataGuid.GuidValue = (ulong)guidinfo.NextGuid; Msg_LD_Save msg = new Msg_LD_Save(); msg.MsgId = (int)DataEnum.TableGuid; msg.PrimaryKeys.Add(dataGuid.GuidType); msg.Data = DbDataSerializer.Encode(dataGuid); DispatchAction(SaveInternal, msg); } } catch (Exception e) { LogSys.Log(LOG_TYPE.ERROR, "DataCache Save ERROR:{0}, Stacktrace:{1}", e.Message, e.StackTrace); } }
public void FromProto(TableGuid proto) { m_TableGuid = proto; UpdatePrimaryKeys(); UpdateForeignKeys(); }