Skip to content

为 PPT 幻灯片缩略图增加持久化磁盘缓存(net6) - #811

Open
CJKmkp wants to merge 38 commits into
net6from
feature/issue-791-persistent-ppt-thumbnail-cache
Open

CJKmkp wants to merge 38 commits into
net6from
feature/issue-791-persistent-ppt-thumbnail-cache

Conversation

@CJKmkp

@CJKmkp CJKmkp commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Closes #791

Changes

  • Add persistent PPT slide-thumbnail caching for both the COM and ROT managers.
  • Store thumbnails under the matching PPT ink-save directory:
    <AutoSavedStrokesLocation>/Auto Saved - Presentations/<PPTInkManager document ID>/Thumbnails.
  • Share the exact presentation ID implementation with PPTInkManager so ink and thumbnails always resolve to the same document directory.
  • Keep thumbnail files isolated from .icstk and Position ink data; organize cache entries by dimensions and saved-file revision.
  • Skip disk caching for unsaved presentations and revalidate the saved state and document identity before publishing generated thumbnails.
  • Publish complete thumbnail sets atomically and clean up only thumbnail-cache data, with age- and size-based eviction across presentations.

Validation

  • Reviewed the net6 diff and verified both COM and ROT export loops remain intact.
  • Build and Office/WPS runtime validation have not been run in this environment.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T10:08:12.225300Z 6bc9f4a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5071b15afb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Ink Canvas/Helpers/PPTManager.cs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6bc9f4a680

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

catch { }
if (isStillSavedRevision && result.Count == count)
PPTThumbnailDiskCache.Save(presentationPath, presentationName, width, height, count, result);
PPTThumbnailDiskCache.Save(presentationPath, activePresentation.Name, width, height, count, result);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the second cache write behind the saved-revision check

After exporting a deck with unsaved edits, this call runs regardless of isStillSavedRevision because the preceding if guards only the first Save; it can cache those previews under the existing file's size/mtime revision, so reopening the unchanged saved file may show edits that were never saved. It also bypasses the cache-enable setting. The fresh evidence in this revision is this added, unguarded second Save call; the same call appears in ROTPPTManager.

Useful? React with 👍 / 👎.

var currentFile = new FileInfo(presentationPath);
isStillSavedRevision = canUseDiskCache &&
Convert.ToInt32(activePresentation.Saved) != 0 &&
PPTPresentationStorage.CreatePresentationId(presentationName, count, presentationPath) == presentationId &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recheck the current presentation identity before caching

If the user performs Save As while slide exports are running, this comparison recomputes the ID from the original presentationName, count, and presentationPath captured before the loop, so it still matches presentationId even though the active presentation now points to a different file. The original file's size and timestamp can remain unchanged, allowing thumbnails from the Save-As deck to be cached under the original file's key; reopening the original can then show the wrong previews. The ROT manager has the same check.

Useful? React with 👍 / 👎.

Comment on lines +73 to +75
if (!Directory.Exists(directory))
{
try { Directory.Move(tempDirectory, directory); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Replace an invalid existing cache directory

If a revision directory contains a missing or malformed PNG, TryLoad treats it as a cache miss, but this branch refuses to move the freshly generated complete set because the destination directory still exists. The temporary set is then deleted, leaving every later request for that presentation, size, and revision to re-export the slides instead of repairing the cache. Remove or replace the invalid directory before publishing the new set.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant