mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-12-05 15:31:36 +00:00
Improved reading and writing large Office files without copying them into memory (#1243)
This commit is contained in:
1 parent
918572c158
commit
dbe609a9a7
37 files changed
+1161
-471
No files matched your search
@@ -63,13 +63,17 @@ internal sealed partial class PresentationTemplate
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Throws when the file is missing, cannot be opened, or is no presentation at all; the caller
|
||||
/// decides what the user hears about it.
|
||||
/// decides what the user hears about it. The template is read through a PackageSkeleton, which
|
||||
/// holds only its XML: the Open XML SDK copies a file it opens for reading into the temporary
|
||||
/// folder, and the pictures and videos of a template take hundreds of megabytes.
|
||||
/// </remarks>
|
||||
/// <param name="path">The path of the template file.</param>
|
||||
/// <param name="logger">Where to report a skeleton which cannot be removed.</param>
|
||||
/// <returns>The template.</returns>
|
||||
public static PresentationTemplate ReadFile(string path)
|
||||
public static PresentationTemplate ReadFile(string path, ILogger logger)
|
||||
{
|
||||
using var stream = TemplateFile.OpenRead(path);
|
||||
using var skeleton = PackageSkeleton.Create(path, Path.GetExtension(path), logger, CancellationToken.None);
|
||||
using var stream = skeleton.OpenRead();
|
||||
return Read(stream);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user