public static ServerInfo[] GetServerList(ServerTypes serverType, string domain) { ServerInfo[] serverList; IntPtr pBuf = IntPtr.Zero; try { int entriesRead = 0; int totalEntries = 0; int result = SafeNativeMethods.NetServerEnum(null, 101, out pBuf, -1, ref entriesRead, ref totalEntries, (uint)serverType, domain, IntPtr.Zero); if (result != Constants.ERROR_SUCCESS && result != Constants.ERROR_MORE_DATA && entriesRead <= 0) { throw new Win32Exception(result); } serverList = new ServerInfo[entriesRead]; int ptr = pBuf.ToInt32(); SERVER_INFO_101 serverInfo; for (int i = 0; i < entriesRead; i++) { serverInfo = (SERVER_INFO_101)Marshal.PtrToStructure(new IntPtr(ptr), typeof(SERVER_INFO_101)); ptr += Marshal.SizeOf(serverInfo); serverList[i] = new ServerInfo(serverInfo); } } finally { FreeBuffer(ref pBuf); } return(serverList); }
private void SetupTestConfiguration(ServerTypes serverType, BrowserTypes browserType) { if (testConfiguration == null) { testConfiguration = new ConfigurationData(serverType, browserType); testConfiguration.Log = Log; testConfiguration.Completed = TestCompleted; testConfiguration.Cancel = delegate() { return(State == States.Cancelling); }; testConfiguration.Pause = TestPause; testConfiguration.Skip = TestSkip; testConfiguration.PauseOnStep = TestPauseOnStep; testConfiguration.ProcessScreenShot = TestProcessScreenShot; testConfiguration.ProcessFile = TestProcessFile; } else { testConfiguration.SetBrowser(browserType); testConfiguration.SetServer(serverType); } }
/// <summary> /// Get connection string for specified server machine type /// </summary> /// <param name="serverType"> /// Type of server machine, it is an enum /// </param> /// <returns> /// Connection string for specified server type. /// </returns> public string GetConnectionString(ServerTypes serverType) { string connectionString = null; // if server type is common then retrieve connection string from application config file if (serverType == ServerTypes.Common) { #if !TEST connectionString = ConfigurationManager.ConnectionStrings[ConfigKeys.DATABASE_CONNECTION].ConnectionString; #else connectionString = ConfigurationManager.ConnectionStrings[ConfigKeys.DATABASE_CONNECTION_TEST].ConnectionString; #endif } else { // server list is null then retrieve server information from database. if (this.serverMachines == null || this.serverMachines.Count == 0) { IBase baseFacde = new BaseFacade(); ServerMachine machines = new ServerMachine(); machines.DatabaseServerType = ServerTypes.Common; this.serverMachines = baseFacde.GetModelsProcedure <ServerMachine>(machines); } // retrieves specified server information from collection using LINQ ServerMachine serverMachine = this.serverMachines.Single(p => p.ServerId == (short)serverType); if (serverMachine != null) { connectionString = serverMachine.ServerValue; } } return(connectionString); }
public ServerTypes GetDataForServerType(ServerTypes STypebject) { DataTable ServerTypesDataTable = new DataTable(); ServerTypes ReturnSTypeobject = new ServerTypes(); try { string SqlQuery = "Select * from ServerTypes where ServerType='" + STypebject.ServerType + "'"; ServerTypesDataTable = objAdaptor.FetchData(SqlQuery); //populate & return data object if (ServerTypesDataTable.Rows.Count > 0) { if (ServerTypesDataTable.Rows[0]["ID"].ToString() != "") { ReturnSTypeobject.ID = int.Parse(ServerTypesDataTable.Rows[0]["ID"].ToString()); } } else { ReturnSTypeobject.ID = 0; } } catch { } finally { } return(ReturnSTypeobject); }
/// <summary> /// Function that finds a server with space for additional clients to be added. /// </summary> /// <param name="serverType">The type of server to search for</param> /// <returns></returns> public override ServerModel GetAvailableServer(ServerTypes serverType) { // Is there a server with room on it? var available = false; var availableServerIndex = -1; foreach (var server in ServerList .Where(server => server.Value.ConnectedClientModelList.Count < ReversiSettings.MaxReversiServerConnections - 1) .Where(server => server.Value.Type == serverType)) { available = true; availableServerIndex = server.Key; break; } // If no servers are available, create a new server; ServerModel newServer; if (!available) { // TODO: Will this crash if there is already a reversi game server running? newServer = new ReversiGameServerModel(GlobalSettings.ServerAddress, GlobalSettings.Port_GameServer); AddServerToManager(newServer); } else { // Retrieve the server by its index value newServer = GetServerFromListById(availableServerIndex); } return(newServer); }
private Servers CollectDataForServers(string Mode, DataRow ServersRow) { try { Servers ServersObject = new Servers(); if (Mode == "Update") { ServersObject.ID = int.Parse(ServersRow["ID"].ToString()); } ServersObject.ServerName = ServersRow["ServerName"].ToString(); ServersObject.IPAddress = ServersRow["IPAddress"].ToString(); ServersObject.Description = ServersRow["Description"].ToString(); ServerTypes STypeobject = new ServerTypes(); STypeobject.ServerType = ServersRow["ServerType"].ToString(); ServersObject.LocationID = int.Parse(ServersRow["LocationID"].ToString()); ServerTypes ReturnValue = VSWebBL.SecurityBL.ServerTypesBL.Ins.GetDataForServerType(STypeobject); ServersObject.ServerTypeID = ReturnValue.ID; Locations LOCobject = new Locations(); LOCobject.Location = ServersRow["Location"].ToString(); Locations ReturnLocValue = VSWebBL.SecurityBL.LocationsBL.Ins.GetDataForLocation(LOCobject); ServersObject.LocationID = ReturnLocValue.ID; return(ServersObject); } catch (Exception ex) { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }
private Servers CollectDataForWebSphereServers() { try { Servers ServersObject = new Servers(); ServersObject.ServerName = NameTextBox.Text; ServersObject.IPAddress = "111.898.2435"; ServersObject.Description = DescTextBox.Text; ServerTypes STypeobject = new ServerTypes(); STypeobject.ServerType = "WebSphere"; ServerTypes ReturnValue = VSWebBL.SecurityBL.ServerTypesBL.Ins.GetDataForServerType(STypeobject); ServersObject.ServerTypeID = ReturnValue.ID; Locations LOCobject = new Locations(); LOCobject.Location = LocationComboBox.Text; Locations ReturnLocValue = VSWebBL.SecurityBL.LocationsBL.Ins.GetDataForLocation(LOCobject); ServersObject.LocationID = ReturnLocValue.ID; return(ServersObject); } catch (Exception ex) { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }
public static T[] NetServerEnum <T>(ServerTypes serverTypes = ServerTypes.Workstation | ServerTypes.Server, string domain = null, int level = 0) where T : struct { if (level == 0) { level = int.Parse(System.Text.RegularExpressions.Regex.Replace(typeof(T).Name, @"[^\d]", "")); } IntPtr bufptr = IntPtr.Zero; try { int entriesRead, totalEntries; IntPtr resumeHandle = IntPtr.Zero; int ret = NetServerEnum(null, level, out bufptr, MAX_PREFERRED_LENGTH, out entriesRead, out totalEntries, serverTypes, domain, resumeHandle); if (ret == 0) { return(InteropUtil.ToArray <T>(bufptr, entriesRead)); } throw new System.ComponentModel.Win32Exception(ret); } finally { NetApiBufferFree(bufptr); } }
public bool UpdateServiceCollection(ServerTypes ServerType, string NodeName) { try { VSFramework.VSAdaptor adapter = new VSFramework.VSAdaptor(); string sql = "Select * from NodeDetails where NodeId=(Select ID from Nodes where Name='" + NodeName + "') and Name='" + ServerType.ToString().Replace("_", " ") + " - UpdateCollection' and Value=1"; DataSet ds = new DataSet(); DataTable dt = new DataTable(); adapter.FillDatasetAny("VitalSigns", "VitalSigns", sql, ref ds, "NodeDetails"); dt = ds.Tables["NodeDetails"]; if (dt.Rows.Count > 0) { string Names = String.Join(",", dt.AsEnumerable().Select(r => r.Field <string>("Name").ToString())); string IDs = String.Join(",", dt.AsEnumerable().Select(r => r.Field <Int32>("ID").ToString())); WriteHistoryEntry("ID " + IDs + " AND Names " + Names + " have been marked for resetCollection. Resetting value to False now..."); sql = "UPDATE NodeDetails set Value=0 where ID in (" + IDs + ")"; adapter.ExecuteNonQueryAny("VitalSigns", "VitalSigns", sql); WriteHistoryEntry("ID " + IDs + " have been reset. Leaving function"); return(true); } return(false); } catch (Exception ex) { WriteHistoryEntry("Error in UpdateServiceCollection. Error: " + ex.Message); } return(true); }
private CloudApplicationsServer CollectDataForCloudApplicationsServer() { try { //Cluster Settings CloudApplicationsServer CloudApplicationsServerObject = new CloudApplicationsServer(); //12/9/2013 NS added CloudApplicationsServerObject.ID = ID; CloudApplicationsServerObject.Name = CredentialsComboBox.Text; CloudApplicationsServerObject.Category = CategoryTextBox.Text; CloudApplicationsServerObject.Enabled = EnabledCheckBox.Checked; //URLsObject.First_Alert_Threshold = int.Parse(AlertTextBox.Text); CloudApplicationsServerObject.OffHoursScanInterval = int.Parse(OffScanTextBox.Text); CloudApplicationsServerObject.ScanInterval = int.Parse(ScanTextBox.Text); CloudApplicationsServerObject.RetryInterval = int.Parse(RetryTextBox.Text); CloudApplicationsServerObject.ResponseThreshold = int.Parse(RespThrTextBox.Text); CloudApplicationsServerObject.SearchStringNotFound = RequiredTextBox.Text; CloudApplicationsServerObject.SearchStringFound = txtSearch.Text; CloudApplicationsServerObject.URL = IPAddressTextBox.Text; CloudApplicationsServerObject.imageurl = Image1.ImageUrl; CloudApplicationsServerObject.UserName = UserNameTextBox.Text; if (PasswordTextBox.Text != "") { if (PasswordTextBox.Text == " ") { PasswordTextBox.Text = ViewState["PWD"].ToString(); } TripleDES tripleDES = new TripleDES(); byte[] encryptedPass = tripleDES.Encrypt(PasswordTextBox.Text); string encryptedPassAsString = string.Join(", ", encryptedPass.Select(s => s.ToString()).ToArray()); CloudApplicationsServerObject.PW = encryptedPassAsString; } // CloudApplicationsServerObject.PW = PasswordTextBox.Text; Locations LOCobject = new Locations(); ServerTypes STypeobject = new ServerTypes(); STypeobject.ServerType = "Cloud"; ServerTypes ReturnValue = VSWebBL.SecurityBL.ServerTypesBL.Ins.GetDataForServerType(STypeobject); CloudApplicationsServerObject.ServerTypeId = ReturnValue.ID; Locations ReturnLocValue = VSWebBL.SecurityBL.LocationsBL.Ins.GetDataForLocation(LOCobject); CloudApplicationsServerObject.LocationId = ReturnLocValue.ID; CloudApplicationsServerObject.Location = ReturnLocValue.Location; CloudApplicationsServerObject.FailureThreshold = int.Parse(SrvAtrFailBefAlertTextBox.Text); return(CloudApplicationsServerObject); } catch (Exception ex) { //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }
public ApiBootstrapper(ComputeServer computeServer, WorkerPool workerPool, AlgorithmFactory algoFactory) { this.computeServer = computeServer; this.workerPool = workerPool; this.algoFactory = algoFactory; serverType = ServerTypes.Compute; }
private void SetupLogFolder(ServerTypes serverType, BrowserTypes browserType, string testName) { string folder = $"{DateTime.Now.ToString("yyyy-MM-dd")}-{serverType}-{browserType}-{testName}"; logFolderPath = System.IO.Path.Combine(txtLogPath.Text, folder); System.IO.Directory.CreateDirectory(logFolderPath); }
internal ServerInfo(SERVER_INFO_101 info) { this.platformId = (PlatformId)info.sv101_platform_id; this.name = info.sv101_name; this.majorVersion = (int)info.sv101_version_major; this.minorVersion = (int)info.sv101_version_minor; this.serverType = (ServerTypes)info.sv101_type; this.comment = info.sv101_comment; }
public bool UpdateeditProfiles(ProfilesMaster StObject, string strsname, string profilemasterid) { bool UpdateRet = false; int Update = 0; try { DataTable dt = new DataTable(); ServerTypes STypebject = new ServerTypes(); ServerTypes RetnSTypebject = new ServerTypes(); STypebject.ServerType = StObject.ServerType; RetnSTypebject = VSWebDAL.SecurityDAL.ServerTypesDAL.Ins.GetDataForServerType(STypebject); StObject.ServerTypeId = RetnSTypebject.ID; if (strsname != "") { string SqlQuery = ""; if (StObject.RoleType == null) { StObject.RoleType = ""; } SqlQuery = "select * from ProfilesMaster where ProfileId='" + strsname + "' and ServerTypeId ='" + StObject.ServerTypeId + "'and AttributeName='" + StObject.AttributeName + "'"; dt = objAdaptor.FetchData(SqlQuery); if (dt.Rows.Count > 0) { SqlQuery = "UPDATE ProfilesMaster set AttributeName='" + StObject.AttributeName + "',isSelected='" + StObject.isSelected + "',UnitOfMeasurement='" + StObject.UnitOfMeasurement + "',RelatedTable='" + StObject.RelatedTable + "',RelatedField='" + StObject.RelatedField + "',DefaultValue='" + StObject.DefaultValue + "',ServerTypeId='" + StObject.ServerTypeId + "',RoleType='" + StObject.RoleType.ToString() + "'where ProfileId='" + strsname + "' and ID='" + profilemasterid + "'"; Update = objAdaptor.ExecuteNonQueryRetRows(SqlQuery); } } } catch { Update = 0; } if (Update == 0) { try { string SqlQuery = ""; SqlQuery = "INSERT INTO ProfilesMaster(ServerTypeId,AttributeName,DefaultValue,UnitOfMeasurement,RelatedTable,RelatedField,RoleType,ProfileId,isSelected) VALUES('" + StObject.ServerTypeId + "','" + StObject.AttributeName + "','" + StObject.DefaultValue + "','" + StObject.UnitOfMeasurement + "','" + StObject.RelatedTable + "','" + StObject.RelatedField + "','" + StObject.RoleType.ToString() + "','" + strsname + "','" + StObject.isSelected + "')"; Update = objAdaptor.ExecuteNonQueryRetRows(SqlQuery); } catch { Update = 0; } } if (Update >= 1) { UpdateRet = true; } return(UpdateRet); }
public ConfigurationData(ServerTypes serverType, BrowserTypes browser) { this.Log = LogConsole; this.ServerType = serverType; this.BrowserType = browser; ConfigureSettings(); }
//public Object UpdateExchangeSettings(NetworkLatency nl) //{ // Object returnval; // try // { // string st = "update NetworkLatencyServers set LatencyYellowThreshold=" + nl.LatencyYellowThreshold + ", LatencyRedThreshold=" + nl.LatencyRedThreshold + ",Enabled='" + nl.Enabled + "' where ID='"+nl.ID+"'"; // returnval = objAdaptor.ExecuteNonQuery(st); // } // catch (Exception e) // { // throw e; // } // return returnval; //} public bool UpdateeditProfiles(NetworkLatency StObject, string strsname) { bool UpdateRet = false; int Update = 0; try { DataTable dt = new DataTable(); ServerTypes STypebject = new ServerTypes(); // RetnSTypebject = VSWebDAL.SecurityDAL.ServerTypesDAL.Ins.GetDataForServerType(STypebject); // StObject.ServerTypeId = RetnSTypebject.ID; if (strsname != "") { string SqlQuery = ""; //if (StObject.RoleType == null) //{ // StObject.RoleType = ""; //} SqlQuery = "select * from NetworkLatencyServers where ServerID='" + strsname + "' "; dt = objAdaptor.FetchData(SqlQuery); if (dt.Rows.Count > 0) { SqlQuery = "UPDATE NetworkLatencyServers set Enabled='" + StObject.Enabled + "',LatencyRedThreshold='" + StObject.LatencyRedThreshold + "',LatencyYellowThreshold='" + StObject.LatencyYellowThreshold + "'where ServerID='" + strsname + "'"; Update = objAdaptor.ExecuteNonQueryRetRows(SqlQuery); } } } catch { Update = 0; } if (Update == 0) { try { string SqlQuery = ""; SqlQuery = "Insert into NetworkLatencyServers(ServerID,NetworkLatencyId,LatencyYellowThreshold , LatencyRedThreshold , Enabled) values" + //"ActiveSyncCredentialsId) values" + "(" + StObject.ServerID + ",'" + StObject.NetworkLatencyId + "','" + StObject.LatencyYellowThreshold + "','" + StObject.LatencyRedThreshold + "','" + StObject.Enabled + "')"; Update = objAdaptor.ExecuteNonQueryRetRows(SqlQuery); } catch { Update = 0; } } if (Update == 1) { UpdateRet = true; } return(UpdateRet); }
public void OnAuthorize(byte id, string name, string ip, int port, ServerTypes type) { this.ID = (uint)id; this.Name = string.Concat("GameServer", id); this.Displayname = name; this.ip = ip; this.port = port; this.type = type; this.isAuthorized = true; }
/// <summary> /// The constructor for this server /// </summary> /// <param name="serverType">The type of server</param> /// <param name="address">The address for this server</param> /// <param name="port">The port for this server</param> public ServerModel(ServerTypes serverType, string address, Int32 port) : base(null, null) { Type = serverType; Address = address; Port = port; Console.WriteLine("-- Creating server of type " + serverType + " on " + address + ": " + port); LaunchUpdateServerThread(); }
public ServerTypes GetDataForServerType(ServerTypes STypeObject) { try { return(VSWebDAL.SecurityDAL.ServerTypesDAL.Ins.GetDataForServerType(STypeObject)); } catch (Exception ex) { throw ex; } }
public bool RegisterServer(int sid, string ip, int port, string name, ServerTypes type) { Logging.Debug(string.Format(" {0} {1} {2} {3}", sid.ToString().PadLeft(3), type.ToString().PadLeft(5), ip.PadRight(16), name)); var server = Worker.Singleton.Serverlist.RemoveAll(s => s.SID == sid); Worker.Singleton.Serverlist.Add(new Serverinformation() { ip = Helper.IpToLong(ip), port = port, type = type, name = name, count = 0, SID = sid }); return(true); }
static Server() { Connecting += () => { ServerTypes = current.ServerTypes(); NameToType = ServerTypes.ToDictionary(a => a.Value.CleanName, a => a.Key); MixinDeclarations.Import(current.FindAllMixins()); PrimaryKey.Import(current.ImportPrimaryKeyDefinitions()); }; }
private ServerInfo(SerializationInfo info, StreamingContext context) { Contracts.Requires.NotNull(info, "info"); this.platformId = (PlatformId)info.GetValue("platformId", typeof(PlatformId)); this.name = info.GetString("name"); this.serverType = (ServerTypes)info.GetValue("serverType", typeof(ServerTypes)); this.majorVersion = info.GetInt32("majorVersion"); this.minorVersion = info.GetInt32("minorVersion"); this.comment = info.GetString("comment"); }
private static extern int NetServerEnum( [MarshalAs(UnmanagedType.LPWStr)] string servernane, // must be null int level, out IntPtr bufptr, int prefmaxlen, out int entriesread, out int totalentries, ServerTypes servertype, [MarshalAs(UnmanagedType.LPWStr)] string domain, // null for login domain IntPtr resume_handle // Must be IntPtr.Zero );
public Object deleteforServertype(ServerTypes StypeObject) { try { return(VSWebDAL.SecurityDAL.ServerTypesDAL.Ins.deleteservertype(StypeObject)); } catch (Exception ex) { throw ex; } }
protected void ServerTypesGridView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { ServerTypes servertypeObject = new ServerTypes(); servertypeObject.ID = Convert.ToInt32(e.Keys[0]); Object returval = VSWebBL.SecurityBL.ServerTypesBL.Ins.deleteforServertype(servertypeObject); ASPxGridView gridView = (ASPxGridView)sender; gridView.CancelEdit(); e.Cancel = true; fillservertypegridview(); }
public EventStoreHandlerOptions(ServerTypes type) { switch (type) { case ServerTypes.AUTH: Type = "auth"; break; case ServerTypes.OPENID: Type = "openid"; break; } }
/// <summary> /// Get all Data from UserSecurityQuestions /// </summary> public DataTable GetAllData(Users u) { DataTable UserStartupURLs = new DataTable(); ServerTypes ReturnUQobject = new ServerTypes(); try { string SqlQuery = "SELECT * FROM [UsersStartupURLs] "; string whereClause = ""; if (u.Isdashboard) { whereClause += " WHERE isDashboard=1 "; } if (u.IsConfigurator) { if (whereClause != "") { whereClause += " OR IsConfigurator=1 "; } else { whereClause += " WHERE IsConfigurator=1 "; } } if (u.Isconsolecomm) { if (whereClause != "") { whereClause += " OR Isconsolecomm=1 "; } else { whereClause += " WHERE Isconsolecomm=1 "; } } if (whereClause != "") { SqlQuery = SqlQuery + whereClause; } UserStartupURLs = objAdaptor.FetchData(SqlQuery); } catch { } finally { } return(UserStartupURLs); }
public void GetServerList() { ServerTypes serverType = ServerTypes.WindowsNT; string domain = null; ServerInfo[] actual; actual = ExtendedNetworkInformation.GetServerList(serverType, domain); CustomAssert.IsNotEmpty(actual); CollectionAssert.AllItemsAreNotNull(actual); CollectionAssert.AllItemsAreUnique(actual); CollectionAssert.AllItemsAreInstancesOfType(actual, typeof(ServerInfo)); }
public static ISchemaRetriever GetSchemaRetriever(ServerTypes serverType) { switch (serverType) { case ServerTypes.SqlServer: return(new SqlSchema()); case ServerTypes.Oracle: return(new OracleSchema()); default: throw new ArgumentOutOfRangeException("Invalid Server Info.", "server"); } }
public Object deleteservertype(ServerTypes StypeObject) { Object deleteobject; try { string delete = "delete from ServerTypes where ID=" + StypeObject.ID + ""; deleteobject = objAdaptor.ExecuteNonQuery(delete); } catch (Exception r) { throw r; } return(deleteobject); }
public Object updateServertype(ServerTypes StypeObject) { Object updateObject; try { string update = "update ServerTypes set ServerType='" + StypeObject.ServerType + "' where ID=" + StypeObject.ID + ""; updateObject = objAdaptor.ExecuteNonQuery(update); } catch (Exception x) { throw x; } return(updateObject); }
private void InitializeDeploymentServer() { DeploymentServer = ServerTypes.Unknown; }
public ApiBootstrapper() { serverType = ServerTypes.Cache; }
public ApiBootstrapper(Controller controller) { this.controller = controller; serverType = ServerTypes.Mediator; }
public void Reset() { ServerType = parse_server_type (PurpleConfig.Network.Server.Type); ServerGUID = PurpleConfig.Network.Server.GUID; if(string.IsNullOrEmpty (ServerGUID) || ServerGUID.Equals (new Guid ().ToString())) _guid = Guid.NewGuid (); ServerID = -1; ServerHost = PurpleConfig.Network.Server.Host; ServerName = PurpleConfig.Network.Server.Name; ServerPort = PurpleConfig.Network.Server.Port; ServerPassword = PurpleConfig.Network.Server.Password; ServerMaxClients = PurpleConfig.Network.Server.Clients.Max; ServerAllowMonitoring = PurpleConfig.Network.Server.AllowMonitoring; SanityTest = PurpleConfig.Network.Server.Sanity.Test; SanityAction = PurpleConfig.Network.Server.Sanity.Action; SanityPeriodical= PurpleConfig.Network.Server.Sanity.Periodical; ClientAuthentificationTimeout = PurpleConfig.Network.Server.Clients.AuthentificationTimeout; SpamPrevention = PurpleConfig.Network.Server.Spam.Prevention; SpamResponse = PurpleConfig.Network.Server.Spam.Response; DatabaseHost = PurpleConfig.Database.IP; DatabaseName = PurpleConfig.Database.Name; DatabasePort = PurpleConfig.Database.Port; DatabaseUser = PurpleConfig.Database.User; DatabasePassword= PurpleConfig.Database.Password; ConfigLoaded = false; serverReference = PurpleServerHelper.GetServerReference (ServerGUID); if(serverReference != null) ServerID = serverReference.id; if(serverReference == null) { serverReference = new PurpleServer (); PurpleServerHelper.CreateServerReference (this, 0, string.Empty, string.Empty); serverReference = PurpleServerHelper.GetServerReference (ServerGUID); } if(serverReference != null) ServerID = serverReference.id; }
public void SetType(ServerTypes serverType) { ServerType = serverType; }
public void Load(string Name) { this.ConfigLoaded = false; string suffix = (!string.IsNullOrEmpty (Name)) ? "." + Name : string.Empty; ServerConfig config = PurpleStorage.PurpleStorage.Load<ServerConfig> (CONFIG_FILE_PREFIX+suffix); if (config == null || config.ServerGUID == Guid.Empty.ToString ()) return; this.ConfigLoaded = true; this.ServerType = config.ServerType; this.ServerID = config.ServerID; this.ServerGUID = config.ServerGUID; this.ServerHost = config.ServerHost; this.ServerName = config.ServerName; this.ServerPort = config.ServerPort; this.ServerPassword = config.ServerPassword; this.ServerMaxClients = config.ServerMaxClients; this.ServerAllowMonitoring = config.ServerAllowMonitoring; this.SanityTest = config.SanityTest; this.SanityAction = config.SanityAction; this.SanityPeriodical = config.SanityPeriodical; this.ClientAuthentificationTimeout = config.ClientAuthentificationTimeout; this.SpamPrevention = config.SpamPrevention; this.SpamResponse = config.SpamResponse; this.DatabaseHost = config.DatabaseHost; this.DatabaseName = config.DatabaseName; this.DatabasePort = config.DatabasePort; this.DatabaseUser = config.DatabaseUser; this.DatabasePassword = config.DatabasePassword; this.serverReference = PurpleServerHelper.GetServerReference (this.ServerGUID); }
public static ServerInfo[] GetServerList(ServerTypes serverType, string domain) { ServerInfo[] serverList; IntPtr pBuf = IntPtr.Zero; try { int entriesRead = 0; int totalEntries = 0; int result = SafeNativeMethods.NetServerEnum(null, 101, out pBuf, -1, ref entriesRead, ref totalEntries, (uint)serverType, domain, IntPtr.Zero); if (result != Constants.ERROR_SUCCESS && result != Constants.ERROR_MORE_DATA && entriesRead <= 0) { throw new Win32Exception(result); } serverList = new ServerInfo[entriesRead]; int ptr = pBuf.ToInt32(); SERVER_INFO_101 serverInfo; for (int i = 0; i < entriesRead; i++) { serverInfo = (SERVER_INFO_101)Marshal.PtrToStructure(new IntPtr(ptr), typeof(SERVER_INFO_101)); ptr += Marshal.SizeOf(serverInfo); serverList[i] = new ServerInfo(serverInfo); } } finally { FreeBuffer(ref pBuf); } return serverList; }