Skip to content

Commit

Permalink
Support running from MSI Installer #1838
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Sep 3, 2023
1 parent 8d47d2a commit 3048699
Show file tree
Hide file tree
Showing 22 changed files with 181 additions and 136 deletions.
1 change: 1 addition & 0 deletions Analogy.Common/DataTypes/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public enum FontSelectionType

public enum SettingsMode
{
None = -1,
PerUser,
ApplicationFolder,
ProgramData,
Expand Down
3 changes: 2 additions & 1 deletion Analogy.Common/Interfaces/IUserSettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public interface IUserSettingsManager
bool TrackActiveMessage { get; set; }
float RealTimeRefreshInterval { get; set; }
FilteringExclusion FilteringExclusion { get; set; }
string LogsLayoutFileName { get; set; }
string LogsLayoutFileName { get; }
bool UseCustomLogsLayout { get; set; }
bool ViewDetailedMessageWithHTML { get; set; }
TimeSpan TimeOffset { get; set; }
Expand All @@ -65,5 +65,6 @@ public interface IUserSettingsManager
void ResetSettings();
bool TryGetWindowPosition(Guid id, out AnalogyPositionState? position);
void SetWindowPosition(Guid id, AnalogyPositionState position);
void SetLogsLayoutFileName(string filename);
}
}
7 changes: 6 additions & 1 deletion Analogy.Common/Managers/DefaultUserSettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class DefaultUserSettingsManager : IUserSettingsManager
public bool TrackActiveMessage { get; set; }
public float RealTimeRefreshInterval { get; set; } = 1;
public FilteringExclusion FilteringExclusion { get; set; } = new FilteringExclusion();
public string LogsLayoutFileName { get; set; }
public string LogsLayoutFileName { get; }
public bool UseCustomLogsLayout { get; set; }
public bool ViewDetailedMessageWithHTML { get; set; }
public TimeSpan TimeOffset { get; set; } = TimeSpan.Zero;
Expand Down Expand Up @@ -102,5 +102,10 @@ public bool TryGetWindowPosition(Guid id, out AnalogyPositionState? position)
public void SetWindowPosition(Guid id, AnalogyPositionState position)
{
}

public void SetLogsLayoutFileName(string filename)
{

}
}
}
4 changes: 2 additions & 2 deletions Analogy.CommonControls/UserControls/LogMessagesUC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ private void SetupEventsHandlers()

