Esempio n. 1
0
        public void ExportToFile(Guid dataIdentifier, string outputFile, ExportFileBehaviour exportFileBehaviour)
        {
            switch (exportFileBehaviour)
            {
                case ExportFileBehaviour.OverrideWhenAlreadyExists:
                    if (File.Exists(outputFile))
                    {
                        File.Delete(outputFile);
                    }
                    break;
                case ExportFileBehaviour.SkipWhenAlreadyExists:
                    if (File.Exists(outputFile))
                    {
                        return;
                    }
                    break;
                case ExportFileBehaviour.ThrowExceptionWhenAlreadyExists:
                    if (File.Exists(outputFile))
                    {
                        throw new Exception(String.Format("File {0} already exists", outputFile));
                    }
                    break;
                default:
                    throw new NotSupportedException(string.Format("Unsupported export behavious ({0})", exportFileBehaviour));
            }

            byte[] fileData = GetFileByteData(dataIdentifier, StreamStateBehaviour.OpenNewStreamForReading, StreamStateBehaviour.OpenNewStreamForReading);
            File.WriteAllBytes(outputFile, fileData);
        }
Esempio n. 2
0
        public static void ExportToFile(string fileStorageName, Guid dataIdentifier, string outputFile, ExportFileBehaviour exportFileBehaviour)
        {
            var fileStorageHandler = FileStorageHandler.Open(fileStorageName);

            fileStorageHandler.ExportToFile(dataIdentifier, outputFile, exportFileBehaviour);
        }
Esempio n. 3
0
 public static void ExportToFile(string fileStorageName, Guid dataIdentifier, string outputFile, ExportFileBehaviour exportFileBehaviour)
 {
     FileStorageHandler fileStorageHandler = FileStorageHandler.Open(fileStorageName);
     fileStorageHandler.ExportToFile(dataIdentifier, outputFile, exportFileBehaviour);
 }