Skip to content

Commit

Permalink
Merge pull request #56 from Rennerdo30/master
Browse files Browse the repository at this point in the history
Fix for #52
  • Loading branch information
maikebing authored May 3, 2019
2 parents c006cb2 + c5d5c8b commit 1f2bdf4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/GitLab.VisualStudio/Services/Storage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ private void SaveUserToLocal(User user)
System.IO.File.WriteAllText(_path, Newtonsoft.Json.JsonConvert.SerializeObject(user));
user.PrivateToken = pt;
}
catch (Exception )
catch (Exception)
{

}
}

Expand Down Expand Up @@ -144,11 +144,13 @@ private User LoadUser()
try
{
var _path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), $"{new Uri(Host).Host}.gitlab4vs");
if (System.IO.File.Exists(_path))
if (!System.IO.File.Exists(_path))
{
_user = Newtonsoft.Json.JsonConvert.DeserializeObject<User>(System.IO.File.ReadAllText(_path));
_user.PrivateToken = GetToken(_user.Host);
_path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), $"{new Uri(Strings.DefaultHost).Host}.gitlab4vs");
}

_user = Newtonsoft.Json.JsonConvert.DeserializeObject<User>(System.IO.File.ReadAllText(_path));
_user.PrivateToken = GetToken(_user.Host);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -222,11 +224,11 @@ public bool HaveHost(string host)
}
result = HostVersionInfo.ContainsKey(host);

if (!result && Uri.TryCreate(host, UriKind.Absolute, out Uri uri))
if (!result && Uri.TryCreate(host, UriKind.Absolute, out Uri uri))
{
result = HostVersionInfo.ContainsKey(uri.Host);
}

return result;
}

Expand Down

0 comments on commit 1f2bdf4

Please sign in to comment.