Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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);
        }