Example #1
0
        public void CopyFile(MetadataItem source, bool fileRemove)
        {
            source.Destination = _target;
            SetDestinationDir(source.ValutaYear, _target);
            source.Destination = Path.Combine(_target, source.ValutaYear);
            String[] MyGuid = GenerateFilename(source.Filename, source.Extension);
            source.MetaDataFileName = MyGuid[1];
            source.ContentFilePath  = $"{source.Destination}\\{MyGuid[0]}";
            XmlService.MetadataItemToXml(source, source.Destination);
            var newFile = source.ContentFilePath;

            File.Copy(source.OriginalPath, newFile);
        }
Example #2
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);
        }