diff --git a/Lurker.sln b/Lurker.sln index 0a1d8f1b..eac8f17c 100644 --- a/Lurker.sln +++ b/Lurker.sln @@ -20,6 +20,9 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AE09C520-0052-4684-8E87-4E41784AA544}" ProjectSection(SolutionItems) = preProject appveyor.yml = appveyor.yml + PoeLurker.ruleset = PoeLurker.ruleset + stylecop.json = stylecop.json + XpertdocVsPowerTools-Settings.json = XpertdocVsPowerTools-Settings.json EndProjectSection EndProject Global diff --git a/PoeLurker.ruleset b/PoeLurker.ruleset new file mode 100644 index 00000000..ce3434bf --- /dev/null +++ b/PoeLurker.ruleset @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/XpertdocVsPowerTools-Settings.json b/XpertdocVsPowerTools-Settings.json new file mode 100644 index 00000000..1d92d254 --- /dev/null +++ b/XpertdocVsPowerTools-Settings.json @@ -0,0 +1,22 @@ +{ + "CodeElementSettings": { + "Enabled": false, + "MoveUsingsOnItemAdded": true, + "MoveUsingsOnItemOpened": true + }, + "FileHeaderSettings": { + "CompanyName": "Wohs Inc.", + "Enabled": true, + "WriteHeaderOnItemAdded": true, + "WriteHeaderOnItemOpened": true, + "WriteHeaderOnItemRenamed": true + }, + "LoggingSettings": { + "Enabled": true + }, + "ProjectSettings": { + "ConfigurePowerToolsOnProjectAdded": false, + "ConfigureSigningOnProjectAdded": false, + "Enabled": false + } +} \ No newline at end of file diff --git a/src/Lurker.Console/Program.cs b/src/Lurker.Console/Program.cs index 8a995f27..8a62ae2b 100644 --- a/src/Lurker.Console/Program.cs +++ b/src/Lurker.Console/Program.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- diff --git a/src/Lurker.UI/App.xaml.cs b/src/Lurker.UI/App.xaml.cs index 7a2d435b..ffdcb894 100644 --- a/src/Lurker.UI/App.xaml.cs +++ b/src/Lurker.UI/App.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,13 +9,16 @@ namespace Lurker.UI using System.Windows; /// - /// Interaction logic for App.xaml + /// Interaction logic for App.xaml. /// public partial class App : Application { + /// + /// Initializes a new instance of the class. + /// public App() { this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/AppBootstrapper.cs b/src/Lurker.UI/AppBootstrapper.cs index 35c14130..f716fb4c 100644 --- a/src/Lurker.UI/AppBootstrapper.cs +++ b/src/Lurker.UI/AppBootstrapper.cs @@ -1,25 +1,27 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI { + using System; + using System.Collections.Generic; + using System.Diagnostics; using Caliburn.Micro; - using Lurker.Helpers; using Lurker.Extensions; using Lurker.Services; using Lurker.UI.Helpers; + using Lurker.UI.Services; using Lurker.UI.ViewModels; using Sentry; - using System; - using System.Collections.Generic; - using System.Diagnostics; - using System.Security.Principal; - using Lurker.UI.Services; - public class AppBootstrapper : BootstrapperBase + /// + /// Represents AppBootstrapper. + /// + /// + public class AppBootstrapper : BootstrapperBase { #region Fields @@ -35,7 +37,7 @@ public class AppBootstrapper : BootstrapperBase /// /// Initializes a new instance of the class. /// - public AppBootstrapper() + public AppBootstrapper() { AppDomain.CurrentDomain.UnhandledException += this.CurrentDomain_UnhandledException; this.Initialize(); @@ -48,7 +50,7 @@ public AppBootstrapper() /// /// Override to configure the framework and setup your IoC container. /// - protected override void Configure() + protected override void Configure() { this._container = new SimpleContainer(); @@ -59,13 +61,13 @@ protected override void Configure() this._container.Singleton(); this._container.Singleton(); this._container.Singleton(); - + this._container.PerRequest(); this._container.PerRequest(); - this._container.PerRequest(); + this._container.PerRequest(); this._container.PerRequest(); this._container.PerRequest(); - this._container.PerRequest(); + this._container.PerRequest(); this._container.PerRequest(); this._container.RegisterInstance(typeof(SimpleContainer), null, this._container); } @@ -78,19 +80,19 @@ protected override void Configure() /// /// The located service. /// - protected override object GetInstance(Type service, string key) + protected override object GetInstance(Type service, string key) { return this._container.GetInstance(service, key); } /// - /// Override this to provide an IoC specific implementation + /// Override this to provide an IoC specific implementation. /// /// The service to locate. /// /// The located services. /// - protected override IEnumerable GetAllInstances(Type service) + protected override IEnumerable GetAllInstances(Type service) { return this._container.GetAllInstances(service); } @@ -99,7 +101,7 @@ protected override IEnumerable GetAllInstances(Type service) /// Override this to provide an IoC specific implementation. /// /// The instance to perform injection on. - protected override void BuildUp(object instance) + protected override void BuildUp(object instance) { this._container.BuildUp(instance); } @@ -109,7 +111,7 @@ protected override void BuildUp(object instance) /// /// The sender. /// The args. - protected override void OnStartup(object sender, System.Windows.StartupEventArgs e) + protected override void OnStartup(object sender, System.Windows.StartupEventArgs e) { var settings = this._container.GetInstance(); this._sentry = SentrySdk.Init(Dsn); @@ -128,7 +130,7 @@ protected override void OnStartup(object sender, System.Windows.StartupEventArgs return; } - DisplayRootViewFor(); + this.DisplayRootViewFor(); } /// @@ -145,7 +147,7 @@ protected override void OnExit(object sender, EventArgs e) /// /// Runnings the instance. /// - /// The other running instance + /// The other running instance. public static Process RunningInstance() { var currentProcess = Process.GetCurrentProcess(); @@ -180,10 +182,10 @@ public static Process RunningInstance() /// The instance containing the event data. private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { - var exception = (e.ExceptionObject as Exception); + var exception = e.ExceptionObject as Exception; Logger.Error(exception, exception.Message); - #if (!DEBUG) + #if !DEBUG SentrySdk.CaptureException(exception); #endif this._sentry.Dispose(); diff --git a/src/Lurker.UI/Converters/CurrencyTypeConverter.cs b/src/Lurker.UI/Converters/CurrencyTypeConverter.cs index dd557a21..782d4967 100644 --- a/src/Lurker.UI/Converters/CurrencyTypeConverter.cs +++ b/src/Lurker.UI/Converters/CurrencyTypeConverter.cs @@ -1,16 +1,21 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.Converters { - using Lurker.Patreon.Models; using System; using System.Windows.Data; using System.Windows.Markup; + using Lurker.Patreon.Models; + /// + /// CurrencyType converter. + /// + /// + /// public class CurrencyTypeConverter : MarkupExtension, IValueConverter { #region Declarations @@ -22,7 +27,7 @@ public class CurrencyTypeConverter : MarkupExtension, IValueConverter #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public CurrencyTypeConverter() { @@ -79,4 +84,4 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Extensions/PriceExtension.cs b/src/Lurker.UI/Extensions/PriceExtension.cs index f50dc6fa..8a10f5a8 100644 --- a/src/Lurker.UI/Extensions/PriceExtension.cs +++ b/src/Lurker.UI/Extensions/PriceExtension.cs @@ -1,15 +1,25 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- -using Lurker.Patreon.Models; - namespace Lurker.UI.Extensions { + using Lurker.Patreon.Models; + + /// + /// Represents the price extensions. + /// public static class PriceExtension { + #region Methods + + /// + /// Calculates the value. + /// + /// The value. + /// The value in chaos. public static double CalculateValue(this Price value) { double ratio = 1; @@ -33,9 +43,11 @@ public static double CalculateValue(this Price value) case CurrencyType.Chromatic: ratio = 0.15; break; - } - return value.NumberOfCurrencies * ratio;; + + return value.NumberOfCurrencies * ratio; } + + #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Helpers/AdminRequestHeleper.cs b/src/Lurker.UI/Helpers/AdminRequestHelper.cs similarity index 88% rename from src/Lurker.UI/Helpers/AdminRequestHeleper.cs rename to src/Lurker.UI/Helpers/AdminRequestHelper.cs index 4f910797..06b4eade 100644 --- a/src/Lurker.UI/Helpers/AdminRequestHeleper.cs +++ b/src/Lurker.UI/Helpers/AdminRequestHelper.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,6 +9,9 @@ namespace Lurker.UI.Helpers using System.Diagnostics; using System.Security.Principal; + /// + /// Represents the admin request helper. + /// public static class AdminRequestHelper { #region Methods @@ -46,4 +49,4 @@ private static bool IsAdministrator() #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Helpers/UpdateManager.cs b/src/Lurker.UI/Helpers/UpdateManager.cs index d2a9009c..3e859b09 100644 --- a/src/Lurker.UI/Helpers/UpdateManager.cs +++ b/src/Lurker.UI/Helpers/UpdateManager.cs @@ -1,16 +1,19 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.Helpers { - using Lurker.Services; - using Squirrel; using System.Linq; using System.Threading.Tasks; + using Lurker.Services; + using Squirrel; + /// + /// Represents the update manager. + /// public class UpdateManager { #region Fields @@ -25,9 +28,11 @@ public class UpdateManager #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// The setting service. + /// The settings service. + /// The clipboard lurker. + /// The client lurker. public UpdateManager(SettingsService settingsService, ClipboardLurker clipboardLurker, ClientLurker clientLurker) { this._clipboardLurker = clipboardLurker; @@ -42,6 +47,7 @@ public UpdateManager(SettingsService settingsService, ClipboardLurker clipboardL /// /// Updates this instance. /// + /// The task awaiter. public async Task Update() { this._settingsService.FirstLaunch = true; @@ -67,10 +73,10 @@ public async Task Update() /// /// Updates this instance. /// - /// True if needs update + /// True if needs update. public async Task CheckForUpdate() { -#if (DEBUG) +#if DEBUG return false; #endif @@ -92,4 +98,4 @@ public async Task CheckForUpdate() #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Lurker.UI.csproj b/src/Lurker.UI/Lurker.UI.csproj index 4f306810..0c19cea7 100644 --- a/src/Lurker.UI/Lurker.UI.csproj +++ b/src/Lurker.UI/Lurker.UI.csproj @@ -29,6 +29,8 @@ DEBUG;TRACE prompt 4 + ..\..\PoeLurker.ruleset + bin\Debug\PoeLurker.xml AnyCPU @@ -230,7 +232,7 @@ - + @@ -427,6 +429,9 @@ Resources.Designer.cs + + stylecop.json + @@ -474,7 +479,10 @@ - + + + + diff --git a/src/Lurker.UI/Models/BulbMessage.cs b/src/Lurker.UI/Models/BulbMessage.cs index e7c1cc5a..8e6f0607 100644 --- a/src/Lurker.UI/Models/BulbMessage.cs +++ b/src/Lurker.UI/Models/BulbMessage.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -8,6 +8,9 @@ namespace Lurker.UI.Models { using System; + /// + /// Represents a bulbMessage. + /// public class BulbMessage { #region Properties @@ -34,4 +37,4 @@ public class BulbMessage #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Models/DoubleClickCommand.cs b/src/Lurker.UI/Models/DoubleClickCommand.cs index 54851f30..f49148c2 100644 --- a/src/Lurker.UI/Models/DoubleClickCommand.cs +++ b/src/Lurker.UI/Models/DoubleClickCommand.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,6 +9,10 @@ namespace Lurker.UI.Models using System; using System.Windows.Input; + /// + /// Represents a double click command. + /// + /// public class DoubleClickCommand : ICommand { #region Fields @@ -65,4 +69,4 @@ public void Execute(object parameter) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Models/LifeBulbMessage.cs b/src/Lurker.UI/Models/LifeBulbMessage.cs index 804a9370..8ee26f06 100644 --- a/src/Lurker.UI/Models/LifeBulbMessage.cs +++ b/src/Lurker.UI/Models/LifeBulbMessage.cs @@ -1,12 +1,16 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.Models { + /// + /// Represents the lifebulb message. + /// + /// public class LifeBulbMessage : BulbMessage { } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Models/ManaBulbMessage.cs b/src/Lurker.UI/Models/ManaBulbMessage.cs index 2d40a949..042a72d2 100644 --- a/src/Lurker.UI/Models/ManaBulbMessage.cs +++ b/src/Lurker.UI/Models/ManaBulbMessage.cs @@ -1,11 +1,15 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.Models { + /// + /// Represents the manabulb message. + /// + /// public class ManaBulbMessage : BulbMessage { #region Properties @@ -22,4 +26,4 @@ public class ManaBulbMessage : BulbMessage #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Models/MyCommand.cs b/src/Lurker.UI/Models/MyCommand.cs index c7d15c61..91671847 100644 --- a/src/Lurker.UI/Models/MyCommand.cs +++ b/src/Lurker.UI/Models/MyCommand.cs @@ -1,33 +1,71 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- -using System; -using System.Windows.Input; - namespace Lurker.UI.Models { - public class MyCommand : ICommand where T : class + using System; + using System.Windows.Input; + + /// + /// Represents MyCommand for the charts. + /// + /// Generics. + /// + public class MyCommand : ICommand + where T : class { + #region Properties + + /// + /// Gets or sets the can execute delegate. + /// public Predicate CanExecuteDelegate { get; set; } + + /// + /// Gets or sets the execute delegate. + /// public Action ExecuteDelegate { get; set; } + #endregion + + #region Methods + + /// + /// Determines whether this instance can execute the specified parameter. + /// + /// The parameter. + /// + /// true if this instance can execute the specified parameter; otherwise, false. + /// public bool CanExecute(object parameter) { - return CanExecuteDelegate == null || CanExecuteDelegate((T)parameter); + return this.CanExecuteDelegate == null || this.CanExecuteDelegate((T)parameter); } + /// + /// Executes the specified parameter. + /// + /// The parameter. public void Execute(object parameter) { - if (ExecuteDelegate != null) ExecuteDelegate((T)parameter); + if (this.ExecuteDelegate != null) + { + this.ExecuteDelegate((T)parameter); + } } + /// + /// Occurs when [can execute changed]. + /// public event EventHandler CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } + + #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Models/OutgoingbarContext.cs b/src/Lurker.UI/Models/OutgoingbarContext.cs index dc2b75e9..39dc447a 100644 --- a/src/Lurker.UI/Models/OutgoingbarContext.cs +++ b/src/Lurker.UI/Models/OutgoingbarContext.cs @@ -1,14 +1,17 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.Models { - using Lurker.UI.ViewModels; using System; + using Lurker.UI.ViewModels; + /// + /// Represents the bar context. + /// public class OutgoingbarContext { #region Fields @@ -21,9 +24,10 @@ public class OutgoingbarContext #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The remove action. + /// The set active offer. public OutgoingbarContext(Action removeAction, Action setActiveOffer) { this._remove = removeAction; @@ -54,4 +58,4 @@ public void SetActiveOffer(OutgoingOfferViewModel offer) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Models/TradeBarContext.cs b/src/Lurker.UI/Models/TradeBarContext.cs index b4874f85..e8430b44 100644 --- a/src/Lurker.UI/Models/TradeBarContext.cs +++ b/src/Lurker.UI/Models/TradeBarContext.cs @@ -1,14 +1,17 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.Models { - using Lurker.UI.ViewModels; using System; + using Lurker.UI.ViewModels; + /// + /// Represents the bar context. + /// public class TradebarContext { #region Fields @@ -22,9 +25,11 @@ public class TradebarContext #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The remove action. + /// The add to active offer action. + /// The set active offer. public TradebarContext(Action removeAction, Action addToActiveOfferAction, Action setActiveOffer) { this._remove = removeAction; @@ -65,4 +70,4 @@ public void SetActiveOffer(OfferViewModel offer) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Models/UpdateState.cs b/src/Lurker.UI/Models/UpdateState.cs index 772a3382..d9817e4e 100644 --- a/src/Lurker.UI/Models/UpdateState.cs +++ b/src/Lurker.UI/Models/UpdateState.cs @@ -1,17 +1,29 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.Models { + /// + /// The application update state. + /// public enum UpdateState { + /// + /// The need update + /// NeedUpdate, + /// + /// The success + /// Success, + /// + /// The working + /// Working, - } -} + } +} \ No newline at end of file diff --git a/src/Lurker.UI/Properties/AssemblyInfo.cs b/src/Lurker.UI/Properties/AssemblyInfo.cs index b3f63eb6..2cb09424 100644 --- a/src/Lurker.UI/Properties/AssemblyInfo.cs +++ b/src/Lurker.UI/Properties/AssemblyInfo.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -10,6 +10,7 @@ using System.Runtime.InteropServices; using System.Windows; +#pragma warning disable // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. diff --git a/src/Lurker.UI/Services/AfkService.cs b/src/Lurker.UI/Services/AfkService.cs index b3fd5631..da3b66e7 100644 --- a/src/Lurker.UI/Services/AfkService.cs +++ b/src/Lurker.UI/Services/AfkService.cs @@ -1,17 +1,21 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.Services { - using Caliburn.Micro; - using Lurker.Patreon.Events; using System; using System.Collections.Generic; using System.Linq; + using Caliburn.Micro; + using Lurker.Patreon.Events; + /// + /// Represents the afk service. + /// + /// public class AfkService : IDisposable { #region Fields @@ -26,9 +30,10 @@ public class AfkService : IDisposable #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The client lurker. + /// The event aggregator. public AfkService(ClientLurker clientLurker, IEventAggregator eventAggregator) { this._trades = new List(); @@ -95,4 +100,4 @@ private void IncomingOffer(object sender, TradeEvent e) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/AffixViewModel.cs b/src/Lurker.UI/ViewModels/AffixViewModel.cs index 61716429..dc4215d7 100644 --- a/src/Lurker.UI/ViewModels/AffixViewModel.cs +++ b/src/Lurker.UI/ViewModels/AffixViewModel.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -8,6 +8,9 @@ namespace Lurker.UI.ViewModels { using Lurker.Patreon.Models; + /// + /// Represents the AffixViewModel. + /// public class AffixViewModel { #region Fields @@ -44,8 +47,8 @@ public AffixViewModel(Affix affix) /// /// Gets the actual value. /// - public string ActualValue => this._affix.ActualValue.Replace(" increased", ""); + public string ActualValue => this._affix.ActualValue.Replace(" increased", string.Empty); #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/BulbViewModelBase.cs b/src/Lurker.UI/ViewModels/BulbViewModelBase.cs index 3094037f..94435a33 100644 --- a/src/Lurker.UI/ViewModels/BulbViewModelBase.cs +++ b/src/Lurker.UI/ViewModels/BulbViewModelBase.cs @@ -1,28 +1,34 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { - using Caliburn.Micro; - using Lurker.Helpers; - using Lurker.Services; - using Lurker.UI.Helpers; - using Lurker.UI.Models; using System; using System.ComponentModel; using System.Threading; using System.Threading.Tasks; + using Caliburn.Micro; + using Lurker.Helpers; + using Lurker.Services; + using Lurker.UI.Models; - public abstract class BulbViewModel : PoeOverlayBase + /// + /// BulbViewModel. + /// + /// + public abstract class BulbViewModelBase : PoeOverlayBase { #region Fields - private INotifyPropertyChanged _actionView; + /// + /// The default bulb height. + /// protected static readonly int DefaultBulbHeight = 220; - protected System.Action _action; + + private INotifyPropertyChanged _actionView; private System.Action _previousAction; private INotifyPropertyChanged _previousActionView; private CancellationTokenSource _tokenSource; @@ -32,13 +38,13 @@ public abstract class BulbViewModel : PoeOverlayBase #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The window manager. /// The docking helper. - /// - /// H - public BulbViewModel(IWindowManager windowManager, DockingHelper dockingHelper, ProcessLurker processLurker, SettingsService settingsService) + /// The Processs lurker. + /// The settings serivce. + public BulbViewModelBase(IWindowManager windowManager, DockingHelper dockingHelper, ProcessLurker processLurker, SettingsService settingsService) : base(windowManager, dockingHelper, processLurker, settingsService) { this.SetDefaultAction(); @@ -51,7 +57,7 @@ public BulbViewModel(IWindowManager windowManager, DockingHelper dockingHelper, /// /// Gets a value indicating whether this instance has action. /// - public bool HasAction => this._action != null; + public bool HasAction => this.Action != null; /// /// Gets a value indicating whether this instance is default action. @@ -59,10 +65,10 @@ public BulbViewModel(IWindowManager windowManager, DockingHelper dockingHelper, /// /// true if this instance is default action; otherwise, false. /// - public bool IsDefaultAction => this.DefaultAction == this._action; + public bool IsDefaultAction => this.DefaultAction == this.Action; /// - /// Gets the action view. + /// Gets or sets the action view. /// public INotifyPropertyChanged ActionView { @@ -79,10 +85,15 @@ protected set } /// - /// Defaults the action. + /// Gets the default action. /// protected virtual System.Action DefaultAction => null; + /// + /// Gets or sets the action. + /// + protected System.Action Action { get; set; } + #endregion #region Methods @@ -92,13 +103,13 @@ protected set /// public void OnClick() { - if (this._action == null) + if (this.Action == null) { this.DefaultAction?.Invoke(); return; } - this._action.Invoke(); + this.Action.Invoke(); } /// @@ -107,7 +118,7 @@ public void OnClick() protected void Hide() { this.ActionView = null; - this._action = this._previousAction; + this.Action = this._previousAction; this.ActionView = this._previousActionView; this._previousAction = null; this._previousActionView = null; @@ -139,11 +150,11 @@ protected virtual void SetAction(BulbMessage message) if (this._previousAction == null) { - this._previousAction = this._action; + this._previousAction = this.Action; this._previousActionView = this._actionView; } - this._action = message.Action; + this.Action = message.Action; this.ActionView = message.View; this.NotifyOfPropertyChange(nameof(this.HasAction)); @@ -152,7 +163,7 @@ protected virtual void SetAction(BulbMessage message) { this._tokenSource = new CancellationTokenSource(); var token = this._tokenSource.Token; - Task.Run(async () => await Task.Delay(message.DisplayTime)).ContinueWith((t) => + Task.Run(async () => await Task.Delay(message.DisplayTime)).ContinueWith((t) => { if (token.IsCancellationRequested) { @@ -166,4 +177,4 @@ protected virtual void SetAction(BulbMessage message) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/ChartViewModelBase.cs b/src/Lurker.UI/ViewModels/ChartViewModelBase.cs index 21f4c226..43dbab7d 100644 --- a/src/Lurker.UI/ViewModels/ChartViewModelBase.cs +++ b/src/Lurker.UI/ViewModels/ChartViewModelBase.cs @@ -1,16 +1,20 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { + using System; using Caliburn.Micro; using LiveCharts; using Lurker.UI.Models; - using System; + /// + /// Represent the chart. + /// + /// public class ChartViewModelBase : PropertyChangedBase { #region Constructors @@ -58,7 +62,7 @@ public ChartViewModelBase() /// public MyCommand DataClickCommand => new MyCommand() { - ExecuteDelegate = p => this.OnClick(p) + ExecuteDelegate = p => this.OnClick(p), }; /// @@ -81,4 +85,4 @@ private void OnClick(ChartPoint point) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/CollaborationViewModel.cs b/src/Lurker.UI/ViewModels/CollaborationViewModel.cs index 46b8ccb4..76056836 100644 --- a/src/Lurker.UI/ViewModels/CollaborationViewModel.cs +++ b/src/Lurker.UI/ViewModels/CollaborationViewModel.cs @@ -1,15 +1,17 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { - using System; - using Caliburn.Micro; using Lurker.Models; + /// + /// Represents the collaborationviewmodel. + /// + /// public class CollaborationViewModel : Caliburn.Micro.PropertyChangedBase { #region Fields @@ -40,4 +42,4 @@ public CollaborationViewModel(Collaboration collaboration) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/ColumnChartViewModel.cs b/src/Lurker.UI/ViewModels/ColumnChartViewModel.cs index 8afd6fa4..9b3e897f 100644 --- a/src/Lurker.UI/ViewModels/ColumnChartViewModel.cs +++ b/src/Lurker.UI/ViewModels/ColumnChartViewModel.cs @@ -1,22 +1,27 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { + using System.Collections.Generic; using LiveCharts; using LiveCharts.Wpf; - using System.Collections.Generic; + /// + /// Represents the ColumnChartViewModel. + /// + /// public class ColumnChartViewModel : ChartViewModelBase { #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// + /// The labels. public ColumnChartViewModel(string[] labels) : base(labels) { @@ -29,17 +34,17 @@ public ColumnChartViewModel(string[] labels) /// /// Adds the specified label. /// - /// The label. - /// The value. + /// The title. + /// The values. public void Add(string title, IEnumerable values) { this.SeriesCollection.Add(new ColumnSeries { Title = title, - Values = new ChartValues(values) + Values = new ChartValues(values), }); } #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/DashboardViewModel.cs b/src/Lurker.UI/ViewModels/DashboardViewModel.cs index b1543897..4428ead7 100644 --- a/src/Lurker.UI/ViewModels/DashboardViewModel.cs +++ b/src/Lurker.UI/ViewModels/DashboardViewModel.cs @@ -1,20 +1,24 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { + using System; + using System.Collections.Generic; + using System.Linq; using Caliburn.Micro; using Lurker.Patreon; using Lurker.Patreon.Events; using Lurker.Patreon.Models; using Lurker.UI.Extensions; - using System; - using System.Collections.Generic; - using System.Linq; + /// + /// Represents the DashboardViewModel. + /// + /// public class DashboardViewModel : ScreenBase { #region Fields @@ -35,7 +39,7 @@ public class DashboardViewModel : ScreenBase /// Initializes a new instance of the class. /// /// The window manager. - public DashboardViewModel(IWindowManager windowManager) + public DashboardViewModel(IWindowManager windowManager) : base(windowManager) { this.DisplayName = "Dashboard"; @@ -219,13 +223,13 @@ private void ItemClassChart_OnSerieClick(object sender, LiveCharts.ChartPoint e) /// /// Gets the pie chart. /// - /// + /// The PieChart. private PieChartViewModel CreateTotalChart() { var pieChart = new PieChartViewModel() { FontSize = 12, - LabelPosition = LiveCharts.PieLabelPosition.InsideSlice + LabelPosition = LiveCharts.PieLabelPosition.InsideSlice, }; var groups = this._trades.GroupBy(i => i.Price.CurrencyType).Select(g => new { Type = g.First().Price.CurrencyType, Sum = g.Sum(i => i.Price.CalculateValue()) }); @@ -269,7 +273,7 @@ private LineChartViewModel GetNetworthChart() /// /// Creates the item class chart. /// - /// + /// The PieChart. private PieChartViewModel CreateItemClassChart() { var pieChart = new PieChartViewModel() @@ -297,7 +301,7 @@ private void OnSerieClick(object sender, LiveCharts.ChartPoint e) if (Enum.TryParse(e.SeriesView.Title, true, out var value)) { var trades = this._allTradres.Where(t => t.Price.CurrencyType == value); - var chart = new ColumnChartViewModel(trades.Select(t => t.ItemName).ToArray()); ; + var chart = new ColumnChartViewModel(trades.Select(t => t.ItemName).ToArray()); chart.Add(e.SeriesView.Title, trades.Select(t => t.Price.NumberOfCurrencies)); this._tradesChart = chart; this.ActiveChart = this._tradesChart; @@ -306,4 +310,4 @@ private void OnSerieClick(object sender, LiveCharts.ChartPoint e) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/ItemOverlayViewModel.cs b/src/Lurker.UI/ViewModels/ItemOverlayViewModel.cs index fedc76b6..f5b74c4d 100644 --- a/src/Lurker.UI/ViewModels/ItemOverlayViewModel.cs +++ b/src/Lurker.UI/ViewModels/ItemOverlayViewModel.cs @@ -1,17 +1,21 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { - using Lurker.Patreon.Models; using System; using System.Collections.Generic; using System.Linq; + using Lurker.Patreon.Models; - public class ItemOverlayViewModel: Caliburn.Micro.PropertyChangedBase + /// + /// Represents the ItemOverlay. + /// + /// + public class ItemOverlayViewModel : Caliburn.Micro.PropertyChangedBase { #region Fields @@ -23,8 +27,10 @@ public class ItemOverlayViewModel: Caliburn.Micro.PropertyChangedBase #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// + /// The item. + /// The close action. public ItemOverlayViewModel(PoeItem item, Action closeAction) { this._item = item; @@ -112,7 +118,7 @@ public void Close() /// Gets the socket information. /// /// The item. - /// The socket information + /// The socket information. private static string GetSocketInformation(PoeItem item) { if (item is SocketableItem socketItem) @@ -125,4 +131,4 @@ private static string GetSocketInformation(PoeItem item) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/LifeBulbViewModel.cs b/src/Lurker.UI/ViewModels/LifeBulbViewModel.cs index e7335ef5..5540051f 100644 --- a/src/Lurker.UI/ViewModels/LifeBulbViewModel.cs +++ b/src/Lurker.UI/ViewModels/LifeBulbViewModel.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -13,7 +13,11 @@ namespace Lurker.UI.ViewModels using Lurker.UI.Models; using Lurker.UI.Views; - public class LifeBulbViewModel : BulbViewModel, IHandle + /// + /// Represents the life bulb viewmodel. + /// + /// + public class LifeBulbViewModel : BulbViewModelBase, IHandle { #region Fields @@ -25,13 +29,15 @@ public class LifeBulbViewModel : BulbViewModel, IHandle #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// + /// The event aggregator. /// The window manager. /// The docking helper. - /// - /// H - public LifeBulbViewModel(IEventAggregator eventAggregator, IWindowManager windowManager, DockingHelper dockingHelper, ProcessLurker processLurker, SettingsService settingsService, PoeKeyboardHelper keyboard) + /// The process lurker. + /// The settings service. + /// The keyboard. + public LifeBulbViewModel(IEventAggregator eventAggregator, IWindowManager windowManager, DockingHelper dockingHelper, ProcessLurker processLurker, SettingsService settingsService, PoeKeyboardHelper keyboard) : base(windowManager, dockingHelper, processLurker, settingsService) { this._keyboardHelper = keyboard; @@ -55,26 +61,26 @@ public void Handle(LifeBulbMessage message) /// /// Sets the window position. /// - /// + /// The window information. protected override void SetWindowPosition(PoeWindowInformation windowInformation) { var value = DefaultBulbHeight * windowInformation.Height / 1080; Execute.OnUIThread(() => { - this._view.Height = value; - this._view.Width = value; - this._view.Left = windowInformation.Position.Left + 6; - this._view.Top = windowInformation.Position.Bottom - value; - var lifeView = this._view as LifeBulbView; + this.View.Height = value; + this.View.Width = value; + this.View.Left = windowInformation.Position.Left + 6; + this.View.Top = windowInformation.Position.Bottom - value; + var lifeView = this.View as LifeBulbView; lifeView.ResizeLifeBulb(); }); } /// - /// Defaults the action. + /// Gets the default action. /// protected override System.Action DefaultAction => () => this._keyboardHelper.JoinHideout(); #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/LineChartViewModel.cs b/src/Lurker.UI/ViewModels/LineChartViewModel.cs index 68dbfd82..f031af30 100644 --- a/src/Lurker.UI/ViewModels/LineChartViewModel.cs +++ b/src/Lurker.UI/ViewModels/LineChartViewModel.cs @@ -1,34 +1,37 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { + using System.Collections.Generic; using LiveCharts; using LiveCharts.Wpf; - using System.Collections.Generic; + /// + /// Represents the line chart. + /// + /// public class LineChartViewModel : ChartViewModelBase { - #region Methods /// /// Adds the specified label. /// - /// The label. - /// The value. + /// The title. + /// The values. public void Add(string title, IEnumerable values) { this.SeriesCollection.Add(new LineSeries { Title = title, - Values = new ChartValues(values) + Values = new ChartValues(values), }); } #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/ManaBulbViewModel.cs b/src/Lurker.UI/ViewModels/ManaBulbViewModel.cs index 5fed73c5..9c1b2fdb 100644 --- a/src/Lurker.UI/ViewModels/ManaBulbViewModel.cs +++ b/src/Lurker.UI/ViewModels/ManaBulbViewModel.cs @@ -1,20 +1,23 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { + using System; using Caliburn.Micro; using Lurker.Helpers; using Lurker.Models; using Lurker.Services; using Lurker.UI.Models; using Lurker.UI.Views; - using System; - public class ManaBulbViewModel : BulbViewModel, IHandle + /// + /// Represents the Manabulbviewmodel. + /// + public class ManaBulbViewModel : BulbViewModelBase, IHandle { #region Fields @@ -27,13 +30,15 @@ public class ManaBulbViewModel : BulbViewModel, IHandle #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// + /// The event aggregator. /// The window manager. /// The docking helper. - /// - /// H - public ManaBulbViewModel(IEventAggregator eventAggregator, IWindowManager windowManager, DockingHelper dockingHelper, ClientLurker clientLurker, ProcessLurker processLurker, SettingsService settingsService) + /// The client lurker. + /// The process lurker. + /// The settings service. + public ManaBulbViewModel(IEventAggregator eventAggregator, IWindowManager windowManager, DockingHelper dockingHelper, ClientLurker clientLurker, ProcessLurker processLurker, SettingsService settingsService) : base(windowManager, dockingHelper, processLurker, settingsService) { this._eventAggregator = eventAggregator; @@ -42,7 +47,7 @@ public ManaBulbViewModel(IEventAggregator eventAggregator, IWindowManager window this._clientLurker.LocationChanged += this.Lurker_LocationChanged; this._clientLurker.RemainingMonsters += this.Lurker_RemainingMonsters; - this._settingsService.OnSave += this.SettingsService_OnSave; + this.SettingsService.OnSave += this.SettingsService_OnSave; } #endregion @@ -50,13 +55,13 @@ public ManaBulbViewModel(IEventAggregator eventAggregator, IWindowManager window #region Properties /// - /// Defaults the action. + /// Gets the default action. /// protected override System.Action DefaultAction { get { - if (!this._settingsService.DashboardEnabled) + if (!this.SettingsService.DashboardEnabled) { return null; } @@ -85,7 +90,7 @@ public void Handle(ManaBulbMessage message) { base.SetAction(message); return; - } + } this.SetAction(message); @@ -98,17 +103,17 @@ public void Handle(ManaBulbMessage message) /// /// Sets the window position. /// - /// + /// The wndow information. protected override void SetWindowPosition(PoeWindowInformation windowInformation) { var value = DefaultBulbHeight * windowInformation.Height / 1080; Execute.OnUIThread(() => { - this._view.Height = value; - this._view.Width = value; - this._view.Left = windowInformation.Position.Right - value - 6; - this._view.Top = windowInformation.Position.Bottom - value; - var lifeView = this._view as ManaBulbView; + this.View.Height = value; + this.View.Width = value; + this.View.Left = windowInformation.Position.Right - value - 6; + this.View.Top = windowInformation.Position.Bottom - value; + var lifeView = this.View as ManaBulbView; }); } @@ -122,7 +127,7 @@ protected override void OnDeactivate(bool close) { this._clientLurker.LocationChanged -= this.Lurker_LocationChanged; this._clientLurker.RemainingMonsters -= this.Lurker_RemainingMonsters; - this._settingsService.OnSave -= this.SettingsService_OnSave; + this.SettingsService.OnSave -= this.SettingsService_OnSave; this._eventAggregator.Unsubscribe(this); } @@ -176,7 +181,7 @@ private void Lurker_LocationChanged(object sender, Patreon.Events.LocationChange { var message = new ManaBulbMessage() { - Action = this.DefaultAction + Action = this.DefaultAction, }; this.SetAction(message); } @@ -192,4 +197,4 @@ private void Lurker_LocationChanged(object sender, Patreon.Events.LocationChange #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/OfferStatus.cs b/src/Lurker.UI/ViewModels/OfferStatus.cs index 9fdc41f4..d8dbb0b7 100644 --- a/src/Lurker.UI/ViewModels/OfferStatus.cs +++ b/src/Lurker.UI/ViewModels/OfferStatus.cs @@ -1,11 +1,14 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { + /// + /// Represents the OfferStatus. + /// public enum OfferStatus { /// @@ -21,6 +24,6 @@ public enum OfferStatus /// /// The trade sended /// - Traded + Traded, } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/OfferViewModel.cs b/src/Lurker.UI/ViewModels/OfferViewModel.cs index 462d34d7..9e452127 100644 --- a/src/Lurker.UI/ViewModels/OfferViewModel.cs +++ b/src/Lurker.UI/ViewModels/OfferViewModel.cs @@ -1,23 +1,28 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { + using System; + using System.Threading; + using System.Threading.Tasks; + using System.Windows.Input; using Caliburn.Micro; using Lurker.Helpers; using Lurker.Patreon.Events; using Lurker.Patreon.Models; using Lurker.Services; using Lurker.UI.Models; - using System; - using System.Threading; - using System.Threading.Tasks; - using System.Windows.Input; - public class OfferViewModel: PropertyChangedBase, IDisposable + /// + /// Represents an Offer. + /// + /// + /// + public class OfferViewModel : PropertyChangedBase, IDisposable { #region Fields @@ -39,9 +44,13 @@ public class OfferViewModel: PropertyChangedBase, IDisposable #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The trade event. + /// The keyboard helper. + /// The tradebar context. + /// The settings service. + /// if set to true [sold]. public OfferViewModel(TradeEvent tradeEvent, PoeKeyboardHelper keyboardHelper, TradebarContext tradebarContext, SettingsService settingsService, bool sold) { this._tradeEvent = tradeEvent; @@ -68,7 +77,7 @@ public OfferViewModel(TradeEvent tradeEvent, PoeKeyboardHelper keyboardHelper, T public bool NotSold => !this._alreadySold; /// - /// Gets or sets the number off currency. + /// Gets the number off currency. /// public double NumberOffCurrency => this._tradeEvent.Price.NumberOfCurrencies; @@ -132,7 +141,7 @@ public OfferStatus Status } /// - /// Gets or sets a value indicating whether this is waiting. + /// Gets or sets a value indicating whether this is waiting. /// public bool Waiting { @@ -397,7 +406,6 @@ private void Whisper(string message) this._keyboardHelper.Whisper(this.PlayerName, TokenHelper.ReplaceToken(message, this._tradeEvent)); } - /// /// Handles the OnSave event of the SettingsService control. /// @@ -423,4 +431,4 @@ protected virtual void Dispose(bool disposing) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/OutgoingOfferViewModel.cs b/src/Lurker.UI/ViewModels/OutgoingOfferViewModel.cs index 8c9876b8..590fb275 100644 --- a/src/Lurker.UI/ViewModels/OutgoingOfferViewModel.cs +++ b/src/Lurker.UI/ViewModels/OutgoingOfferViewModel.cs @@ -1,18 +1,22 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { + using System.Windows.Input; using Caliburn.Micro; using Lurker.Helpers; using Lurker.Patreon.Events; using Lurker.UI.Models; - using System.Windows.Input; - public class OutgoingOfferViewModel: PropertyChangedBase + /// + /// Represents the outgoing offer. + /// + /// + public class OutgoingOfferViewModel : PropertyChangedBase { #region Fields @@ -30,9 +34,11 @@ public class OutgoingOfferViewModel: PropertyChangedBase #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The trade event. + /// The keyboard helper. + /// The context. public OutgoingOfferViewModel(OutgoingTradeEvent tradeEvent, PoeKeyboardHelper keyboardHelper, OutgoingbarContext context) { this._event = tradeEvent; @@ -103,7 +109,7 @@ public bool Active /// /// Gets or sets the delay to close. /// - public double DelayToClose + public double DelayToClose { get { @@ -186,4 +192,4 @@ public void SetActive() #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/OutgoingbarViewModel.cs b/src/Lurker.UI/ViewModels/OutgoingbarViewModel.cs index 2ae8ddff..002f9fc5 100644 --- a/src/Lurker.UI/ViewModels/OutgoingbarViewModel.cs +++ b/src/Lurker.UI/ViewModels/OutgoingbarViewModel.cs @@ -1,20 +1,20 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { + using System.Collections.ObjectModel; + using System.Linq; + using System.Timers; using Caliburn.Micro; using Lurker.Helpers; using Lurker.Models; using Lurker.Patreon.Events; using Lurker.Services; using Lurker.UI.Models; - using System.Collections.ObjectModel; - using System.Linq; - using System.Timers; /// /// Represents the outgoing bar view model. @@ -25,7 +25,6 @@ public class OutgoingbarViewModel : PoeOverlayBase { #region Fields - protected static int DefaultWidth = 55; private ClipboardLurker _clipboardLurker; private ClientLurker _clientLurker; private PoeKeyboardHelper _keyboardHelper; @@ -41,11 +40,17 @@ public class OutgoingbarViewModel : PoeOverlayBase #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// The lurker. + /// The event aggregator. + /// The clipboard lurker. + /// The client lurker. + /// The process lurker. + /// The docking helper. + /// The keyboard helper. + /// The settings service. /// The window manager. - public OutgoingbarViewModel(IEventAggregator eventAggregator, ClipboardLurker clipboardLurker, ClientLurker clientLurker, ProcessLurker processLurker, DockingHelper dockingHelper, PoeKeyboardHelper keyboardHelper, SettingsService settingsService, IWindowManager windowManager) + public OutgoingbarViewModel(IEventAggregator eventAggregator, ClipboardLurker clipboardLurker, ClientLurker clientLurker, ProcessLurker processLurker, DockingHelper dockingHelper, PoeKeyboardHelper keyboardHelper, SettingsService settingsService, IWindowManager windowManager) : base(windowManager, dockingHelper, processLurker, settingsService) { this.Offers = new ObservableCollection(); @@ -77,6 +82,11 @@ public OutgoingbarViewModel(IEventAggregator eventAggregator, ClipboardLurker cl /// public bool AnyOffer => this.Offers.Any(); + /// + /// Gets the default width. + /// + protected static int DefaultWidth => 55; + #endregion #region Methods @@ -88,7 +98,7 @@ public OutgoingbarViewModel(IEventAggregator eventAggregator, ClipboardLurker cl /// The new offer text. private void ClipboardLurker_NewOffer(object sender, string newOfferText) { - if (!this._settingsService.ClipboardEnabled || this._lastOutgoingOfferText == newOfferText) + if (!this.SettingsService.ClipboardEnabled || this._lastOutgoingOfferText == newOfferText) { return; } @@ -150,10 +160,10 @@ private void Lurker_TradeAccepted(object sender, Patreon.Events.TradeAcceptedEve return; } - if (!string.IsNullOrEmpty(this._settingsService.ThankYouMessage)) + if (!string.IsNullOrEmpty(this.SettingsService.ThankYouMessage)) { var tradeEvent = this._activeOffer.Event; - this._keyboardHelper.Whisper(tradeEvent.PlayerName, TokenHelper.ReplaceToken(this._settingsService.ThankYouMessage, tradeEvent)); + this._keyboardHelper.Whisper(tradeEvent.PlayerName, TokenHelper.ReplaceToken(this.SettingsService.ThankYouMessage, tradeEvent)); } this.InsertEvent(this._activeOffer.Event); @@ -194,7 +204,7 @@ private void RemoveOffer(OutgoingOfferViewModel offer) /// /// Sets the window position. /// - /// + /// The window information. protected override void SetWindowPosition(PoeWindowInformation windowInformation) { var yPosition = windowInformation.FlaskBarWidth * (238 / (double)DefaultFlaskBarWidth); @@ -202,10 +212,10 @@ protected override void SetWindowPosition(PoeWindowInformation windowInformation var height = windowInformation.FlaskBarHeight - (Margin * 2); Execute.OnUIThread(() => { - this._view.Height = height < 0 ? 1 : height; - this._view.Width = width; - this._view.Left = windowInformation.Position.Left + yPosition; - this._view.Top = windowInformation.Position.Bottom - windowInformation.FlaskBarHeight + Margin; + this.View.Height = height < 0 ? 1 : height; + this.View.Width = width; + this.View.Left = windowInformation.Position.Left + yPosition; + this.View.Top = windowInformation.Position.Bottom - windowInformation.FlaskBarHeight + Margin; }); } @@ -262,10 +272,10 @@ private void SetActiveOffer(OutgoingOfferViewModel offer) { View = new TradeValueViewModel(offer.Event), OnShow = (a) => { this._removeActive = a; }, - Action = () => { this._keyboardHelper.Trade(offer.Event.PlayerName); } + Action = () => { this._keyboardHelper.Trade(offer.Event.PlayerName); }, }); } #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/PieChartViewModel.cs b/src/Lurker.UI/ViewModels/PieChartViewModel.cs index d42d6e22..e5cd090d 100644 --- a/src/Lurker.UI/ViewModels/PieChartViewModel.cs +++ b/src/Lurker.UI/ViewModels/PieChartViewModel.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,7 +9,11 @@ namespace Lurker.UI.ViewModels using LiveCharts; using LiveCharts.Wpf; - public class PieChartViewModel: ChartViewModelBase + /// + /// Represents the PieChart. + /// + /// + public class PieChartViewModel : ChartViewModelBase { #region Methods @@ -53,4 +57,4 @@ public void Add(string label, double value) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/PoeOverlayBase.cs b/src/Lurker.UI/ViewModels/PoeOverlayBase.cs index 70445bc7..4db9c157 100644 --- a/src/Lurker.UI/ViewModels/PoeOverlayBase.cs +++ b/src/Lurker.UI/ViewModels/PoeOverlayBase.cs @@ -1,33 +1,28 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- - namespace Lurker.UI.ViewModels { + using System; + using System.Threading.Tasks; + using System.Windows; using Caliburn.Micro; using Lurker.Helpers; using Lurker.Models; using Lurker.Services; - using System; - using System.Threading.Tasks; - using System.Windows; + /// + /// Represents a Poe Overlay. + /// + /// + /// public abstract class PoeOverlayBase : ScreenBase, IViewAware { #region Fields - protected static int Margin = 4; - protected static int DefaultFlaskBarHeight = 122; - protected static int DefaultFlaskBarWidth = 550; - protected static int DefaultExpBarHeight = 24; - protected static int DefaultHeight = 1080; - - protected Window _view; - protected SettingsService _settingsService; - protected ProcessLurker _processLurker; private DockingHelper _dockingHelper; private bool _manualHide; @@ -36,21 +31,23 @@ public abstract class PoeOverlayBase : ScreenBase, IViewAware #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The window manager. /// The docking helper. - public PoeOverlayBase(IWindowManager windowManager, DockingHelper dockingHelper, ProcessLurker processLurker, SettingsService settingsService) + /// The process lurker. + /// The settings service. + public PoeOverlayBase(IWindowManager windowManager, DockingHelper dockingHelper, ProcessLurker processLurker, SettingsService settingsService) : base(windowManager) { this._dockingHelper = dockingHelper; - this._processLurker = processLurker; - this._settingsService = settingsService; + this.ProcessLurker = processLurker; + this.SettingsService = settingsService; this._dockingHelper.OnWindowMove += this.DockingHelper_OnWindowMove; this._dockingHelper.OnForegroundChange += this.DockingHelper_OnForegroundChange; - this._processLurker.ProcessClosed += this.Lurker_PoeClosed; - this._settingsService.OnSave += this.SettingsService_OnSave; + this.ProcessLurker.ProcessClosed += this.Lurker_PoeClosed; + this.SettingsService.OnSave += this.SettingsService_OnSave; } #endregion @@ -60,7 +57,47 @@ public PoeOverlayBase(IWindowManager windowManager, DockingHelper dockingHelper, /// /// Gets a value indicating whether [debug enabled]. /// - public bool DebugEnabled => this._settingsService.DebugEnabled; + public bool DebugEnabled => this.SettingsService.DebugEnabled; + + /// + /// Gets the margin. + /// + protected static int Margin => 4; + + /// + /// Gets the default height of the flask bar. + /// + protected static int DefaultFlaskBarHeight => 122; + + /// + /// Gets the default width of the flask bar. + /// + protected static int DefaultFlaskBarWidth => 550; + + /// + /// Gets the default height of the exp bar. + /// + protected static int DefaultExpBarHeight => 24; + + /// + /// Gets the default height. + /// + protected static int DefaultHeight => 1080; + + /// + /// Gets the view. + /// + protected Window View { get; private set; } + + /// + /// Gets the settings service. + /// + protected SettingsService SettingsService { get; private set; } + + /// + /// Gets the process lurker. + /// + protected ProcessLurker ProcessLurker { get; private set; } #endregion @@ -71,7 +108,7 @@ public PoeOverlayBase(IWindowManager windowManager, DockingHelper dockingHelper, /// protected void HideView() { - this._view.Hide(); + this.View.Hide(); } /// @@ -84,7 +121,7 @@ protected void ShowView() return; } - this._view.Show(); + this.View.Show(); } /// @@ -131,8 +168,7 @@ private void SettingsService_OnSave(object sender, EventArgs e) /// Handles the OnWindowMove event of the DockingHelper control. /// /// The source of the event. - /// The instance containing the event data. - /// + /// The position. private void DockingHelper_OnWindowMove(object sender, PoeWindowInformation position) { this.SetWindowPosition(position); @@ -151,16 +187,17 @@ private void Lurker_PoeClosed(object sender, EventArgs e) /// /// Called when an attached view's Loaded event fires. /// - /// + /// The view. protected override void OnViewLoaded(object view) { - this._view = view as Window; + this.View = view as Window; this.SetWindowPosition(this._dockingHelper.WindowInformation); } /// /// Sets the window position. /// + /// The window information. protected abstract void SetWindowPosition(PoeWindowInformation windowInformation); /// @@ -171,8 +208,8 @@ protected override void OnDeactivate(bool close) { if (close) { - this._processLurker.ProcessClosed -= this.Lurker_PoeClosed; - this._settingsService.OnSave -= this.SettingsService_OnSave; + this.ProcessLurker.ProcessClosed -= this.Lurker_PoeClosed; + this.SettingsService.OnSave -= this.SettingsService_OnSave; this._dockingHelper.OnWindowMove -= this.DockingHelper_OnWindowMove; } @@ -181,4 +218,4 @@ protected override void OnDeactivate(bool close) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/PositionViewModel.cs b/src/Lurker.UI/ViewModels/PositionViewModel.cs index c97c53dd..8890117f 100644 --- a/src/Lurker.UI/ViewModels/PositionViewModel.cs +++ b/src/Lurker.UI/ViewModels/PositionViewModel.cs @@ -1,16 +1,19 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- - namespace Lurker.UI.ViewModels { + using System.Windows.Media; using Lurker.Patreon.Events; using Lurker.Services; - using System.Windows.Media; + /// + /// The position view model. + /// + /// public class PositionViewModel : Caliburn.Micro.PropertyChangedBase { #region Fields @@ -23,9 +26,10 @@ public class PositionViewModel : Caliburn.Micro.PropertyChangedBase #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The trade event. + /// The setting service. public PositionViewModel(TradeEvent tradeEvent, SettingsService settingService) { this._tradeEvent = tradeEvent; @@ -53,4 +57,4 @@ public PositionViewModel(TradeEvent tradeEvent, SettingsService settingService) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/RemainingMonsterViewModel.cs b/src/Lurker.UI/ViewModels/RemainingMonsterViewModel.cs index a4cd82d4..a9bb1c50 100644 --- a/src/Lurker.UI/ViewModels/RemainingMonsterViewModel.cs +++ b/src/Lurker.UI/ViewModels/RemainingMonsterViewModel.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -8,6 +8,10 @@ namespace Lurker.UI.ViewModels { using Lurker.Patreon.Events; + /// + /// Represents the remaining monster. + /// + /// public class RemainingMonsterViewModel : Caliburn.Micro.PropertyChangedBase { #region Fields @@ -32,7 +36,7 @@ public RemainingMonsterViewModel(MonstersRemainEvent monsterEvent) #region Properties /// - /// Gets or sets the monster remaining. + /// Gets the monster count. /// public int MonsterCount => this._monsterEvent.MonsterCount; @@ -43,4 +47,4 @@ public RemainingMonsterViewModel(MonstersRemainEvent monsterEvent) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/ScreenBase.cs b/src/Lurker.UI/ViewModels/ScreenBase.cs index 651dba46..2f3d1af4 100644 --- a/src/Lurker.UI/ViewModels/ScreenBase.cs +++ b/src/Lurker.UI/ViewModels/ScreenBase.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -8,7 +8,11 @@ namespace Lurker.UI.ViewModels { using Caliburn.Micro; - public class ScreenBase: Screen + /// + /// Represents the screen base class. + /// + /// + public class ScreenBase : Screen { #region Fields @@ -38,4 +42,4 @@ protected override void OnActivate() #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/SettingsViewModel.cs b/src/Lurker.UI/ViewModels/SettingsViewModel.cs index dffbf0f0..10d9b27a 100644 --- a/src/Lurker.UI/ViewModels/SettingsViewModel.cs +++ b/src/Lurker.UI/ViewModels/SettingsViewModel.cs @@ -1,16 +1,11 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { - using Caliburn.Micro; - using Lurker.Helpers; - using Lurker.Services; - using Lurker.UI.Helpers; - using MahApps.Metro.Controls; using System; using System.Diagnostics; using System.Security.Authentication; @@ -18,8 +13,17 @@ namespace Lurker.UI.ViewModels using System.Threading.Tasks; using System.Windows; using System.Windows.Media; + using Caliburn.Micro; + using Lurker.Helpers; + using Lurker.Services; + using Lurker.UI.Helpers; + using MahApps.Metro.Controls; - public class SettingsViewModel: ScreenBase + /// + /// Represents the settings view model. + /// + /// + public class SettingsViewModel : ScreenBase { #region Fields @@ -38,8 +42,12 @@ public class SettingsViewModel: ScreenBase #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// + /// The window manager. + /// The keyboard helper. + /// The settings service. + /// The sound service. public SettingsViewModel(IWindowManager windowManager, KeyboardHelper keyboardHelper, SettingsService settingsService, SoundService soundService) : base(windowManager) { @@ -155,11 +163,8 @@ public string BusyMessage } /// - /// Gets or sets the busy message. + /// Gets or sets a value indicating whether [remaining monster enabled]. /// - /// - /// The busy message. - /// public bool RemainingMonsterEnabled { get @@ -396,7 +401,7 @@ public int ToolTipDelay } /// - /// Gets or sets the tool tip delay. + /// Gets or sets a value indicating whether [always visible]. /// public bool AlwaysVisible { @@ -521,7 +526,7 @@ public async void LoginToPatreon() } } catch (AuthenticationException) - { + { } } @@ -536,7 +541,7 @@ public void Pledge() /// /// Called when an attached view's Loaded event fires. /// - /// + /// The view. protected override void OnViewLoaded(object view) { var window = view as MetroWindow; @@ -574,8 +579,8 @@ protected async override void OnActivate() this.Pledging = await service.IsPledging(); } } - catch - { + catch + { } } else @@ -650,4 +655,4 @@ private async void PlaySoundTest(CancellationToken token) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/ShellViewModel.cs b/src/Lurker.UI/ViewModels/ShellViewModel.cs index 9f885101..e34f0b27 100644 --- a/src/Lurker.UI/ViewModels/ShellViewModel.cs +++ b/src/Lurker.UI/ViewModels/ShellViewModel.cs @@ -1,20 +1,11 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI { - using Caliburn.Micro; - using Lurker.Helpers; - using Lurker.Patreon; - using Lurker.Patreon.Models; - using Lurker.Services; - using Lurker.UI.Helpers; - using Lurker.UI.Models; - using Lurker.UI.Services; - using Lurker.UI.ViewModels; using System; using System.Collections.Generic; using System.Diagnostics; @@ -24,13 +15,24 @@ namespace Lurker.UI using System.Runtime.InteropServices.ComTypes; using System.Text; using System.Threading.Tasks; + using Caliburn.Micro; + using Lurker.Helpers; + using Lurker.Patreon; + using Lurker.Patreon.Models; + using Lurker.Services; + using Lurker.UI.Helpers; + using Lurker.UI.Models; + using Lurker.UI.Services; + using Lurker.UI.ViewModels; - public class ShellViewModel : Conductor.Collection.AllActive , IViewAware, IHandle + /// + /// Represents the SHellViewModel. + /// + public class ShellViewModel : Conductor.Collection.AllActive, IViewAware, IHandle { #region Fields private static readonly List PossibleProcessNames = new List { "PathOfExile", "PathOfExile_x64", "PathOfExileSteam", "PathOfExile_x64Steam", "PathOfExile_x64_KG.exe", "PathOfExile_KG.exe" }; - private SimpleContainer _container; private ProcessLurker _processLurker; private ClientLurker _currentLurker; @@ -97,7 +99,7 @@ public ShellViewModel(SimpleContainer container, SettingsService settingsService #region Properties /// - /// Gets the item overlay. + /// Gets or sets the item overlay view model. /// public ItemOverlayViewModel ItemOverlayViewModel { @@ -153,7 +155,7 @@ public bool IsItemOverlayOpen } /// - /// Gets a value indicating whether [start with windows]. + /// Gets or sets a value indicating whether [start with windows]. /// public bool StartWithWindows { @@ -250,7 +252,7 @@ public void OnTrayOpen() // Hide mana overlay for 10s var message = new ManaBulbMessage() { - NeedToHide = true + NeedToHide = true, }; this._eventAggregator.PublishOnUIThread(message); @@ -259,7 +261,7 @@ public void OnTrayOpen() /// /// Gets the assembly version. /// - /// The assembly version + /// The assembly version. private static string GetAssemblyVersion() { var assembly = Assembly.GetExecutingAssembly(); @@ -276,7 +278,7 @@ public async void Update() var message = new ManaBulbMessage() { IsUpdate = true, - View = new UpdateViewModel(UpdateState.Working) + View = new UpdateViewModel(UpdateState.Working), }; this._eventAggregator.PublishOnUIThread(message); @@ -312,7 +314,6 @@ private void CreateLink() file.Save(this.ShortcutFilePath, false); } - /// /// Registers the instances. /// @@ -521,6 +522,7 @@ public void Handle(Screen screen) #endregion } +#pragma warning disable [ComImport] [Guid("00021401-0000-0000-C000-000000000046")] internal class ShellLink diff --git a/src/Lurker.UI/ViewModels/TradeValueViewModel.cs b/src/Lurker.UI/ViewModels/TradeValueViewModel.cs index 202e4265..029618e5 100644 --- a/src/Lurker.UI/ViewModels/TradeValueViewModel.cs +++ b/src/Lurker.UI/ViewModels/TradeValueViewModel.cs @@ -1,16 +1,19 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- - namespace Lurker.UI.ViewModels { using Lurker.Patreon.Events; using Lurker.Patreon.Models; - public class TradeValueViewModel: Caliburn.Micro.PropertyChangedBase + /// + /// Represetns the trade value. + /// + /// + public class TradeValueViewModel : Caliburn.Micro.PropertyChangedBase { #region Fields @@ -39,10 +42,10 @@ public TradeValueViewModel(TradeEvent tradeEvent) public CurrencyType CurrencyType => this._tradeEvent.Price.CurrencyType; /// - /// Gets or sets the number off currency. + /// Gets the number off currency. /// public double NumberOffCurrency => this._tradeEvent.Price.NumberOfCurrencies; #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/TradebarViewModel.cs b/src/Lurker.UI/ViewModels/TradebarViewModel.cs index dab2aa91..8e91747c 100644 --- a/src/Lurker.UI/ViewModels/TradebarViewModel.cs +++ b/src/Lurker.UI/ViewModels/TradebarViewModel.cs @@ -1,11 +1,14 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Linq; using Caliburn.Micro; using Lurker.Helpers; using Lurker.Models; @@ -14,16 +17,17 @@ namespace Lurker.UI.ViewModels using Lurker.Patreon.Parsers; using Lurker.Services; using Lurker.UI.Models; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Linq; + /// + /// Represent the trade bar. + /// + /// public class TradebarViewModel : PoeOverlayBase { #region Fields private static readonly ItemClassParser ItemClassParser = new ItemClassParser(); - private static int DefaultOverlayHeight = 60; + private static readonly int DefaultOverlayHeight = 60; private PoeKeyboardHelper _keyboardHelper; private ClientLurker _clientLurker; private TradebarContext _context; @@ -38,17 +42,21 @@ public class TradebarViewModel : PoeOverlayBase #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// The lurker. + /// The event aggregator. + /// The client lurker. + /// The process lurker. /// The docking helper. /// The keyboard helper. + /// The settings service. + /// The window manager. + /// The sound service. public TradebarViewModel(IEventAggregator eventAggregator, ClientLurker clientLurker, ProcessLurker processLurker, DockingHelper dockingHelper, PoeKeyboardHelper keyboardHelper, SettingsService settingsService, IWindowManager windowManager, SoundService soundService) - : base (windowManager, dockingHelper, processLurker, settingsService) + : base(windowManager, dockingHelper, processLurker, settingsService) { this._eventAggregator = eventAggregator; this._keyboardHelper = keyboardHelper; - this._settingsService = settingsService; this._soundService = soundService; this._clientLurker = clientLurker; this.TradeOffers = new ObservableCollection(); @@ -105,14 +113,14 @@ private void Lurker_IncomingOffer(object sender, TradeEvent e) return; } - if (this._settingsService.AlertEnabled) + if (this.SettingsService.AlertEnabled) { this.PlayAlert(); } - Execute.OnUIThread(() => + Execute.OnUIThread(() => { - this.TradeOffers.Add(new OfferViewModel(e, this._keyboardHelper, this._context, this._settingsService, this.CheckIfOfferIsAlreadySold(e))); + this.TradeOffers.Add(new OfferViewModel(e, this._keyboardHelper, this._context, this.SettingsService, this.CheckIfOfferIsAlreadySold(e))); }); } @@ -146,7 +154,7 @@ private bool CheckIfOfferIsAlreadySold(TradeEvent tradeEvent) /// private void PlayAlert() { - this._soundService.PlayTradeAlert(this._settingsService.AlertVolume); + this._soundService.PlayTradeAlert(this.SettingsService.AlertVolume); } /// @@ -160,12 +168,12 @@ private void Lurker_TradeAccepted(object sender, TradeAcceptedEvent e) if (offer != null) { this.InsertEvent(offer.Event); - if (!string.IsNullOrEmpty(this._settingsService.ThankYouMessage)) + if (!string.IsNullOrEmpty(this.SettingsService.ThankYouMessage)) { offer.ThankYou(); } - if (this._settingsService.AutoKickEnabled) + if (this.SettingsService.AutoKickEnabled) { this._keyboardHelper.Kick(offer.PlayerName); } @@ -234,8 +242,8 @@ private void RemoveOffer(OfferViewModel offer) { if (offer != null) { - Execute.OnUIThread(() => - { + Execute.OnUIThread(() => + { this.TradeOffers.Remove(offer); this._activeOffers.Remove(offer); @@ -264,7 +272,6 @@ private void AddActiveOffer(OfferViewModel offer) this._activeOffers.Add(offer); this.ActiveOffer.Active = true; - this.SendToLifeBulb(this.ActiveOffer.Event); } @@ -276,9 +283,9 @@ private void SendToLifeBulb(TradeEvent tradeEvent) { this._eventAggregator.PublishOnUIThread(new LifeBulbMessage() { - View = new PositionViewModel(tradeEvent, this._settingsService), + View = new PositionViewModel(tradeEvent, this.SettingsService), OnShow = (a) => { this._removeActive = a; }, - Action = this.SearchItem + Action = this.SearchItem, }); } @@ -334,7 +341,7 @@ protected override void OnDeactivate(bool close) /// /// Sets the window position. /// - /// + /// The window information. protected override void SetWindowPosition(PoeWindowInformation windowInformation) { var overlayHeight = DefaultOverlayHeight * windowInformation.FlaskBarHeight / DefaultFlaskBarHeight; @@ -342,13 +349,13 @@ protected override void SetWindowPosition(PoeWindowInformation windowInformation Execute.OnUIThread(() => { - this._view.Height = overlayHeight; - this._view.Width = overlayWidth; - this._view.Left = windowInformation.Position.Left + windowInformation.FlaskBarWidth + Margin; - this._view.Top = windowInformation.Position.Bottom - overlayHeight - windowInformation.ExpBarHeight - Margin; + this.View.Height = overlayHeight; + this.View.Width = overlayWidth; + this.View.Left = windowInformation.Position.Left + windowInformation.FlaskBarWidth + Margin; + this.View.Top = windowInformation.Position.Bottom - overlayHeight - windowInformation.ExpBarHeight - Margin; }); } #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/ViewModels/UpdateViewModel.cs b/src/Lurker.UI/ViewModels/UpdateViewModel.cs index 87b61cde..d46ba114 100644 --- a/src/Lurker.UI/ViewModels/UpdateViewModel.cs +++ b/src/Lurker.UI/ViewModels/UpdateViewModel.cs @@ -1,23 +1,28 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.UI.ViewModels { - using Lurker.UI.Models; using System; using System.IO; using System.Reflection; + using Lurker.UI.Models; + /// + /// Represents the update view model. + /// + /// public class UpdateViewModel : Caliburn.Micro.PropertyChangedBase { #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// + /// The state. public UpdateViewModel(UpdateState state) { if (!File.Exists(this.NeedUpdateFilePath)) @@ -103,7 +108,7 @@ public UpdateViewModel(UpdateState state) /// /// Gets the settings folder path. /// - private string SettingsFolderPath => Path.Combine(AppDataFolderPath, FolderName); + private string SettingsFolderPath => Path.Combine(this.AppDataFolderPath, this.FolderName); #endregion @@ -112,8 +117,10 @@ public UpdateViewModel(UpdateState state) /// /// Gets the content of the resource. /// - /// Name of the resource. - /// The animation text. + /// Name of the file. + /// + /// The animation text. + /// private string GetResourceContent(string fileName) { using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"Lurker.UI.Assets.{fileName}")) @@ -127,4 +134,4 @@ private string GetResourceContent(string fileName) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/AffixView.xaml.cs b/src/Lurker.UI/Views/AffixView.xaml.cs index 43ecd3e0..a584acae 100644 --- a/src/Lurker.UI/Views/AffixView.xaml.cs +++ b/src/Lurker.UI/Views/AffixView.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,13 +9,16 @@ namespace Lurker.UI.Views using System.Windows.Controls; /// - /// Interaction logic for AffixView.xaml + /// Interaction logic for AffixView.xaml. /// public partial class AffixView : UserControl { + /// + /// Initializes a new instance of the class. + /// public AffixView() { - InitializeComponent(); + this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/CollaborationView.xaml.cs b/src/Lurker.UI/Views/CollaborationView.xaml.cs index a196fe5c..feda7749 100644 --- a/src/Lurker.UI/Views/CollaborationView.xaml.cs +++ b/src/Lurker.UI/Views/CollaborationView.xaml.cs @@ -1,23 +1,26 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- -using Lurker.Services; -using System.IO; -using System.Reflection; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media.Imaging; - namespace Lurker.UI.Views { + using System.IO; + using System.Reflection; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Media.Imaging; + using Lurker.Services; + /// - /// Interaction logic for CollaborationView.xaml + /// Interaction logic for CollaborationView.xaml. /// public partial class CollaborationView : UserControl { + /// + /// Initializes a new instance of the class. + /// public CollaborationView() { this.InitializeComponent(); @@ -41,21 +44,5 @@ private async void CollaborationView_IsVisibleChanged(object sender, DependencyP } } } - - /// - /// Gets the content of the resource. - /// - /// Name of the resource. - /// The animation text. - private static string GetResourceContent(string fileName) - { - using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"Lurker.UI.Assets.{fileName}")) - { - using (StreamReader reader = new StreamReader(stream)) - { - return reader.ReadToEnd(); - } - } - } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/ColumnChartView.xaml.cs b/src/Lurker.UI/Views/ColumnChartView.xaml.cs index 41c8de71..31f35847 100644 --- a/src/Lurker.UI/Views/ColumnChartView.xaml.cs +++ b/src/Lurker.UI/Views/ColumnChartView.xaml.cs @@ -1,28 +1,24 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; +//----------------------------------------------------------------------- +// +// Copyright © Wohs Inc. +// +//----------------------------------------------------------------------- namespace Lurker.UI.Views { + using System.Windows.Controls; + /// - /// Interaction logic for ColumnChartView.xaml + /// Interaction logic for ColumnChartView.xaml. /// public partial class ColumnChartView : UserControl { + /// + /// Initializes a new instance of the class. + /// public ColumnChartView() { - InitializeComponent(); + this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/DashboardView.xaml.cs b/src/Lurker.UI/Views/DashboardView.xaml.cs index c4062659..2182b9ef 100644 --- a/src/Lurker.UI/Views/DashboardView.xaml.cs +++ b/src/Lurker.UI/Views/DashboardView.xaml.cs @@ -1,21 +1,24 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- -using System.Windows; - namespace Lurker.UI.Views { + using System.Windows; + /// - /// Interaction logic for DashboardView.xaml + /// Interaction logic for DashboardView.xaml. /// public partial class DashboardView : Window { + /// + /// Initializes a new instance of the class. + /// public DashboardView() { this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/ItemOverlayView.xaml.cs b/src/Lurker.UI/Views/ItemOverlayView.xaml.cs index 746ed5d6..16dbbb8b 100644 --- a/src/Lurker.UI/Views/ItemOverlayView.xaml.cs +++ b/src/Lurker.UI/Views/ItemOverlayView.xaml.cs @@ -1,21 +1,24 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- -using System.Windows.Controls; - namespace Lurker.UI.Views { + using System.Windows.Controls; + /// - /// Interaction logic for ItemOverlayView.xaml + /// Interaction logic for ItemOverlayView.xaml. /// public partial class ItemOverlayView : UserControl { + /// + /// Initializes a new instance of the class. + /// public ItemOverlayView() { this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/LifeBulbView.xaml.cs b/src/Lurker.UI/Views/LifeBulbView.xaml.cs index c01fe7dd..12a9f466 100644 --- a/src/Lurker.UI/Views/LifeBulbView.xaml.cs +++ b/src/Lurker.UI/Views/LifeBulbView.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -10,12 +10,15 @@ namespace Lurker.UI.Views using System.Windows; /// - /// Interaction logic for LifeBulbView.xaml + /// Interaction logic for LifeBulbView.xaml. /// public partial class LifeBulbView : Window { private Window _parent; + /// + /// Initializes a new instance of the class. + /// public LifeBulbView() { this.InitializeComponent(); @@ -52,8 +55,8 @@ private void HideFromAltTab() Width = 1, Height = 1, - WindowStyle = WindowStyle.ToolWindow, // Set window style as ToolWindow to avoid its icon in AltTab - ShowInTaskbar = false + WindowStyle = WindowStyle.ToolWindow, // Set window style as ToolWindow to avoid its icon in AltTab + ShowInTaskbar = false, }; this._parent.Show(); @@ -61,4 +64,4 @@ private void HideFromAltTab() this._parent.Hide(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/LineChartView.xaml.cs b/src/Lurker.UI/Views/LineChartView.xaml.cs index 29ec320e..1e25eaaa 100644 --- a/src/Lurker.UI/Views/LineChartView.xaml.cs +++ b/src/Lurker.UI/Views/LineChartView.xaml.cs @@ -1,21 +1,24 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- -using System.Windows.Controls; - namespace Lurker.UI.Views { + using System.Windows.Controls; + /// - /// Interaction logic for LineChartView.xaml + /// Interaction logic for LineChartView.xaml. /// public partial class LineChartView : UserControl { + /// + /// Initializes a new instance of the class. + /// public LineChartView() { this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/ManaBulbView.xaml.cs b/src/Lurker.UI/Views/ManaBulbView.xaml.cs index 274eb794..200b474f 100644 --- a/src/Lurker.UI/Views/ManaBulbView.xaml.cs +++ b/src/Lurker.UI/Views/ManaBulbView.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -10,12 +10,15 @@ namespace Lurker.UI.Views using System.Windows; /// - /// Interaction logic for LifeBulbView.xaml + /// Interaction logic for LifeBulbView.xaml. /// public partial class ManaBulbView : Window { private Window _parent; + /// + /// Initializes a new instance of the class. + /// public ManaBulbView() { this.InitializeComponent(); @@ -44,8 +47,8 @@ private void HideFromAltTab() Width = 1, Height = 1, - WindowStyle = WindowStyle.ToolWindow, // Set window style as ToolWindow to avoid its icon in AltTab - ShowInTaskbar = false + WindowStyle = WindowStyle.ToolWindow, // Set window style as ToolWindow to avoid its icon in AltTab + ShowInTaskbar = false, }; this._parent.Show(); @@ -53,4 +56,4 @@ private void HideFromAltTab() this._parent.Hide(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/OfferView.xaml.cs b/src/Lurker.UI/Views/OfferView.xaml.cs index 841876b8..a0ddc99d 100644 --- a/src/Lurker.UI/Views/OfferView.xaml.cs +++ b/src/Lurker.UI/Views/OfferView.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,13 +9,16 @@ namespace Lurker.UI.Views using System.Windows.Controls; /// - /// Interaction logic for TradeOfferView.xaml + /// Interaction logic for TradeOfferView.xaml. /// public partial class OfferView : UserControl { + /// + /// Initializes a new instance of the class. + /// public OfferView() { - InitializeComponent(); + this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/OutgoingOfferView.xaml.cs b/src/Lurker.UI/Views/OutgoingOfferView.xaml.cs index 0fb5cb05..2273467c 100644 --- a/src/Lurker.UI/Views/OutgoingOfferView.xaml.cs +++ b/src/Lurker.UI/Views/OutgoingOfferView.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,14 +9,17 @@ namespace Lurker.UI.Views using System.Windows.Controls; /// - /// Interaction logic for OutgoingOfferView.xaml + /// Interaction logic for OutgoingOfferView.xaml. /// public partial class OutgoingOfferView : UserControl { + /// + /// Initializes a new instance of the class. + /// public OutgoingOfferView() { this.InitializeComponent(); this.MainAction.Height = this.MainAction.Width / 2; } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/OutgoingbarView.xaml.cs b/src/Lurker.UI/Views/OutgoingbarView.xaml.cs index bc30b5c7..96690d9d 100644 --- a/src/Lurker.UI/Views/OutgoingbarView.xaml.cs +++ b/src/Lurker.UI/Views/OutgoingbarView.xaml.cs @@ -1,10 +1,9 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- - namespace Lurker.UI.Views { using System; @@ -12,7 +11,7 @@ namespace Lurker.UI.Views using System.Windows.Controls; /// - /// Interaction logic for OutgoingbarView.xaml + /// Interaction logic for OutgoingbarView.xaml. /// public partial class OutgoingbarView : Window { @@ -58,9 +57,8 @@ private void HideFromAltTab() Left = -100, Width = 1, Height = 1, - - WindowStyle = WindowStyle.ToolWindow, // Set window style as ToolWindow to avoid its icon in AltTab - ShowInTaskbar = false + WindowStyle = WindowStyle.ToolWindow, // Set window style as ToolWindow to avoid its icon in AltTab + ShowInTaskbar = false, }; this._parent.Show(); @@ -82,4 +80,4 @@ private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input. #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/PieChartView.xaml.cs b/src/Lurker.UI/Views/PieChartView.xaml.cs index d4471bca..6337f5e3 100644 --- a/src/Lurker.UI/Views/PieChartView.xaml.cs +++ b/src/Lurker.UI/Views/PieChartView.xaml.cs @@ -1,22 +1,24 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- -using System.Windows.Controls; -using System.Windows.Media; - namespace Lurker.UI.Views { + using System.Windows.Controls; + /// - /// Interaction logic for PieChartView.xaml + /// Interaction logic for PieChartView.xaml. /// public partial class PieChartView : UserControl { + /// + /// Initializes a new instance of the class. + /// public PieChartView() { - InitializeComponent(); + this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/PositionView.xaml.cs b/src/Lurker.UI/Views/PositionView.xaml.cs index 5b7062e5..d739d1d3 100644 --- a/src/Lurker.UI/Views/PositionView.xaml.cs +++ b/src/Lurker.UI/Views/PositionView.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,13 +9,16 @@ namespace Lurker.UI.Views using System.Windows.Controls; /// - /// Interaction logic for PositionView.xaml + /// Interaction logic for PositionView.xaml. /// public partial class PositionView : UserControl { + /// + /// Initializes a new instance of the class. + /// public PositionView() { this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/RemainingMonsterView.xaml.cs b/src/Lurker.UI/Views/RemainingMonsterView.xaml.cs index 64d71782..1e09e14e 100644 --- a/src/Lurker.UI/Views/RemainingMonsterView.xaml.cs +++ b/src/Lurker.UI/Views/RemainingMonsterView.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,13 +9,16 @@ namespace Lurker.UI.Views using System.Windows.Controls; /// - /// Interaction logic for RemainingMonsterView.xaml + /// Interaction logic for RemainingMonsterView.xaml. /// public partial class RemainingMonsterView : UserControl { + /// + /// Initializes a new instance of the class. + /// public RemainingMonsterView() { this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/SettingsView.xaml.cs b/src/Lurker.UI/Views/SettingsView.xaml.cs index 41f5376f..1f0ccee9 100644 --- a/src/Lurker.UI/Views/SettingsView.xaml.cs +++ b/src/Lurker.UI/Views/SettingsView.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,7 +9,7 @@ namespace Lurker.UI.Views using MahApps.Metro.Controls; /// - /// Interaction logic for SettingsView.xaml + /// Interaction logic for SettingsView.xaml. /// public partial class SettingsView : MetroWindow { @@ -25,4 +25,4 @@ public SettingsView() #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/ShellView.xaml.cs b/src/Lurker.UI/Views/ShellView.xaml.cs index 2423028b..4ae34858 100644 --- a/src/Lurker.UI/Views/ShellView.xaml.cs +++ b/src/Lurker.UI/Views/ShellView.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -8,11 +8,19 @@ namespace Lurker.UI { using System.Windows; + /// + /// Represents the shellview. + /// + /// + /// public partial class ShellView : Window { + /// + /// Initializes a new instance of the class. + /// public ShellView() { this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/TradeValueView.xaml.cs b/src/Lurker.UI/Views/TradeValueView.xaml.cs index 68d5b2ea..c888b48a 100644 --- a/src/Lurker.UI/Views/TradeValueView.xaml.cs +++ b/src/Lurker.UI/Views/TradeValueView.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,13 +9,16 @@ namespace Lurker.UI.Views using System.Windows.Controls; /// - /// Interaction logic for TradeValueView.xaml + /// Interaction logic for TradeValueView.xaml. /// public partial class TradeValueView : UserControl { + /// + /// Initializes a new instance of the class. + /// public TradeValueView() { this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/TradebarView.xaml.cs b/src/Lurker.UI/Views/TradebarView.xaml.cs index 324fa468..a4ab2325 100644 --- a/src/Lurker.UI/Views/TradebarView.xaml.cs +++ b/src/Lurker.UI/Views/TradebarView.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -11,7 +11,7 @@ namespace Lurker.UI.Views using System.Windows.Controls; /// - /// Interaction logic for TradeBarView.xaml + /// Interaction logic for TradeBarView.xaml. /// public partial class TradebarView : Window { @@ -28,7 +28,7 @@ public partial class TradebarView : Window /// public TradebarView() { - InitializeComponent(); + this.InitializeComponent(); this.HideFromAltTab(); } @@ -58,8 +58,8 @@ private void HideFromAltTab() Width = 1, Height = 1, - WindowStyle = WindowStyle.ToolWindow, // Set window style as ToolWindow to avoid its icon in AltTab - ShowInTaskbar = false + WindowStyle = WindowStyle.ToolWindow, // Set window style as ToolWindow to avoid its icon in AltTab + ShowInTaskbar = false, }; this._parent.Show(); @@ -81,4 +81,4 @@ private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input. #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/Views/UpdateView.xaml.cs b/src/Lurker.UI/Views/UpdateView.xaml.cs index bb019d3a..1e2ad06e 100644 --- a/src/Lurker.UI/Views/UpdateView.xaml.cs +++ b/src/Lurker.UI/Views/UpdateView.xaml.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,13 +9,16 @@ namespace Lurker.UI.Views using System.Windows.Controls; /// - /// Interaction logic for UpdateView.xaml + /// Interaction logic for UpdateView.xaml. /// public partial class UpdateView : UserControl { + /// + /// Initializes a new instance of the class. + /// public UpdateView() { this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Lurker.UI/packages.config b/src/Lurker.UI/packages.config index 0561b866..8ce79570 100644 --- a/src/Lurker.UI/packages.config +++ b/src/Lurker.UI/packages.config @@ -40,5 +40,6 @@ + \ No newline at end of file diff --git a/src/Lurker/ClientLurker.cs b/src/Lurker/ClientLurker.cs index 723014a9..f7e47acb 100644 --- a/src/Lurker/ClientLurker.cs +++ b/src/Lurker/ClientLurker.cs @@ -1,14 +1,11 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker { - using Lurker.Extensions; - using Lurker.Patreon.Events; - using Sentry; using System; using System.Collections.Generic; using System.Diagnostics; @@ -17,6 +14,8 @@ namespace Lurker using System.Text; using System.Threading; using System.Threading.Tasks; + using Lurker.Extensions; + using Lurker.Patreon.Events; /// /// Defines a file Watcher for the Client log file. @@ -40,6 +39,7 @@ public class ClientLurker : IDisposable /// /// Initializes a new instance of the class. /// + /// The path of exile process. public ClientLurker(Process pathOfExileProcess) { this._pathOfExileProcess = pathOfExileProcess; @@ -138,12 +138,51 @@ protected virtual void Dispose(bool disposing) } } + /// + /// Gets the line. + /// + /// The stream. + /// + /// The current line of the stream position. + /// + /// Error reading from file. + private static string GetLine(Stream stream) + { + // while we have not yet reached start of file, read bytes backwards until '\n' byte is hit + var lineLength = 0; + while (stream.Position > 0) + { + stream.Position--; + var byteFromFile = stream.ReadByte(); + + if (byteFromFile < 0) + { + // the only way this should happen is if someone truncates the file out from underneath us while we are reading backwards + throw new IOException("Error reading from file"); + } + else if (byteFromFile == '\n') + { + // we found the new line, break out, fs.Position is one after the '\n' char + break; + } + + lineLength++; + stream.Position--; + } + + var oldPosition = stream.Position; + var bytes = new BinaryReader(stream).ReadBytes(lineLength - 1); + + // -1 is the \n + stream.Position = oldPosition - 1; + return Encoding.UTF8.GetString(bytes).Replace(System.Environment.NewLine, string.Empty); + } + /// /// Reads the last line from ut f8 encoded file. /// - /// The path. - /// - /// Error reading from file at " + path + /// The last line. + /// Error reading from file at " + path. private string GetLastLine() { using (var stream = new FileStream(this.FilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) @@ -152,6 +191,7 @@ private string GetLastLine() { return null; } + stream.Position = stream.Length - 1; return GetLine(stream); @@ -161,7 +201,7 @@ private string GetLastLine() /// /// Gets the new lines. /// - /// The all the new lines + /// The all the new lines. private IEnumerable GetNewLines() { using (var stream = new FileStream(this.FilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) @@ -185,44 +225,6 @@ private IEnumerable GetNewLines() } } - /// - /// Gets the line. - /// - /// The stream. - /// The current line of the stream position - private static string GetLine(Stream stream) - { - // while we have not yet reached start of file, read bytes backwards until '\n' byte is hit - var lineLength = 0; - while (stream.Position > 0) - { - stream.Position--; - var byteFromFile = stream.ReadByte(); - - if (byteFromFile < 0) - { - // the only way this should happen is if someone truncates the file out from underneath us while we are reading backwards - throw new IOException("Error reading from file"); - } - else if (byteFromFile == '\n') - { - // we found the new line, break out, fs.Position is one after the '\n' char - break; - } - - lineLength++; - stream.Position--; - } - - var oldPosition = stream.Position; - // fs.Position will be right after the '\n' char or position 0 if no '\n' char - var bytes = new BinaryReader(stream).ReadBytes(lineLength -1); - - // -1 is the \n - stream.Position = oldPosition - 1; - return Encoding.UTF8.GetString(bytes).Replace(System.Environment.NewLine, string.Empty); - } - /// /// Lurks this instance. /// @@ -269,7 +271,7 @@ private async void LurkLastWriteTime() while (fileInformation.LastWriteTimeUtc == lastWriteTime); lastWriteTime = fileInformation.LastAccessTimeUtc; - this.OnFileChanged(GetLastLine()); + this.OnFileChanged(this.GetLastLine()); } } @@ -302,12 +304,11 @@ private async void LurkLastLine() } } } - + /// /// Called when [file changed]. /// - /// The sender. - /// The instance containing the event data. + /// The newline. private void OnFileChanged(string newline) { if (string.IsNullOrEmpty(newline)) @@ -382,7 +383,6 @@ private void OnFileChanged(string newline) var playerLeftEvent = PlayerLeftEvent.TryParse(newline); if (playerLeftEvent != null) { - this.PlayerLeft?.Invoke(this, playerLeftEvent); return; } @@ -395,7 +395,7 @@ private void OnFileChanged(string newline) var exception = new Exception(lineError, ex); Logger.Error(exception, exception.Message); -#if (!DEBUG) +#if !DEBUG SentrySdk.AddBreadcrumb(message: lineError, level: Sentry.Protocol.BreadcrumbLevel.Error); SentrySdk.CaptureException(ex); #endif @@ -422,4 +422,4 @@ private bool FileLastWriteTimeEnable() #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/ClipboardLurker.cs b/src/Lurker/ClipboardLurker.cs index d9674991..afa34d84 100644 --- a/src/Lurker/ClipboardLurker.cs +++ b/src/Lurker/ClipboardLurker.cs @@ -1,28 +1,31 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- - namespace Lurker { - using Gma.System.MouseKeyHook; - using Lurker.Helpers; - using Lurker.Patreon.Events; - using Lurker.Patreon.Models; - using Lurker.Patreon.Parsers; - using Lurker.Services; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; + using Gma.System.MouseKeyHook; + using Lurker.Helpers; + using Lurker.Patreon.Events; + using Lurker.Patreon.Models; + using Lurker.Patreon.Parsers; + using Lurker.Services; using WindowsInput; using WK.Libraries.SharpClipboardNS; - public class ClipboardLurker: IDisposable + /// + /// The clipboard lurker. + /// + /// + public class ClipboardLurker : IDisposable { #region Fields @@ -40,8 +43,10 @@ public class ClipboardLurker: IDisposable #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// + /// The settings service. + /// The keyboard helper. public ClipboardLurker(SettingsService settingsService, PoeKeyboardHelper keyboardHelper) { this.ClearClipboard(); @@ -106,12 +111,11 @@ protected virtual void Dispose(bool disposing) { this._keyboardEvent.MouseClick -= this.KeyboardEvent_MouseClick; this._keyboardEvent.Dispose(); - this._clipboardMonitor.ClipboardChanged -= ClipboardMonitor_ClipboardChanged; + this._clipboardMonitor.ClipboardChanged -= this.ClipboardMonitor_ClipboardChanged; this._settingsService.OnSave -= this.SettingsService_OnSave; } } - /// /// Handles the OnSave event of the SettingsService control. /// @@ -146,9 +150,9 @@ private void StartWatcher() this._keyboardEvent = Hook.GlobalEvents(); var assignment = new Dictionary { - {search, this.Search}, - {remainingMonster, this.RemainingMonster}, - {deleteItem, this.DeleteItem}, + { search, this.Search }, + { remainingMonster, this.RemainingMonster }, + { deleteItem, this.DeleteItem }, }; this._keyboardEvent.OnCombination(assignment); @@ -191,7 +195,7 @@ private async Task GetClipboardText() await Task.Delay(20); var clipboardText = string.Empty; - Thread thread = new Thread(() => + Thread thread = new Thread(() => { var retryCount = 3; while (retryCount != 0) @@ -247,7 +251,6 @@ private void ClearClipboard() /// /// The source of the event. /// The instance containing the event data. - /// private void ClipboardMonitor_ClipboardChanged(object sender, SharpClipboard.ClipboardChangedEventArgs e) { if (e.ContentType == SharpClipboard.ContentTypes.Text) @@ -322,7 +325,7 @@ private async void ParseItem() /// /// Gets the item in clipboard. /// - /// The item in the clipboard + /// The item in the clipboard. private async Task GetItemInClipboard() { try @@ -339,7 +342,7 @@ private async Task GetItemInClipboard() /// /// Gets the item base type in clipboard. /// - /// + /// The item search value. private async Task GetItemSearchValueInClipboard() { try @@ -402,4 +405,4 @@ private void DeleteItem() #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Extensions/ProcessExtension.cs b/src/Lurker/Extensions/ProcessExtension.cs index ec3a6649..4620c04e 100644 --- a/src/Lurker/Extensions/ProcessExtension.cs +++ b/src/Lurker/Extensions/ProcessExtension.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -13,7 +13,10 @@ namespace Lurker.Extensions using System.Text; using System.Threading; - public static class Extensions + /// + /// Represents all the extension methods. + /// + public static class ProcessExtension { [DllImport("Kernel32.dll")] private static extern bool QueryFullProcessImageName([In] IntPtr hProcess, [In] uint dwFlags, [Out] StringBuilder lpExeName, [In, Out] ref uint lpdwSize); @@ -37,8 +40,7 @@ public static string GetMainModuleFileName(this Process process, int buffer = 10 /// Gets the window handle. /// /// The process. - /// - /// + /// The window hande pointer. public static IntPtr GetWindowHandle(this Process process) { process.Refresh(); @@ -52,9 +54,8 @@ public static IntPtr GetWindowHandle(this Process process) Thread.Sleep(200); if (process == null) { - throw new System.InvalidOperationException(); + throw new InvalidOperationException(); } - } while (newProcess.MainWindowHandle == IntPtr.Zero); } @@ -66,4 +67,4 @@ public static IntPtr GetWindowHandle(this Process process) return newProcess.MainWindowHandle; } } -} +} \ No newline at end of file diff --git a/src/Lurker/Extensions/StringExtension.cs b/src/Lurker/Extensions/StringExtension.cs index c6c2c12a..6f1e48f2 100644 --- a/src/Lurker/Extensions/StringExtension.cs +++ b/src/Lurker/Extensions/StringExtension.cs @@ -1,24 +1,33 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- - namespace Lurker.Extensions { using System.Linq; + /// + /// The string extensions. + /// public static class StringExtension { - private static char WildCard = '*'; + #region Fiels + + /// + /// The wild card. + /// + private static readonly char WildCard = '*'; + + #endregion /// /// Splits the specified split value. /// /// The value. /// The split value. - /// Split the current string using another string + /// Split the current string using another string. public static string[] Split(this string value, string splitValue) { return value.Split(new string[] { splitValue }, System.StringSplitOptions.RemoveEmptyEntries); @@ -57,7 +66,7 @@ public static string GetLineAfter(this string value, string marker) /// /// The value. /// The marker. - /// The line + /// The line. public static string GetLineBefore(this string value, string marker) { var index = value.IndexOf(marker); @@ -75,7 +84,7 @@ public static string GetLineBefore(this string value, string marker) /// /// The value. /// The marker. - /// The full line of the marker + /// The full line of the marker. public static string GetLine(this string value, string marker) { var index = value.IndexOf(marker); @@ -93,7 +102,7 @@ public static string GetLine(this string value, string marker) /// /// The value. /// The criteria. - /// If match + /// If match. public static bool Match(this string value, string criteria) { if (string.IsNullOrEmpty(criteria)) @@ -135,4 +144,4 @@ public static bool Match(this string value, string criteria) return true; } } -} +} \ No newline at end of file diff --git a/src/Lurker/Helpers/DockingHelper.cs b/src/Lurker/Helpers/DockingHelper.cs index 7cc8eb31..d0a91ab3 100644 --- a/src/Lurker/Helpers/DockingHelper.cs +++ b/src/Lurker/Helpers/DockingHelper.cs @@ -1,40 +1,42 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.Helpers { - using Lurker.Extensions; - using Lurker.Models; - using Lurker.Services; using System; using System.Diagnostics; using System.Threading; using System.Threading.Tasks; + using Lurker.Extensions; + using Lurker.Models; + using Lurker.Services; using static Lurker.Native; - public class DockingHelper: IDisposable + /// + /// Represents DockingHelper. + /// + /// + public class DockingHelper : IDisposable { #region Fields - private static int DefaultFlaskBarHeight = 122; - private static int DefaultFlaskBarWidth = 550; - private static int DefaultExpBarHeight = 24; - private static int DefaultHeight = 1080; - - private const uint LostFocus = 3; private const uint GainMouseCapture = 8; private const uint LostMouseCapture = 9; private const uint MoveEnd = 11; - private const uint Minimized = 22; - private const uint ObjectDestroy = 32769; - private const uint ObjectHidden = 8003; - private Process _myProcess; - private readonly uint _windowProcessId, _windowOwnerId; + private static readonly int DefaultFlaskBarHeight = 122; + private static readonly int DefaultFlaskBarWidth = 550; + private static readonly int DefaultExpBarHeight = 24; + private static readonly int DefaultHeight = 1080; + + private readonly uint _windowProcessId; + private readonly uint _windowOwnerId; private readonly WinEventDelegate _winEventDelegate; + + private Process _myProcess; private CancellationTokenSource _tokenSource; private SettingsService _settingsService; private IntPtr _hook; @@ -46,9 +48,10 @@ public class DockingHelper: IDisposable #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The process. + /// The settings service. public DockingHelper(Process process, SettingsService settingsService) { this._myProcess = Process.GetCurrentProcess(); @@ -58,7 +61,7 @@ public DockingHelper(Process process, SettingsService settingsService) this._windowHandle = this._process.GetWindowHandle(); this._windowOwnerId = GetWindowThreadProcessId(this._windowHandle, out this._windowProcessId); - this._winEventDelegate = WhenWindowMoveStartsOrEnds; + this._winEventDelegate = this.WhenWindowMoveStartsOrEnds; this._hook = SetWinEventHook(0, MoveEnd, this._windowHandle, this._winEventDelegate, this._windowProcessId, this._windowOwnerId, 0); this.WindowInformation = this.GetWindowInformation(); this.WatchForegound(); @@ -68,12 +71,24 @@ public DockingHelper(Process process, SettingsService settingsService) #region Events + /// + /// Occurs when [on window move]. + /// public event EventHandler OnWindowMove; + /// + /// Occurs when [on lost mouse capture]. + /// public event EventHandler OnLostMouseCapture; + /// + /// Occurs when [on mouse capture]. + /// public event EventHandler OnMouseCapture; + /// + /// Occurs when [on foreground change]. + /// public event EventHandler OnForegroundChange; #endregion @@ -133,7 +148,7 @@ private void WhenWindowMoveStartsOrEnds(IntPtr hWinEventHook, uint eventType, In return; } - switch(eventType) + switch (eventType) { case MoveEnd: this.InvokeWindowMove(); @@ -153,7 +168,7 @@ private void WhenWindowMoveStartsOrEnds(IntPtr hWinEventHook, uint eventType, In private async void WatchForegound() { var token = this._tokenSource.Token; - while(true) + while (true) { if (token.IsCancellationRequested) { @@ -203,7 +218,7 @@ private void InvokeWindowMove() /// /// Gets the window information. /// - /// + /// The poe window information. private PoeWindowInformation GetWindowInformation() { Rect poePosition = default; @@ -228,4 +243,4 @@ private PoeWindowInformation GetWindowInformation() #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Helpers/KeyboardHelper.cs b/src/Lurker/Helpers/KeyboardHelper.cs index 32c2e78d..06124e78 100644 --- a/src/Lurker/Helpers/KeyboardHelper.cs +++ b/src/Lurker/Helpers/KeyboardHelper.cs @@ -1,21 +1,24 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.Helpers { - using Lurker.Extensions; using System; using System.Diagnostics; + using Lurker.Extensions; using WindowsInput; + /// + /// Represents the keyboard helper. + /// public class KeyboardHelper { #region Fields - private readonly object CommandLock = new object(); + private readonly object _commandLock = new object(); private Process _process; private InputSimulator _simulator; private IntPtr _windowHandle; @@ -25,9 +28,9 @@ public class KeyboardHelper #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// The window handle. + /// The process. public KeyboardHelper(Process process) : this() { @@ -62,12 +65,12 @@ public void Write(string text) } /// - /// Simulates a search using Ctrl+F + /// Simulates a search using Ctrl+F. /// - /// The search term to use + /// The search term to use. public void Search(string searchTerm) { - lock (CommandLock) + lock (this._commandLock) { this._simulator.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LMENU); Native.SetForegroundWindow(this._windowHandle); @@ -85,8 +88,8 @@ public void Search(string searchTerm) /// /// The command. protected void SendCommand(string command) - { - lock (CommandLock) + { + lock (this._commandLock) { // This is to fix the first SetForegroundWindow this._simulator.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LMENU); @@ -103,4 +106,4 @@ protected void SendCommand(string command) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Helpers/PoeKeyboardHelper.cs b/src/Lurker/Helpers/PoeKeyboardHelper.cs index a515b1b1..b75d3c08 100644 --- a/src/Lurker/Helpers/PoeKeyboardHelper.cs +++ b/src/Lurker/Helpers/PoeKeyboardHelper.cs @@ -1,23 +1,26 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.Helpers { - using System; using System.Diagnostics; + /// + /// Represents the PoeKeyboardHelper. + /// + /// public class PoeKeyboardHelper : KeyboardHelper { #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// The window handle. - public PoeKeyboardHelper(Process process) + /// The process. + public PoeKeyboardHelper(Process process) : base(process) { } @@ -122,4 +125,4 @@ public void JoinHideout(string playerName) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Helpers/TokenHelper.cs b/src/Lurker/Helpers/TokenHelper.cs index 986f2520..7c6cb651 100644 --- a/src/Lurker/Helpers/TokenHelper.cs +++ b/src/Lurker/Helpers/TokenHelper.cs @@ -1,20 +1,34 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.Helpers { - using Lurker.Patreon.Events; using System.Text.RegularExpressions; + using Lurker.Patreon.Events; + /// + /// Represents token helper. + /// public static class TokenHelper { #region Fields + /// + /// The item name. + /// public static readonly string ItemName = "{ItemName}"; + + /// + /// The buyer name. + /// public static readonly string BuyerName = "{BuyerName}"; + + /// + /// The price. + /// public static readonly string Price = "{Price}"; #endregion @@ -25,8 +39,10 @@ public static class TokenHelper /// Replaces the token. /// /// The message. - /// The offer. - /// The string with token replaced + /// The trade. + /// + /// The string with token replaced. + /// public static string ReplaceToken(string message, TradeEvent trade) { message = Regex.Replace(message, ItemName, trade.ItemName, RegexOptions.IgnoreCase); @@ -37,4 +53,4 @@ public static string ReplaceToken(string message, TradeEvent trade) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Helpers/TradeEventHelper.cs b/src/Lurker/Helpers/TradeEventHelper.cs index 0b2b45b9..ff90c21a 100644 --- a/src/Lurker/Helpers/TradeEventHelper.cs +++ b/src/Lurker/Helpers/TradeEventHelper.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -10,6 +10,9 @@ namespace Lurker.Helpers using System.Linq; using System.Text.RegularExpressions; + /// + /// Represents the trade event helper. + /// public static class TradeEventHelper { #region Fields @@ -34,7 +37,9 @@ public static class TradeEventHelper /// Determines whether [is trade message] [the specified message]. /// /// The message. - /// + /// + /// true if [is trade message] [the specified message]; otherwise, false. + /// public static bool IsTradeMessage(string message) { if (string.IsNullOrEmpty(message)) @@ -47,4 +52,4 @@ public static bool IsTradeMessage(string message) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Lurker.csproj b/src/Lurker/Lurker.csproj index 424de57d..d832cbad 100644 --- a/src/Lurker/Lurker.csproj +++ b/src/Lurker/Lurker.csproj @@ -22,6 +22,8 @@ DEBUG;TRACE prompt 4 + ..\..\PoeLurker.ruleset + bin\Debug\Lurker.xml pdbonly @@ -149,7 +151,6 @@ - @@ -158,17 +159,23 @@ - + + stylecop.json + + + + + \ No newline at end of file diff --git a/src/Lurker/Models/Collaboration.cs b/src/Lurker/Models/Collaboration.cs index f931f1db..910db8b6 100644 --- a/src/Lurker/Models/Collaboration.cs +++ b/src/Lurker/Models/Collaboration.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,6 +9,9 @@ namespace Lurker.Models using System; using System.Diagnostics; + /// + /// Represents a collaboration. + /// public class Collaboration { #region Properties @@ -34,7 +37,10 @@ public class Collaboration /// /// Determines whether this instance is expired. - /// + /// + /// + /// true if this instance is expired; otherwise, false. + /// public bool IsExpired() { return DateTime.Compare(DateTime.Now, this.ExpireDate) >= 0 ? true : false; @@ -50,4 +56,4 @@ public void Open() #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Models/FBCMRequest.cs b/src/Lurker/Models/FBCMRequest.cs deleted file mode 100644 index cd7c7d02..00000000 --- a/src/Lurker/Models/FBCMRequest.cs +++ /dev/null @@ -1,22 +0,0 @@ -//----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. -// -//----------------------------------------------------------------------- - -namespace Lurker.Models -{ - public class FBCMRequest - { - - /// - /// Gets or sets to. - /// - public string To { get; set; } - - /// - /// Gets or sets the data. - /// - public object Data { get; set; } - } -} diff --git a/src/Lurker/Models/PoeApplicationContext.cs b/src/Lurker/Models/PoeApplicationContext.cs index 48275267..22533089 100644 --- a/src/Lurker/Models/PoeApplicationContext.cs +++ b/src/Lurker/Models/PoeApplicationContext.cs @@ -1,11 +1,14 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.Models { + /// + /// Represents an applicaiton context. + /// public static class PoeApplicationContext { #region Properties @@ -22,4 +25,4 @@ public static class PoeApplicationContext #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Models/PoeWindowInformation.cs b/src/Lurker/Models/PoeWindowInformation.cs index b688fb2d..c28149a2 100644 --- a/src/Lurker/Models/PoeWindowInformation.cs +++ b/src/Lurker/Models/PoeWindowInformation.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -8,7 +8,11 @@ namespace Lurker.Models { using System; - public class PoeWindowInformation: EventArgs + /// + /// Represents the Poe window information. + /// + /// + public class PoeWindowInformation : EventArgs { #region Properties @@ -44,4 +48,4 @@ public class PoeWindowInformation: EventArgs #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Models/Settings.cs b/src/Lurker/Models/Settings.cs index 489f0587..ea680644 100644 --- a/src/Lurker/Models/Settings.cs +++ b/src/Lurker/Models/Settings.cs @@ -1,15 +1,18 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.Models { - using ConfOxide; using System.ComponentModel; + using ConfOxide; - public sealed class Settings: SettingsBase + /// + /// Represents the settings. + /// + public sealed class Settings : SettingsBase { #region Properties @@ -88,7 +91,6 @@ public sealed class Settings: SettingsBase [DefaultValue(true)] public bool ItemHighlightEnabled { get; set; } - /// /// Gets or sets a value indicating whether [item highlight enabled]. /// @@ -124,4 +126,4 @@ public sealed class Settings: SettingsBase #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Native.cs b/src/Lurker/Native.cs index 8b107fa2..990de07f 100644 --- a/src/Lurker/Native.cs +++ b/src/Lurker/Native.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,6 +9,7 @@ namespace Lurker using System; using System.Runtime.InteropServices; + #pragma warning disable public static class Native { public static bool IsKeyPressed(VirtualKeyStates nVirtKey) @@ -292,4 +293,4 @@ public enum VirtualKeyStates : int VK_OEM_CLEAR = 0xFE } } -} +} \ No newline at end of file diff --git a/src/Lurker/ProcessLurker.cs b/src/Lurker/ProcessLurker.cs index 26adb5b9..2e4f71da 100644 --- a/src/Lurker/ProcessLurker.cs +++ b/src/Lurker/ProcessLurker.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -13,13 +13,17 @@ namespace Lurker using System.Threading; using System.Threading.Tasks; + /// + /// Represents the process lurker. + /// + /// public class ProcessLurker : IDisposable { #region Fields + private static readonly int WaitingTime = 5000; private IEnumerable _processNames; private CancellationTokenSource _tokenSource; - private static readonly int WaitingTime = 5000; private Process _activeProcess; #endregion @@ -61,7 +65,7 @@ public ProcessLurker(IEnumerable processNames) /// /// Waits for process. /// - /// + /// The process. public async Task WaitForProcess() { var process = this.GetProcess(); @@ -104,8 +108,8 @@ protected virtual void Dispose(bool disposing) /// /// Gets the process. /// - /// - /// Path of Exile is not running + /// The process. + /// Path of Exile is not running. private Process GetProcess() { if (this._activeProcess != null) @@ -148,7 +152,9 @@ await Task.Run(() => process = this.GetProcess(); } } - catch { } + catch + { + } finally { this.ProcessClosed?.Invoke(this, EventArgs.Empty); @@ -159,8 +165,7 @@ await Task.Run(() => /// /// Gets the window handle. /// - /// - /// + /// The process. private Process WaitForWindowHandle() { Process currentProcess; @@ -171,12 +176,7 @@ private Process WaitForWindowHandle() { var process = this.GetProcess(); Thread.Sleep(200); - if (process == null) - { - throw new System.InvalidOperationException(); - } - - currentProcess = process; + currentProcess = process ?? throw new InvalidOperationException(); } while (currentProcess.MainWindowHandle == IntPtr.Zero); } @@ -190,4 +190,4 @@ private Process WaitForWindowHandle() #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Properties/AssemblyInfo.cs b/src/Lurker/Properties/AssemblyInfo.cs index b13519b4..c930fdd7 100644 --- a/src/Lurker/Properties/AssemblyInfo.cs +++ b/src/Lurker/Properties/AssemblyInfo.cs @@ -1,5 +1,10 @@ -using System.Reflection; -using System.Runtime.CompilerServices; +//----------------------------------------------------------------------- +// +// Copyright © Wohs Inc. +// +//----------------------------------------------------------------------- + +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -33,4 +38,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/src/Lurker/Services/AssetService.cs b/src/Lurker/Services/AssetService.cs index 3cf5ea11..adbe809f 100644 --- a/src/Lurker/Services/AssetService.cs +++ b/src/Lurker/Services/AssetService.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -9,6 +9,9 @@ namespace Lurker.Services using System; using System.IO; + /// + /// Represents the asset service. + /// public static class AssetService { #region Properties @@ -36,7 +39,7 @@ public static class AssetService /// Gets the specified file name. /// /// Name of the file. - /// The file content + /// The file content. public static string Get(string fileName) { return File.ReadAllText(Path.Combine(SettingsFolderPath, fileName)); @@ -88,4 +91,4 @@ public static void Update(string fileName, string content) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Services/CollaborationService.cs b/src/Lurker/Services/CollaborationService.cs index 32e0f179..d0ce9402 100644 --- a/src/Lurker/Services/CollaborationService.cs +++ b/src/Lurker/Services/CollaborationService.cs @@ -1,19 +1,24 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.Services { - using Lurker.Models; - using Newtonsoft.Json; using System; using System.Threading.Tasks; + using Lurker.Models; + using Newtonsoft.Json; + /// + /// Represents the collaboation Service. + /// + /// public class CollaborationService : HttpServiceBase { #region Fields + private static readonly string BaseGitUrl = "https://raw.githubusercontent.com/C1rdec/Poe-Lurker/master/assets/Collaboration/"; private static readonly string InformationFileUrl = $"{BaseGitUrl}Info"; private static readonly string ImageFileUrl = $"{BaseGitUrl}Image"; @@ -25,7 +30,7 @@ public class CollaborationService : HttpServiceBase /// /// Gets the collaboration asynchronous. /// - /// + /// The collaboration. public async Task GetCollaborationAsync() { try @@ -37,7 +42,7 @@ public async Task GetCollaborationAsync() { return new Collaboration() { - ExpireDate = DateTime.Now.AddDays(-1) + ExpireDate = DateTime.Now.AddDays(-1), }; } } @@ -45,12 +50,12 @@ public async Task GetCollaborationAsync() /// /// Gets the image asynchronous. /// - /// The image content - public async Task GetImageAsync() + /// The image content. + public Task GetImageAsync() { - return await this.GetContent(ImageFileUrl); + return this.GetContent(ImageFileUrl); } #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Services/FireBaseService.cs b/src/Lurker/Services/FireBaseService.cs deleted file mode 100644 index f5ff362b..00000000 --- a/src/Lurker/Services/FireBaseService.cs +++ /dev/null @@ -1,79 +0,0 @@ -//----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. -// -//----------------------------------------------------------------------- - -using FirebaseAdmin.Messaging; -using Google.Apis.Auth.OAuth2; -using Lurker.Models; -using Lurker.Patreon.Events; -using Lurker.Patreon.Models; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using System.Collections.Generic; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; - -namespace Lurker.Services -{ - public class FireBaseService : HttpServiceBase - { - #region Fields - - private static readonly string BaseUrl = "https://fcm.googleapis.com/fcm/send"; - - #endregion - - #region Constructors - - #endregion - - #region Methods - - public async Task SendMessageAsync(string message) - { - var credential = GoogleCredential.GetApplicationDefault(); - FirebaseAdmin.FirebaseApp.Create(); - var message2 = new Message() - { - Token = "c_QIkJm668Q:APA91bEN_AqY47lBMaK-rN6e7fk8r7Ey_tkUyRux3SeMVmlrNEkmBB7r6ujil5h-llJCV9itr5KfsPQjIIkhuXAnj_SBdSV_20gGtZsgPd2u1OtU4VO16aEDZE8WxAkgt8HnoASoma6l", - Data = new Dictionary() { { "CurrencyType", CurrencyType.Chaos.ToString() } , { "NumberOfCurrencies", "69" } } - }; - await FirebaseMessaging.DefaultInstance.SendAsync(message2); - - var request = new FBCMRequest() - { - To = "c_QIkJm668Q:APA91bEN_AqY47lBMaK-rN6e7fk8r7Ey_tkUyRux3SeMVmlrNEkmBB7r6ujil5h-llJCV9itr5KfsPQjIIkhuXAnj_SBdSV_20gGtZsgPd2u1OtU4VO16aEDZE8WxAkgt8HnoASoma6l", - Data = new SimpleTradeModel() { Price = new Price() { CurrencyType = CurrencyType.Chaos, NumberOfCurrencies = 69 } }, - }; - - var serializerSettings = new JsonSerializerSettings(); - serializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); - var json = JsonConvert.SerializeObject(request, serializerSettings); - - var data = new StringContent(json, Encoding.UTF8, "application/json"); - - var response = await this._client.PostAsync(BaseUrl, data); - } - - public async Task Authenticate() - { - var apiKey = "AIzaSyBOwZja1ky4eINiF7Ma0QO5q6d3pLXuZyA"; - var cloundMessagingToken = "AAAAnYEYm-0:APA91bFPe6B0P7WDA-rpfoidaj1UK8z-TniWjO7fDthYTb_ezXNc0UTI_q0ZYRzFlOKmVtSiJjNkq_wp66fsXd1lm2EhxDVBxVAFGwBODPNnPsJSdC8nPDoIk23Jr1wk6h-uDkjvGjkU"; - var url = $"https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key={apiKey}"; - - - var serializerSettings = new JsonSerializerSettings(); - serializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); - var json = JsonConvert.SerializeObject(new { token = cloundMessagingToken, returnSecureToken = true}, serializerSettings); - - var data = new StringContent(json, Encoding.UTF8, "application/json"); - - var response = await this._client.PostAsync(url, data); - } - - #endregion - } -} diff --git a/src/Lurker/Services/HttpServiceBase.cs b/src/Lurker/Services/HttpServiceBase.cs index 17e2b67d..828b6608 100644 --- a/src/Lurker/Services/HttpServiceBase.cs +++ b/src/Lurker/Services/HttpServiceBase.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- @@ -10,14 +10,12 @@ namespace Lurker.Services using System.Net.Http; using System.Threading.Tasks; + /// + /// Http Service base. + /// + /// public abstract class HttpServiceBase : IDisposable { - #region Fields - - protected HttpClient _client; - - #endregion - #region Constructors /// @@ -25,9 +23,18 @@ public abstract class HttpServiceBase : IDisposable /// protected HttpServiceBase() { - this._client = new HttpClient(); + this.Client = new HttpClient(); } + #region Properties + + /// + /// Gets or sets the client. + /// + protected HttpClient Client { get; set; } + + #endregion + #endregion #region Methods @@ -48,17 +55,19 @@ protected virtual void Dispose(bool isDisposing) { if (isDisposing) { - this._client.Dispose(); + this.Client.Dispose(); } } /// /// Creates the authorize URL. /// + /// The URL. + /// The text. protected async Task GetText(string url) { var request = new HttpRequestMessage(HttpMethod.Get, url); - var response = await this._client.SendAsync(request); + var response = await this.Client.SendAsync(request); return await response.Content.ReadAsStringAsync(); } @@ -66,13 +75,14 @@ protected async Task GetText(string url) /// Gets the content. /// /// The URL. + /// The byte­[]. protected async Task GetContent(string url) { var request = new HttpRequestMessage(HttpMethod.Get, url); - var response = await this._client.SendAsync(request); + var response = await this.Client.SendAsync(request); return await response.Content.ReadAsByteArrayAsync(); } #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Services/SettingsService.cs b/src/Lurker/Services/SettingsService.cs index 17b139c8..7f66dec6 100644 --- a/src/Lurker/Services/SettingsService.cs +++ b/src/Lurker/Services/SettingsService.cs @@ -1,17 +1,20 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.Services { + using System; + using System.IO; using ConfOxide; using Lurker.Helpers; using Lurker.Models; - using System; - using System.IO; + /// + /// The settings service. + /// public class SettingsService { #region Fields @@ -66,6 +69,9 @@ public SettingsService() #region Events + /// + /// Occurs when [on save]. + /// public event EventHandler OnSave; #endregion @@ -126,7 +132,7 @@ public string ThankYouMessage } /// - /// Gets or sets the first launch. + /// Gets or sets a value indicating whether [first launch]. /// public bool FirstLaunch { @@ -399,7 +405,7 @@ public string LifeForeground /// /// Gets the settings folder path. /// - private string SettingsFolderPath => System.IO.Path.Combine(AppDataFolderPath, FolderName); + private string SettingsFolderPath => System.IO.Path.Combine(this.AppDataFolderPath, this.FolderName); /// /// Gets the settings file path. @@ -419,6 +425,9 @@ public void Save() this.OnSave?.Invoke(this, EventArgs.Empty); } + /// + /// Creates the default settings. + /// private void CreateDefaultSettings() { using (var file = File.Create(this.SettingsFilePath)) @@ -435,4 +444,4 @@ private void CreateDefaultSettings() #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/Services/SoundService.cs b/src/Lurker/Services/SoundService.cs index 4d44016c..a213c537 100644 --- a/src/Lurker/Services/SoundService.cs +++ b/src/Lurker/Services/SoundService.cs @@ -1,15 +1,18 @@ //----------------------------------------------------------------------- -// -// Missing Copyright information from a valid stylecop.json file. +// +// Copyright © Wohs Inc. // //----------------------------------------------------------------------- namespace Lurker.Services { - using NAudio.Wave; using System; using System.IO; + using NAudio.Wave; + /// + /// Represents the sound services. + /// public class SoundService { #region Methods @@ -57,4 +60,4 @@ private void Play(Stream stream, float volume) #endregion } -} +} \ No newline at end of file diff --git a/src/Lurker/packages.config b/src/Lurker/packages.config index da301389..4f6486b5 100644 --- a/src/Lurker/packages.config +++ b/src/Lurker/packages.config @@ -28,6 +28,7 @@ + \ No newline at end of file diff --git a/stylecop.json b/stylecop.json new file mode 100644 index 00000000..39cd28e8 --- /dev/null +++ b/stylecop.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "documentationRules": { + "companyName": "Wohs Inc.", + "copyrightText": "Copyright © {companyName}" + }, + "layoutRules": { + "newlineAtEndOfFile": "omit" + } + } +} \ No newline at end of file