Exemple #1
0
        /// <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);
        }
Exemple #2
0
 public Option(string fileName, string password, string updatedFile, string updatedVersion)
 {
     file                = new OptionFile();
     file.PassWord       = password;
     file.UpdatedFile    = updatedFile;
     file.UpdatedVersion = updatedVersion;
 }
Exemple #3
0
 public Option(string fileName, string password, string updatedFile, string updatedVersion)
 {
     file = new OptionFile();
     file.PassWord = password;
     file.UpdatedFile = updatedFile;
     file.UpdatedVersion = updatedVersion;
 }
Exemple #4
0
 public Option(string fileName)
 {
     this.fileName = fileName;
     file          = new OptionFile();
     Read();
 }
Exemple #5
0
 /// <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;
 }
Exemple #6
0
 public Option(string fileName)
 {
     this.fileName = fileName;
     file = new OptionFile();
     Read();
 }