public void registerToken(String token) { ClientSave saveBean = new ClientSave(); saveBean.Token = token; FileStream fs = new FileStream("save.user", FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, saveBean); fs.Close(); }
public String readClientSave() { try { FileStream fs = new FileStream("save.user", FileMode.Open); BinaryFormatter bf = new BinaryFormatter(); ClientSave saveBean = (ClientSave)bf.Deserialize(fs); fs.Close(); if (saveBean.Token == null || saveBean.Token.Length < 5) { return("no token"); } return(saveBean.Token); } catch (Exception e) { return("error"); } }