mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-28 08:34:06 +02:00
Refactor and move BrowserCache, VideoPlayer, and ExportManager
This commit is contained in:
parent
931761600f
commit
e114a93714
@ -5,11 +5,11 @@
|
|||||||
using TweetDuck.Core.Bridge;
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDuck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDuck.Core.Handling;
|
using TweetDuck.Core.Handling;
|
||||||
|
using TweetDuck.Core.Management;
|
||||||
using TweetDuck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
using TweetDuck.Core.Notification.Screenshot;
|
using TweetDuck.Core.Notification.Screenshot;
|
||||||
using TweetDuck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
using TweetDuck.Core.Other.Analytics;
|
using TweetDuck.Core.Other.Analytics;
|
||||||
using TweetDuck.Core.Other.Management;
|
|
||||||
using TweetDuck.Core.Other.Settings;
|
using TweetDuck.Core.Other.Settings;
|
||||||
using TweetDuck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDuck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
using TweetDuck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using TweetDuck.Core.Management;
|
||||||
using TweetDuck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
|
|
||||||
namespace TweetDuck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace TweetDuck.Core.Utils{
|
namespace TweetDuck.Core.Management{
|
||||||
static class BrowserCache{
|
static class BrowserCache{
|
||||||
public static string CacheFolder => Path.Combine(Program.StoragePath, "Cache");
|
public static string CacheFolder => Path.Combine(Program.StoragePath, "Cache");
|
||||||
|
|
@ -2,38 +2,49 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using TweetDuck.Core.Other;
|
||||||
using TweetDuck.Data;
|
using TweetDuck.Data;
|
||||||
using TweetDuck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDuck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
|
|
||||||
namespace TweetDuck.Core.Other.Settings.Export{
|
namespace TweetDuck.Core.Management{
|
||||||
sealed class ExportManager{
|
sealed class ProfileManager{
|
||||||
private static readonly string CookiesPath = Path.Combine(Program.StoragePath, "Cookies");
|
private static readonly string CookiesPath = Path.Combine(Program.StoragePath, "Cookies");
|
||||||
private static readonly string TempCookiesPath = Path.Combine(Program.StoragePath, "CookiesTmp");
|
private static readonly string TempCookiesPath = Path.Combine(Program.StoragePath, "CookiesTmp");
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum Items{
|
||||||
|
None = 0,
|
||||||
|
UserConfig = 1,
|
||||||
|
SystemConfig = 2, // TODO implement later
|
||||||
|
Session = 4,
|
||||||
|
PluginData = 8,
|
||||||
|
All = UserConfig|SystemConfig|Session|PluginData
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsRestarting { get; private set; }
|
public bool IsRestarting { get; private set; }
|
||||||
public Exception LastException { get; private set; }
|
public Exception LastException { get; private set; }
|
||||||
|
|
||||||
private readonly string file;
|
private readonly string file;
|
||||||
private readonly PluginManager plugins;
|
private readonly PluginManager plugins;
|
||||||
|
|
||||||
public ExportManager(string file, PluginManager plugins){
|
public ProfileManager(string file, PluginManager plugins){
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.plugins = plugins;
|
this.plugins = plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Export(ExportFileFlags flags){
|
public bool Export(Items items){
|
||||||
try{
|
try{
|
||||||
using(CombinedFileStream stream = new CombinedFileStream(new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))){
|
using(CombinedFileStream stream = new CombinedFileStream(new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))){
|
||||||
if (flags.HasFlag(ExportFileFlags.UserConfig)){
|
if (items.HasFlag(Items.UserConfig)){
|
||||||
stream.WriteFile("config", Program.UserConfigFilePath);
|
stream.WriteFile("config", Program.UserConfigFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags.HasFlag(ExportFileFlags.SystemConfig)){
|
if (items.HasFlag(Items.SystemConfig)){
|
||||||
stream.WriteFile("system", Program.SystemConfigFilePath);
|
stream.WriteFile("system", Program.SystemConfigFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
if (items.HasFlag(Items.PluginData)){
|
||||||
stream.WriteFile("plugin.config", Program.PluginConfigFilePath);
|
stream.WriteFile("plugin.config", Program.PluginConfigFilePath);
|
||||||
|
|
||||||
foreach(Plugin plugin in plugins.Plugins){
|
foreach(Plugin plugin in plugins.Plugins){
|
||||||
@ -47,7 +58,7 @@ public bool Export(ExportFileFlags flags){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags.HasFlag(ExportFileFlags.Session)){
|
if (items.HasFlag(Items.Session)){
|
||||||
stream.WriteFile("cookies", CookiesPath);
|
stream.WriteFile("cookies", CookiesPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,8 +72,8 @@ public bool Export(ExportFileFlags flags){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExportFileFlags GetImportFlags(){
|
public Items FindImportItems(){
|
||||||
ExportFileFlags flags = ExportFileFlags.None;
|
Items items = Items.None;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
using(CombinedFileStream stream = new CombinedFileStream(new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.None))){
|
using(CombinedFileStream stream = new CombinedFileStream(new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.None))){
|
||||||
@ -71,33 +82,33 @@ public ExportFileFlags GetImportFlags(){
|
|||||||
while((key = stream.SkipFile()) != null){
|
while((key = stream.SkipFile()) != null){
|
||||||
switch(key){
|
switch(key){
|
||||||
case "config":
|
case "config":
|
||||||
flags |= ExportFileFlags.UserConfig;
|
items |= Items.UserConfig;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "system":
|
case "system":
|
||||||
flags |= ExportFileFlags.SystemConfig;
|
items |= Items.SystemConfig;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "plugin.config":
|
case "plugin.config":
|
||||||
case "plugin.data":
|
case "plugin.data":
|
||||||
flags |= ExportFileFlags.PluginData;
|
items |= Items.PluginData;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "cookies":
|
case "cookies":
|
||||||
flags |= ExportFileFlags.Session;
|
items |= Items.Session;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
LastException = e;
|
LastException = e;
|
||||||
flags = ExportFileFlags.None;
|
items = Items.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
return flags;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Import(ExportFileFlags flags){
|
public bool Import(Items items){
|
||||||
try{
|
try{
|
||||||
HashSet<string> missingPlugins = new HashSet<string>();
|
HashSet<string> missingPlugins = new HashSet<string>();
|
||||||
|
|
||||||
@ -107,14 +118,14 @@ public bool Import(ExportFileFlags flags){
|
|||||||
while((entry = stream.ReadFile()) != null){
|
while((entry = stream.ReadFile()) != null){
|
||||||
switch(entry.KeyName){
|
switch(entry.KeyName){
|
||||||
case "config":
|
case "config":
|
||||||
if (flags.HasFlag(ExportFileFlags.UserConfig)){
|
if (items.HasFlag(Items.UserConfig)){
|
||||||
entry.WriteToFile(Program.UserConfigFilePath);
|
entry.WriteToFile(Program.UserConfigFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "system":
|
case "system":
|
||||||
if (flags.HasFlag(ExportFileFlags.SystemConfig)){
|
if (items.HasFlag(Items.SystemConfig)){
|
||||||
entry.WriteToFile(Program.SystemConfigFilePath);
|
entry.WriteToFile(Program.SystemConfigFilePath);
|
||||||
IsRestarting = true;
|
IsRestarting = true;
|
||||||
}
|
}
|
||||||
@ -122,14 +133,14 @@ public bool Import(ExportFileFlags flags){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "plugin.config":
|
case "plugin.config":
|
||||||
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
if (items.HasFlag(Items.PluginData)){
|
||||||
entry.WriteToFile(Program.PluginConfigFilePath);
|
entry.WriteToFile(Program.PluginConfigFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "plugin.data":
|
case "plugin.data":
|
||||||
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
if (items.HasFlag(Items.PluginData)){
|
||||||
string[] value = entry.KeyValue;
|
string[] value = entry.KeyValue;
|
||||||
|
|
||||||
entry.WriteToFile(Path.Combine(Program.PluginDataPath, value[0], value[1]), true);
|
entry.WriteToFile(Path.Combine(Program.PluginDataPath, value[0], value[1]), true);
|
||||||
@ -142,7 +153,7 @@ public bool Import(ExportFileFlags flags){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "cookies":
|
case "cookies":
|
||||||
if (flags.HasFlag(ExportFileFlags.Session)){
|
if (items.HasFlag(Items.Session)){
|
||||||
entry.WriteToFile(Path.Combine(Program.StoragePath, TempCookiesPath));
|
entry.WriteToFile(Path.Combine(Program.StoragePath, TempCookiesPath));
|
||||||
IsRestarting = true;
|
IsRestarting = true;
|
||||||
}
|
}
|
@ -3,10 +3,11 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDuck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
|
using TweetDuck.Core.Other;
|
||||||
using TweetDuck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetLib.Communication;
|
using TweetLib.Communication;
|
||||||
|
|
||||||
namespace TweetDuck.Core.Other.Management{
|
namespace TweetDuck.Core.Management{
|
||||||
sealed class VideoPlayer : IDisposable{
|
sealed class VideoPlayer : IDisposable{
|
||||||
public bool Running{
|
public bool Running{
|
||||||
get{
|
get{
|
@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDuck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDuck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
using TweetDuck.Core.Other.Settings.Export;
|
using TweetDuck.Core.Management;
|
||||||
using TweetDuck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
|
|
||||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
@ -11,24 +11,25 @@ private enum State{
|
|||||||
Deciding, Reset, Import, Export
|
Deciding, Reset, Import, Export
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExportFileFlags Flags{
|
private ProfileManager.Items SelectedItems{
|
||||||
get => selectedFlags;
|
get => _selectedItems;
|
||||||
|
|
||||||
set{
|
set{
|
||||||
// this will call events and SetFlag, which also updates the UI
|
// this will call events and SetFlag, which also updates the UI
|
||||||
cbConfig.Checked = value.HasFlag(ExportFileFlags.UserConfig);
|
cbConfig.Checked = value.HasFlag(ProfileManager.Items.UserConfig);
|
||||||
cbSession.Checked = value.HasFlag(ExportFileFlags.Session);
|
cbSession.Checked = value.HasFlag(ProfileManager.Items.Session);
|
||||||
cbPluginData.Checked = value.HasFlag(ExportFileFlags.PluginData);
|
cbPluginData.Checked = value.HasFlag(ProfileManager.Items.PluginData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ShouldReloadBrowser { get; private set; }
|
public bool ShouldReloadBrowser { get; private set; }
|
||||||
|
|
||||||
private readonly PluginManager plugins;
|
private readonly PluginManager plugins;
|
||||||
private State currentState;
|
|
||||||
|
|
||||||
private ExportManager importManager;
|
private State currentState;
|
||||||
private ExportFileFlags selectedFlags = ExportFileFlags.None;
|
private ProfileManager importManager;
|
||||||
|
|
||||||
|
private ProfileManager.Items _selectedItems = ProfileManager.Items.None;
|
||||||
|
|
||||||
public DialogSettingsManage(PluginManager plugins){
|
public DialogSettingsManage(PluginManager plugins){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -42,15 +43,15 @@ private void radioDecision_CheckedChanged(object sender, EventArgs e){
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void cbConfig_CheckedChanged(object sender, EventArgs e){
|
private void cbConfig_CheckedChanged(object sender, EventArgs e){
|
||||||
SetFlag(ExportFileFlags.UserConfig, cbConfig.Checked);
|
SetFlag(ProfileManager.Items.UserConfig, cbConfig.Checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cbSession_CheckedChanged(object sender, EventArgs e){
|
private void cbSession_CheckedChanged(object sender, EventArgs e){
|
||||||
SetFlag(ExportFileFlags.Session, cbSession.Checked);
|
SetFlag(ProfileManager.Items.Session, cbSession.Checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cbPluginData_CheckedChanged(object sender, EventArgs e){
|
private void cbPluginData_CheckedChanged(object sender, EventArgs e){
|
||||||
SetFlag(ExportFileFlags.PluginData, cbPluginData.Checked);
|
SetFlag(ProfileManager.Items.PluginData, cbPluginData.Checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnContinue_Click(object sender, EventArgs e){
|
private void btnContinue_Click(object sender, EventArgs e){
|
||||||
@ -63,7 +64,7 @@ private void btnContinue_Click(object sender, EventArgs e){
|
|||||||
currentState = State.Reset;
|
currentState = State.Reset;
|
||||||
|
|
||||||
Text = "Restore Defaults";
|
Text = "Restore Defaults";
|
||||||
Flags = ExportFileFlags.UserConfig;
|
SelectedItems = ProfileManager.Items.UserConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import
|
// Import
|
||||||
@ -81,11 +82,11 @@ private void btnContinue_Click(object sender, EventArgs e){
|
|||||||
file = dialog.FileName;
|
file = dialog.FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
importManager = new ExportManager(file, plugins);
|
importManager = new ProfileManager(file, plugins);
|
||||||
currentState = State.Import;
|
currentState = State.Import;
|
||||||
|
|
||||||
Text = "Import Profile";
|
Text = "Import Profile";
|
||||||
Flags = importManager.GetImportFlags();
|
SelectedItems = importManager.FindImportItems();
|
||||||
|
|
||||||
cbConfig.Enabled = cbConfig.Checked;
|
cbConfig.Enabled = cbConfig.Checked;
|
||||||
cbSession.Enabled = cbSession.Checked;
|
cbSession.Enabled = cbSession.Checked;
|
||||||
@ -98,7 +99,7 @@ private void btnContinue_Click(object sender, EventArgs e){
|
|||||||
|
|
||||||
Text = "Export Profile";
|
Text = "Export Profile";
|
||||||
btnContinue.Text = "Export Profile";
|
btnContinue.Text = "Export Profile";
|
||||||
Flags = ExportFileFlags.All & ~ExportFileFlags.Session;
|
SelectedItems = ProfileManager.Items.All & ~ProfileManager.Items.Session;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Continue...
|
// Continue...
|
||||||
@ -108,11 +109,11 @@ private void btnContinue_Click(object sender, EventArgs e){
|
|||||||
|
|
||||||
case State.Reset:
|
case State.Reset:
|
||||||
if (FormMessage.Warning("Reset TweetDuck Options", "This will reset the selected items. Are you sure you want to proceed?", FormMessage.Yes, FormMessage.No)){
|
if (FormMessage.Warning("Reset TweetDuck Options", "This will reset the selected items. Are you sure you want to proceed?", FormMessage.Yes, FormMessage.No)){
|
||||||
if (Flags.HasFlag(ExportFileFlags.UserConfig)){
|
if (SelectedItems.HasFlag(ProfileManager.Items.UserConfig)){
|
||||||
Program.UserConfig.Reset();
|
Program.UserConfig.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flags.HasFlag(ExportFileFlags.SystemConfig)){
|
if (SelectedItems.HasFlag(ProfileManager.Items.SystemConfig)){
|
||||||
try{
|
try{
|
||||||
File.Delete(Program.SystemConfigFilePath);
|
File.Delete(Program.SystemConfigFilePath);
|
||||||
}catch(Exception ex){
|
}catch(Exception ex){
|
||||||
@ -120,7 +121,7 @@ private void btnContinue_Click(object sender, EventArgs e){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flags.HasFlag(ExportFileFlags.PluginData)){
|
if (SelectedItems.HasFlag(ProfileManager.Items.PluginData)){
|
||||||
try{
|
try{
|
||||||
File.Delete(Program.PluginConfigFilePath);
|
File.Delete(Program.PluginConfigFilePath);
|
||||||
Directory.Delete(Program.PluginDataPath, true);
|
Directory.Delete(Program.PluginDataPath, true);
|
||||||
@ -129,10 +130,10 @@ private void btnContinue_Click(object sender, EventArgs e){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flags.HasFlag(ExportFileFlags.Session)){
|
if (SelectedItems.HasFlag(ProfileManager.Items.Session)){
|
||||||
Program.Restart(Arguments.ArgDeleteCookies);
|
Program.Restart(Arguments.ArgDeleteCookies);
|
||||||
}
|
}
|
||||||
else if (Flags.HasFlag(ExportFileFlags.SystemConfig)){
|
else if (SelectedItems.HasFlag(ProfileManager.Items.SystemConfig)){
|
||||||
Program.Restart();
|
Program.Restart();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -146,14 +147,14 @@ private void btnContinue_Click(object sender, EventArgs e){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case State.Import:
|
case State.Import:
|
||||||
if (importManager.Import(Flags)){
|
if (importManager.Import(SelectedItems)){
|
||||||
Program.UserConfig.Reload();
|
Program.UserConfig.Reload();
|
||||||
|
|
||||||
if (importManager.IsRestarting){
|
if (importManager.IsRestarting){
|
||||||
if (Flags.HasFlag(ExportFileFlags.Session)){
|
if (SelectedItems.HasFlag(ProfileManager.Items.Session)){
|
||||||
Program.Restart(Arguments.ArgImportCookies);
|
Program.Restart(Arguments.ArgImportCookies);
|
||||||
}
|
}
|
||||||
else if (Flags.HasFlag(ExportFileFlags.SystemConfig)){
|
else if (SelectedItems.HasFlag(ProfileManager.Items.SystemConfig)){
|
||||||
Program.Restart();
|
Program.Restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,9 +190,9 @@ private void btnContinue_Click(object sender, EventArgs e){
|
|||||||
Program.UserConfig.Save();
|
Program.UserConfig.Save();
|
||||||
Program.SystemConfig.Save();
|
Program.SystemConfig.Save();
|
||||||
|
|
||||||
ExportManager manager = new ExportManager(file, plugins);
|
ProfileManager manager = new ProfileManager(file, plugins);
|
||||||
|
|
||||||
if (!manager.Export(Flags)){
|
if (!manager.Export(SelectedItems)){
|
||||||
Program.Reporter.HandleException("Profile Export Error", "An exception happened while exporting TweetDuck profile.", true, manager.LastException);
|
Program.Reporter.HandleException("Profile Export Error", "An exception happened while exporting TweetDuck profile.", true, manager.LastException);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,15 +207,15 @@ private void btnCancel_Click(object sender, EventArgs e){
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetFlag(ExportFileFlags flag, bool enable){
|
private void SetFlag(ProfileManager.Items flag, bool enable){
|
||||||
selectedFlags = enable ? selectedFlags | flag : selectedFlags & ~flag;
|
_selectedItems = enable ? _selectedItems | flag : _selectedItems & ~flag;
|
||||||
btnContinue.Enabled = selectedFlags != ExportFileFlags.None;
|
btnContinue.Enabled = _selectedItems != ProfileManager.Items.None;
|
||||||
|
|
||||||
if (currentState == State.Import){
|
if (currentState == State.Import){
|
||||||
btnContinue.Text = selectedFlags.HasFlag(ExportFileFlags.Session) ? "Import && Restart" : "Import Profile";
|
btnContinue.Text = _selectedItems.HasFlag(ProfileManager.Items.Session) ? "Import && Restart" : "Import Profile";
|
||||||
}
|
}
|
||||||
else if (currentState == State.Reset){
|
else if (currentState == State.Reset){
|
||||||
btnContinue.Text = selectedFlags.HasFlag(ExportFileFlags.Session) ? "Restore && Restart" : "Restore Defaults";
|
btnContinue.Text = _selectedItems.HasFlag(ProfileManager.Items.Session) ? "Restore && Restart" : "Restore Defaults";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace TweetDuck.Core.Other.Settings.Export{
|
|
||||||
[Flags]
|
|
||||||
enum ExportFileFlags{
|
|
||||||
None = 0,
|
|
||||||
UserConfig = 1,
|
|
||||||
SystemConfig = 2, // TODO implement later
|
|
||||||
Session = 4,
|
|
||||||
PluginData = 8,
|
|
||||||
All = UserConfig|SystemConfig|Session|PluginData
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,6 +4,7 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDuck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
using TweetDuck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
|
using TweetDuck.Core.Management;
|
||||||
using TweetDuck.Core.Other.Settings.Dialogs;
|
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||||
using TweetDuck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
using TweetDuck.Core;
|
using TweetDuck.Core;
|
||||||
using TweetDuck.Core.Handling.General;
|
using TweetDuck.Core.Handling.General;
|
||||||
using TweetDuck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
using TweetDuck.Core.Other.Settings.Export;
|
using TweetDuck.Core.Management;
|
||||||
using TweetDuck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDuck.Data;
|
using TweetDuck.Data;
|
||||||
using TweetDuck.Updates;
|
using TweetDuck.Updates;
|
||||||
@ -118,10 +118,10 @@ private static void Main(){
|
|||||||
SystemConfig = SystemConfig.Load(SystemConfigFilePath);
|
SystemConfig = SystemConfig.Load(SystemConfigFilePath);
|
||||||
|
|
||||||
if (Arguments.HasFlag(Arguments.ArgImportCookies)){
|
if (Arguments.HasFlag(Arguments.ArgImportCookies)){
|
||||||
ExportManager.ImportCookies();
|
ProfileManager.ImportCookies();
|
||||||
}
|
}
|
||||||
else if (Arguments.HasFlag(Arguments.ArgDeleteCookies)){
|
else if (Arguments.HasFlag(Arguments.ArgDeleteCookies)){
|
||||||
ExportManager.DeleteCookies();
|
ProfileManager.DeleteCookies();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Arguments.HasFlag(Arguments.ArgUpdated)){
|
if (Arguments.HasFlag(Arguments.ArgUpdated)){
|
||||||
|
Loading…
Reference in New Issue
Block a user