Simplified names in Wabbajack.Common

This commit is contained in:
erri120 2019-11-21 16:04:48 +01:00
parent d8276fb2ea
commit 7583703239
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135
3 changed files with 30 additions and 30 deletions

View File

@ -16,25 +16,25 @@ namespace Wabbajack
{
get
{
if (this.Exception != null)
if (Exception != null)
{
return this.Exception.ToString();
return Exception.ToString();
}
return _reason;
}
}
bool IErrorResponse.Succeeded => this.Succeeded;
Exception IErrorResponse.Exception => this.Exception;
bool IErrorResponse.Succeeded => Succeeded;
Exception IErrorResponse.Exception => Exception;
private ErrorResponse(
bool succeeded,
string reason = null,
Exception ex = null)
{
this.Succeeded = succeeded;
this._reason = reason;
this.Exception = ex;
Succeeded = succeeded;
_reason = reason;
Exception = ex;
}
public override string ToString()
@ -76,7 +76,7 @@ namespace Wabbajack
public static ErrorResponse Convert(IErrorResponse err, bool nullIsSuccess = true)
{
if (err == null) return ErrorResponse.Create(nullIsSuccess);
if (err == null) return Create(nullIsSuccess);
return new ErrorResponse(err.Succeeded, err.Reason, err.Exception);
}
}

View File

@ -16,16 +16,16 @@ namespace Wabbajack
{
get
{
if (this.Exception != null)
if (Exception != null)
{
return this.Exception.ToString();
return Exception.ToString();
}
return _reason;
}
}
bool IErrorResponse.Succeeded => this.Succeeded;
Exception IErrorResponse.Exception => this.Exception;
bool IErrorResponse.Succeeded => Succeeded;
Exception IErrorResponse.Exception => Exception;
private GetResponse(
bool succeeded,
@ -33,16 +33,16 @@ namespace Wabbajack
string reason = null,
Exception ex = null)
{
this.Value = val;
this.Succeeded = succeeded;
this._reason = reason;
this.Exception = ex;
Value = val;
Succeeded = succeeded;
_reason = reason;
Exception = ex;
}
public bool Equals(GetResponse<T> other)
{
return this.Succeeded == other.Succeeded
&& object.Equals(this.Value, other.Value);
return Succeeded == other.Succeeded
&& Equals(Value, other.Value);
}
public override bool Equals(object obj)
@ -66,26 +66,26 @@ namespace Wabbajack
{
return new GetResponse<R>(
succeeded: false,
reason: this._reason,
ex: this.Exception);
reason: _reason,
ex: Exception);
}
public GetResponse<R> Bubble<R>(Func<T, R> conv)
{
return new GetResponse<R>(
succeeded: this.Succeeded,
val: conv(this.Value),
reason: this._reason,
ex: this.Exception);
succeeded: Succeeded,
val: conv(Value),
reason: _reason,
ex: Exception);
}
public T EvaluateOrThrow()
{
if (this.Succeeded)
if (Succeeded)
{
return this.Value;
return Value;
}
throw new ArgumentException(this.Reason);
throw new ArgumentException(Reason);
}
#region Factories

View File

@ -210,7 +210,7 @@ namespace Wabbajack.Common
public static DateTime AsUnixTime(this long timestamp)
{
System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
dtDateTime = dtDateTime.AddSeconds(timestamp).ToLocalTime();
return dtDateTime;
}
@ -751,7 +751,7 @@ namespace Wabbajack.Common
{
return ErrorResponse.Fail(ex.Message);
}
catch (System.IO.PathTooLongException ex)
catch (PathTooLongException ex)
{
return ErrorResponse.Fail(ex.Message);
}
@ -776,7 +776,7 @@ namespace Wabbajack.Common
{
return ErrorResponse.Fail(ex.Message);
}
catch (System.IO.PathTooLongException ex)
catch (PathTooLongException ex)
{
return ErrorResponse.Fail(ex.Message);
}