public static void SaveConnection(CmsInstance value, SettingsType type) { // Save as the last session var name = "lastsession" + (type == SettingsType.ForImport ? "Import" : "Export"); SetProperty(name, SerializeCmsInstance(value)); var found = false; var sessions = GetConnections(type); foreach (var session in sessions) { if (session.Server == value.Server && session.Instance == value.Instance) { session.Key = value.Key; session.Username = value.Username; SaveConnections(sessions, type); found = true; } } if (!found) { // Not found, so append our item var list = sessions.ToList(); list.Add(value); SaveConnections(list.ToArray(), type); } Settings.Default.Save(); }
public static bool WcoAuthenticate(CmsInstance cms) { try { return(MigrationEngine.WcoAuthenticate(cms)); } catch { return(false); } }
public MigrationEngineWrapper(string server, string instance, string developerKey, string username, string password, bool useWco, string wcoUsername, string wcoPassword) { _cms = new CmsInstance { Server = server, Instance = instance, Key = developerKey, Username = username, Password = password }; if (useWco) { _cms.WcoUsername = wcoUsername; _cms.WcoPassword = wcoPassword; } _migrationEngine = new MigrationEngine(_cms); }
private void SaveConnection() { var cmsInstance = new CmsInstance() { Server = txtServer.Text, Instance = txtInstance.Text, Key = txtDeveloperKey.Text, Username = txtUsername.Text, Password = "", WcoUsername = "", WcoPassword = "" }; if (rbWcoYes.Checked && !string.IsNullOrWhiteSpace(txtWcoUsername.Text)) { cmsInstance.WcoUsername = txtWcoUsername.Text; } AppSettings.SaveConnection(cmsInstance, SettingsType.ForExport); }
private static CmsInstance DeserializeCmsInstance(string value) { if (string.IsNullOrWhiteSpace(value)) { return(null); } var temp = value.Split(",".ToCharArray()); var cmsInstance = new CmsInstance { Server = temp[0], Instance = temp[1], Key = temp[2], Username = temp[3] }; if (temp.Length > 4 && !string.IsNullOrWhiteSpace(temp[4])) { cmsInstance.WcoUsername = temp[4]; } return(cmsInstance); }
private static string SerializeCmsInstance(CmsInstance value) { return(value.Server + "," + value.Instance + "," + value.Key + "," + value.Username + "," + value.WcoUsername); }
public ComboItem(CmsInstance cmsInstance) { CmsInstance = cmsInstance; }