Example #1
0
 public FileSystemService()
 {
     XmlService = new XmlService();
     FilenameGeneratorService = new FilenameGeneratorServiceService();
     DirectoryService         = new DirectoryService();
     GuidGeneratorService     = new GuidGeneratorService();
 }
Example #2
0
        private IList <string> GetAllSubFolder()
        {
            var nameOfAllSubFolder = new List <string>();
            var subFolder          = DirectoryService.GetSubFolder(TargetPath);

            foreach (var n in subFolder)
            {
                nameOfAllSubFolder.Add(n.Name);
            }

            return(nameOfAllSubFolder);
        }
Example #3
0
        private IList <string> GetAllFiles()
        {
            var metadataFile       = new List <string>();
            var nameOfAllSubFolder = GetAllSubFolder();

            foreach (var d in nameOfAllSubFolder)
            {
                var list = DirectoryService.GetFiles(TargetPath + @"\" + d, @"*_Metadata.xml");
                metadataFile.AddRange(list);
            }

            return(metadataFile);
        }
Example #4
0
        public void AddFile(IMetadataItem metadataItem, bool isRemoveFileEnabled, string sourcePath)
        {
            MetaDataIteam = metadataItem;

            var documentId = GuidGeneratorService.GetNewGuid();
            var extension  = DirectoryService.GetExtension(sourcePath);

            MetaDataIteam.ContentFilename  = FilenameGeneratorService.GetContentFilename(documentId, extension);
            MetaDataIteam.MetadataFilename = FilenameGeneratorService.GetMetadataFilename(documentId);

            var targetDir = DirectoryService.Combine(TargetPath, MetaDataIteam.ValutaYear);

            MetaDataIteam.OrginalPath          = sourcePath;
            MetaDataIteam.PathInRepo           = targetDir + @"\" + MetaDataIteam.ContentFilename;
            MetaDataIteam.ContentFileExtension = extension;
            MetaDataIteam.ContentFilename      = MetaDataIteam.ContentFilename;
            MetaDataIteam.DocumentId           = documentId;

            DirectoryService.CreateDirectoryFolder(targetDir);

            XmlService.MetadataItemToXml(MetaDataIteam, targetDir);
            DirectoryService.DeleteFile(MetaDataIteam, isRemoveFileEnabled);
        }