public void SaveList(List <ConnectItem> list) { FileStream fs = new FileStream(DataDir, FileMode.Create); BinaryWriter bw = new BinaryWriter(fs); byte[] buffer = Encoding.UTF32.GetBytes(EncryptUtils.DESEncrypt(JsonConvert.SerializeObject(list), "6SUHDbR9", "vkWMQQxZ")); bw.Write(buffer, 0, buffer.Length); bw.Flush(); bw.Close(); fs.Close(); }
public List <ConnectItem> GetAccList() { List <ConnectItem> ret = new List <ConnectItem>(); FileStream fs = new FileStream(DataDir, FileMode.Open); BinaryReader br = new BinaryReader(fs); byte[] buffer = br.ReadBytes((int)fs.Length); ret = JsonConvert.DeserializeObject <List <ConnectItem> >(EncryptUtils.DESDecrypt(Encoding.UTF32.GetString(buffer), "6SUHDbR9", "vkWMQQxZ")); br.Close(); fs.Close(); return(ret); }