public static UnifiedNetwork.Entity.Service StartService(string ip, string portstr) { DSService.Instance = new DSService(); ServiceInvoker.StartService(ip, portstr, DSService.Instance); if (FeatureMatrix.IsEnable("ServiceReporter")) { DSService.StartReporting(DSService.Instance); } return(DSService.Instance); }
public static void StartReporting(DSService serv) { if (!FeatureMatrix.IsEnable("ServiceReporter")) { return; } ServiceReporter.Instance.Initialize("DSService"); int num = ServiceReporterSettings.Get("DSService.FPS.Interval", 60); ServiceReporter.Instance.AddSubject("FPS", null, num * 1000); ServiceReporter.Instance.AddGathering("Stat", new ServiceReporter.GatheringDelegate <int>(serv.OnGatheringStat)); ServiceReporter.Instance.AddGathering("FPS", new ServiceReporter.GatheringDelegate <int>(serv.OnGatheringFPS)); int num2 = ServiceReporterSettings.Get("DSService.Interval", 60); ServiceReporter.Instance.Start(num2 * 1000); }
public static int GetDSProcessCount() { string text = FeatureMatrix.GetString("DSProcessCount").ToUpper(); if (text == "" || text == null) { return(0); } if (text.Contains('C')) { int num = text.IndexOf('C'); string str = text.Substring(0, num); string str2 = (text.Length > num) ? text.Substring(num + 1) : ""; return(DSService.ToInt(str, 1) * DSService.GetCoreCount() + DSService.ToInt(str2, 0)); } return(DSService.ToInt(text, 1)); }
public void RemoveDSEntity(int dsID) { DSEntity dsentity; if (this.DSEntities.TryGetValue(dsID, out dsentity)) { DSLog.AddLog(dsentity, "RemoveDSEntity", ""); Log <DSService> .Logger.WarnFormat("{0} DS 제거", dsID); if (dsentity.Process != null) { try { dsentity.Process.Kill(); DSLog.AddLog(dsentity, "KillProcess (RemoveDSEntity)", ""); } catch (Exception ex) { Log <DSEntity> .Logger.FatalFormat("KillProcess Failed!!\n - {0}", ex); DSLog.AddLog(dsentity, "KillProcess Failed", ""); } dsentity.Process = null; } else { UpdateDSShipInfo op = new UpdateDSShipInfo(DSService.Instance.ID, dsID, 0L, UpdateDSShipInfo.CommandEnum.PVPClosed, ""); DSService.RequestDSBossOperation(op); } if (dsentity.TcpClient != null) { try { dsentity.TcpClient.Disconnect(); DSLog.AddLog(dsentity, "DisconnectTcp", ""); } catch (Exception ex2) { Log <DSEntity> .Logger.FatalFormat("DisconnectTcp Failed!!\n - {0}", ex2); DSLog.AddLog(dsentity, "DisconnectTcp Failed", ""); } dsentity.TcpClient = null; } } }
public static int ReCheckCount(int idStart, int count) { if (!FeatureMatrix.IsEnable("DSNormalRaid") || idStart < ServiceCoreSettings.Default.DSGiantCount || ServiceCoreSettings.Default.DSGiantCount < 0) { return(count); } string text = FeatureMatrix.GetString("DSNormalCount").ToUpper(); if (text == "" || text == null) { return(0); } if (text.Contains("P")) { int num = text.IndexOf('P'); string str = text.Substring(0, num); string str2 = (text.Length > num) ? text.Substring(num + 1) : ""; return(DSService.ToInt(str, 1) * count + DSService.ToInt(str2, 0)); } return(DSService.ToInt(text, 1)); }
public void SetupDSController() { this.DSBossID = base.LookUp.GetFirstRegisteredServiceID("DSService.DSService"); if (base.ID == this.DSBossID) { Log <DSService> .Logger.WarnFormat("I am Boss!!!!!", new object[0]); this.DSWaitingSystem = new DSWaitingSystem(); if (FeatureMatrix.IsEnable("DSDynamicLoad")) { this.DSEntityMakerSystem = new DSEntityMakerSystem(this); } this.PrintDsState(); } Log <DSService> .Logger.WarnFormat("Boss is {0}", this.DSBossID); if (FeatureMatrix.IsEnable("DSDynamicLoad")) { this.InitializeEntity(); RegisterDSServiceInfo registerDSServiceInfo = new RegisterDSServiceInfo(base.ID, DSService.GetCoreCount()); registerDSServiceInfo.OnComplete += delegate(Operation _) { Log <DSService> .Logger.WarnFormat("Register DS Service ID : [{0}] / Core : [{1}]", base.ID, DSService.GetCoreCount()); }; base.RequestOperation(this.DSBossID, registerDSServiceInfo); return; } RegisterDSEntity op = new RegisterDSEntity(base.ID, DSService.GetCoreCount(), this.GiantRaidMachinCandidate); op.OnComplete += delegate(Operation _) { this.InitializeEntity(op.IDStart, op.ProcessCount); Log <DSService> .Logger.WarnFormat("Initialized for {0}", op.DSType); }; base.RequestOperation(this.DSBossID, op); }
public SendPacketDSProcessor(DSService service, SendPacketDS op) : base(op) { }