#49 cycle through eve clients at toon selection page

#9 Allow EveO to preview other executables
This commit is contained in:
Izakbar
2025-02-05 09:33:40 +00:00
parent 607fbcbeac
commit 7ec1aceb54
5 changed files with 60 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
@@ -60,6 +61,8 @@ namespace EveOPreview.Configuration.Implementation
this.DisableThumbnail = new Dictionary<string, bool>();
this.PriorityClients = new List<string>();
this.ExecutablesToPreview = new List<string> { "exefile" };
this.MinimizeToTray = false;
this.ThumbnailRefreshPeriod = 500;
this.ThumbnailResizeTimeoutPeriod = 500;
@@ -224,6 +227,8 @@ namespace EveOPreview.Configuration.Implementation
private Dictionary<string, bool> DisableThumbnail { get; set; }
[JsonProperty]
private List<string> PriorityClients { get; set; }
[JsonProperty]
private List<string> ExecutablesToPreview { get; set; }
public Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation)
{
@@ -326,6 +331,10 @@ namespace EveOPreview.Configuration.Implementation
{
return this.PriorityClients.Contains(currentClient);
}
public bool IsExecutableToPreview(string processName)
{
return this.ExecutablesToPreview.Any(s => s.Equals(processName, StringComparison.OrdinalIgnoreCase));
}
public bool IsThumbnailDisabled(string currentClient)
{

View File

@@ -73,6 +73,7 @@ namespace EveOPreview.Configuration
Keys StringToKey(string hotkey);
bool IsPriorityClient(string currentClient);
bool IsExecutableToPreview(string processName);
bool IsThumbnailDisabled(string currentClient);
void ToggleThumbnail(string currentClient, bool isDisabled);

View File

@@ -12,7 +12,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
[assembly: AssemblyVersion("8.0.1.6")]
[assembly: AssemblyFileVersion("8.0.1.6")]
[assembly: AssemblyVersion("8.0.1.7")]
[assembly: AssemblyFileVersion("8.0.1.7")]
[assembly: CLSCompliant(false)]

View File

@@ -1,4 +1,5 @@
using System;
using EveOPreview.Configuration;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -14,12 +15,14 @@ namespace EveOPreview.Services.Implementation
#region Private fields
private readonly IDictionary<IntPtr, string> _processCache;
private IProcessInfo _currentProcessInfo;
private readonly IThumbnailConfiguration _configuration;
#endregion
public ProcessMonitor()
public ProcessMonitor(IThumbnailConfiguration configuration)
{
this._processCache = new Dictionary<IntPtr, string>(512);
this._configuration = configuration;
// This field cannot be initialized properly in constructor
// At the moment this code is executed the main application window is not yet initialized
this._currentProcessInfo = new ProcessInfo(IntPtr.Zero, "");
@@ -28,7 +31,7 @@ namespace EveOPreview.Services.Implementation
private bool IsMonitoredProcess(string processName)
{
// This is a possible extension point
return String.Equals(processName, ProcessMonitor.DEFAULT_PROCESS_NAME, StringComparison.OrdinalIgnoreCase);
return _configuration.IsExecutableToPreview(processName);
}
private IProcessInfo GetCurrentProcessInfo()

View File

@@ -126,13 +126,46 @@ namespace EveOPreview.Services
foreach (var t in clientOrder)
{
if (t.Key == _activeClient.Title)
if (t.Key == _activeClient.Title && t.Key != "EVE")
{
setNextClient = true;
lastClient = _thumbnailViews.FirstOrDefault(x => x.Value.Title == t.Key).Value;
continue;
}
// cycle through login screens ?
if (t.Key == _activeClient.Title && t.Key == "EVE")
{
lastClient = _thumbnailViews.FirstOrDefault(x => x.Value.Title == t.Key && x.Value.Id == _activeClient.Handle).Value;
if (lastClient == null)
{
setNextClient = true;
continue;
}
var possibleClients = (isForwards ? _thumbnailViews.OrderBy(x => x.Value.Id.ToInt64()) : _thumbnailViews.OrderByDescending(x => x.Value.Id.ToInt64())).Where(x => x.Value.Title == t.Key);
foreach (var pc in possibleClients)
{
if ( pc.Value.Id.Equals(lastClient.Id) )
{
setNextClient = true;
continue;
}
if (!setNextClient)
{
continue;
}
// this is the next client (at login screen)
SetActive(pc);
return;
}
// rolled off top of list - back to first (if any there!)
// set next client ?
continue;
}
if (!setNextClient)
{
continue;
@@ -140,7 +173,9 @@ namespace EveOPreview.Services
if (_thumbnailViews.Any(x => x.Value.Title == t.Key))
{
var ptr = _thumbnailViews.First(x => x.Value.Title == t.Key);
var ptr = t.Key.Equals("EVE") ?
(isForwards ? _thumbnailViews.OrderBy(x => x.Value.Id.ToInt64()) : _thumbnailViews.OrderByDescending(x => x.Value.Id.ToInt64())).First(x => x.Value.Title == t.Key)
: _thumbnailViews.First(x => x.Value.Title == t.Key);
SetActive(ptr);
return;
}
@@ -151,7 +186,9 @@ namespace EveOPreview.Services
{
if (_thumbnailViews.Any(x => x.Value.Title == t.Key))
{
var ptr = _thumbnailViews.First(x => x.Value.Title == t.Key);
var ptr = t.Key.Equals("EVE") ?
(isForwards ? _thumbnailViews.OrderBy(x => x.Value.Id.ToInt64()) : _thumbnailViews.OrderByDescending(x => x.Value.Id.ToInt64())).First(x => x.Value.Title == t.Key)
: _thumbnailViews.First(x => x.Value.Title == t.Key);
SetActive(ptr);
_activeClient = (ptr.Key, t.Key);
return;