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 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 int GetFolderFilesCount(string folderName) { if (!mFolderMap.ContainsKey(folderName)) { return(0); } FPFolder folder = mFolderMap[folderName]; if (folder == null) { return(0); } return(folder.GetCount()); }
private void UpdateDataGrid(string current) { if (mCurrentFocuseTile == "") { mFileDataCollection.Clear(); IDictionary <string, FPFolder> mFolderMap = mApp.FPM.GetAllFolder(); foreach (KeyValuePair <string, FPFolder> kv in mFolderMap) { IEnumerator <FPFile> it = kv.Value.mFileList.GetEnumerator(); while (it.MoveNext()) { if (it.Current != null) { FileData filedata = new FileData(); filedata.Name = it.Current.mSrcName; filedata.Path = it.Current.mSrcPath; filedata.Folder = kv.Key; filedata.Status = it.Current.mStatus; mFileDataCollection.Add(filedata); } } } } else if (mCurrentFocuseTile == current) { mFileDataCollection.Clear(); FPFolder folder = mApp.FPM.GetFolder(current); if (folder != null) { IEnumerator <FPFile> it = folder.mFileList.GetEnumerator(); while (it.MoveNext()) { if (it.Current != null) { FileData filedata = new FileData(); filedata.Name = it.Current.mSrcName; filedata.Path = it.Current.mSrcPath; filedata.Folder = folder.mName; filedata.Status = it.Current.mStatus; mFileDataCollection.Add(filedata); } } } } }
public FPStatus CopyFolder(string folderName) { if (folderName == "") { return(FPStatus.Error); } if (!mFolderMap.ContainsKey(folderName)) { return(FPStatus.Error); } FPFolder folder = mFolderMap[folderName]; FPStatus ret = folder.Copy(); return(ret); }
public FPStatus MoveFile(string folderName, string fileName) { if (folderName == "" || fileName == "") { return(FPStatus.Error); } if (!mFolderMap.ContainsKey(folderName)) { return(FPStatus.Error); } FPFolder folder = mFolderMap[folderName]; FPStatus ret = folder.MoveFile(fileName); return(ret); }
private void UpdateTileFocus(string current) { if (mCurrentFocuseTile == current) { return; } mCurrentFocuseTile = current; UIElementCollection items = mWrapPanel.Children; System.Collections.IEnumerator it = items.GetEnumerator(); while (it.MoveNext()) { Label label = (Label)it.Current; if (label != null) { if (string.Compare(current, (string)label.Tag) == 0) { label.Style = (Style)this.Resources["LabelTileFocus"]; } else { label.Style = (Style)this.Resources["LabelTileNormal"]; } } } if (current == "") { mCurrentFolderName.Content = "全局"; } else { mCurrentFolderName.Content = current; FPFolder folder = mApp.FPM.GetFolder(current); if (folder != null && folder.mStatus == FPStatus.OK) { mStatusBarFolderPath.Content = folder.mPath; } } UpdateDataGrid(mCurrentFocuseTile); }
public FPStatus AddFolder(string filename) { DirectoryInfo info = new DirectoryInfo(filename); if (!info.Exists) { return(FPStatus.Not_Exists); } if (mFolderMap.ContainsKey(info.Name)) { return(FPStatus.Already_Exists); } FPFolder folder = new FPFolder(filename); mFolderMap[info.Name] = folder; return(FPStatus.OK); }