ToProto() public méthode

public ToProto ( ) : TableUserInfo
Résultat TableUserInfo
Exemple #1
0
 internal void DSPSaveUser(UserInfo ui, int saveCount)
 {
     try {
         ulong  userGuid = ui.Guid;
         string key      = userGuid.ToString();
         if (ui.Modified)
         {
             Msg_LD_Save msg = new Msg_LD_Save();
             msg.MsgId = (int)DataEnum.TableUserInfo;
             msg.PrimaryKeys.AddRange(ui.PrimaryKeys);
             msg.ForeignKeys.AddRange(ui.ForeignKeys);
             msg.Data = DbDataSerializer.Encode(ui.ToProto());
             DispatchAction(DSSaveInternal, msg);
             ui.Modified = false;
         }
         ui.CurrentUserSaveCount = saveCount;
     } catch (Exception e) {
         LogSys.Log(LOG_TYPE.ERROR, "DataCache Save ERROR. Msg:DSP_User, Key:{0}, SaveCount:{1}, Error:{2},\nStacktrace:{3}", ui.Guid, saveCount, e.Message, e.StackTrace);
     }
 }
Exemple #2
0
 internal void SaveUser(UserInfo ui, int saveCount)
 {
     try {
         ulong  userGuid = ui.Guid;
         string key      = userGuid.ToString();
         if (ui.Modified)
         {
             Msg_LD_Save msg = new Msg_LD_Save();
             msg.MsgId = (int)DataEnum.TableUserInfo;
             msg.PrimaryKeys.AddRange(ui.PrimaryKeys);
             msg.ForeignKeys.AddRange(ui.ForeignKeys);
             msg.Data = DbDataSerializer.Encode(ui.ToProto());
             DispatchAction(SaveInternal, msg);
             ui.Modified = false;
         }
         foreach (var pair in ui.MailStateInfo.WholeMailStates)
         {
             var mi = pair.Value;
             if (mi.Modified)
             {
                 Msg_LD_Save msg = new Msg_LD_Save();
                 msg.MsgId = (int)DataEnum.TableMailStateInfo;
                 msg.PrimaryKeys.AddRange(mi.PrimaryKeys);
                 msg.ForeignKeys.AddRange(mi.ForeignKeys);
                 msg.Data = DbDataSerializer.Encode(mi.ToProto());
                 DispatchAction(SaveInternal, msg);
                 mi.Modified = false;
             }
         }
         foreach (var mi in ui.MailStateInfo.DeletedWholeMailStates)
         {
             if (mi.Deleted)
             {
                 Msg_LD_Save msg = new Msg_LD_Save();
                 msg.MsgId = (int)DataEnum.TableMailStateInfo;
                 msg.PrimaryKeys.AddRange(mi.PrimaryKeys);
                 msg.ForeignKeys.AddRange(mi.ForeignKeys);
                 msg.Data = null;
                 DispatchAction(SaveInternal, msg);
                 mi.Deleted = false;
             }
         }
         ui.MailStateInfo.DeletedWholeMailStates.Clear();
         foreach (var mi in ui.MemberInfos)
         {
             if (mi.Modified)
             {
                 Msg_LD_Save msg = new Msg_LD_Save();
                 msg.MsgId = (int)DataEnum.TableMemberInfo;
                 msg.PrimaryKeys.AddRange(mi.PrimaryKeys);
                 msg.ForeignKeys.AddRange(mi.ForeignKeys);
                 msg.Data = DbDataSerializer.Encode(mi.ToProto());
                 DispatchAction(SaveInternal, msg);
                 mi.Modified = false;
             }
         }
         foreach (var mi in ui.DeletedMemberInfos)
         {
             if (mi.Deleted)
             {
                 Msg_LD_Save msg = new Msg_LD_Save();
                 msg.MsgId = (int)DataEnum.TableMemberInfo;
                 msg.PrimaryKeys.AddRange(mi.PrimaryKeys);
                 msg.ForeignKeys.AddRange(mi.ForeignKeys);
                 msg.Data = null;
                 DispatchAction(SaveInternal, msg);
                 mi.Deleted = false;
             }
         }
         ui.DeletedMemberInfos.Clear();
         foreach (var ii in ui.ItemBag.ItemInfos)
         {
             if (ii.Modified)
             {
                 Msg_LD_Save msg = new Msg_LD_Save();
                 msg.MsgId = (int)DataEnum.TableItemInfo;
                 msg.PrimaryKeys.AddRange(ii.PrimaryKeys);
                 msg.ForeignKeys.AddRange(ii.ForeignKeys);
                 msg.Data = DbDataSerializer.Encode(ii.ToProto());
                 DispatchAction(SaveInternal, msg);
                 ii.Modified = false;
             }
         }
         foreach (var ii in ui.ItemBag.DeletedItemInfos)
         {
             if (ii.Deleted)
             {
                 Msg_LD_Save msg = new Msg_LD_Save();
                 msg.MsgId = (int)DataEnum.TableItemInfo;
                 msg.PrimaryKeys.AddRange(ii.PrimaryKeys);
                 msg.ForeignKeys.AddRange(ii.ForeignKeys);
                 msg.Data = null;
                 DispatchAction(SaveInternal, msg);
                 ii.Deleted = false;
             }
         }
         ui.ItemBag.DeletedItemInfos.Clear();
         foreach (var fi in ui.FriendInfos)
         {
             if (fi.Modified)
             {
                 Msg_LD_Save msg = new Msg_LD_Save();
                 msg.MsgId = (int)DataEnum.TableFriendInfo;
                 msg.PrimaryKeys.AddRange(fi.PrimaryKeys);
                 msg.ForeignKeys.AddRange(fi.ForeignKeys);
                 msg.Data = DbDataSerializer.Encode(fi.ToProto());
                 DispatchAction(SaveInternal, msg);
                 fi.Modified = false;
             }
         }
         foreach (var fi in ui.DeletedFriendInfos)
         {
             if (fi.Deleted)
             {
                 Msg_LD_Save msg = new Msg_LD_Save();
                 msg.MsgId = (int)DataEnum.TableFriendInfo;
                 msg.PrimaryKeys.AddRange(fi.PrimaryKeys);
                 msg.ForeignKeys.AddRange(fi.ForeignKeys);
                 msg.Data = DbDataSerializer.Encode(fi.ToProto());
                 DispatchAction(SaveInternal, msg);
                 fi.Deleted = false;
             }
         }
         ui.DeletedFriendInfos.Clear();
         ui.CurrentUserSaveCount = saveCount;
     } catch (Exception e) {
         LogSys.Log(LOG_TYPE.ERROR, "DataCache Save ERROR. Msg:SaveUser, Key:{0}, SaveCount:{1}, Error:{2},\nStacktrace:{3}", ui.Guid, saveCount, e.Message, e.StackTrace);
     }
 }