public ConfigConnectionSettingClient(string windowName, ConfigConnection config = null) { InitializeComponent(); this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; this.Title = windowName; InitConfig(config); }
public RadarConnection(ConfigConnection config) { this.Ip = config.Ip; this.Port = config.Port; this.RpcEndPoint = config.RpcEndPoint; this.ColorTableIndex = config.ColorTableIndex; this.IsEnable = config.IsEnable; }
public void InitConfig(ConfigConnection config) { if (config != null) { _config.Ip = config.Ip; _config.Port = config.Port; _config.RpcEndPoint = config.RpcEndPoint; } loadRadarInfo(); }
/// <summary> /// Wraps the call to CreateClient, handling any specific errors that could be thrown /// around invalid PAT and account name and wraps them in a ValidationException with /// a helpful message. /// </summary> private WorkItemClientConnection CreateValidationClient(ConfigConnection connection) { try { return(ClientHelpers.CreateClient(connection)); } catch (Exception e) when(e is VssServiceResponseException && e.Message == "The resource cannot be found.") { throw new ValidationException(connection.Account, (VssServiceResponseException)e); } catch (Exception e) when(e is VssUnauthorizedException) { throw new ValidationException(connection.Account, (VssUnauthorizedException)e); } }
public static WorkItemClientConnection CreateClient(ConfigConnection connection) { Uri url = new Uri(connection.Account.TrimEnd('/')); VssCredentials credentials; if (connection.UseIntegratedAuth) { credentials = new VssCredentials(true); } else { credentials = new VssBasicCredential("", connection.AccessToken); } return(new WorkItemClientConnection(url, credentials)); }
//------------------------------------------------------------------------------ // Get collection of connections from provided configuration //------------------------------------------------------------------------------ private DBConnectionList GetConfigConnections(Configuration configuration) { DBConnectionList configConnections = null; if (configuration != null) { ConnectionStringSettingsList connectionStringSettingsList = GetConnectionStringSettingsList(configuration); if (connectionStringSettingsList != null) { foreach (ConnectionStringSettings connectionStringSettings in connectionStringSettingsList) { DBConnection configConnection = new ConfigConnection(ServiceProvider, connectionStringSettings); if (configConnections == null) { configConnections = new DBConnectionList(); } configConnections.Add(configConnection); } } } return(configConnections); }
/// <summary> /// Get standard configuration from database /// </summary> /// <returns>datatable with standard configuration</returns> public DataTable GetStandardConfigurationAsDataTable() { if (HasConnection) { try { DbCommand sqlCom = ConfigConnection.CreateCommand(); sqlCom.CommandText = "select * from " + Constants.CFG_TABLE_STANDARD; DbDataAdapter da; if (sqlCom is OleDbCommand) { da = new OleDbDataAdapter((OleDbCommand)sqlCom); } else { da = new SqlDataAdapter((SqlCommand)sqlCom); } DataTable dt = new DataTable(); da.Fill(dt); return(dt); } catch (Exception ex) { if (_needsStandardConfiguration) { MessageBox.Show("Loading standard configuration failed: " + Environment.NewLine + ex.Message); } } } return(new DataTable()); }
public override void Initialize() { Connection = new ConfigConnection(); UI = new ConfigUI(); Log = new ConfigLog(); Control = new ConfigControl(); Debug = new ConfigDebug(); Life = new ConfigLife(); FormArsenal = new ConfigFormArsenal(); FormFleet = new ConfigFormFleet(); FormHeadquarters = new ConfigFormHeadquarters(); FormQuest = new ConfigFormQuest(); FormShipGroup = new ConfigFormShipGroup(); FormBrowser = new ConfigFormBrowser(); NotifierExpedition = new ConfigNotifierBase(); NotifierConstruction = new ConfigNotifierBase(); NotifierRepair = new ConfigNotifierBase(); NotifierCondition = new ConfigNotifierBase(); NotifierDamage = new ConfigNotifierDamage(); Whitecap = new ConfigWhitecap(); }
public override void Initialize() { Connection = new ConfigConnection(); UI = new ConfigUI(); Log = new ConfigLog(); Control = new ConfigControl(); Debug = new ConfigDebug(); Life = new ConfigLife(); FormArsenal = new ConfigFormArsenal(); FormDock = new ConfigFormDock(); FormFleet = new ConfigFormFleet(); FormFleetPlus = new ConfigFormFleetPlus(); FormHeadquarters = new ConfigFormHeadquarters(); FormQuest = new ConfigFormQuest(); FormShipGroup = new ConfigFormShipGroup(); FormBrowser = new ConfigFormBrowser(); FormCompass = new ConfigFormCompass(); NotifierExpedition = new ConfigNotifierBase(); NotifierConstruction = new ConfigNotifierBase(); NotifierRepair = new ConfigNotifierBase(); NotifierCondition = new ConfigNotifierBase(); NotifierDamage = new ConfigNotifierDamage(); NotifierAnchorageRepair = new ConfigNotifierAnchorageRepair(); BGMPlayer = new ConfigBGMPlayer(); Whitecap = new ConfigWhitecap(); VersionUpdateTime = DateTimeHelper.TimeToCSVString( SoftwareInformation.UpdateTime ); }
private void ReadConfigConnections(XmlDocument doc) { XmlNodeList nodes = doc.SelectNodes("/updatesp/connection"); if (nodes.Count == 0) { throw new Exception("Unable to read database configuration: can't find any /updatesp/connection nodes"); } foreach (XmlNode node in nodes) { ConfigConnection conn = new ConfigConnection(); conn.name = node.SelectSingleNode("name").InnerText; conn.server = node.SelectSingleNode("server").InnerText; conn.username = node.SelectSingleNode("username").InnerText; conn.pw = node.SelectSingleNode("pw").InnerText; conn.TestConnection(); _configConnections.Add(conn.name, conn); } }
private SqlDataReader Execute(string dbName, ConfigConnection conn, string SQL, bool bIgnoreNotExistForPermissions) { string connstr = conn.makeConnectionString(dbName); SqlConnection MySqlConn = new SqlConnection(connstr); MySqlConn.Open(); SqlCommand MySqlCmd = new SqlCommand(SQL, MySqlConn); SqlDataReader dataReader = MySqlCmd.ExecuteReader(); return dataReader; }
private void ExecuteNonQuery(string dbName, ConfigConnection conn, string SQL, List<SqlParameter> sqlParamList, bool bIgnoreNotExistForPermissions) { string connstr = conn.makeConnectionString(dbName); SqlConnection MySqlConn = new SqlConnection(connstr); MySqlConn.Open(); try { MySqlConn.InfoMessage += new SqlInfoMessageEventHandler(OnInfoMessage); // Supports multiple batches by looking for "\nGO" as a separator string[] cmds = SQL.Split(new string[] { "\nGO" }, StringSplitOptions.RemoveEmptyEntries); foreach (string cmd in cmds) { if (cmd != "\r\n") { SqlCommand MySqlCmd = new SqlCommand(cmd, MySqlConn); AddParamsToCmd(MySqlCmd, sqlParamList); MySqlCmd.CommandTimeout = 0; MySqlCmd.ExecuteNonQuery(); MySqlCmd.Parameters.Clear(); } } } catch (SqlException e) { if (e.Number == 7601)// || conn.database.ToLower().Equals("theguide")) { // Ignore the CONTAINSTABLE error when full text catalogs are missing } else if (bIgnoreNotExistForPermissions && e.Number == 15151) { Console.WriteLine("Permission Warning: " + e.Message); // Ignore if asked to ignore "object doesn't exist when applying permissions" errors } else if (bIgnoreNotExistForPermissions && e.Number == 3701) { // Ignore if asked and trying to drop existing stored procedure } else { throw; } } finally { MySqlConn.Close(); } }