/// <summary> /// 读取配置文件 /// </summary> public bool Read() { if (!System.IO.File.Exists(fileName)) { return(false); } FileStream stream = null; try { stream = new FileStream(fileName, FileMode.Open, FileAccess.Read); BinaryFormatter formatter = new BinaryFormatter(); file = (OptionFile)formatter.Deserialize(stream); if (stream != null) { stream.Close(); } } catch { if (stream != null) { stream.Close(); } return(false); } return(true); }
public Option(string fileName, string password, string updatedFile, string updatedVersion) { file = new OptionFile(); file.PassWord = password; file.UpdatedFile = updatedFile; file.UpdatedVersion = updatedVersion; }
public Option(string fileName) { this.fileName = fileName; file = new OptionFile(); Read(); }
/// <summary> /// ��ȡ�����ļ� /// </summary> public bool Read() { if (!System.IO.File.Exists(fileName)) return false; FileStream stream = null; try { stream = new FileStream(fileName, FileMode.Open, FileAccess.Read); BinaryFormatter formatter = new BinaryFormatter(); file = (OptionFile)formatter.Deserialize(stream); if (stream != null) stream.Close(); } catch { if (stream != null) stream.Close(); return false; } return true; }