private static ExtractResult TryExtractFile(ArcFile arcFile, ArcFileNode arcNode) { var exportPath = GetExportPath(arcNode); // Extraction will fail if the directory doesn't exist. var exportFileDirectory = Path.GetDirectoryName(exportPath); try { if (!Directory.Exists(exportFileDirectory)) { Directory.CreateDirectory(exportFileDirectory); } } catch (Exception e) { Serilog.Log.Error(e, "Error creating directory {@exportFileDirectory}", exportFileDirectory); return(new ExtractResult { CompletionSummary = $"Error creating directory {exportFileDirectory}", Success = false }); } // Extraction may fail. // TODO: Update the C# bindings to store more detailed error info? if (!arcFile.TryExtractFile(arcNode, exportPath, ApplicationSettings.Instance.ArcRegion)) { Serilog.Log.Logger.Error("Failed to extract to {@path}", exportPath); return(new ExtractResult { CompletionSummary = $"Failed to extract {arcNode.Path}", Success = false }); } return(new ExtractResult { CompletionSummary = $"Extracted {arcNode.Path}", Success = false }); }