Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
gro-ove committed Nov 26, 2018
1 parent d2b71be commit 5372072
Show file tree
Hide file tree
Showing 134 changed files with 346 additions and 347 deletions.
2 changes: 1 addition & 1 deletion AcManager.ContentRepair/CarRepair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public virtual bool IsAvailable(IEnumerable<CarRepairBase> repairs) {

public abstract class CarSimpleRepairBase : CarRepairBase {
protected virtual Task<bool> FixAsync([NotNull] CarObject car, IProgress<AsyncProgressEntry> progress = null,
CancellationToken cancellation = default(CancellationToken)) {
CancellationToken cancellation = default) {
progress?.Report(AsyncProgressEntry.FromStringIndetermitate("Fixing car…"));
return Task.Run(() => {
var data = car.AcdData;
Expand Down
2 changes: 1 addition & 1 deletion AcManager.ContentRepair/ContentRepairSuggestion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ContentRepairSuggestionFix(ContentRepairSuggestion parent, string fixCapt
_fix = fix;
}

public Task<bool> Fix(IProgress<AsyncProgressEntry> progress = null, CancellationToken cancellation = default(CancellationToken)) {
public Task<bool> Fix(IProgress<AsyncProgressEntry> progress = null, CancellationToken cancellation = default) {
return _fix(progress, cancellation);
}

Expand Down
6 changes: 3 additions & 3 deletions AcManager.ContentRepair/Repairs/CarFlamesRepair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class CarFlamesRepair : CarRepairBase {
private static byte[] _flamesTextures;

private static async Task<byte[]> GetFlamesTexturesAsync(IProgress<AsyncProgressEntry> progress = null,
CancellationToken cancellation = default(CancellationToken)) {
CancellationToken cancellation = default) {
if (_flamesTextures == null) {
progress?.Report(AsyncProgressEntry.FromStringIndetermitate("Loading flames textures…"));
_flamesTextures = await CmApiProvider.GetStaticDataBytesAsync("flames", TimeSpan.FromDays(3), cancellation: cancellation);
Expand All @@ -35,7 +35,7 @@ private static async Task<byte[]> GetFlamesTexturesAsync(IProgress<AsyncProgress
public override bool AffectsData => true;

public static async Task<bool> UpgradeToSecondVersionAsync(CarObject car, IProgress<AsyncProgressEntry> progress = null,
CancellationToken cancellation = default(CancellationToken)) {
CancellationToken cancellation = default) {
progress?.Report(AsyncProgressEntry.FromStringIndetermitate("Updating data…"));
if (!await Task.Run(() => {
var data = car.AcdData;
Expand Down Expand Up @@ -73,7 +73,7 @@ public static async Task<bool> UpgradeToSecondVersionAsync(CarObject car, IProgr
}

public static async Task<bool> FixMissingTexturesAsync(CarObject car, IProgress<AsyncProgressEntry> progress = null,
CancellationToken cancellation = default(CancellationToken)) {
CancellationToken cancellation = default) {
var flamesTextures = await GetFlamesTexturesAsync(progress, cancellation);
if (cancellation.IsCancellationRequested) return false;

Expand Down
4 changes: 2 additions & 2 deletions AcManager.ContentRepair/Repairs/CarModelRepair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CarModelRepair : CarRepairBase {
private static readonly string[] SuspensionNodes = { "SUSP_LF", "SUSP_RF", "SUSP_LR", "SUSP_RR" };

private Task<bool> FixAsync([NotNull] CarObject car, Action<Kn5> fix, IProgress<AsyncProgressEntry> progress = null,
CancellationToken cancellation = default(CancellationToken)) {
CancellationToken cancellation = default) {
progress?.Report(AsyncProgressEntry.FromStringIndetermitate("Fixing car…"));
return Task.Run(() => {
var kn5Filename = AcPaths.GetMainCarFilename(car.Location, car.AcdData, false);
Expand All @@ -31,7 +31,7 @@ private Task<bool> FixAsync([NotNull] CarObject car, Action<Kn5> fix, IProgress<
}

public static async Task<bool> FixSuspensionNodesAsync(CarObject car, IProgress<AsyncProgressEntry> progress = null,
CancellationToken cancellation = default(CancellationToken)) {
CancellationToken cancellation = default) {
progress?.Report(AsyncProgressEntry.FromStringIndetermitate("Fixing car…"));
return await Task.Run(() => {
var kn5Filename = AcPaths.GetMainCarFilename(car.Location, car.AcdData, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private static string GetSoundbankChecksum(string carId) {
}

private async Task<bool> FixAsync([NotNull] CarObject car, CarObject donor, IProgress<AsyncProgressEntry> progress = null,
CancellationToken cancellation = default(CancellationToken)) {
CancellationToken cancellation = default) {
progress?.Report(AsyncProgressEntry.FromStringIndetermitate("Fixing sound…"));
await car.ReplaceSound(donor);
return true;
Expand Down
2 changes: 1 addition & 1 deletion AcManager.Controls/AcListPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ private void OnBatchActionRunButtonClick(object sender, RoutedEventArgs args) {
if (_selectedBatchAction == null || _list == null) return;

if (_selectedBatchAction.InternalWaitingDialog) {
await _selectedBatchAction.ApplyAsync(_list.SelectedItems, null, default(CancellationToken));
await _selectedBatchAction.ApplyAsync(_list.SelectedItems, null, default);
} else {
using (var waiting = new WaitingDialog()) {
waiting.Report(AsyncProgressEntry.FromStringIndetermitate("Processing…"));
Expand Down
8 changes: 4 additions & 4 deletions AcManager.Controls/AcObjectBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ public AcObjectNew AcObject {
typeof(AcObjectBase), new PropertyMetadata(false));

public bool IsNameReadOnly {
get => GetValue(IsNameReadOnlyProperty) as bool? ?? default(bool);
get => GetValue(IsNameReadOnlyProperty) as bool? ?? default;
set => SetValue(IsNameReadOnlyProperty, value);
}

public static readonly DependencyProperty ShowIconProperty = DependencyProperty.Register(nameof(ShowIcon), typeof(bool),
typeof(AcObjectBase));

public bool ShowIcon {
get => GetValue(ShowIconProperty) as bool? ?? default(bool);
get => GetValue(ShowIconProperty) as bool? ?? default;
set => SetValue(ShowIconProperty, value);
}

Expand Down Expand Up @@ -145,15 +145,15 @@ public Collection<ToolBar> ToolBars {
typeof(AcObjectBase), new PropertyMetadata(true));

public bool Scrollable {
get => GetValue(ScrollableProperty) as bool? ?? default(bool);
get => GetValue(ScrollableProperty) as bool? ?? default;
set => SetValue(ScrollableProperty, value);
}

public static readonly DependencyProperty HeaderPaddingProperty = DependencyProperty.Register(nameof(HeaderPadding), typeof(Thickness),
typeof(AcObjectBase));

public Thickness HeaderPadding {
get => GetValue(HeaderPaddingProperty) as Thickness? ?? default(Thickness);
get => GetValue(HeaderPaddingProperty) as Thickness? ?? default;
set => SetValue(HeaderPaddingProperty, value);
}
}
Expand Down
2 changes: 1 addition & 1 deletion AcManager.Controls/AvalonExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedE
}

public static AvalonEditMode GetMode(DependencyObject obj) {
return obj.GetValue(ModeProperty) as AvalonEditMode? ?? default(AvalonEditMode);
return obj.GetValue(ModeProperty) as AvalonEditMode? ?? default;
}

public static void SetMode(DependencyObject obj, AvalonEditMode value) {
Expand Down
2 changes: 1 addition & 1 deletion AcManager.Controls/BestLapsList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public bool ShowTitle {
typeof(BestLapsList), new FrameworkPropertyMetadata(new Thickness(20d, 0d, 0d, 0d)));

public Thickness EntryPadding {
get => GetValue(EntryPaddingProperty) as Thickness? ?? default(Thickness);
get => GetValue(EntryPaddingProperty) as Thickness? ?? default;
set => SetValue(EntryPaddingProperty, value);
}
}
Expand Down
4 changes: 2 additions & 2 deletions AcManager.Controls/Converters/TimeSpanConverters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private static TimeSpan Convert(string s) {
case 2:
return TimeSpan.FromMinutes((p[0] < 0 ? -1 : 1) * (p[0].Abs() * 60 + p[1]));
default:
return default(TimeSpan);
return default;
}
}

Expand Down Expand Up @@ -56,7 +56,7 @@ private static TimeSpan Convert(string s) {
case 3:
return TimeSpan.FromSeconds((p[0] < 0 ? -1 : 1) * (p[0].Abs() * 3600 + p[1].Abs() * 60 + p[2].Abs()));
default:
return default(TimeSpan);
return default;
}
}

Expand Down
2 changes: 1 addition & 1 deletion AcManager.Controls/Dialogs/BlurredPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private void UpdateOffset() {
_updateOffset.Yield(() => {
try {
if (_loaded && _visual != null) {
var offset = _visual.PointFromScreen(PointToScreen(default(Point)));
var offset = _visual.PointFromScreen(PointToScreen(default));
Viewbox = new Rect(offset.X - _blurRadius, offset.Y - _blurRadius,
ActualWidth + _blurRadius * 2, ActualHeight + _blurRadius * 2);
}
Expand Down
2 changes: 1 addition & 1 deletion AcManager.Controls/Dialogs/ImageViewer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public ImageViewer([NotNull] IEnumerable<T> items, int position, [CanBeNull] Ima
public new T SelectDialog() {
Model.SelectionMode = true;
ShowDialog();
return IsSelected ? _list.ElementAtOrDefault(Model.CurrentPosition) : default(T);
return IsSelected ? _list.ElementAtOrDefault(Model.CurrentPosition) : default;
}

public new ViewModel<T> Model => (ViewModel<T>)DataContext;
Expand Down
4 changes: 2 additions & 2 deletions AcManager.Controls/FavouriteButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ public PathData Data {
typeof(RatingBar), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));

public double Rating {
get => GetValue(RatingProperty) as double? ?? default(double);
get => GetValue(RatingProperty) as double? ?? default;
set => SetValue(RatingProperty, value);
}

public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register(nameof(IsReadOnly), typeof(bool),
typeof(RatingBar));

public bool IsReadOnly {
get => GetValue(IsReadOnlyProperty) as bool? ?? default(bool);
get => GetValue(IsReadOnlyProperty) as bool? ?? default;
set => SetValue(IsReadOnlyProperty, value);
}

Expand Down
4 changes: 2 additions & 2 deletions AcManager.Controls/Graphs/CustomTrackerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static CustomTrackerControl() {
typeof(CustomTrackerControl), new PropertyMetadata(OnPositionOverrideChanged));

public ScreenPoint PositionOverride {
get => GetValue(PositionOverrideProperty) as ScreenPoint? ?? default(ScreenPoint);
get => GetValue(PositionOverrideProperty) as ScreenPoint? ?? default;
set => SetValue(PositionOverrideProperty, value);
}

Expand All @@ -26,7 +26,7 @@ private static void OnPositionOverrideChanged(DependencyObject o, DependencyProp
typeof(CustomTrackerControl), new PropertyMetadata(OnLineExtentsOverrideChanged));

public OxyRect LineExtentsOverride {
get => GetValue(LineExtentsOverrideProperty) as OxyRect? ?? default(OxyRect);
get => GetValue(LineExtentsOverrideProperty) as OxyRect? ?? default;
set => SetValue(LineExtentsOverrideProperty, value);
}

Expand Down
6 changes: 3 additions & 3 deletions AcManager.Controls/Helpers/DelayedPropertyWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public T Value {

var now = DateTime.Now;
if (Interval == TimeSpan.Zero || now - _previousChange > Interval) {
_unappliedValue = default(T);
_unappliedValue = default;
_hasUnappliedValue = false;
_value = value;
_changed(value);
Expand All @@ -43,7 +43,7 @@ public void ForceValue(T newValue) {
if (Equals(newValue, _value)) return;
_timer?.Stop();
_value = newValue;
_unappliedValue = default(T);
_unappliedValue = default;
_hasUnappliedValue = false;
_changed(_value);
_previousChange = DateTime.Now;
Expand All @@ -58,7 +58,7 @@ private void ResetTimer() {
_timer.Tick += (o, eventArgs) => {
_timer.Stop();
_value = _unappliedValue;
_unappliedValue = default(T);
_unappliedValue = default;
_hasUnappliedValue = false;
_changed(_value);
_previousChange = DateTime.Now;
Expand Down
2 changes: 1 addition & 1 deletion AcManager.Controls/OriginIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private static OriginIconDescription FindIcon([CanBeNull] string obj) {
}
}

Cache[key] = default(OriginIconDescription);
Cache[key] = default;
return null;
}

Expand Down
8 changes: 4 additions & 4 deletions AcManager.Controls/PropertiesGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ public FontFamily LabelFontFamily {
typeof(PropertiesGrid));

public FontWeight LabelFontWeight {
get => GetValue(LabelFontWeightProperty) as FontWeight? ?? default(FontWeight);
get => GetValue(LabelFontWeightProperty) as FontWeight? ?? default;
set => SetValue(LabelFontWeightProperty, value);
}

public static readonly DependencyProperty LabelPaddingProperty = DependencyProperty.Register(nameof(LabelPadding), typeof(Thickness),
typeof(PropertiesGrid));

public Thickness LabelPadding {
get => GetValue(LabelPaddingProperty) as Thickness? ?? default(Thickness);
get => GetValue(LabelPaddingProperty) as Thickness? ?? default;
set => SetValue(LabelPaddingProperty, value);
}

Expand Down Expand Up @@ -332,7 +332,7 @@ private void UpdateComputedValues() {
protected override Size MeasureOverride(Size constraint) {
UpdateComputedValues();

if (_columns == 0 || _rows == 0) return default(Size);
if (_columns == 0 || _rows == 0) return default;
var childConstraint =
new Size(Math.Max(constraint.Width - _totalSpacingWidth, 0d) / _columns,
Math.Max((constraint.Height - _totalSpacingHeight) / _rows, 0d));
Expand Down Expand Up @@ -363,7 +363,7 @@ protected override Size MeasureOverride(Size constraint) {
}

protected override Size ArrangeOverride(Size arrangeSize) {
if (_columns == 0 || _rows == 0) return default(Size);
if (_columns == 0 || _rows == 0) return default;
UpdateLabels();

var totalSpacingX = _columns == 0 ? 0 : _horizontalSpacing * (_columns - 1);
Expand Down
6 changes: 3 additions & 3 deletions AcManager.Controls/TemperatureValueLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public double Rounding {
typeof(TemperatureBlock), new PropertyMetadata(OnModeChanged));

public TemperatureUnitMode Mode {
get => GetValue(ModeProperty) as TemperatureUnitMode? ?? default(TemperatureUnitMode);
get => GetValue(ModeProperty) as TemperatureUnitMode? ?? default;
set => SetValue(ModeProperty, value);
}

Expand Down Expand Up @@ -89,7 +89,7 @@ static TemperatureValueLabel() {
typeof(TemperatureValueLabel));

public TemperatureUnitMode Mode {
get => GetValue(ModeProperty) as TemperatureUnitMode? ?? default(TemperatureUnitMode);
get => GetValue(ModeProperty) as TemperatureUnitMode? ?? default;
set => SetValue(ModeProperty, value);
}

Expand All @@ -111,7 +111,7 @@ static DoubleTemperatureValueLabel() {
typeof(DoubleTemperatureValueLabel));

public TemperatureUnitMode Mode {
get => GetValue(ModeProperty) as TemperatureUnitMode? ?? default(TemperatureUnitMode);
get => GetValue(ModeProperty) as TemperatureUnitMode? ?? default;
set => SetValue(ModeProperty, value);
}

Expand Down
2 changes: 1 addition & 1 deletion AcManager.Controls/UserControls/ModernPopup.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private static CustomPopupPlacement[] OnPlacementCallback(Size popupSize, Size t
typeof(ModernPopup), new PropertyMetadata(new Thickness(4d)));

public Thickness Padding {
get => GetValue(PaddingProperty) as Thickness? ?? default(Thickness);
get => GetValue(PaddingProperty) as Thickness? ?? default;
set => SetValue(PaddingProperty, value);
}

Expand Down
2 changes: 1 addition & 1 deletion AcManager.Controls/UserControls/Web/JsBridgeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected T Sync<T>(Func<T> action) {
return action();
} catch (Exception e) {
Logging.Warning(e);
return default(T);
return default;
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion AcManager.Controls/Video/IVideoPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public bool AutoPlay {
new PropertyMetadata(Stretch.Uniform, OnStretchChanged));

public Stretch Stretch {
get => GetValue(StretchProperty) as Stretch? ?? default(Stretch);
get => GetValue(StretchProperty) as Stretch? ?? default;
set => SetValue(StretchProperty, value);
}

Expand Down
2 changes: 1 addition & 1 deletion AcManager.Controls/Video/WindowsMediaPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void MediaPlayer_MediaOpened(object sender, RoutedEventArgs e) {
}
}

private void ResetAndPlay(TimeSpan position = default(TimeSpan)) {
private void ResetAndPlay(TimeSpan position = default) {
_mediaPlayer.Position = position;
_mediaPlayer.Play();
}
Expand Down
4 changes: 2 additions & 2 deletions AcManager.Controls/ViewModels/RaceGridViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ public string ErrorMessage {
}

[ItemCanBeNull]
private async Task<IReadOnlyList<RaceGridEntry>> FindCandidates(CancellationToken cancellation = default(CancellationToken)) {
private async Task<IReadOnlyList<RaceGridEntry>> FindCandidates(CancellationToken cancellation = default) {
var mode = Mode;

// Don’t change anything in Fixed or Manual mode
Expand Down Expand Up @@ -1321,7 +1321,7 @@ public bool ForceFixedSeed {
}

[ItemCanBeNull]
public async Task<IList<Game.AiCar>> GenerateGameEntries(CancellationToken cancellation = default(CancellationToken)) {
public async Task<IList<Game.AiCar>> GenerateGameEntries(CancellationToken cancellation = default) {
if (IsBusy) {
await RebuildGridAsync();
if (cancellation.IsCancellationRequested) return null;
Expand Down
2 changes: 1 addition & 1 deletion AcManager.Controls/ViewModels/UploaderParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public int IsBusy {
public async Task Prepare() {
try {
IsBusy++;
await SelectedUploader.PrepareAsync(default(CancellationToken));
await SelectedUploader.PrepareAsync(default);
} finally {
IsBusy--;
}
Expand Down
2 changes: 1 addition & 1 deletion AcManager.DiscordRpc/DiscordConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ private byte[] Fit(int size) {
}

[ItemCanBeNull]
private async Task<JToken> ReadAsync(CancellationToken cancellation = default(CancellationToken)) {
private async Task<JToken> ReadAsync(CancellationToken cancellation = default) {
if (IsDisposed) throw new DiscordException("Disposed");

// 400 bytes to fit all necessary stuff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ internal class RefreshResponse {
public override async Task ResetAsync(CancellationToken cancellation) {
await base.ResetAsync(cancellation);
_authToken = null;
_authExpiration = default(DateTime);
_authExpiration = default;
Storage.Remove(KeyAuthToken);
Storage.Remove(KeyAuthExpiration);
}
Expand Down
Loading

0 comments on commit 5372072

Please sign in to comment.