Skip to content

Commit

Permalink
リリースのためのダミープルリクのついでに、コード全体にフォーマッタをかけて作成
Browse files Browse the repository at this point in the history
  • Loading branch information
samunohito committed Apr 12, 2022
1 parent be0fce7 commit 0005cab
Show file tree
Hide file tree
Showing 32 changed files with 132 additions and 119 deletions.
12 changes: 6 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
<Version>3.4.255</Version>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
<Version>3.4.255</Version>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
19 changes: 11 additions & 8 deletions SimpleVolumeMixer/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@
MahApps.Metro resource dictionaries.
Learn more about using MahApps.Metro at https://mahapps.com/
-->
<ResourceDictionary
<ResourceDictionary
Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary
<ResourceDictionary
Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />

<!--Material Design-->
<materialDesign:MahAppsBundledTheme BaseTheme="Inherit" PrimaryColor="Grey" SecondaryColor="Lime" />
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.Grey.Primary.xaml" />

<!--Material Design: MahApps統合設定 -->
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignThemes.MahApps;component/Themes/MaterialDesignTheme.MahApps.Fonts.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignThemes.MahApps;component/Themes/MaterialDesignTheme.MahApps.Flyout.xaml" />

<ResourceDictionary Source="/UI/Styles/_FontSizes.xaml" />
<ResourceDictionary Source="/UI/Styles/_Thickness.xaml" />
<ResourceDictionary Source="/UI/Styles/MetroWindow.xaml" />
Expand All @@ -49,11 +49,14 @@
</ResourceDictionary.MergedDictionaries>

<SolidColorBrush x:Key="PrimaryHueLightBrush" Color="{StaticResource Primary200}" po:Freeze="True" />
<SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="{StaticResource Primary200Foreground}" po:Freeze="True" />
<SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="{StaticResource Primary200Foreground}"
po:Freeze="True" />
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="{StaticResource Primary500}" po:Freeze="True" />
<SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="{StaticResource Primary500Foreground}" po:Freeze="True" />
<SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="{StaticResource Primary500Foreground}"
po:Freeze="True" />
<SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="{StaticResource Primary700}" po:Freeze="True" />
<SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="{StaticResource Primary700Foreground}" po:Freeze="True" />
<SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="{StaticResource Primary700Foreground}"
po:Freeze="True" />
</ResourceDictionary>
</Application.Resources>
</prism:PrismApplication>
13 changes: 8 additions & 5 deletions SimpleVolumeMixer/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected override async void OnInitialized()

var themeSelectorService = Container.Resolve<IThemeSelectorService>();
themeSelectorService.InitializeTheme();

base.OnInitialized();
await Task.CompletedTask;
}
Expand All @@ -66,15 +66,18 @@ protected override void RegisterTypes(IContainerRegistry containerRegistry)
containerRegistry.Register<ISystemService, SystemService>();
containerRegistry.Register<IPersistAndRestoreService, PersistAndRestoreService>();
containerRegistry.Register<IThemeSelectorService, ThemeSelectorService>();

// UseCases
containerRegistry.GetContainer().RegisterType<AudioSessionsPageUseCase>(new DisposableComponentLifetimeManager());
containerRegistry.GetContainer()
.RegisterType<AudioSessionsPageUseCase>(new DisposableComponentLifetimeManager());

// Views
containerRegistry.RegisterForNavigation<SettingsPage, SettingsPageViewModel>(PageKeys.Settings);
containerRegistry.RegisterForNavigation<AudioSessionsPage, AudioSessionsPageViewModel>(PageKeys.AudioSessions);
containerRegistry.RegisterForNavigation<AudioSessionsSubHorizontalPage, AudioSessionsPageSubViewModel>(PageKeys.AudioSessionsSubHorizontal);
containerRegistry.RegisterForNavigation<AudioSessionsSubVerticalPage, AudioSessionsPageSubViewModel>(PageKeys.AudioSessionsSubVertical);
containerRegistry.RegisterForNavigation<AudioSessionsSubHorizontalPage, AudioSessionsPageSubViewModel>(
PageKeys.AudioSessionsSubHorizontal);
containerRegistry.RegisterForNavigation<AudioSessionsSubVerticalPage, AudioSessionsPageSubViewModel>(
PageKeys.AudioSessionsSubVertical);
containerRegistry.RegisterForNavigation<AudioDevicesPage, AudioDevicesPageViewModel>(PageKeys.AudioDevices);

