Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/GitHub.Api/Authentication/ICredentialManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface ICredential : IDisposable
interface ICredentialManager
{
Task<ICredential> Load(UriString host);
Task Save(ICredential credential);
Task Save(ICredential cred);
Task Delete(UriString host);
bool HasCredentials();
ICredential CachedCredentials { get; }
Expand Down
6 changes: 3 additions & 3 deletions src/GitHub.Api/Git/GitCredentialManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ public async Task<ICredential> Load(UriString host)
return credential;
}

public async Task Save(ICredential credential)
public async Task Save(ICredential cred)
{
Logger.Trace("Save: {0}", credential.Host);
this.credential = cred;

this.credential = credential;
Logger.Trace("Save: {0}", credential.Host);

if (!await LoadCredentialHelper())
return;
Expand Down
14 changes: 9 additions & 5 deletions src/GitHub.Api/IO/FileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ public FileSystem()
{
}

public FileSystem(string currentDirectory)
/// <summary>
/// Initialize the filesystem object with the path passed in set as the current directory
/// </summary>
/// <param name="directory">Current directory</param>
public FileSystem(string directory)
{
this.currentDirectory = currentDirectory;
this.currentDirectory = directory;
}

public void SetCurrentDirectory(string currentDirectory)
public void SetCurrentDirectory(string directory)
{
Debug.Assert(Path.IsPathRooted(currentDirectory));
this.currentDirectory = currentDirectory;
Debug.Assert(Path.IsPathRooted(directory));
this.currentDirectory = directory;
}

public bool FileExists(string filename)
Expand Down
6 changes: 3 additions & 3 deletions src/GitHub.Api/NewTaskSystem/ConcurrentExclusiveInterleave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ protected override IEnumerable<Task> GetScheduledTasks()
/// <param name="task">The task to be executed.</param>
internal void ExecuteTask(Task task)
{
var processingTaskOnCurrentThread = this.processingTaskOnCurrentThread.Value;
if (!processingTaskOnCurrentThread) this.processingTaskOnCurrentThread.Value = true;
var isProcessingTaskOnCurrentThread = this.processingTaskOnCurrentThread.Value;
if (!isProcessingTaskOnCurrentThread) this.processingTaskOnCurrentThread.Value = true;
//try
//{
TryExecuteTask(task);
Expand All @@ -403,7 +403,7 @@ internal void ExecuteTask(Task task)
// throw;
//}

if (!processingTaskOnCurrentThread) this.processingTaskOnCurrentThread.Value = false;
if (!isProcessingTaskOnCurrentThread) this.processingTaskOnCurrentThread.Value = false;
}

/// <summary>Gets the maximum concurrency level this scheduler is able to support.</summary>
Expand Down
16 changes: 8 additions & 8 deletions src/GitHub.Api/NewTaskSystem/TaskBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface ITask : IAsyncResult
ITask Catch(Action<Exception> handler);
ITask Catch(Func<Exception, bool> handler);
ITask Finally(Action handler);
ITask Finally(Action<bool, Exception> continuation, TaskAffinity affinity = TaskAffinity.Concurrent);
ITask Finally(Action<bool, Exception> actionToContinueWith, TaskAffinity affinity = TaskAffinity.Concurrent);
ITask Defer<T>(Func<T, Task> continueWith, TaskAffinity affinity = TaskAffinity.Concurrent, bool always = false);
ITask Start();
ITask Start(TaskScheduler scheduler);
Expand Down Expand Up @@ -157,22 +157,22 @@ public ITask Finally(Action handler)
return this;
}

public ITask Finally(Action<bool, Exception> continuation, TaskAffinity affinity = TaskAffinity.Concurrent)
public ITask Finally(Action<bool, Exception> actionToContinueWith, TaskAffinity affinity = TaskAffinity.Concurrent)
{
Guard.ArgumentNotNull(continuation, "continuation");
var ret = Then(new ActionTask(Token, continuation) { Affinity = affinity, Name = "Finally" }, true);
Guard.ArgumentNotNull(actionToContinueWith, nameof(actionToContinueWith));
var ret = Then(new ActionTask(Token, actionToContinueWith) { Affinity = affinity, Name = "Finally" }, true);
DependsOn?.SetFaultHandler(ret);
ret.ContinuationIsFinally = true;
return ret;
}