wsLogs.WorkspaceSaved += (s, e) =>
{
Settings.LogsLayoutFileName = e.Workspace.Path;
Settings.SetLogsLayoutFileName(e.Workspace.Path);
// Settings.UseCustomLogsLayout = true;
};
wsLogs.AfterApplyWorkspace += (s, e) =>
Expand All @@ -1015,7 +1015,7 @@ private void SetupEventsHandlers()
else if (File.Exists(ws.Workspace.Path))
{
// Settings.UseCustomLogsLayout = true;
Settings.LogsLayoutFileName = ws.Workspace.Path;
Settings.SetLogsLayoutFileName(ws.Workspace.Path);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ private void SetupEventsHandlers()

wsLogs.WorkspaceSaved += (s, e) =>
{
Settings.LogsLayoutFileName = e.Workspace.Path;
Settings.SetLogsLayoutFileName(e.Workspace.Path);
// Settings.UseCustomLogsLayout = true;
};
wsLogs.AfterApplyWorkspace += (s, e) =>
Expand All @@ -775,7 +775,7 @@ private void SetupEventsHandlers()
else if (File.Exists(ws.Workspace.Path))
{
// Settings.UseCustomLogsLayout = true;
Settings.LogsLayoutFileName = ws.Workspace.Path;
Settings.SetLogsLayoutFileName(ws.Workspace.Path);
}

}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Analogy/ApplicationSettings/ApplicationGeneralSettingsUC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ namespace Analogy.ApplicationSettings
public partial class ApplicationGeneralSettingsUC : DevExpress.XtraEditors.XtraUserControl
{
private IAnalogyUserSettings Settings { get; }
public ApplicationGeneralSettingsUC(IAnalogyUserSettings settings)
private IAnalogyFoldersAccess FoldersAccess { get; }

public ApplicationGeneralSettingsUC(IAnalogyUserSettings settings,IAnalogyFoldersAccess foldersAccess)
{
Settings = settings;
FoldersAccess = foldersAccess;
InitializeComponent();
}

Expand Down Expand Up @@ -71,6 +74,7 @@ private void SetupEventsHandlers()

private void LoadSettings()
{
ceSettingsLocationApplicationFolder.Text = $"Portable: Store settings in the Application Folder ({FoldersAccess.ConfigurationsFolder})";
toggleSwitchIdleMode.IsOn = Settings.IdleMode;
nudIdleTime.Value = Settings.IdleTimeMinutes;
nudRecentFiles.Value = Settings.RecentFilesCount;
Expand Down
1 change: 1 addition & 0 deletions Analogy/CommonChangeLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public static IEnumerable<AnalogyChangeLog> GetChangeLog()
{
return new List<AnalogyChangeLog>
{
new ("V5.0.0 - Support running from MSI Installer #1838", AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2023,09,03),"5.0.0.0"),
new ("V5.0.0 - Add Export to Simple File #1815", AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2023,08,25),"5.0.0.0"),
new ("V5.0.0 - Change Time Offset is very slow #1769", AnalogChangeLogType.Bug,"Lior Banai",new DateTime(2023,08,25),"5.0.0.0"),
new ("V5.0.0 - Message viewer doesn't understand Linux-style new lines #1770", AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2023,08,25),"5.0.0.0"),
Expand Down
10 changes: 6 additions & 4 deletions Analogy/Forms/ApplicationSettingsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ public partial class ApplicationSettingsForm : DevExpress.XtraBars.FluentDesignS
{
private IAnalogyUserSettings Settings { get; }
private IFactoriesManager FactoriesManager { get; }
private IAnalogyFoldersAccess FoldersAccess { get; }
private UpdateManager UpdateManager { get; }
private ApplicationSettingsSelectionType SelectedSettingType { get; }
public ApplicationSettingsForm(IAnalogyUserSettings settings, IFactoriesManager factoriesManager, UpdateManager updateManager)
public ApplicationSettingsForm(IAnalogyUserSettings settings, IFactoriesManager factoriesManager, IAnalogyFoldersAccess foldersAccess, UpdateManager updateManager)
{
InitializeComponent();
Settings = settings;
FactoriesManager = factoriesManager;
FoldersAccess = foldersAccess;
UpdateManager = updateManager;
EnableAcrylicAccent = false;
SelectedSettingType = ApplicationSettingsSelectionType.ApplicationGeneralSettings;
}

public ApplicationSettingsForm(ApplicationSettingsSelectionType selectedSettingType, IAnalogyUserSettings settings, IFactoriesManager factoriesManager, UpdateManager updateManager) : this(settings, factoriesManager, updateManager)
public ApplicationSettingsForm(ApplicationSettingsSelectionType selectedSettingType, IAnalogyUserSettings settings, IFactoriesManager factoriesManager, IAnalogyFoldersAccess foldersAccess, UpdateManager updateManager) : this(settings, factoriesManager, foldersAccess, updateManager)
{
SelectedSettingType = selectedSettingType;
}
Expand All @@ -48,7 +50,7 @@ private UserControl GetUserControlByType(ApplicationSettingsSelectionType settin
switch (settingType)
{
case ApplicationSettingsSelectionType.ApplicationGeneralSettings:
return new ApplicationGeneralSettingsUC(Settings);
return new ApplicationGeneralSettingsUC(Settings, FoldersAccess);
case ApplicationSettingsSelectionType.ApplicationUISettings:
return new ApplicationUISettingsUC(Settings);
case ApplicationSettingsSelectionType.MessagesFilteringSettings:
Expand Down Expand Up @@ -199,7 +201,7 @@ private void bbtnReset_ItemClick(object sender, ItemClickEventArgs e)
Hide();
Close();
Settings.ResetSettings();
ApplicationSettingsForm us = new ApplicationSettingsForm(Settings, FactoriesManager, UpdateManager);
ApplicationSettingsForm us = new ApplicationSettingsForm(Settings, FactoriesManager, FoldersAccess, UpdateManager);
us.ShowDialog(owner);
}
}
Expand Down
Loading

0 comments on commit 3048699

Please sign in to comment.