public static void Save(SettingItems settings) { FileStream fs = new FileStream(Application.StartupPath + "\\config.ini", FileMode.OpenOrCreate); byte[] arrEncryptByte = Serialize.EncryptToBytes(settings); byte[] arrLength = PubHelper.intToByte(arrEncryptByte.Length); //将长度(整数)保存在4个元素的字节数组中 fs.Write(arrLength, 0, arrLength.Length); fs.Write(arrEncryptByte, 0, arrEncryptByte.Length); fs.Close(); }
public static void Save(CurrentIDs currentIDs) { byte[] arrEncryptByte = Serialize.EncryptToBytes(currentIDs); byte[] arrLength = PubHelper.intToByte(arrEncryptByte.Length); //将长度(整数)保存在4个元素的字节数组中 lock (GlobalPool.Lock) { FileStream fs = new FileStream(Application.StartupPath + "\\config.ini", FileMode.OpenOrCreate); fs.Write(arrLength, 0, arrLength.Length); fs.Write(arrEncryptByte, 0, arrEncryptByte.Length); fs.Close(); } }