|
@@ -167,41 +167,52 @@ namespace PRS.Mobile
|
|
|
|
|
|
private void CheckAutoConfigurationLink()
|
|
|
{
|
|
|
- var parameters = App.LaunchParameters;
|
|
|
- App.LaunchParameters = "";
|
|
|
-
|
|
|
- if (String.IsNullOrWhiteSpace(parameters))
|
|
|
- return;
|
|
|
-
|
|
|
- var decrypted = Encryption.Decrypt(parameters, "logindetailslink");
|
|
|
- if (decrypted?.ToUpper()?.Contains("ENDURLS") == true)
|
|
|
+ try
|
|
|
{
|
|
|
- var comps = decrypted.Split("ENDURLS");
|
|
|
- if (comps.Length == 2)
|
|
|
+ var parameters = App.LaunchParameters;
|
|
|
+ App.LaunchParameters = "";
|
|
|
+
|
|
|
+ if (String.IsNullOrWhiteSpace(parameters))
|
|
|
+ return;
|
|
|
+
|
|
|
+ var decrypted = Encryption.Decrypt(parameters, "logindetailslink");
|
|
|
+ if (decrypted?.ToUpper()?.Contains("ENDURLS") == true)
|
|
|
{
|
|
|
- var urls = comps.First().Split(',');
|
|
|
- var settings = comps.Last().Split(',');
|
|
|
- if (urls.Any() && (settings.Length == 3))
|
|
|
+ var comps = decrypted.Split("ENDURLS");
|
|
|
+ if (comps.Length == 2)
|
|
|
{
|
|
|
- String user = settings[0];
|
|
|
- String password = settings[1];
|
|
|
- DateTime expiry = DateTime.Parse(settings[2]);
|
|
|
- if (expiry > DateTime.Now)
|
|
|
+ var urls = comps.First().Split(',').Where(x => x != "").ToArray();
|
|
|
+ var settings = comps.Last().Split(',').Where(x => x != "").ToArray();
|
|
|
+ if (urls.Any() && (settings.Length == 3))
|
|
|
{
|
|
|
- _settings.URLs = urls;
|
|
|
- _settings.UserID = user;
|
|
|
- _settings.Password = password;
|
|
|
- new LocalConfiguration<DatabaseSettings>().Save(_settings);
|
|
|
- DisplayAlert("Autoconfiguration", "Configuration Updated Successfully!!", "OK").Wait();
|
|
|
+ String user = settings[0];
|
|
|
+ String password = settings[1];
|
|
|
+ DateTime expiry = DateTime.Parse(settings[2]);
|
|
|
+ if (expiry > DateTime.Now)
|
|
|
+ {
|
|
|
+ _settings = new DatabaseSettings();
|
|
|
+ _settings.URLs = urls;
|
|
|
+ _settings.UserID = user;
|
|
|
+ _settings.Password = password;
|
|
|
+ new LocalConfiguration<DatabaseSettings>().Save(_settings);
|
|
|
+ DisplayAlert("Autoconfiguration", "Configuration Updated Successfully!!", "OK");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ DisplayAlert("AutoConfiguration", "AutoConfiguration Link has expired!", "OK");
|
|
|
}
|
|
|
- DisplayAlert("AutoConfiguration", "AutoConfiguration Link has expired!", "OK").Wait();
|
|
|
+ else
|
|
|
+ DisplayAlert("AutoConfiguration", "Invalid AutoConfiguration content!", "OK");
|
|
|
}
|
|
|
- DisplayAlert("AutoConfiguration", "Invalid AutoConfiguration content!", "OK").Wait();
|
|
|
+ else
|
|
|
+ DisplayAlert("AutoConfiguration", "Invalid AutoConfiguration structure!", "OK");
|
|
|
}
|
|
|
- DisplayAlert("AutoConfiguration", "Invalid AutoConfiguration structure!", "OK").Wait();
|
|
|
+ else
|
|
|
+ DisplayAlert("AutoConfiguration", "Invalid AutoConfiguration format!", "OK");
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ DisplayAlert("Error loading from link", e.Message, "OK");
|
|
|
}
|
|
|
- DisplayAlert("AutoConfiguration", "Invalid AutoConfiguration format!", "OK").Wait();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void LoadSettings()
|