Exemplo n.º 1
0
 public static bool LoadFromDB(string passport)
 {
     if (File.Exists(string.Format("./Save/{0}.db", passport)))
     {
         Profile = new Profile();
         FileStream fs  = new FileStream(string.Format("./Save/{0}.db", passport), FileMode.Open);
         byte[]     dts = new byte[fs.Length];
         fs.Read(dts, 0, dts.Length);
         object tmp;
         DbSerializer.BytesToCustomType(dts, out tmp, typeof(Profile));
         Profile = (Profile)tmp;
         fs.Close();
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
 public void OnPacketLogin(PacketS2CLoginResult s2CLogin)
 {
     if (s2CLogin.SaveData.Length == 0)
     {
         UserProfile.Profile     = new Profile();
         UserProfile.Profile.Pid = s2CLogin.PlayerId;
     }
     else
     {
         object tmp;
         DbSerializer.BytesToCustomType(s2CLogin.SaveData, out tmp, typeof(Profile));
         UserProfile.Profile = (Profile)tmp;
         TalePlayer.C2SSender.UpdatePlayerInfo(UserProfile.Profile.Name, UserProfile.Profile.InfoBasic.Head);
     }
     MainForm.Instance.LoginResult();
 }