internal void PerformFileOperation(QaeConfig config) { try { IFileProvider provider; switch (ProviderType) { case QueuedFileOperationProviderType.Root: provider = config.RootFileProvider; break; case QueuedFileOperationProviderType.ModLibs: provider = config.ModLibsFileProvider; break; case QueuedFileOperationProviderType.FileSystemRoot: provider = new FolderFileProvider("/", false); break; default: throw new NotImplementedException($"Provider type {ProviderType} is not implemented in QueuedFileOp."); } switch (Type) { case QueuedFileOperationType.DeleteFile: if (!provider.FileExists(TargetPath)) { Log.LogErr($"Queued file operation was supposed to delete '{TargetPath}' but it didn't exist!"); } else { provider.Delete(TargetPath); } break; case QueuedFileOperationType.DeleteFolder: if (!provider.DirectoryExists(TargetPath)) { Log.LogErr($"Queued file operation was supposed to delete '{TargetPath}' but it didn't exist!"); } else { provider.RmRfDir(TargetPath); } break; case QueuedFileOperationType.ExtractZipToFolder: throw new NotImplementedException(); case QueuedFileOperationType.WriteFile: provider.MkDir(TargetPath.GetDirectoryFwdSlash(), true); provider.Write(TargetPath, SourceData, true); provider.Save(); break; } } catch (NotImplementedException) { throw; } catch (Exception ex) { Log.LogErr($"Exception handling queued file operation of type {Type}", ex); throw; } }