├── UnityLauncher
├── icon.png
├── Core
│ ├── Common
│ │ ├── MainWindow
│ │ │ ├── Messages
│ │ │ │ ├── CloseMessage.cs
│ │ │ │ ├── EditorsFilled.cs
│ │ │ │ ├── SelectedEditorChanged.cs
│ │ │ │ └── EditorLocationsChanged.cs
│ │ │ ├── MainWindowView.xaml.cs
│ │ │ ├── MainWindowModelView.cs
│ │ │ ├── MainWindowView.xaml
│ │ │ └── MainWindowModel.cs
│ │ ├── BaseClasses
│ │ │ ├── EventHandlers
│ │ │ │ ├── CommandEventHandler.cs
│ │ │ │ ├── CancelCommandEventHandler.cs
│ │ │ │ ├── CancelCommandEventArgs.cs
│ │ │ │ └── CommandEventArgs.cs
│ │ │ ├── Attributes
│ │ │ │ └── NonInstanciatedBehaviorAttribute.cs
│ │ │ ├── CommonContext.cs
│ │ │ ├── BaseModel.cs
│ │ │ ├── Enableable
│ │ │ │ ├── EnableableModelView.cs
│ │ │ │ └── EnableableModel.cs
│ │ │ ├── BaseBehaviorModelView.cs
│ │ │ ├── Infos
│ │ │ │ ├── StringInfo.cs
│ │ │ │ └── EditorInfo.cs
│ │ │ ├── Notifier.cs
│ │ │ ├── BaseModelView.cs
│ │ │ └── Commands
│ │ │ │ └── Command.cs
│ │ └── Settings
│ │ │ ├── SettingHolder.cs
│ │ │ ├── SettingHolderConverter.cs
│ │ │ └── Settings.cs
│ ├── Interfaces
│ │ ├── IContext.cs
│ │ ├── ILaunchBehavior.cs
│ │ ├── IOptionsBehavior.cs
│ │ ├── IBehavior.cs
│ │ ├── IInitializableView.cs
│ │ ├── ILaunchCommandSource.cs
│ │ ├── ILaunchCommandBehavior.cs
│ │ ├── IMessageReceiver.cs
│ │ ├── IUIBehavior.cs
│ │ └── ISettingsProvider.cs
│ ├── LaunchSettings
│ │ ├── User
│ │ │ ├── Messages
│ │ │ │ └── UserListChanged.cs
│ │ │ ├── UserView.xaml.cs
│ │ │ ├── EnterPasswordDialog
│ │ │ │ ├── EnterPasswordDialog.xaml.cs
│ │ │ │ └── EnterPasswordDialog.xaml
│ │ │ ├── UserInfo.cs
│ │ │ ├── UserModelView.cs
│ │ │ ├── UserView.xaml
│ │ │ └── UserModel.cs
│ │ ├── Project
│ │ │ ├── Messages
│ │ │ │ └── SelectedProjectChanged.cs
│ │ │ ├── ProjectView.xaml.cs
│ │ │ ├── ProjectModelView.cs
│ │ │ ├── ProjectModel.cs
│ │ │ ├── ProjectInfo.cs
│ │ │ └── ProjectView.xaml
│ │ ├── RenderMode
│ │ │ ├── RenderModeInfo.cs
│ │ │ ├── RenderModeView.xaml.cs
│ │ │ ├── RenderModeModelView.cs
│ │ │ ├── RenderModeView.xaml
│ │ │ └── RenderModeModel.cs
│ │ ├── Custom
│ │ │ ├── CustomView.xaml.cs
│ │ │ ├── CustomModelView.cs
│ │ │ ├── CustomModel.cs
│ │ │ └── CustomView.xaml
│ │ └── SkinPathcer
│ │ │ ├── SkinPatcherView.xaml.cs
│ │ │ ├── SkinPatcherModelView.cs
│ │ │ ├── SkinPatcherModel.cs
│ │ │ ├── SkinPatcherView.xaml
│ │ │ └── Infos
│ │ │ └── ExtendedEditorInfo.cs
│ ├── Tools
│ │ ├── Attributes
│ │ │ └── JsonEncryptAttribute .cs
│ │ ├── Controls
│ │ │ ├── UnsecurePasswordBox.xaml
│ │ │ └── UnsecurePasswordBox.xaml.cs
│ │ ├── StringComparerConverter.cs
│ │ ├── ProxyLaunchCommandSource.cs
│ │ ├── FileHelper.cs
│ │ ├── EncryptedStringPropertyResolver .cs
│ │ └── BinnaryHelper.cs
│ ├── Options
│ │ ├── Locations
│ │ │ ├── EditorLocationsView.xaml.cs
│ │ │ ├── EditorLocationsModelView.cs
│ │ │ ├── EditorLocationsView.xaml
│ │ │ └── EditorLocationsModel.cs
│ │ └── Users
│ │ │ ├── UsersView.xaml.cs
│ │ │ ├── UsersModelView.cs
│ │ │ ├── UsersModel.cs
│ │ │ └── UsersView.xaml
│ └── Behaviors.cs
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── packages.config
├── App.xaml.cs
├── App.xaml
└── app.manifest
├── README.md
├── UnityLauncher.sln
└── .gitignore
/UnityLauncher/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HolyShovelSoft/UnityLauncher/HEAD/UnityLauncher/icon.png
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/MainWindow/Messages/CloseMessage.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Core.Common
2 | {
3 | public class CloseMessage
4 | {
5 |
6 | }
7 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Interfaces/IContext.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Interfaces
2 | {
3 | public interface IContext
4 | {
5 | string ContextKey { get; }
6 | }
7 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Interfaces/ILaunchBehavior.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Interfaces
2 | {
3 | public interface ILaunchBehavior : IUIBehavior
4 | {
5 |
6 | }
7 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Interfaces/IOptionsBehavior.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Interfaces
2 | {
3 | public interface IOptionsBehavior : IUIBehavior
4 | {
5 |
6 | }
7 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # UnityLauncher
2 | This is custom unity launcher project... just for personal purposes. If you want use it... do it at your own risk. =)
3 |
4 | Project mostly dead - because Unity Hub...
5 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/EventHandlers/CommandEventHandler.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Core
2 | {
3 | public delegate void CommandEventHandler(object sender, CommandEventArgs args);
4 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/MainWindow/Messages/EditorsFilled.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Core.Common
2 | {
3 | public class EditorsFilled
4 | {
5 | public EditorInfo[] infos;
6 | }
7 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Interfaces/IBehavior.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Interfaces
2 | {
3 | public interface IBehavior : IContext
4 | {
5 | IMessageReceiver MessageReceiver { get; }
6 | }
7 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Interfaces/IInitializableView.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Interfaces
2 | {
3 | public interface IInitializableView
4 | {
5 | void Init(object dataContext);
6 | }
7 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Interfaces/ILaunchCommandSource.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Interfaces
2 | {
3 | public interface ILaunchCommandSource
4 | {
5 | string CommandLineValue { get; }
6 | }
7 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/EventHandlers/CancelCommandEventHandler.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Core
2 | {
3 | public delegate void CancelCommandEventHandler(object sender, CancelCommandEventArgs args);
4 | }
--------------------------------------------------------------------------------
/UnityLauncher/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/User/Messages/UserListChanged.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Core.LaunchSettings.Messages
2 | {
3 | public class UserListChanged
4 | {
5 | public UserInfo[] users;
6 | }
7 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/MainWindow/Messages/SelectedEditorChanged.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Core.Common
2 | {
3 | public struct SelectedEditorChanged
4 | {
5 | public EditorInfo selectEditorInfo;
6 | }
7 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/EventHandlers/CancelCommandEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Core
2 | {
3 | public class CancelCommandEventArgs : CommandEventArgs
4 | {
5 | public bool Cancel { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/Project/Messages/SelectedProjectChanged.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Core.LaunchSettings
2 | {
3 | public struct SelectedProjectChanged
4 | {
5 | public ProjectInfo selectedProject;
6 | }
7 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Interfaces/ILaunchCommandBehavior.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Interfaces
2 | {
3 | public interface ILaunchCommandBehavior : ILaunchBehavior
4 | {
5 | ILaunchCommandSource LaunchCommandSource { get; }
6 | }
7 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/EventHandlers/CommandEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace UnityLauncher.Core
4 | {
5 | public class CommandEventArgs : EventArgs
6 | {
7 | public object Parameter { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/MainWindow/Messages/EditorLocationsChanged.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Core.Common
2 | {
3 | public struct EditorLocationsChanged
4 | {
5 | public string[] pathes;
6 | public string[] masks;
7 | }
8 | }
--------------------------------------------------------------------------------
/UnityLauncher/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/Settings/SettingHolder.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace UnityLauncher.Core
4 | {
5 | public class SettingHolder
6 | {
7 | [JsonProperty]
8 | public T Value { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Tools/Attributes/JsonEncryptAttribute .cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace UnityLauncher.Core.Attributes
4 | {
5 | [AttributeUsage(AttributeTargets.Property)]
6 | public class JsonEncryptAttribute : Attribute
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Interfaces/IMessageReceiver.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Interfaces
2 | {
3 | public interface IMessageReceiver{ }
4 |
5 | public interface IMessageReceiver : IMessageReceiver
6 | {
7 | void OnMessage(T message);
8 | }
9 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Interfaces/IUIBehavior.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace UnityLauncher.Interfaces
4 | {
5 | public interface IUIBehavior : IBehavior
6 | {
7 | int UiOrder { get; }
8 | FrameworkElement GetControl();
9 | }
10 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/Attributes/NonInstanciatedBehaviorAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace UnityLauncher.Core.Attributes
4 | {
5 | [AttributeUsage(AttributeTargets.Class)]
6 | public class NonInstanciatedBehaviorAttribute : Attribute
7 | {
8 | public string flagPropertyName;
9 | }
10 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Interfaces/ISettingsProvider.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Interfaces
2 | {
3 | public interface ISettingsProvider
4 | {
5 | T GetSetting(IContext context, string key);
6 | void SaveSetting(IContext context, string key, T value);
7 | void RemoveSetting(IContext context, string key);
8 | }
9 | }
--------------------------------------------------------------------------------
/UnityLauncher/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/CommonContext.cs:
--------------------------------------------------------------------------------
1 | using UnityLauncher.Interfaces;
2 |
3 | namespace UnityLauncher.Core
4 | {
5 | public class CommonContext : IContext
6 | {
7 | public CommonContext(string contextKey)
8 | {
9 | ContextKey = contextKey;
10 | }
11 |
12 | public string ContextKey { get; }
13 | }
14 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/BaseModel.cs:
--------------------------------------------------------------------------------
1 | using UnityLauncher.Interfaces;
2 |
3 | namespace UnityLauncher.Core
4 | {
5 | public abstract class BaseModel
6 | {
7 | protected IContext Context { get; private set; }
8 |
9 | public virtual void Init(IContext context)
10 | {
11 | Context = context;
12 | }
13 |
14 | protected BaseModel() { }
15 | }
16 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Options/Locations/EditorLocationsView.xaml.cs:
--------------------------------------------------------------------------------
1 | using UnityLauncher.Interfaces;
2 |
3 | namespace UnityLauncher.Core.Options
4 | {
5 | public partial class EditorLocationsView : IInitializableView
6 | {
7 | public EditorLocationsView() { }
8 |
9 | public void Init(object dataContext)
10 | {
11 | DataContext = dataContext;
12 | InitializeComponent();
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/RenderMode/RenderModeInfo.cs:
--------------------------------------------------------------------------------
1 | namespace UnityLauncher.Core.LaunchSettings
2 | {
3 | public class RenderModeInfo : Notifier
4 | {
5 | public string Value { get; }
6 | public string Command { get; }
7 |
8 | public RenderModeInfo(string value, string command, object parent)
9 | {
10 | Value = value;
11 | Command = command;
12 | Parent = parent;
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Options/Users/UsersView.xaml.cs:
--------------------------------------------------------------------------------
1 | using UnityLauncher.Interfaces;
2 |
3 | namespace UnityLauncher.Core.Options
4 | {
5 | ///
6 | /// Interaction logic for UsersView.xaml
7 | ///
8 | public partial class UsersView : IInitializableView
9 | {
10 | public UsersView() { }
11 |
12 | public void Init(object dataContext)
13 | {
14 | DataContext = dataContext;
15 | InitializeComponent();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/User/UserView.xaml.cs:
--------------------------------------------------------------------------------
1 | using UnityLauncher.Interfaces;
2 |
3 | namespace UnityLauncher.Core.LaunchSettings
4 | {
5 | ///
6 | /// Interaction logic for UserView.xaml
7 | ///
8 | public partial class UserView : IInitializableView
9 | {
10 | public UserView() { }
11 |
12 | public void Init(object dataContext)
13 | {
14 | DataContext = dataContext;
15 | InitializeComponent();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/Custom/CustomView.xaml.cs:
--------------------------------------------------------------------------------
1 | using UnityLauncher.Interfaces;
2 |
3 | namespace UnityLauncher.Core.LaunchSettings
4 | {
5 | ///
6 | /// Interaction logic for CustomView.xaml
7 | ///
8 | public partial class CustomView : IInitializableView
9 | {
10 | public CustomView() {}
11 |
12 | public void Init(object dataContext)
13 | {
14 | DataContext = dataContext;
15 | InitializeComponent();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/Project/ProjectView.xaml.cs:
--------------------------------------------------------------------------------
1 | using UnityLauncher.Interfaces;
2 |
3 | namespace UnityLauncher.Core.LaunchSettings
4 | {
5 | ///
6 | /// Interaction logic for ProjectView.xaml
7 | ///
8 | public partial class ProjectView : IInitializableView
9 | {
10 | public ProjectView() { }
11 |
12 | public void Init(object dataContext)
13 | {
14 | DataContext = dataContext;
15 | InitializeComponent();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/SkinPathcer/SkinPatcherView.xaml.cs:
--------------------------------------------------------------------------------
1 | using UnityLauncher.Interfaces;
2 |
3 | namespace UnityLauncher.Core.LaunchSettings
4 | {
5 | ///
6 | /// Interaction logic for SkinPatcherView.xaml
7 | ///
8 | public partial class SkinPatcherView : IInitializableView
9 | {
10 | public SkinPatcherView() { }
11 |
12 | public void Init(object dataContext)
13 | {
14 | DataContext = dataContext;
15 | InitializeComponent();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/RenderMode/RenderModeView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 | using UnityLauncher.Interfaces;
3 |
4 | namespace UnityLauncher.Core.LaunchSettings
5 | {
6 | ///
7 | /// Interaction logic for RenderModeView.xaml
8 | ///
9 | public partial class RenderModeView : IInitializableView
10 | {
11 | public RenderModeView() { }
12 |
13 | public void Init(object dataContext)
14 | {
15 | DataContext = dataContext;
16 | InitializeComponent();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/Tools/Controls/UnsecurePasswordBox.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/UnityLauncher/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using UnityLauncher.Core;
2 | using UnityLauncher.Core.Common;
3 | using UnityLauncher.Interfaces;
4 |
5 | namespace UnityLauncher
6 | {
7 | ///
8 | /// Interaction logic for App.xaml
9 | ///
10 | public partial class App
11 | {
12 | public App()
13 | {
14 | InitializeComponent();
15 | Settings.Init();
16 | var mainWindow = new MainWindowView();
17 | var mainViewModel = new MainWindowModelView(mainWindow);
18 | Behaviors.Init(mainViewModel, (IBehavior) Settings.Instance);
19 | mainWindow.Init(mainViewModel);
20 | mainWindow.Show();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/Enableable/EnableableModelView.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using UnityLauncher.Interfaces;
3 |
4 | namespace UnityLauncher.Core
5 | {
6 | public abstract class EnableableModelView : BaseBehaviorModelView where TModel : EnableableModel, new() where TView : FrameworkElement, IInitializableView , new()
7 | {
8 | public virtual bool IsEnabled
9 | {
10 | get => Model.IsEnabled;
11 | set => Model.IsEnabled = value;
12 | }
13 |
14 | protected EnableableModelView()
15 | {
16 | Model.OnEnableChange += () => NotifyPropertyChanged("IsEnabled");
17 | NotifyPropertyChanged("IsEnabled");
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/BaseBehaviorModelView.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using UnityLauncher.Interfaces;
3 |
4 | namespace UnityLauncher.Core
5 | {
6 | public abstract class BaseBehaviorModelView : BaseModelView, IUIBehavior where TModel : BaseModel, new() where TView : FrameworkElement, IInitializableView, new()
7 | {
8 | protected TView View { get; }
9 |
10 | protected BaseBehaviorModelView()
11 | {
12 | View = new TView();
13 | Init(View);
14 | View.Init(this);
15 | }
16 |
17 | public abstract int UiOrder { get; }
18 |
19 | public FrameworkElement GetControl()
20 | {
21 | return UiElement;
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/Infos/StringInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace UnityLauncher.Core
4 | {
5 | public class StringInfo : Notifier
6 | {
7 | public event Action OnValueChange;
8 |
9 | public bool NotEmpty => !string.IsNullOrEmpty(value);
10 |
11 | private string value;
12 | public string Value
13 | {
14 | get => value;
15 | set
16 | {
17 | if (value != this.value)
18 | {
19 | this.value = value;
20 | OnValueChange?.Invoke();
21 | NotifyPropertyChanged("Value");
22 | NotifyPropertyChanged("NotEmpty");
23 | }
24 | }
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Tools/StringComparerConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 |
5 | namespace UnityLauncher.Core
6 | {
7 | public class StringComparerConverter : IMultiValueConverter
8 | {
9 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
10 | {
11 | if (values == null) return false;
12 | if (values.Length < 2) return false;
13 | if (values[0] is string && values[1] is string)
14 | {
15 | return (string) values[0] == (string) values[1];
16 | }
17 | return false;
18 | }
19 |
20 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
21 | {
22 | return new object[0];
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/Enableable/EnableableModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityLauncher.Interfaces;
3 |
4 | namespace UnityLauncher.Core
5 | {
6 | public abstract class EnableableModel : BaseModel
7 | {
8 | public event Action OnEnableChange;
9 |
10 | private bool isEnabled;
11 | public virtual bool IsEnabled
12 | {
13 | get => isEnabled;
14 | set
15 | {
16 | if (isEnabled != value)
17 | {
18 | isEnabled = value;
19 | OnEnableChange?.Invoke();
20 | Settings.Instance.SaveSetting(Context, "IsEnabled", value);
21 | }
22 | }
23 | }
24 |
25 | public override void Init(IContext context)
26 | {
27 | base.Init(context);
28 | isEnabled = Settings.Instance.GetSetting(Context, "IsEnabled");
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/Notifier.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using Newtonsoft.Json;
3 |
4 | namespace UnityLauncher.Core
5 | {
6 | public abstract class Notifier: INotifyPropertyChanged
7 | {
8 | [JsonIgnore]
9 | public object This => this;
10 |
11 | private object parent;
12 | [JsonIgnore]
13 | public object Parent
14 | {
15 | get => parent;
16 | set
17 | {
18 | if (value != parent)
19 | {
20 | parent = value;
21 | NotifyPropertyChanged("Parent");
22 | }
23 | }
24 | }
25 |
26 | public event PropertyChangedEventHandler PropertyChanged = delegate { };
27 |
28 | protected void NotifyPropertyChanged(string propertyName)
29 | {
30 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/UnityLauncher/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/MainWindow/MainWindowView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using UnityLauncher.Interfaces;
4 |
5 | namespace UnityLauncher
6 | {
7 | ///
8 | /// Interaction logic for MainWindowView.xaml
9 | ///
10 | public partial class MainWindowView : IInitializableView
11 | {
12 | private static MainWindowView _instance;
13 | public static MainWindowView Instance => _instance;
14 | public event Action OnCloseEvent;
15 |
16 | public MainWindowView()
17 | {
18 | _instance = this;
19 | }
20 |
21 | public void Init(object dataContext)
22 | {
23 | DataContext = dataContext;
24 | InitializeComponent();
25 | }
26 |
27 | protected override void OnClosed(EventArgs e)
28 | {
29 | OnCloseEvent?.Invoke();
30 |
31 | base.OnClosed(e);
32 |
33 | Application.Current.Shutdown();
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/UnityLauncher.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26430.15
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityLauncher", "UnityLauncher\UnityLauncher.csproj", "{F0484D06-4E3B-49AA-8F68-54508F722A31}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {F0484D06-4E3B-49AA-8F68-54508F722A31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {F0484D06-4E3B-49AA-8F68-54508F722A31}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {F0484D06-4E3B-49AA-8F68-54508F722A31}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {F0484D06-4E3B-49AA-8F68-54508F722A31}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/RenderMode/RenderModeModelView.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using UnityLauncher.Interfaces;
3 |
4 | namespace UnityLauncher.Core.LaunchSettings
5 | {
6 | public class RenderModeModelView : EnableableModelView, ILaunchCommandBehavior
7 | {
8 | public override string ContextKey => "RenderMode";
9 | public override IMessageReceiver MessageReceiver => null;
10 | public override int UiOrder => 2;
11 |
12 | public RenderModeInfo Selected
13 | {
14 | get => Model.Selected;
15 | set => Model.Selected = value;
16 | }
17 |
18 | public ObservableCollection Modes => Model.modes;
19 |
20 | public RenderModeModelView()
21 | {
22 | Model.OnSelectedChange += OnSelectedChange;
23 | }
24 |
25 | private void OnSelectedChange()
26 | {
27 | NotifyPropertyChanged("Selected");
28 | }
29 |
30 | public ILaunchCommandSource LaunchCommandSource => Model;
31 | }
32 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Tools/ProxyLaunchCommandSource.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityLauncher.Interfaces;
3 |
4 | namespace UnityLauncher.Core
5 | {
6 | public class ProxyLaunchCommandSource : ILaunchCommandSource
7 | {
8 | private readonly ILaunchCommandSource wrappedSource;
9 | private readonly Action beforeProxy;
10 | private readonly Func proxyProcess;
11 |
12 | public ProxyLaunchCommandSource(ILaunchCommandSource wrappedSource, Action beforeProxy, Func proxyProcess)
13 | {
14 | this.wrappedSource = wrappedSource;
15 | this.beforeProxy = beforeProxy;
16 | this.proxyProcess = proxyProcess;
17 | }
18 |
19 | public string CommandLineValue
20 | {
21 | get
22 | {
23 | beforeProxy?.Invoke();
24 |
25 | var result = wrappedSource?.CommandLineValue ?? "";
26 | if (proxyProcess != null)
27 | {
28 | result = proxyProcess(result);
29 | }
30 |
31 | return result;
32 | }
33 | }
34 |
35 | }
36 | }
--------------------------------------------------------------------------------
/UnityLauncher/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace UnityLauncher.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/SkinPathcer/SkinPatcherModelView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityLauncher.Core.Attributes;
3 | using UnityLauncher.Interfaces;
4 |
5 | namespace UnityLauncher.Core.LaunchSettings
6 | {
7 | [NonInstanciatedBehavior(flagPropertyName = "UseThisBehaviour")]
8 | public class SkinPatcherModelView : EnableableModelView, ILaunchBehavior
9 | {
10 | private static bool UseThisBehaviour => Settings.Instance.GetSetting(new CommonContext("SkinPatch"), "UseDarkPathcerOption");
11 | public override string ContextKey => "SkinPatch";
12 | public override IMessageReceiver MessageReceiver => Model;
13 | public override int UiOrder => 4;
14 |
15 | public ExtendedEditorInfo EditorInfo => Model.ExtendedEditor;
16 | public Command PatchCommand { get; }
17 | public Command RestoreBackupCommand { get; }
18 |
19 | public SkinPatcherModelView()
20 | {
21 | Model.OnEditorChanged += OnEditorChanged;
22 | PatchCommand = new Command(Model.Patch);
23 | RestoreBackupCommand = new Command(Model.RestoreBackup);
24 | NotifyPropertyChanged("PatchCommand");
25 | NotifyPropertyChanged("RestoreBackupCommand");
26 | NotifyPropertyChanged("EditorInfo");
27 | }
28 |
29 | private void OnEditorChanged()
30 | {
31 | NotifyPropertyChanged("EditorInfo");
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/User/EnterPasswordDialog/EnterPasswordDialog.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace UnityLauncher.Core.LaunchSettings
4 | {
5 | ///
6 | /// Interaction logic for EnterPasswordDialog.xaml
7 | ///
8 | public partial class EnterPasswordDialog
9 | {
10 | public string UserNameValue
11 | {
12 | get => UserName.Text;
13 | set => UserName.Text = value;
14 | }
15 |
16 | public string PasswordValue
17 | {
18 | get => PassworBox.Password;
19 | set => PassworBox.Password = value;
20 | }
21 |
22 | public EnterPasswordDialog()
23 | {
24 | InitializeComponent();
25 | }
26 |
27 | private void Cancel_Click(object sender, System.Windows.RoutedEventArgs e)
28 | {
29 | DialogResult = false;
30 | }
31 |
32 | private void Ok_Click(object sender, System.Windows.RoutedEventArgs e)
33 | {
34 | DialogResult = true;
35 | }
36 |
37 | private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
38 | {
39 | var button = (sender as Button);
40 | if (button != null)
41 | {
42 | PassworBox.ShowPassword = !PassworBox.ShowPassword;
43 | button.Content = PassworBox.ShowPassword? "Hide Password": "Show Password";
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/Tools/FileHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 |
5 | namespace UnityLauncher.Core
6 | {
7 | public static class FileHelper
8 | {
9 | private class LockerImpl : IDisposable
10 | {
11 | private object locker;
12 |
13 | public LockerImpl(object locker)
14 | {
15 | this.locker = locker;
16 |
17 | if (locker != null)
18 | {
19 | Monitor.Enter(locker);
20 | }
21 | }
22 |
23 | public void Dispose()
24 | {
25 | if (locker != null)
26 | {
27 | Monitor.Exit(locker);
28 | }
29 | }
30 | }
31 |
32 | private static readonly Dictionary Lockers = new Dictionary();
33 |
34 | private static object GetLocker(string path)
35 | {
36 | if (string.IsNullOrEmpty(path)) return null;
37 | object locker;
38 | if (!Lockers.TryGetValue(path, out locker) || locker == null)
39 | {
40 | locker = new object();
41 | Lockers[path] = locker;
42 | }
43 | return locker;
44 | }
45 |
46 | public static IDisposable LockForFileOperation(string filePath)
47 | {
48 | return new LockerImpl(GetLocker(filePath));
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/Settings/SettingHolderConverter.cs:
--------------------------------------------------------------------------------
1 | //using System;
2 | //using Newtonsoft.Json;
3 | //using Newtonsoft.Json.Linq;
4 | //
5 | //namespace UnityLauncher.Core
6 | //{
7 | // public class SettingHolderConverter : JsonConverter
8 | // {
9 | // private Type targetObjectType;
10 | //
11 | //
12 | // public override bool CanWrite => false;
13 | //
14 | // public override bool CanRead => targetObjectType == typeof(SettingHolder);
15 | //
16 | // public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
17 | // {
18 | // throw new NotSupportedException();
19 | // }
20 | //
21 | // public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
22 | // {
23 | // targetObjectType = objectType;
24 | // var jToken = JToken.ReadFrom(reader);
25 | // var a = jToken["ValueType"];
26 | // var type = a.ToObject();
27 | // if (type != null)
28 | // {
29 | // var targetType = typeof(SettingHolder<>).MakeGenericType(type);
30 | // var result = jToken.ToObject(targetType);
31 | // return result;
32 | // }
33 | // return null;
34 | // }
35 | //
36 | // public override bool CanConvert(Type objectType)
37 | // {
38 | // return typeof(SettingHolder) == objectType;
39 | // }
40 | //
41 | // }
42 | //}
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/BaseModelView.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Windows;
3 | using UnityLauncher.Interfaces;
4 |
5 | namespace UnityLauncher.Core
6 | {
7 | public abstract class BaseModelView : Notifier, IBehavior
8 | {
9 | protected static readonly Dictionary ViewToModelView = new Dictionary();
10 |
11 | public static BaseModelView GetModelView(FrameworkElement uiElement)
12 | {
13 | if (uiElement == null) return null;
14 | BaseModelView result;
15 | ViewToModelView.TryGetValue(uiElement, out result);
16 | return result;
17 | }
18 |
19 | public abstract FrameworkElement UiElement { get; protected set; }
20 | public abstract string ContextKey { get; }
21 | public abstract IMessageReceiver MessageReceiver { get; }
22 | }
23 |
24 | public abstract class BaseModelView : BaseModelView where T: BaseModel, new()
25 | {
26 | public T Model { get; private set; }
27 |
28 | public sealed override FrameworkElement UiElement { get; protected set; }
29 |
30 | protected void Init(FrameworkElement uiElement)
31 | {
32 | UiElement = uiElement;
33 | if (uiElement != null)
34 | {
35 | ViewToModelView[uiElement] = this;
36 | uiElement.DataContext = this;
37 | }
38 | Model = new T();
39 | Model.Init(this);
40 | }
41 |
42 | protected BaseModelView(FrameworkElement uiElement)
43 | {
44 | Init(uiElement);
45 | }
46 |
47 | protected BaseModelView() { }
48 | }
49 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/Custom/CustomModelView.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using UnityLauncher.Interfaces;
3 |
4 | namespace UnityLauncher.Core.LaunchSettings
5 | {
6 | public class CustomModelView : EnableableModelView, ILaunchCommandBehavior
7 | {
8 | public override string ContextKey => "Custom";
9 | public override IMessageReceiver MessageReceiver => null;
10 | public ILaunchCommandSource LaunchCommandSource => Model;
11 | public ObservableCollection Commands => Model.commands;
12 | private StringInfo newCommand;
13 | public override int UiOrder => 3;
14 |
15 | public StringInfo NewCommand => newCommand ?? (newCommand = new StringInfo {Parent = this, Value = ""});
16 | public Command AddNewCommand { get; }
17 | public Command RemoveCommand { get; }
18 |
19 | public CustomModelView()
20 | {
21 | AddNewCommand = new Command(AddNewValue);
22 | RemoveCommand = new Command(RemoveValue);
23 | NotifyPropertyChanged("AddNewCommand");
24 | NotifyPropertyChanged("RemoveCommand");
25 | }
26 |
27 | private void AddNewValue(object param)
28 | {
29 | var info = param as StringInfo;
30 | if (info != null)
31 | {
32 | if (Model.AddCommand(info.Value))
33 | {
34 | NewCommand.Value = "";
35 | }
36 | }
37 | }
38 |
39 | private void RemoveValue(object param)
40 | {
41 | var info = param as StringInfo;
42 | if (info != null)
43 | {
44 | Model.RemoveCommand(Commands.IndexOf(info));
45 | }
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/Infos/EditorInfo.cs:
--------------------------------------------------------------------------------
1 | using UnityLauncher.Interfaces;
2 |
3 | namespace UnityLauncher.Core
4 | {
5 | public class EditorInfo : Notifier, IContext
6 | {
7 | private string path;
8 | public string Path
9 | {
10 | get => path;
11 | private set
12 | {
13 | if (path != value)
14 | {
15 | path = value;
16 | NotifyPropertyChanged("Path");
17 | }
18 | }
19 | }
20 |
21 | private string version;
22 | public string Version
23 | {
24 | get => version;
25 | set
26 | {
27 | if (version != value)
28 | {
29 | version = value;
30 | NotifyPropertyChanged("Version");
31 | }
32 | }
33 | }
34 |
35 | private bool? isX64;
36 | public bool? IsX64
37 | {
38 | get => isX64;
39 | set
40 | {
41 | if (isX64 != value)
42 | {
43 | isX64 = value;
44 | NotifyPropertyChanged("IsX64");
45 | }
46 | }
47 | }
48 |
49 | public string ContextKey => "EditorInfo";
50 |
51 | protected EditorInfo(EditorInfo info)
52 | {
53 | Path = info.Path;
54 | Version = info.Version;
55 | IsX64 = info.IsX64;
56 | }
57 |
58 | protected void FillVersion()
59 | {
60 | Version = BinnaryHelper.GetUnityVersion(path);
61 | IsX64 = BinnaryHelper.IsX64(path);
62 | }
63 |
64 | public EditorInfo(string path)
65 | {
66 | Path = path;
67 | FillVersion();
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/User/UserInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 | using UnityLauncher.Core.Attributes;
4 |
5 | namespace UnityLauncher.Core.LaunchSettings
6 | {
7 | public class UserInfo : Notifier
8 | {
9 | public event Action OnDirtyChanged;
10 |
11 | private bool isDirty;
12 | [JsonIgnore]
13 | public bool IsDirty
14 | {
15 | get => isDirty;
16 | set
17 | {
18 | if (isDirty != value)
19 | {
20 | isDirty = value;
21 | OnDirtyChanged?.Invoke();
22 | }
23 | }
24 | }
25 |
26 | private bool passwordIsShowed;
27 | [JsonIgnore]
28 | public bool PasswordIsShowed
29 | {
30 | get => passwordIsShowed;
31 | set
32 | {
33 | if (passwordIsShowed != value)
34 | {
35 | passwordIsShowed = value;
36 | NotifyPropertyChanged("PasswordIsShowed");
37 | }
38 | }
39 | }
40 |
41 | private string name;
42 | public string Name
43 | {
44 | get => name;
45 | set
46 | {
47 | if (name != value)
48 | {
49 | name = value;
50 | IsDirty = true;
51 | NotifyPropertyChanged("Name");
52 | }
53 | }
54 | }
55 |
56 | private string password;
57 |
58 | [JsonEncrypt]
59 | public string Password
60 | {
61 | get => password;
62 | set
63 | {
64 | if (password != value)
65 | {
66 | password = value;
67 | IsDirty = true;
68 | NotifyPropertyChanged("Password");
69 | }
70 | }
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/RenderMode/RenderModeView.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/User/EnterPasswordDialog/EnterPasswordDialog.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/UnityLauncher/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using System.Windows;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Unity Launcher")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Holy Shovel Soft")]
12 | [assembly: AssemblyProduct("Unity Launcher")]
13 | [assembly: AssemblyCopyright("Holy Shovel Soft © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | //In order to begin building localizable applications, set
23 | //CultureYouAreCodingWith in your .csproj file
24 | //inside a . For example, if you are using US english
25 | //in your source files, set the to en-US. Then uncomment
26 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
27 | //the line below to match the UICulture setting in the project file.
28 |
29 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
30 |
31 |
32 | [assembly: ThemeInfo(
33 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
34 | //(used if a resource is not found in the page,
35 | // or application resource dictionaries)
36 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
37 | //(used if a resource is not found in the page,
38 | // app, or any theme specific resource dictionaries)
39 | )]
40 |
41 |
42 | // Version information for an assembly consists of the following four values:
43 | //
44 | // Major Version
45 | // Minor Version
46 | // Build Number
47 | // Revision
48 | //
49 | // You can specify all the values or you can default the Build and Revision Numbers
50 | // by using the '*' as shown below:
51 | // [assembly: AssemblyVersion("1.0.*")]
52 | [assembly: AssemblyVersion("0.3.2.1")]
53 | [assembly: AssemblyFileVersion("0.3.2.1")]
54 |
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/SkinPathcer/SkinPatcherModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using UnityLauncher.Core.Common;
5 | using UnityLauncher.Interfaces;
6 |
7 | namespace UnityLauncher.Core.LaunchSettings
8 | {
9 | public class SkinPatcherModel :
10 | EnableableModel,
11 | IMessageReceiver,
12 | IMessageReceiver
13 | {
14 | public event Action OnEditorChanged;
15 |
16 | private ExtendedEditorInfo extendedEditor;
17 | public ExtendedEditorInfo ExtendedEditor
18 | {
19 | get => extendedEditor;
20 | set
21 | {
22 | if (extendedEditor != value)
23 | {
24 | extendedEditor = value;
25 | OnEditorChanged?.Invoke();
26 | }
27 | }
28 | }
29 |
30 | private readonly Dictionary extendedEditors = new Dictionary();
31 |
32 | public void OnMessage(SelectedEditorChanged message)
33 | {
34 | if (message.selectEditorInfo != null)
35 | {
36 | ExtendedEditorInfo extendedInfo;
37 | ExtendedEditor = extendedEditors.TryGetValue(message.selectEditorInfo, out extendedInfo) ? extendedInfo : null;
38 | }
39 | else
40 | {
41 | ExtendedEditor = null;
42 | }
43 | }
44 |
45 | public bool CanBePatched => ExtendedEditor?.IsPatchable??false;
46 |
47 | public void OnMessage(EditorsFilled message)
48 | {
49 | extendedEditors.Clear();
50 | if(message.infos == null) return;
51 | var kvps = message.infos.Where(info => info != null)
52 | .Select(info => new KeyValuePair(info, new ExtendedEditorInfo(info)));
53 | foreach (var kvp in kvps)
54 | {
55 | extendedEditors[kvp.Key] = kvp.Value;
56 | }
57 | }
58 |
59 | public void Patch()
60 | {
61 | if (ExtendedEditor?.IsPatchable ?? false)
62 | {
63 | ExtendedEditor.Patch();
64 | }
65 | }
66 |
67 | public void RestoreBackup()
68 | {
69 | if (ExtendedEditor?.IsPatchable ?? false)
70 | {
71 | ExtendedEditor.RestoreBackup();
72 | }
73 | }
74 | }
75 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/LaunchSettings/User/UserModelView.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using UnityLauncher.Core.Attributes;
3 | using UnityLauncher.Interfaces;
4 |
5 | namespace UnityLauncher.Core.LaunchSettings
6 | {
7 | [NonInstanciatedBehavior]
8 | public class UserModelView: EnableableModelView, ILaunchCommandBehavior
9 | {
10 | public override string ContextKey => "Users";
11 | public override IMessageReceiver MessageReceiver => Model;
12 | private readonly ProxyLaunchCommandSource proxySource;
13 | public override int UiOrder => 1;
14 |
15 | private readonly EnterPasswordDialog enterPasswordDialog = new EnterPasswordDialog();
16 | public ObservableCollection AvailibleUsers => Model.availibleUsers;
17 |
18 | public UserInfo SelectedUser
19 | {
20 | get => Model.SelectedUser;
21 | set => Model.SelectedUser = value;
22 | }
23 |
24 | public string SelectedUserName
25 | {
26 | get => Model.SelectedUserName;
27 | set => Model.SelectedUserName = value;
28 | }
29 |
30 | public ILaunchCommandSource LaunchCommandSource => proxySource;
31 |
32 | public UserModelView()
33 | {
34 | Model.OnUserChange += OnUserChange;
35 | proxySource = new ProxyLaunchCommandSource(Model, OnBeforeProxy, ProcessProxy);
36 | }
37 |
38 | private void OnUserChange()
39 | {
40 | NotifyPropertyChanged("SelectedUser");
41 | NotifyPropertyChanged("SelectedUserName");
42 | }
43 |
44 | private void OnBeforeProxy()
45 | {
46 | if(!IsEnabled) return;
47 | if (!string.IsNullOrEmpty(SelectedUserName) && string.IsNullOrEmpty(SelectedUser?.Password))
48 | {
49 | enterPasswordDialog.Owner = MainWindowView.Instance;
50 | enterPasswordDialog.UserNameValue = SelectedUserName;
51 | enterPasswordDialog.PasswordValue = "";
52 | var result = enterPasswordDialog.ShowDialog();
53 | if (result.HasValue)
54 | {
55 | var password = enterPasswordDialog.PasswordValue;
56 | enterPasswordDialog.PasswordValue = "";
57 | enterPasswordDialog.UserNameValue = "";
58 | Model.SetEnteredPassword(password);
59 | }
60 | }
61 | }
62 |
63 | private string ProcessProxy(string value)
64 | {
65 | return value;
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/UnityLauncher/Core/Common/BaseClasses/Commands/Command.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Input;
3 |
4 | namespace UnityLauncher.Core
5 | {
6 | public class Command : ICommand
7 | {
8 | public event EventHandler CanExecuteChanged;
9 | public event CancelCommandEventHandler Executing;
10 | public event CommandEventHandler Executed;
11 | protected Action action;
12 | protected Action