internal virtual ITask Finally<T>(T continuation)
internal virtual ITask Finally<T>(T taskToContinueWith)
where T : TaskBase
{
Guard.ArgumentNotNull(continuation, "continuation");
Guard.ArgumentNotNull(taskToContinueWith, nameof(taskToContinueWith));
continuation = (TaskBase)(object)taskToContinueWith;
continuationAlways = true;
continuation.SetDependsOn(this);
this.continuation = (TaskBase)(object)continuation;
this.continuationAlways = true;
DependsOn?.SetFaultHandler((TaskBase)(object)continuation);
return continuation;
}
Expand Down
26 changes: 13 additions & 13 deletions src/GitHub.Api/Platform/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,16 @@ public override void Rename(string oldKey, string newKey)
SaveToCache(cachePath);
}

private void LoadFromCache(string cachePath)
private void LoadFromCache(string path)
{
logger.Trace("LoadFromCache: {0}", cachePath);
logger.Trace("LoadFromCache: {0}", path);

EnsureCachePath(cachePath);
EnsureCachePath(path);

if (!fileExists(cachePath))
if (!fileExists(path))
return;

var data = readAllText(cachePath, Encoding.UTF8);
var data = readAllText(path, Encoding.UTF8);

try
{
Expand All @@ -135,21 +135,21 @@ private void LoadFromCache(string cachePath)
if (cacheData == null)
{
// cache is corrupt, remove
fileDelete(cachePath);
fileDelete(path);
return;
}
}

private bool SaveToCache(string cachePath)
private bool SaveToCache(string path)
{
logger.Trace("SaveToCache: {0}", cachePath);
logger.Trace("SaveToCache: {0}", path);

EnsureCachePath(cachePath);
EnsureCachePath(path);

try
{
var data = SimpleJson.SerializeObject(cacheData);
writeAllText(cachePath, data);
writeAllText(path, data);
}
catch (Exception ex)
{
Expand All @@ -160,12 +160,12 @@ private bool SaveToCache(string cachePath)
return true;
}

private void EnsureCachePath(string cachePath)
private void EnsureCachePath(string path)
{
if (fileExists(cachePath))
if (fileExists(path))
return;

var di = Path.GetDirectoryName(cachePath);
var di = Path.GetDirectoryName(path);
if (!dirExists(di))
dirCreate(di);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ protected override void InitializeUI()
{
Logger.Trace("Restarted {0}", Environment.Repository);
ProjectWindowInterface.Initialize(Environment.Repository);
var view = Window.GetWindow();
if (view != null)
view.Initialize(this);
var window = Window.GetWindow();
if (window != null)
window.Initialize(this);
}

protected override void SetProjectToTextSerialization()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AuthenticationView : Subview

[NonSerialized] private bool need2fa;
[NonSerialized] private bool busy;
[NonSerialized] private string message;
[NonSerialized] private string errorMessage;
[NonSerialized] private bool enterPressed;
[NonSerialized] private string password = "";

Expand Down Expand Up @@ -148,7 +148,7 @@ private void OnGUILogin()
}
GUILayout.EndHorizontal();

ShowMessage(message, Styles.ErrorLabel);
ShowErrorMessage();

GUILayout.Space(Styles.BaseSpacing + 3);

Expand Down Expand Up @@ -182,7 +182,7 @@ private void OnGUI2FA()
GUILayout.EndHorizontal();
GUILayout.Space(Styles.BaseSpacing);

ShowMessage(message, Styles.ErrorLabel);
ShowErrorMessage();

GUILayout.Space(Styles.BaseSpacing);

Expand Down Expand Up @@ -214,7 +214,7 @@ private void DoRequire2fa(string msg)
Logger.Trace("Strating 2FA - Message:\"{0}\"", msg);

need2fa = true;
message = msg;
errorMessage = msg;
busy = false;
Redraw();
}
Expand All @@ -223,7 +223,7 @@ private void DoResult(bool success, string msg)
{
Logger.Trace("DoResult - Success:{0} Message:\"{1}\"", success, msg);

message = msg;
errorMessage = msg;
busy = false;

if (success == true)
Expand All @@ -236,11 +236,11 @@ private void DoResult(bool success, string msg)
}
}

private void ShowMessage(string message, GUIStyle style)
private void ShowErrorMessage()
{
if (message != null)
if (errorMessage != null)
{
GUILayout.Label(message, style);
GUILayout.Label(errorMessage, Styles.ErrorLabel);
}
}
}
Expand Down