Files
Files copied to clipboard
Feature: Added support for SeerPro's "Track selected file" setting
Resolved / Related Issues
To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.
- Closes #14966
Steps used to test these changes
Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.
- Install SeerPro
- Confirm that the follow selection setting in SeerPro is reflected in Files
- This setting is only detected once, Files requires a restart after updating the setting in SeerPro
Fyi @ccseer
cool. thx.
On Thu, May 9, 2024, 10:33 PM Yair @.***> wrote:
@.**** commented on this pull request.
In src/Files.App/Services/PreviewPopupProviders/SeerProProvider.cs https://github.com/files-community/Files/pull/15339#discussion_r1595536479 :
if (_isTrackSelectionSettingEnabledCache is null)
_isTrackSelectionSettingEnabledCache = DetectTrackSelectionSetting().Result;return _isTrackSelectionSettingEnabledCache.Value;}}private Task<bool> DetectTrackSelectionSetting(){bool trackSelectedFile = true;// List of possible paths for the Seer Pro settings filestring[] paths ={Environment.ExpandEnvironmentVariables("%USERPROFILE%\\Documents\\Seer\\uwp.ini"),Environment.ExpandEnvironmentVariables("%USERPROFILE%\\appdata\\Local\\Packages\\CNABA5E861-AC2A-4523-B3C1.Seer-AWindowsQuickLookTo_p7t0z30wh4868\\LocalCache\\Local\\Corey\\Seer\\uwp.ini"),That's included on the next line
— Reply to this email directly, view it on GitHub https://github.com/files-community/Files/pull/15339#discussion_r1595536479, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZZIHRPRHUYUQFFVW2MGYLZBOCNBAVCNFSM6AAAAABHNUI2Y2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDANBYGEYDKNRYGQ . You are receiving this because you were mentioned.Message ID: @.***>
I tested the store version and it works correct, @ccseer can you confirm this works for the win32 version?
I tested the store version and it works correct, @ccseer can you confirm this works for the win32 version?
do i need to build from the source to test? I just read the code, the default path for win32 is from REG, but it's not in your code. Am I missing something?
I just read the code, the default path for win32 is from REG, but it's not in your code.
I didn't implement anything for the registry, I'll modify this PR to account for that possibility.
- Double Backslashes in Key Name: In the keyName variable, you've used double backslashes (\) at the beginning and within the path. When specifying registry paths in C#, you should use a single backslash () as the separator, and there's no need for leading backslashes. The correct format for the key name would be @"HKEY_CURRENT_USER\Software\Corey\Seer".
- Registry.GetValue Usage: The Registry.GetValue method is correctly used to read a value from the registry. However, the third parameter you've passed is null, which is the default value returned if the specified valueName does not exist. If you're trying to read a boolean value named General, ensure that General is the correct name of the value you're interested in. If you're trying to read a value named tracking_file (as mentioned in your previous question), you should replace "General" with "tracking_file".
- Return Type: The snippet ends with return Task.FromResult(true);, which suggests you want this code to be part of an asynchronous method returning a Task
. However, the code snippet as provided does not include the method signature, so it's unclear how this fits into the larger context of your application.
using System;
using System.Threading.Tasks;
using Microsoft.Win32;
public class RegistryReader
{
public Task<bool> ReadTrackingFileValueAsync()
{
var keyName = @"HKEY_CURRENT_USER\Software\Corey\Seer";
var value = Registry.GetValue(keyName, "tracking_file", null);
if (value is not null)
{
// Assuming the value is stored as an integer (0 for false, non-zero for true)
bool trackSelectedFile = Convert.ToBoolean(value);
return Task.FromResult(trackSelectedFile);
}
else
{
// Return false or handle the case where the value does not exist
return Task.FromResult(false);
}
}
}
When I tried to test it, it crashed with the following exception:
2024-05-12 22:17:34.4955|Error|System.ArgumentException: Registry key name must start with a valid base key name. (Parameter 'keyName')
at Microsoft.Win32.Registry.GetBaseKeyFromKeyName(String keyName, String& subKeyName)
at Microsoft.Win32.Registry.GetValue(String keyName, String valueName, Object defaultValue)
at Files.App.Services.PreviewPopupProviders.SeerProProvider.DetectTrackSelectionSetting()
at Files.App.Services.PreviewPopupProviders.SeerProProvider.get_IsTrackSelectionSettingEnabled()
at Files.App.Services.PreviewPopupProviders.SeerProProvider.SwitchPreviewAsync(String path)
at Files.App.Actions.LaunchPreviewPopupAction.SwitchPopupPreviewAsync()
at Files.App.Actions.LaunchPreviewPopupAction.Context_PropertyChanged(Object sender, PropertyChangedEventArgs e)
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
at Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext.<>c__DisplayClass2_0.<Post>b__0()
@hishitetsu can you try with the latest commit?
Everything looks good from my end
It still tracks the file regardless of the settings in my environment.
the default value is true. if Seer is running, and the Key is not found, you can take it as true.
On Mon, May 13, 2024, 12:24 AM hishitetsu @.***> wrote:
It still tracks the file regardless of the settings in my environment.
— Reply to this email directly, view it on GitHub https://github.com/files-community/Files/pull/15339#issuecomment-2106306108, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZZIHXDWNBG4BBYB7SNQN3ZB6JT3AVCNFSM6AAAAABHNUI2Y2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBWGMYDMMJQHA . You are receiving this because you were mentioned.Message ID: @.***>
It still tracks the file regardless of the settings in my environment.
Did you restart Files in between changing the setting?
I tested with the Win32 version and confirm it's working as expected. The one thing to note is that a restart of Files is required after changing the setting in Seer.