containerRegistry.RegisterForNavigation<ShellWindow, ShellWindowViewModel>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void Dispose()
{
return;
}

OnDisposing();
_disposable.Dispose();
OnDisposed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private void KeyOnDisposed(object? sender, EventArgs e)
{
return;
}

lock (_gate)
{
var key = (TK)sender;
Expand Down
5 changes: 2 additions & 3 deletions SimpleVolumeMixer/Core/Helper/Component/QueueProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

namespace SimpleVolumeMixer.Core.Helper.Component;


public class QueueProcessor<TP, TR> : DisposableComponent
{
private readonly BlockingCollection<QueueProcessorHandle<TP, TR>> _handles;
Expand Down Expand Up @@ -45,7 +44,7 @@ private void DoProcess()
handle.Executed = true;
continue;
}

handle.Result = handle.Function(handle.Argument);
handle.Executed = true;
}
Expand All @@ -56,4 +55,4 @@ protected override void OnDisposing()
StopRequest();
base.OnDisposing();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class AudioSessionAccessorManager : SynchronizedReactiveCollectionWrapper
/// いずれかのセッションが破棄される際に呼び出される
/// </summary>
public event EventHandler<AudioSessionAccessorEventArgs>? SessionDisposing;

/// <summary>
/// いずれかのセッションが破棄された際に呼び出される
/// </summary>
Expand All @@ -31,7 +32,7 @@ public AudioSessionAccessorManager(AudioDeviceAccessor device, ILogger logger)
_sessionManager.SessionManagerClosed += OnSessionManagerClosed;
_sessionManager.SessionCreated += OnSessionCreated;
}

/// <summary>
/// 引数のPIDを持つセッションが内蔵コレクションにあるかを確認する
/// </summary>
Expand Down Expand Up @@ -178,7 +179,7 @@ public void CloseSession()
{
_sessionManager.CloseSessionManager();
}

/// <summary>
/// CoreAudioAPIから新規セッションが作成された旨の通知が届いた際に呼び出される
/// </summary>
Expand All @@ -192,10 +193,10 @@ private void OnSessionCreated(object? sender, SessionCreatedEventArgs e)
{
return;
}

Add(e.NewSession);
}

