Skip to content

Commit 1f2bdf4

Browse files
authored
Merge pull request #56 from Rennerdo30/master
Fix for #52
2 parents c006cb2 + c5d5c8b commit 1f2bdf4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/GitLab.VisualStudio/Services/Storage.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ private void SaveUserToLocal(User user)
114114
System.IO.File.WriteAllText(_path, Newtonsoft.Json.JsonConvert.SerializeObject(user));
115115
user.PrivateToken = pt;
116116
}
117-
catch (Exception )
117+
catch (Exception)
118118
{
119-
119+
120120
}
121121
}
122122

@@ -144,11 +144,13 @@ private User LoadUser()
144144
try
145145
{
146146
var _path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), $"{new Uri(Host).Host}.gitlab4vs");
147-
if (System.IO.File.Exists(_path))
147+
if (!System.IO.File.Exists(_path))
148148
{
149-
_user = Newtonsoft.Json.JsonConvert.DeserializeObject<User>(System.IO.File.ReadAllText(_path));
150-
_user.PrivateToken = GetToken(_user.Host);
149+
_path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), $"{new Uri(Strings.DefaultHost).Host}.gitlab4vs");
151150
}
151+
152+
_user = Newtonsoft.Json.JsonConvert.DeserializeObject<User>(System.IO.File.ReadAllText(_path));
153+
_user.PrivateToken = GetToken(_user.Host);
152154
}
153155
catch (Exception ex)
154156
{
@@ -222,11 +224,11 @@ public bool HaveHost(string host)
222224
}
223225
result = HostVersionInfo.ContainsKey(host);
224226

225-
if (!result && Uri.TryCreate(host, UriKind.Absolute, out Uri uri))
227+
if (!result && Uri.TryCreate(host, UriKind.Absolute, out Uri uri))
226228
{
227229
result = HostVersionInfo.ContainsKey(uri.Host);
228230
}
229-
231+
230232
return result;
231233
}
232234

0 commit comments

Comments
 (0)