public FPStatus AddFile(string folderName, string fileName) { if (!File.Exists(fileName)) { return(FPStatus.Not_Exists); } if (!mFolderMap.ContainsKey(folderName)) { return(FPStatus.Error); } FPFolder folder = mFolderMap[folderName]; if (folder == null) { return(FPStatus.Error); } FileInfo info = new FileInfo(fileName); FPFile file = new FPFile(info.Name, info.DirectoryName); if (folder.AddFile(file)) { return(FPStatus.OK); } else { return(FPStatus.Error); } }
public bool AddFile(FPFile file) { file.SetDstPath(mPath); if (file.mStatus != FPStatus.OK) { return(false); } bool bExists = false; foreach (FPFile fi in mFileList) { if (fi.mSrcName == file.mSrcName && fi.mSrcPath == file.mSrcPath) { bExists = true; break; } } if (bExists) { return(false); } mFileList.Add(file); return(true); }
public FPStatus AddFileList(string folderName, string[] fileList) { if (!mFolderMap.ContainsKey(folderName)) { return(FPStatus.Error); } FPFolder folder = mFolderMap[folderName]; if (folder == null) { return(FPStatus.Error); } FPStatus ret = FPStatus.OK; foreach (string fileName in fileList) { FileInfo info = new FileInfo(fileName); if (!info.Exists) { ret = FPStatus.Not_Exists; continue; } FPFile file = new FPFile(info.Name, info.DirectoryName); if (folder.AddFile(file)) { ret = FPStatus.Error; } } return(ret); }
public static void AddRecord(FPFile file, string method) { string sql = "insert into record(name, srcpath, destpath, method, status, recordtime) values" + "(@name, @srcpath, @destpath, @method, @status, @recordtime)"; SQLiteParameter[] ps = new SQLiteParameter[] { new SQLiteParameter("@name", file.mSrcName), new SQLiteParameter("@srcpath", file.mSrcPath), new SQLiteParameter("@destpath", file.mDstPath), new SQLiteParameter("@method", method), new SQLiteParameter("@status", FPFile.GetStatusString(file.mStatus)), new SQLiteParameter("@recordtime", DateTime.Now) }; DBUtil.ExecuteNonQuery(sql, ps); }
public bool RemoveFile(FPFile file) { if (file.mSrcName.Length == 0 || file.mSrcPath.Length == 0) { return(true); } IEnumerator <FPFile> it = mFileList.GetEnumerator(); while (it.MoveNext()) { if (it.Current.mSrcName == file.mSrcName && it.Current.mSrcPath == file.mSrcPath) { mFileList.Remove(it.Current); break; } } return(true); }