/// <summary>
/// セッションマネージャの取得が完了した際に呼び出される。
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task OpenSessionManager()
{
// 古いインスタンスがある場合は破棄
CloseSessionManager();

// 個別で破棄するのでDisposableには入れない
_sessionManager = sessionManager;
_eventAdapter = new AudioSessionManagerEventAdapter(sessionManager, _logger);
Expand Down Expand Up @@ -92,7 +92,7 @@ public void CloseSessionManager()
{
return null;
}

return _sessionManager.GetSessionEnumerator();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public AudioDeviceAccessorEventArgs(AudioDeviceAccessor device)
{
Device = device;
}

public AudioDeviceAccessor Device { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

public class AudioSessionAccessorSimpleVolumeChangedEventArgs : AudioSessionAccessorEventArgs
{
public AudioSessionAccessorSimpleVolumeChangedEventArgs(AudioSessionAccessor session, float newVolume, bool isMuted) :
public AudioSessionAccessorSimpleVolumeChangedEventArgs(AudioSessionAccessor session, float newVolume, bool isMuted)
:
base(session)
{
NewVolume = newVolume;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ namespace SimpleVolumeMixer.Core.Helper.CoreAudio.Event;

public class DeviceAccessorRoleHolderChangedEventArgs : AudioDeviceAccessorEventArgs
{
internal DeviceAccessorRoleHolderChangedEventArgs(AudioDeviceAccessor device, RoleType role, bool oldState, bool newState) :
internal DeviceAccessorRoleHolderChangedEventArgs(AudioDeviceAccessor device, RoleType role, bool oldState,
bool newState) :
base(device)
{
Role = role;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected override void OnDisposing()
_session.GroupingParamChanged -= OnGroupingParamChanged;
_session.StateChanged -= OnStateChanged;
_session.SessionDisconnected -= OnSessionDisconnected;

_processor.StopRequest();

base.OnDisposing();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ private void Push(Action action)
protected override void OnDisposing()
{
_logger.LogDebug("disposing...");

_client.DeviceAdded -= OnDeviceAdded;
_client.DeviceRemoved -= OnDeviceRemoved;
_client.DevicePropertyChanged -= OnDevicePropertyChanged;
_client.DeviceStateChanged -= OnDeviceStateChanged;
_client.DefaultDeviceChanged -= OnDefaultDeviceChanged;

_processor.Dispose();

base.OnDisposing();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void DeviceOnDisposed(object? sender, EventArgs e)
{
Dispose();
}

public AudioDeviceAccessor Device { get; }

public ReadOnlyReactiveCollection<AudioSession> Sessions { get; }
Expand Down
2 changes: 1 addition & 1 deletion SimpleVolumeMixer/Core/Services/CoreAudioService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public CoreAudioService(ICoreAudioRepository coreAudioRepository)
public ReadOnlyReactiveCollection<AudioDevice> Devices { get; }
public IReadOnlyReactiveProperty<AudioDevice?> CommunicationRoleDevice { get; }
public IReadOnlyReactiveProperty<AudioDevice?> MultimediaRoleDevice { get; }

public void SetDefaultDevice(AudioDevice device, DataFlowType dataFlowType, RoleType roleType)
{
_coreAudioRepository.SetDefaultDevice(device.Device, dataFlowType, roleType);
Expand Down
2 changes: 1 addition & 1 deletion SimpleVolumeMixer/Core/Services/FileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void Delete(string folderPath, string fileName)
{
throw new ArgumentNullException(nameof(fileName));
}

if (File.Exists(Path.Combine(folderPath, fileName)))
{
File.Delete(Path.Combine(folderPath, fileName));
Expand Down
2 changes: 1 addition & 1 deletion SimpleVolumeMixer/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura />
<Costura/>
</Weavers>
23 changes: 13 additions & 10 deletions SimpleVolumeMixer/NLog.config
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<variable name="Layout"
value="${longdate}\t[t${threadid}]\t[${logger}]\t[${callsite:includeNamespace=false}]\t[${level:upperCase=true}]] ${message} ${exception:format=message,stacktrace} ${event-properties:item=ir-objects}" />
value="${longdate}\t[t${threadid}]\t[${logger}]\t[${callsite:includeNamespace=false}]\t[${level:upperCase=true}]] ${message} ${exception:format=message,stacktrace} ${event-properties:item=ir-objects}"/>

<targets>
<wrapper-target xsi:type="AsyncWrapper" name="ToFile">
<target xsi:type="File"
createDirs="true"
archiveAboveSize="31457280"
<target xsi:type="File"
createDirs="true"
archiveAboveSize="31457280"
archiveNumbering="Sequence"
maxArchiveFiles="5"
maxArchiveFiles="5"
archiveEvery="Day"
layout="${Layout}" />
layout="${Layout}"/>
</wrapper-target>
<wrapper-target xsi:type="AsyncWrapper" name="ToDebug">
<target xsi:type="Debugger"
name="Console">
<layout>${longdate} [t${threadid}] [${logger}] [${callsite:includeNamespace=false}] [${level:upperCase=true}] ${message} ${exception:format=message,stacktrace} ${event-properties:item=ir-objects}</layout>
<layout>${longdate} [t${threadid}] [${logger}] [${callsite:includeNamespace=false}]
[${level:upperCase=true}] ${message} ${exception:format=message,stacktrace}
${event-properties:item=ir-objects}
</layout>
</target>
</wrapper-target>
</targets>

<rules>
<!-- <logger name="*" minlevel="Info" writeTo="ToFile" /> -->
<logger name="default" minlevel="Debug" writeTo="ToDebug" />
<logger name="default" minlevel="Debug" writeTo="ToDebug"/>
</rules>
</nlog>
4 changes: 2 additions & 2 deletions SimpleVolumeMixer/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<data name="SettingsPageGitHubLink" xml:space="preserve">
<value>https://github.com/samunohito/SimpleVolumeMixer</value>
</data>


<data name="SettingsPageRadioButtonDarkTheme" xml:space="preserve">
<value>Dark</value>
</data>
Expand Down
Loading

0 comments on commit 0005cab

Please sign in to comment.