Skip to content

Commit

Permalink
Update SeerProProvider.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 committed May 8, 2024
1 parent 22f1907 commit bc25331
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions src/Files.App/Services/PreviewPopupProviders/SeerProProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,42 +48,38 @@ public async Task<bool> DetectAvailability()

private Task<bool> DetectTrackSelectionSetting()
{
string seerProSettingsPath = string.Empty;
bool trackSelectedFile = false;

// List of possible paths for the Seer Pro settings file
string[] paths =
{
Environment.ExpandEnvironmentVariables("%USERPROFILE%/Documents/Seer/uwp.ini"),
Environment.ExpandEnvironmentVariables("%USERPROFILE%/appdata/Local/Corey/Seer/uwp.ini"),
Environment.ExpandEnvironmentVariables("%USERPROFILE%/Documents/Seer/config.ini")
Environment.ExpandEnvironmentVariables("%USERPROFILE%\\Documents\\Seer\\uwp.ini"),
Environment.ExpandEnvironmentVariables("%USERPROFILE%\\appdata\\Local\\Corey\\Seer\\uwp.ini"),
Environment.ExpandEnvironmentVariables("%USERPROFILE%\\Documents\\Seer\\config.ini")
};

// Find the first existing path
foreach (var path in paths)
{
if (File.Exists(path))
{
seerProSettingsPath = path;
break;
}
}
// Read the settings file and look for the tracking_file setting
string[] lines = File.ReadAllLines(path);

// Read the settings file and look for the tracking_file setting
if (!string.IsNullOrEmpty(seerProSettingsPath))
{
string[] lines = File.ReadAllLines(seerProSettingsPath);
foreach (var line in lines)
{
if (line.StartsWith("tracking_file", StringComparison.OrdinalIgnoreCase))
foreach (var line in lines)
{
string[] keyValue = line.Split('=');
if (keyValue.Length == 2 && bool.TryParse(keyValue[1].Trim(), out bool isTrackingFile))
if (line.StartsWith("tracking_file", StringComparison.OrdinalIgnoreCase))
{
trackSelectedFile = isTrackingFile;
break;
string[] keyValue = line.Split('=');
if (keyValue.Length == 2 && bool.TryParse(keyValue[1].Trim(), out bool isTrackingFile))
{
trackSelectedFile = isTrackingFile;
break;
}
}
}

break;
}
}

Expand Down

0 comments on commit bc25331

Please sign in to comment.