Skip to content

Commit

Permalink
Fix for #52
Browse files Browse the repository at this point in the history
  • Loading branch information
rennerdo30 committed May 3, 2019
1 parent c006cb2 commit c5d5c8b
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 c5d5c8b

Please sign in to comment.