/// <summary> /// check file size /// </summary> /// <param name="fileName"></param> /// <returns></returns> public bool CheckFileSize(string fileName) { FileInfo file = new FileInfo(fileName); sampleDatabase db = new sampleDatabase(); if (file.Length > db.getDataStoreSize())//replace db.getDataStoreSize() { throw new ArgumentException("Not enough space in database"); } else { return(true); } }
/// <summary> /// Check file for dup content /// </summary> /// <param name="fileName"></param> /// <returns></returns> public bool CheckFileDup(string fileName) { sampleDatabase db = new sampleDatabase(); using (StreamReader sr = File.OpenText(fileName)) { string s = sr.ReadLine(); if (Array.Exists(db.getSampleData(), element => element == s)) { throw new ArgumentException("Duplication error"); } else { return(true); } } }