private void updateList(Interface.IGame game) { if (!lbxListGames.Items.Contains(game.getGameID())) { lbxListGames.Items.Add(game.getGameID()); } }
public Interface[] InterfacesArray() { System.Collections.ArrayList arrList = new System.Collections.ArrayList(); int i = 0; while (true) { IntPtr cIf; Interface iface; cIf = UnmanagedGetInterfaceN(cNode, i); if (cIf == IntPtr.Zero) { //Debug.WriteLine("UnmanagedAttribute zero pointer"); break; } iface = new Interface(cIf); i++; arrList.Add(iface); } Interface[] array = (Interface[])arrList.ToArray(typeof(Interface)); Debug.WriteLine("NodeList with " + i + " nodes"); return array; }
// v=v+cv2; public void Add(Interface.IVector v2, double c) { for (int i = 0; i < v2.Size; i++) { v[i] += v2[i]*c; } }
/// <summary> /// Translates control using InterfaceLanguage instance /// </summary> /// <param name="control">Control to translate</param> /// <param name="lang">Language object</param> /// <returns>True if control has been translated, false otherwise</returns> public static bool Translate( this Control control, Interface.InterfaceLanguage lang ) { string prefix = "lang"; if( control.Tag == null ) return (false); if( !control.Tag.ToString().StartsWith( prefix ) ) return (false); string tag = control.Tag.ToString().Substring( prefix.Length ); FieldInfo field = null; try { field = lang.GetType().GetField( tag ); } catch( Exception ) { return (false); } if( field == null ) return (false); else if( !field.IsPublic ) return (false); else if( field.FieldType != typeof( string ) ) return (false); string value = (string)field.GetValue( lang ); control.Text = value; return (true); }
public override Model.Cache DoControl(Interface.IView view, Interface.IController controller) { if (controller.Cache.getCrudModeInCache() != Model.Cache.crudMode.Stateless) { // CRUD FUNCTIONALITY HERE switch (controller.Cache.getCrudModeInCache()) { case Model.Cache.crudMode.Create: menuSwitcher(view, controller); Model.Member member = new Model.Member ( view.getResponse("Firstname"), view.getResponse("Lastname"), view.getResponse("Personal Number") ); Console.WriteLine(member); return null; default: throw new NotImplementedException(); } } else { menuSwitcher(view, controller); ClientResponse = view.getResponse(); SelectedInMenuBoat = (Model.Cache.menuBoat)int.Parse(ClientResponse); return prepareNewCacheFromMenuBoat(); } }
public override Task<IEnumerable<Interface.InterfaceUtilization>> GetUtilization(Interface nodeInteface, DateTime? start, DateTime? end, int? pointCount = null) { const string allSql = @" Select itd.DateTime, itd.In_Maxbps InMaxBps, itd.In_Averagebps InAvgBps, itd.Out_Maxbps OutMaxBps, itd.Out_Averagebps OutAvgBps, Row_Number() Over(Order By itd.DateTime) RowNumber From InterfaceTraffic itd Where itd.InterfaceID = @Id And {dateRange} "; const string sampledSql = @" Select * From (Select itd.DateTime, itd.In_Maxbps InMaxBps, itd.In_Averagebps InAvgBps, itd.Out_Maxbps OutMaxBps, itd.Out_Averagebps OutAvgBps, Row_Number() Over(Order By itd.DateTime) RowNumber From InterfaceTraffic itd Where itd.InterfaceID = @Id And {dateRange}) itd Where itd.RowNumber % ((Select Count(*) + @intervals From InterfaceTraffic itd Where itd.InterfaceID = @Id And {dateRange})/@intervals) = 0"; return UtilizationQuery<Interface.InterfaceUtilization>(nodeInteface.Id, allSql, sampledSql, "itd.DateTime", start, end, pointCount); }
protected override Object InExecutive(Interface.WATFDictionary<String, String> attributes) { object rtn = default(object); if (this.context.Assemblys.ContainsKey(attributes[GlobalDefine.Keyword.Executive.From])) { //执行反射外部函数 WATF.Plugin.IPlugin reflection = (WATF.Plugin.IPlugin)this.context.Assemblys[attributes[GlobalDefine.Keyword.Executive.From]].CreateInstance(attributes[GlobalDefine.Keyword.Executive.Select]); Dictionary<string, object> paramList = GetParamsFromWhere(attributes[GlobalDefine.Keyword.Executive.Where],this.context); if (this.context.Results.Count > 0) { rtn = reflection.StartMethod(this.context.Results.Peek(), paramList); } else { rtn = reflection.StartMethod(null, paramList); } if (attributes.ContainsKey(GlobalDefine.Keyword.Executive.Into) && !attributes[GlobalDefine.Keyword.Executive.Into].Equals(string.Empty)) { this.context.SetVar(attributes[GlobalDefine.Keyword.Executive.Into], rtn); } } else//如果没有from关键字,则执行内部函数逻辑 { } return rtn; }
public static void AddTestDataToIndex(Interface.IIndexService indexService, Api.Index index, string testData) { string[] lines = testData.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); string[] headers = lines[0].Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); foreach (string line in lines.Skip(1)) { string[] items = line.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); var indexDocument = new Document(); indexDocument.Id = items[0]; indexDocument.Index = index.IndexName; indexDocument.Fields = new Api.KeyValuePairs(); for (int i = 1; i < items.Length; i++) { indexDocument.Fields.Add(headers[i], items[i]); } indexService.PerformCommand( index.IndexName, IndexCommand.NewCreate(indexDocument.Id, indexDocument.Fields)); } indexService.PerformCommand(index.IndexName, IndexCommand.Commit); Thread.Sleep(100); }
/// <summary> /// 注册收听者 /// </summary> /// <param name="listenerMember">收听者对象</param> /// <returns></returns> public bool Register(Interface.IListenerMember listenerMember) { listenerMember.OnlyListenerKey = Guid.NewGuid().ToString(); this.ListenerMemberList.Add(listenerMember); this.OnAddListenerMember(listenerMember); return true; }
public static void Begin(Interface.Struct.BeginSession session) { roundNumber = session.roundNumber; techniteSubRoundNumber = session.techniteSubRoundNumber; FactionUUID = session.factionUUID; TechniteGridID = session.techniteGridID; Out.Log(Significance.Important, "Session started: "+FactionUUID+" in round "+roundNumber+"/"+techniteSubRoundNumber); }
//res = vec*v public static Interface.IVector multScalar(double v, Interface.IVector vec) { for (int i = 0; i < vec.Size; i++) { vec[i] *= v; } return vec; }
/// <summary> /// 添加模块 /// </summary> /// <param name="modules"></param> /// <returns></returns> public bool AddModules(Interface.IModules modules) { if (this.ModulesList.ContainsKey(modules.Key)) return false; this.ModulesList.Add(modules.Key, modules); return true; }
public override Model.Cache DoControl(Interface.IView view, Interface.IController controller) { menuSwitcher(view, controller); ClientResponse = view.getResponse(); SelectedInMenuIndex = (Model.Cache.menuIndex)int.Parse(ClientResponse); return prepareNewCacheFromMenuIndex(); }
// vres =v1+cv2; public static Interface.IVector Add(Interface.IVector v1, Interface.IVector v2, double c) { Vector result = new Vector(v1.Size); for (int i = 0; i < v2.Size; i++) { v1[i] += v2[i] * c; } return result; }
public ParametersNativeDll(IExternalType nativeDll, Interface inter, Uri dataFile, bool debuggerLaunch) { if (nativeDll == null) nativeDll = new ExternalType(); _nativeDllImplementingNetAssembly = (ExternalType)nativeDll.Clone(); _interface = inter; _debuggerLaunch = debuggerLaunch; }
//res = v1*v2 scalar multiplication public static double multVector(Interface.IVector v1, Interface.IVector v2) { double result = 0; for (int i = 0; i < v1.Size; i++) { result += v1[i] * v2[i]; } return result; }
public InterfaceOperation(Mapping.InterfaceOperation operation, Interface iface, IpAddress ipAddress = null) : base(operation) { this.InterfaceId = operation.InterfaceId; this.Interface = iface; this.IpAddressId = operation.IpAddressId; this.IpAddress = ipAddress; }
public void SetupFixture() { if (System.IO.File.Exists(filename)) System.IO.File.Delete(filename); intf = new Interface(); intf.CreateAccessDatabase(filename); intf.CreateDefaultDatabaseContent(); }
// Use this for initialization void Awake() { iEnergy = iMaxEnergy; // El objeto empieza con energía máxima // thisAnimation = animation; thisAudioSource = audio; // Se obtiene el componente script Interface de la cámara del juego. intfce = objCam.GetComponent<Interface>(); }
/// <summary> /// 初始化配置文件 /// </summary> /// <param name="setting"></param> public static bool InitSetting(Interface.ISettings setting) { if (setting == null) return false; if (string.IsNullOrWhiteSpace(setting.SettingFilePath)) { if (!SetSettingFilePath(setting)) return false; } return LoadSetting(setting); }
// vres = v1+v2 public static Interface.IVector sumVector(Interface.IVector v1, Interface.IVector v2) { Interface.IVector result = v1.Clone() as Interface.IVector; result.Nullify(); for (int i = 0; i < v1.Size; i++) { result[i] = v1[i] + v2[i]; } return result; }
public static Interface.IVector multMatrixVector(Interface.IMatrix matr, Interface.IVector vec) { Interface.IVector res = vec.Clone() as Interface.IVector; res.Nullify(); matr.Run ( (int i, int j, double el) => { res[i] += el * vec[j]; } ); return res; }
protected override Sitecore.Data.Items.Item ExtractItem(Interface.DisplayElement dElement) { var item = base.ExtractItem(dElement); if (item != null && item.Source != null) { return item.Source; } //if it does not have a clone source, return null so we don't display any data return null; }
public Form1() { InitializeComponent(); Product product = new ProductA(); product.ProductB1(); product.ProductB2(); Interface inter = new Interface(); }
public VirtualMachineOperation(Mapping.VirtualMachineOperation operation, VirtualMachine virtualMachine, Disk disk = null, Interface iface = null) : base(operation) { this.VirtualMachineId = operation.VirtualMachineId; this.VirtualMachine = virtualMachine; this.DiskId = operation.DiskId; this.Disk = disk; this.IntefaceId = operation.InterfaceId; this.Interface = iface; }
void Start () { currentWorld = spawnWorld; this.transform.position = currentWorld.transform.position; rayDirection = new Vector3(Input.mousePosition.x, Input.mousePosition.y); ui = GetComponent<Interface>(); fx = GameObject.FindObjectOfType<FX>(); transition = GameObject.FindObjectOfType<Transition>(); mouseLook = GameObject.FindObjectOfType<MouseLook>(); }
private async void StartIndexing(Interface.IIndexService indexservice, string path) { int pageCounter = 0; string line; var file = new StreamReader(path); var source = new List<Dictionary<string, string>>(3000000); while ((line = file.ReadLine()) != null) { pageCounter++; var document = new Dictionary<string, string>(); var id = pageCounter; document.Add("title", line.Substring(0, line.IndexOf('|') - 1)); document.Add("body", line.Substring(line.IndexOf('|') + 1)); source.Add(document); //indexservice.SendCommandToQueue( // "wikipedia", // IndexCommand.NewCreate(id.ToString(CultureInfo.InvariantCulture), document)); if (pageCounter % 100000 == 0) { Console.WriteLine(pageCounter); } } Console.WriteLine("Starting Test"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); pageCounter = 0; foreach (var item in source) { pageCounter++; await indexservice.CommandQueue() .SendAsync( new Tuple<string, IndexCommand>( "wikipedia", IndexCommand.NewCreate(pageCounter.ToString(CultureInfo.InvariantCulture), item))); } stopwatch.Stop(); FileInfo fileInfo = new FileInfo(path); double fileSize = fileInfo.Length / 1073741824.0; double time = stopwatch.ElapsedMilliseconds / 3600000.0; double indexingSpeed = fileSize / time; Console.WriteLine("Total Records indexed: " + pageCounter); Console.WriteLine("Total Elapsed time (ms): " + stopwatch.ElapsedMilliseconds); Console.WriteLine("Total Data Size (MB): " + fileInfo.Length / (1024.0 * 1024.0)); Console.WriteLine("Indexing Speed (GB/Hr): " + indexingSpeed); }
protected override void OutExecutive(Interface.WATFDictionary<String, String> attributes) { if (this.context.Assemblys.ContainsKey(attributes[GlobalDefine.Keyword.Executive.From])) { //执行反射外部函数 WATF.Plugin.IPlugin reflection = (WATF.Plugin.IPlugin)this.context.Assemblys[attributes[GlobalDefine.Keyword.Executive.From]].CreateInstance(attributes[GlobalDefine.Keyword.Executive.Select]); reflection.EndMethod(); } else//如果没有from关键字,则执行内部函数逻辑 { } }
public bool Handle(uint PacketId, out Interface Event) { if (this.RequestHandlers.ContainsKey(PacketId)) { Event = this.RequestHandlers[PacketId]; return true; } else { Event = null; return false; } }
public virtual void menuSwitcher(Interface.IView view, Interface.IController controller) { if (isCrudRequest(controller.Cache.getCrudModeInCache())) { // Requset crudMode != stateless switchCrudMessageToClient(controller.Cache.getCrudModeInCache(), view); } else { // Request crudMode == stateLess view.setRequest(); } }
private bool DespawnWasBlocked(BasePlayer player, MiniCopter mini) { object hookResult = Interface.CallHook("OnMyMiniDespawn", player, mini); return(hookResult is bool && (bool)hookResult == false); }
// BaseCombatEntity public bool DoRepair(BaseCombatEntity entity, BasePlayer player) { if (!entity.repair.enabled) { return(false); } if (Interface.CallHook("OnStructureRepair", new object[] { entity, player }) != null) { return(false); } if (entity.SecondsSinceAttacked <= lastAttackLimit) { entity.OnRepairFailed(); return(false); } float num = entity.MaxHealth() - entity.Health(); float num2 = num / entity.MaxHealth(); if (num <= 0f || num2 <= 0f) { entity.OnRepairFailed(); return(false); } var list = entity.RepairCost(num2); if (list == null || list.Count == 0) { return(false); } foreach (var ia in list) { ia.amount *= repairMulti; } float num3 = list.Sum(x => x.amount); if (num3 > 0f) { float num4 = list.Min(x => Mathf.Clamp01((float)player.inventory.GetAmount(x.itemid) / x.amount)); num4 = Mathf.Min(num4, 50f / num); if (num4 <= 0f) { entity.OnRepairFailed(); return(false); } int num5 = 0; foreach (var current in list) { int amount = Mathf.CeilToInt(num4 * current.amount); num5 += player.inventory.Take(null, current.itemid, amount); } float num7 = (float)num5 / num3; entity.health += num * num7; entity.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); } else { entity.health += num; entity.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); } if (entity.health >= entity.MaxHealth()) { entity.OnRepairFinished(); } else { entity.OnRepair(); } return(true); }
private object OnPlayerChat(PlayerMessageEvent evt) { // Call covalence hook return(Interface.CallHook("OnUserChat", covalence.PlayerManager.GetPlayer(evt.PlayerId.ToString()), evt.Message)); }
private bool SpawnWasBlocked(BasePlayer player) { object hookResult = Interface.CallHook("OnMyMiniSpawn", player); return(hookResult is bool && (bool)hookResult == false); }
private void OnPlayerSpawn(PlayerClient client) { // Call covalence hook Interface.Call("OnUserSpawn", covalence.PlayerManager.FindPlayer(client.userID.ToString())); }
void SaveTune(string playerName, string tuneName, ulong userID) { Interface.GetMod().DataFileSystem.WriteObject <List <TuneNote> >("ms-" + tuneName, tuneRecTemp[userID]); Log("Tune " + tuneName + " saved by " + playerName); }
public object CallHook(string hookname, object[] args) { return(Interface.CallHook(hookname, args)); }
private void SaveKitsData() { Interface.GetMod().DataFileSystem.SaveDatafile("Kits_Data"); }
void TryGiveKit(BasePlayer player, string kitname) { if (KitsConfig[kitname] == null) { SendTheReply(player, unknownKit); return; } object thereturn = Interface.GetMod().CallHook("canRedeemKit", new object[1] { player }); if (thereturn != null) { if (thereturn is string) { SendTheReply(player, (string)thereturn); } return; } Dictionary <string, object> kitdata = (KitsConfig[kitname]) as Dictionary <string, object>; double cooldown = 0.0; int kitleft = 1; int kitlvl = 0; if (kitdata.ContainsKey("level")) { kitlvl = (int)kitdata["level"]; } if (kitlvl > player.net.connection.authLevel) { SendTheReply(player, cantUseKit); return; } if (kitdata.ContainsKey("max")) { kitleft = GetKitLeft(player, kitname, (int)(kitdata["max"])); } if (kitleft <= 0) { SendTheReply(player, maxKitReached); return; } foreach (string name in permNames) { if (kitdata.ContainsKey(name)) { if (!hasVip(player, name)) { SendReply(player, cantUseKit); return; } } } if (kitdata.ContainsKey("cooldown")) { cooldown = GetKitTimeleft(player, kitname, (double)(kitdata["cooldown"])); } if (cooldown > 0.0) { SendTheReply(player, string.Format("You must wait {0}s before using this kit again", cooldown.ToString())); return; } object wasGiven = GiveKit(player, kitname); if ((wasGiven is bool) && !((bool)wasGiven)) { Puts(string.Format("An error occurred while giving the kit {0} to {1}", kitname, player.displayName.ToString())); return; } proccessKitGiven(player, kitname, kitdata, kitleft); }
public void PlayerAttack(BaseEntity.RPCMessage msg) { BasePlayer player = msg.player; if (!this.VerifyClientAttack(player)) { this.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); } else { using (TimeWarning.New(nameof(PlayerAttack), 50L)) { using (PlayerAttack playerAttack = PlayerAttack.Deserialize((Stream)msg.read)) { if (playerAttack == null) { return; } HitInfo info = (HitInfo)Pool.Get <HitInfo>(); info.LoadFromAttack((Attack)playerAttack.attack, true); info.Initiator = (BaseEntity)player; info.Weapon = (AttackEntity)this; info.WeaponPrefab = (BaseEntity)this; info.Predicted = msg.connection; info.damageProperties = this.damageProperties; if (Interface.CallHook("OnMeleeAttack", (object)player, (object)info) != null) { return; } if (info.IsNaNOrInfinity()) { string shortPrefabName = this.ShortPrefabName; AntiHack.Log(player, AntiHackType.MeleeHack, "Contains NaN (" + shortPrefabName + ")"); player.stats.combat.Log(info, "melee_nan"); } else { if (ConVar.AntiHack.melee_protection > 0 && Object.op_Implicit((Object)info.HitEntity)) { bool flag = true; float num1 = 1f + ConVar.AntiHack.melee_forgiveness; double meleeClientframes = (double)ConVar.AntiHack.melee_clientframes; float meleeServerframes = ConVar.AntiHack.melee_serverframes; float num2 = (float)(meleeClientframes / 60.0); float num3 = meleeServerframes * Mathx.Max(Time.get_deltaTime(), Time.get_smoothDeltaTime(), Time.get_fixedDeltaTime()); float num4 = (player.desyncTime + num2 + num3) * num1; if (ConVar.AntiHack.projectile_protection >= 2) { double num5 = (double)info.HitEntity.MaxVelocity(); Vector3 parentVelocity = info.HitEntity.GetParentVelocity(); double magnitude = (double)((Vector3) ref parentVelocity).get_magnitude(); float num6 = (float)(num5 + magnitude); float num7 = info.HitEntity.BoundsPadding() + num4 * num6; float num8 = info.HitEntity.Distance(info.HitPositionWorld); if ((double)num8 > (double)num7) { string shortPrefabName1 = this.ShortPrefabName; string shortPrefabName2 = info.HitEntity.ShortPrefabName; AntiHack.Log(player, AntiHackType.MeleeHack, "Entity too far away (" + shortPrefabName1 + " on " + shortPrefabName2 + " with " + (object)num8 + "m > " + (object)num7 + "m in " + (object)num4 + "s)"); player.stats.combat.Log(info, "melee_distance"); flag = false; } } if (ConVar.AntiHack.melee_protection >= 1) { double num5 = (double)info.Initiator.MaxVelocity(); Vector3 parentVelocity = info.Initiator.GetParentVelocity(); double magnitude = (double)((Vector3) ref parentVelocity).get_magnitude(); float num6 = (float)(num5 + magnitude); float num7 = (float)((double)info.Initiator.BoundsPadding() + (double)num4 * (double)num6 + (double)num1 * (double)this.maxDistance); float num8 = info.Initiator.Distance(info.HitPositionWorld); if ((double)num8 > (double)num7) { string shortPrefabName1 = this.ShortPrefabName; string shortPrefabName2 = info.HitEntity.ShortPrefabName; AntiHack.Log(player, AntiHackType.MeleeHack, "Initiator too far away (" + shortPrefabName1 + " on " + shortPrefabName2 + " with " + (object)num8 + "m > " + (object)num7 + "m in " + (object)num4 + "s)"); player.stats.combat.Log(info, "melee_distance"); flag = false; } } if (ConVar.AntiHack.melee_protection >= 3) { Vector3 pointStart = info.PointStart; Vector3 position1 = Vector3.op_Addition(info.HitPositionWorld, Vector3.op_Multiply(((Vector3) ref info.HitNormalWorld).get_normalized(), 1f / 1000f)); Vector3 center = player.eyes.center; Vector3 position2 = player.eyes.position; Vector3 p2 = pointStart; Vector3 p3 = info.PositionOnRay(position1); Vector3 p4 = position1; int num5 = GamePhysics.LineOfSight(center, position2, p2, p3, p4, 2162688, 0.0f) ? 1 : 0; if (num5 == 0) { player.stats.Add("hit_" + info.HitEntity.Categorize() + "_indirect_los", 1, Stats.Server); } else { player.stats.Add("hit_" + info.HitEntity.Categorize() + "_direct_los", 1, Stats.Server); } if (num5 == 0) { string shortPrefabName1 = this.ShortPrefabName; string shortPrefabName2 = info.HitEntity.ShortPrefabName; AntiHack.Log(player, AntiHackType.MeleeHack, "Line of sight (" + shortPrefabName1 + " on " + shortPrefabName2 + ") " + (object)center + " " + (object)position2 + " " + (object)p2 + " " + (object)p3 + " " + (object)p4); player.stats.combat.Log(info, "melee_los"); flag = false; } } if (!flag) { AntiHack.AddViolation(player, AntiHackType.MeleeHack, ConVar.AntiHack.melee_penalty); return; } } player.metabolism.UseHeart(this.heartStress * 0.2f); using (TimeWarning.New("DoAttackShared", 50L)) this.DoAttackShared(info); } } } } }
private void SaveWarpData() { Interface.GetMod().DataFileSystem.WriteObject("SavedWarpLocations", _warpList); Interface.GetMod().DataFileSystem.WriteObject("SavedWarpCoolDown", _warpCoolDown); }
private const int _warpCoolDownTime = 300; // Time taken until warp can be used again (in seconds) //private const int _warpCoolDownTime = 5; // Time taken until warp can be used again (in seconds) #endregion #region Save and Load Data Methods // SAVE DATA =============================================================================================== private void LoadWarpData() { _warpList = Interface.GetMod().DataFileSystem.ReadObject <Dictionary <string, float[]> >("SavedWarpLocations"); _warpCoolDown = Interface.GetMod().DataFileSystem.ReadObject <Dictionary <ulong, int> >("SavedWarpCoolDown"); }
private void AddExtensionMethods(XmlWriter writer, Object info) { MemberDictionary members = info as MemberDictionary; if (members == null) { return; } TypeNode type = members.Type; InterfaceList contracts = type.Interfaces; foreach (Interface contract in contracts) { List <Method> extensionMethods = null; if (index.TryGetValue(contract, out extensionMethods)) { foreach (Method extensionMethod in extensionMethods) { if (!IsExtensionMethodHidden(extensionMethod, members)) { AddExtensionMethod(writer, type, extensionMethod, null); } } } if (contract.IsGeneric && (contract.TemplateArguments != null) && (contract.TemplateArguments.Count > 0)) { Interface templateContract = (Interface)ReflectionUtilities.GetTemplateType(contract); TypeNode specialization = contract.TemplateArguments[0]; if (index.TryGetValue(templateContract, out extensionMethods)) { foreach (Method extensionMethod in extensionMethods) { if (IsValidTemplateArgument(specialization, extensionMethod.TemplateParameters[0])) { if (!IsExtensionMethodHidden(extensionMethod, members)) { AddExtensionMethod(writer, type, extensionMethod, specialization); } } } } } } TypeNode comparisonType = type; while (comparisonType != null) { List <Method> extensionMethods = null; if (index.TryGetValue(comparisonType, out extensionMethods)) { foreach (Method extensionMethod in extensionMethods) { if (!IsExtensionMethodHidden(extensionMethod, members)) { AddExtensionMethod(writer, type, extensionMethod, null); } } } if (comparisonType.IsGeneric && (comparisonType.TemplateArguments != null) && (comparisonType.TemplateArguments.Count > 0)) { TypeNode templateType = ReflectionUtilities.GetTemplateType(comparisonType); TypeNode specialization = comparisonType.TemplateArguments[0]; if (index.TryGetValue(templateType, out extensionMethods)) { foreach (Method extensionMethod in extensionMethods) { if (IsValidTemplateArgument(specialization, extensionMethod.TemplateParameters[0])) { if (!IsExtensionMethodHidden(extensionMethod, members)) { AddExtensionMethod(writer, type, extensionMethod, specialization); } } } } } comparisonType = comparisonType.BaseType; } }
private void OnPlayerRespawn(PlayerRespawnEvent evt) { // Call covalence hook Interface.CallHook("OnUserRespawn", covalence.PlayerManager.GetPlayer(evt.Player.Id.ToString())); }
private void InitializeKits() { KitsConfig = Interface.GetMod().DataFileSystem.GetDatafile("Kits_List"); KitsData = Interface.GetMod().DataFileSystem.GetDatafile("Kits_Data"); }
public LoadModel(Interface pif) { this.pif = pif; }
public static ResponseMsg editSegcodeGrid(string oper, string id, string seg_code, string program_code, string buy_method, string include_in_bolt, string include_in_spo, string include_in_tav_reporting, string site_location) { //Session Login Check if (HttpContext.Current.Session["Connection"] == null) { throw new Exception("Session State Timeout"); } //Variables ResponseMsg result = new ResponseMsg(); //Create request SegcodeEditRequest editRequest = new SegcodeEditRequest(); editRequest.oper = oper.Trim().ToLower(); editRequest.id = id.Trim().ToUpper(); editRequest.seg_code = seg_code.Trim().ToUpper(); editRequest.program_code = program_code.Trim().ToUpper(); editRequest.buy_method = buy_method.Trim(); editRequest.include_in_bolt = include_in_bolt.Trim().ToUpper(); editRequest.include_in_spo = include_in_spo.Trim().ToUpper(); editRequest.include_in_tav_reporting = include_in_tav_reporting.Trim().ToUpper(); editRequest.site_location = site_location.Trim(); //Validate request input if (!editRequest._isValid()) { //set error message result.addError("Your request to edit this segcode contains invalid input and was not saved."); //Return invalid request return(result); } //Edit database using request using (Interface db = new Interface()) { try { //Check if user has permissions to edit if (!db.checkSegcodeEditPerm()) { //set error message result.addMsg("You do not have permission to edit segcodes."); //Return request return(result); } } catch (Exception) { //set error message result.addError("Unable to verify permissions. Please try again or contact application support."); //Return request return(result); } //Perform action if (editRequest.oper == "edit") { result = db.editSegcode(editRequest); } else if (editRequest.oper == "delete") { result = db.deleteSegcode(editRequest); } else if (editRequest.oper == "new") { result = db.newSegcode(editRequest); } } return(result); }
private object OnServerCommand(ClientInfo client, string command) { return(Interface.CallDeprecatedHook("OnRunCommand", "OnServerCommand", new DateTime(2016, 8, 1), client, command)); }
void SaveData() => Interface.GetMod().DataFileSystem.WriteObject("Godmode", storedData);
private void OnPlayerRespawned(PlayerInfos player) { // Call covalence hook Interface.Call("OnUserRespawned", Covalence.PlayerManager.FindPlayer(player.account_id)); }
private void PLC_Update_100_ms(Interface sender, InterfaceEventArgs e) { String msg = "SISTEM SPREMAN"; // Workpiece Nominal Values from Machine 1 MeasurementDataM1.cNominal = (float)e.StatusData.Machine1Data.C.Value; MeasurementDataM1.aNominal = (float)e.StatusData.Machine1Data.A.Value; MeasurementDataM1.bNominal = (float)e.StatusData.Machine1Data.B.Value; MeasurementDataM1.jNominal = (float)e.StatusData.Machine1Data.J.Value; MeasurementDataM1.fNominal = (float)e.StatusData.Machine1Data.F.Value; MeasurementDataM1.eNominal = (float)e.StatusData.Machine1Data.E.Value; MeasurementDataM1.dNominal = (float)e.StatusData.Machine1Data.D.Value; MeasurementDataM1.gNominal = (float)e.StatusData.Machine1Data.G.Value; // Workpiece Nominal Values from Machine 2 MeasurementDataM2.cNominal = (float)e.StatusData.Machine2Data.C.Value; MeasurementDataM2.aNominal = (float)e.StatusData.Machine2Data.A.Value; MeasurementDataM2.bNominal = (float)e.StatusData.Machine2Data.B.Value; MeasurementDataM2.jNominal = (float)e.StatusData.Machine2Data.J.Value; MeasurementDataM2.fNominal = (float)e.StatusData.Machine2Data.F.Value; MeasurementDataM2.eNominal = (float)e.StatusData.Machine2Data.E.Value; MeasurementDataM2.dNominal = (float)e.StatusData.Machine2Data.D.Value; MeasurementDataM2.gNominal = (float)e.StatusData.Machine2Data.G.Value; // Signal to fill SQL Database for Machine1 if ((bool)e.StatusData.Savedata.M1.Value && _oneCallFlagSaveM1) { _oneCallFlagSaveM1 = false; // Value setting // C Database.KotaCPoz1 = (float)e.StatusData.MeasuredPos1.C.Value; Database.KotaCPoz2 = (float)e.StatusData.MeasuredPos2.C.Value; // A1.2 Database.KotaA12Poz1 = (float)e.StatusData.MeasuredPos1.A12.Value; Database.KotaA12Poz2 = (float)e.StatusData.MeasuredPos2.A12.Value; // A1.1 Database.KotaA11Poz1 = (float)e.StatusData.MeasuredPos1.A11.Value; Database.KotaA11Poz2 = (float)e.StatusData.MeasuredPos2.A11.Value; // A Database.KotaAPoz1 = (float)e.StatusData.MeasuredPos1.A.Value; Database.KotaAPoz2 = (float)e.StatusData.MeasuredPos2.A.Value; // B Database.KotaBPoz1 = (float)e.StatusData.MeasuredPos1.B.Value; Database.KotaBPoz2 = (float)e.StatusData.MeasuredPos2.B.Value; // J Database.KotaJPoz1 = (float)e.StatusData.MeasuredPos1.J.Value; Database.KotaJPoz2 = (float)e.StatusData.MeasuredPos2.J.Value; // F1 AND F2 POS 1 Database.KotaF1LG2Poz1 = (float)e.StatusData.MeasuredPos1.F1LG2.Value; Database.KotaF2LG2Poz1 = (float)e.StatusData.MeasuredPos1.F2LG2.Value; Database.KotaF1LG3Poz1 = (float)e.StatusData.MeasuredPos1.F1LG3.Value; Database.KotaF2LG3Poz1 = (float)e.StatusData.MeasuredPos1.F2LG3.Value; // F1 AND F2 POS 2 Database.KotaF1LG2Poz2 = (float)e.StatusData.MeasuredPos2.F1LG2.Value; Database.KotaF2LG2Poz2 = (float)e.StatusData.MeasuredPos2.F2LG2.Value; Database.KotaF1LG3Poz2 = (float)e.StatusData.MeasuredPos2.F1LG3.Value; Database.KotaF2LG3Poz2 = (float)e.StatusData.MeasuredPos2.F2LG3.Value; // E Database.KotaEPoz1 = (float)e.StatusData.MeasuredPos1.E.Value; Database.KotaEPoz2 = (float)e.StatusData.MeasuredPos2.E.Value; // D Database.KotaDPoz1 = (float)e.StatusData.MeasuredPos1.D.Value; Database.KotaDPoz2 = (float)e.StatusData.MeasuredPos2.D.Value; // H1 Database.KotaH1Poz1 = (float)e.StatusData.MeasuredPos1.H1.Value; Database.KotaH1Poz2 = (float)e.StatusData.MeasuredPos2.H1.Value; // K Database.KotaKPoz1 = (float)e.StatusData.MeasuredPos1.K.Value; Database.KotaKPoz2 = (float)e.StatusData.MeasuredPos2.K.Value; // Workpiecedata Database.RadniNalog = (string)e.StatusData.Workpiecedata.RadniNalog.Value; // Fill SQL base for Machine 1 // New thread Thread WriteToDatabaseM1 = new Thread(() => Database.ModifyDb(MySQLconnectionString, "stroj1")); WriteToDatabaseM1.Name = "WriteToDatabaseM1"; WriteToDatabaseM1.Start(); } else if (!(bool)e.StatusData.Savedata.M1.Value) { _oneCallFlagSaveM1 = true; } // Signal to fill SQL Database for Machine2 if ((bool)e.StatusData.Savedata.M2.Value && _oneCallFlagSaveM2) { _oneCallFlagSaveM2 = false; // Value setting // C Database.KotaCPoz1 = (float)e.StatusData.MeasuredPos1.C.Value; Database.KotaCPoz2 = (float)e.StatusData.MeasuredPos2.C.Value; // A1.2 Database.KotaA12Poz1 = (float)e.StatusData.MeasuredPos1.A12.Value; Database.KotaA12Poz2 = (float)e.StatusData.MeasuredPos2.A12.Value; // A1.1 Database.KotaA11Poz1 = (float)e.StatusData.MeasuredPos1.A11.Value; Database.KotaA11Poz2 = (float)e.StatusData.MeasuredPos2.A11.Value; // A Database.KotaAPoz1 = (float)e.StatusData.MeasuredPos1.A.Value; Database.KotaAPoz2 = (float)e.StatusData.MeasuredPos2.A.Value; // B Database.KotaBPoz1 = (float)e.StatusData.MeasuredPos1.B.Value; Database.KotaBPoz2 = (float)e.StatusData.MeasuredPos2.B.Value; // J Database.KotaJPoz1 = (float)e.StatusData.MeasuredPos1.J.Value; Database.KotaJPoz2 = (float)e.StatusData.MeasuredPos2.J.Value; // F1 AND F2 POS 1 Database.KotaF1LG2Poz1 = (float)e.StatusData.MeasuredPos1.F1LG2.Value; Database.KotaF2LG2Poz1 = (float)e.StatusData.MeasuredPos1.F2LG2.Value; Database.KotaF1LG3Poz1 = (float)e.StatusData.MeasuredPos1.F1LG3.Value; Database.KotaF2LG3Poz1 = (float)e.StatusData.MeasuredPos1.F2LG3.Value; // F1 AND F2 POS 2 Database.KotaF1LG2Poz2 = (float)e.StatusData.MeasuredPos2.F1LG2.Value; Database.KotaF2LG2Poz2 = (float)e.StatusData.MeasuredPos2.F2LG2.Value; Database.KotaF1LG3Poz2 = (float)e.StatusData.MeasuredPos2.F1LG3.Value; Database.KotaF2LG3Poz2 = (float)e.StatusData.MeasuredPos2.F2LG3.Value; // E Database.KotaEPoz1 = (float)e.StatusData.MeasuredPos1.E.Value; Database.KotaEPoz2 = (float)e.StatusData.MeasuredPos2.E.Value; // D Database.KotaDPoz1 = (float)e.StatusData.MeasuredPos1.D.Value; Database.KotaDPoz2 = (float)e.StatusData.MeasuredPos2.D.Value; // H1 Database.KotaH1Poz1 = (float)e.StatusData.MeasuredPos1.H1.Value; Database.KotaH1Poz2 = (float)e.StatusData.MeasuredPos2.H1.Value; // K Database.KotaKPoz1 = (float)e.StatusData.MeasuredPos1.K.Value; Database.KotaKPoz2 = (float)e.StatusData.MeasuredPos2.K.Value; // Workpiecedata Database.RadniNalog = (string)e.StatusData.Workpiecedata.RadniNalog.Value; // Fill SQL base for Machine 1 // New thread Thread WriteToDatabaseM2 = new Thread(() => Database.ModifyDb(MySQLconnectionString, "stroj2")); WriteToDatabaseM2.Name = "WriteToDatabaseM2"; WriteToDatabaseM2.Start(); } else if (!(bool)e.StatusData.Savedata.M2.Value) { _oneCallFlagSaveM2 = true; } if (mwHandle != null) { mwHandle.TbStatusMessage.Dispatcher.BeginInvoke((Action)(() => { mwHandle.TbStatusMessage.Text = msg; })); } }
void cmdShrink(BasePlayer player, string command, string[] args) { if (!player.IsAdmin() && !permission.UserHasPermission(player.UserIDString, "shrinkingradzone.use")) { return; } if (args.Length == 0) { SendReply(player, $"<color=#00CC00>{Title}</color> <color=#939393>v</color><color=#00CC00>{Version}</color> <color=#939393>-</color> <color=#00CC00>{Author}</color>"); SendReply(player, msg("/shrink on me - Starts a shrinking rad zone on your position", player.UserIDString)); SendReply(player, msg("/shrink on <x> <z> - Starts a shrinking rad zone on the specified position", player.UserIDString)); SendReply(player, msg("/shrink stop - Destroys all active zones", player.UserIDString)); SendReply(player, msg("/shrink buffer <## value> - Set the radiation buffer size", player.UserIDString)); SendReply(player, msg("/shrink startsize <## value> - Set the initial zone size", player.UserIDString)); SendReply(player, msg("/shrink endsize <## value> - Set the final zone size", player.UserIDString)); SendReply(player, msg("/shrink strength <## value> - Set the radiation strength (rads per second)", player.UserIDString)); SendReply(player, msg("/shrink time <## value> - Set the time it takes to shrink (in seconds)", player.UserIDString)); return; } switch (args[0].ToLower()) { case "on": if (args.Length >= 2) { object position = null; if (args[1].ToLower() == "me") { position = player.transform.position; } else if (args.Length > 2) { float x; float z; if (float.TryParse(args[1], out x) && float.TryParse(args[2], out z)) { var temp = new Vector3(x, 0, z); var height = TerrainMeta.HeightMap.GetHeight((Vector3)temp); position = new Vector3(x, height, z); } } if (position is Vector3) { CreateShrinkZone((Vector3)position, configData.InitialZoneSize, configData.ShrinkTime); SendReply(player, "Zone Created!"); return; } } else { SendReply(player, "/shrink on me\n/shrink on <x> <z>"); return; } return; case "stop": foreach (var zone in activeZones) { UnityEngine.Object.DestroyImmediate(zone.Value); Interface.CallHook("RadzoneEnd", zone.Key); } activeZones.Clear(); SendReply(player, msg("All zones destroyed")); return; case "buffer": if (args.Length == 2) { float value; if (float.TryParse(args[1], out value)) { configData.RadiationBuffer = value; SaveConfig(); SendReply(player, string.Format(msg("Radiation buffer set to : {0}", player.UserIDString), value)); } else { SendReply(player, msg("You must enter a number value", player.UserIDString)); } } else { SendReply(player, msg("/shrink buffer <##>", player.UserIDString)); } return; case "startsize": if (args.Length == 2) { float value; if (float.TryParse(args[1], out value)) { configData.InitialZoneSize = value; SaveConfig(); SendReply(player, string.Format(msg("Initial size set to : {0}", player.UserIDString), value)); } else { SendReply(player, msg("You must enter a number value", player.UserIDString)); } } else { SendReply(player, msg("/shrink startsize <##>", player.UserIDString)); } return; case "endsize": if (args.Length == 2) { float value; if (float.TryParse(args[1], out value)) { configData.FinalZoneSize = value; SaveConfig(); SendReply(player, string.Format(msg("Final size set to : {0}", player.UserIDString), value)); } else { SendReply(player, msg("You must enter a number value", player.UserIDString)); } } else { SendReply(player, msg("/shrink endsize <##>", player.UserIDString)); } return; case "strength": if (args.Length == 2) { float value; if (float.TryParse(args[1], out value)) { configData.RadiationStrength = value; SaveConfig(); SendReply(player, string.Format(msg("Radiation strength set to : {0}", player.UserIDString), value)); } else { SendReply(player, msg("You must enter a number value", player.UserIDString)); } } else { SendReply(player, msg("/shrink strength <##>", player.UserIDString)); } return; case "time": if (args.Length == 2) { float value; if (float.TryParse(args[1], out value)) { configData.ShrinkTime = value; SaveConfig(); SendReply(player, string.Format(msg("Shrink time set to : {0}", player.UserIDString), value)); } else { SendReply(player, msg("You must enter a number value", player.UserIDString)); } } else { SendReply(player, msg("/shrink time <##>", player.UserIDString)); } return; default: break; } }
private object OnRunCommand(ConsoleSystem.Arg arg, bool wantreply) { if (arg == null) { return(null); } var cmdnamefull = $"{arg.Class}.{arg.Function}"; // Get the args var str = arg.GetString(0); // Get the covalence player var iplayer = arg.argUser != null?covalence.PlayerManager.FindPlayer(arg.argUser.userID.ToString()) : null; // Is it a console command? if (cmdnamefull != "chat.say") { if (covalence.CommandSystem.HandleConsoleMessage(iplayer, $"{cmdnamefull} {str}") || cmdlib.HandleConsoleCommand(arg, wantreply)) { return(true); } return(null); } if (str.Length == 0) { return(true); } // Is it a chat command? if (str[0] != '/') { var chatSpecific = Interface.Call("OnPlayerChat", arg.argUser, str); var chatCovalence = Interface.Call("OnUserChat", iplayer, str); return(chatSpecific ?? chatCovalence); } // Get the full command var command = str.Substring(1); // Parse it string cmd; string[] args; ParseChatCommand(command, out cmd, out args); if (cmd == null) { return(true); } // Is the command blocked? var commandSpecific = Interface.Call("OnPlayerCommand", arg); var commandCovalence = Interface.Call("OnUserCommand", iplayer, cmd, args); if (commandSpecific != null || commandCovalence != null) { return(true); } // Is this a Covalence command? if (covalence.CommandSystem.HandleChatMessage(iplayer, str)) { return(true); } // Is it a regular chat command? var player = arg.argUser; if (player == null) { Interface.Oxide.LogDebug("Player is actually a {0}!", arg.argUser); } else if (!cmdlib.HandleChatCommand(player, cmd, args)) { ConsoleNetworker.SendClientCommand(player.networkPlayer, $"chat.add \"Server\" \" Unknown command {cmd}\""); } // Handled arg.ReplyWith(string.Empty); return(true); }
void cxmdShrink(ConsoleSystem.Arg arg) { if (arg.connection != null) { return; } if (arg.Args.Length == 0) { SendReply(arg, $"{Title} v{Version} - {Author}"); SendReply(arg, "shrink on <x> <z> - Starts a shrinking rad zone on the specified position"); SendReply(arg, "shrink stop - Destroys all active zones"); SendReply(arg, "shrink buffer <## value> - Set the radiation buffer size"); SendReply(arg, "shrink startsize <## value> - Set the initial zone size"); SendReply(arg, "shrink endsize <## value> - Set the final zone size"); SendReply(arg, "shrink strength <## value> - Set the radiation strength (rads per second)"); SendReply(arg, "shrink time <## value> - Set the time it takes to shrink (in seconds)"); return; } switch (arg.Args[0].ToLower()) { case "on": if (arg.Args.Length >= 2) { object position = null; if (arg.Args.Length > 2) { float x; float z; if (float.TryParse(arg.Args[1], out x) && float.TryParse(arg.Args[2], out z)) { var temp = new Vector3(x, 0, z); var height = TerrainMeta.HeightMap.GetHeight((Vector3)temp); position = new Vector3(x, height, z); } } if (position is Vector3) { CreateShrinkZone((Vector3)position, configData.InitialZoneSize, configData.ShrinkTime); SendReply(arg, "Zone Created!"); return; } } else { SendReply(arg, "/shrink on me\n/shrink on <x> <z>"); return; } return; case "stop": foreach (var zone in activeZones) { UnityEngine.Object.DestroyImmediate(zone.Value); Interface.CallHook("RadzoneEnd", zone.Key); } activeZones.Clear(); SendReply(arg, msg("All zones destroyed")); return; case "buffer": if (arg.Args.Length == 2) { float value; if (float.TryParse(arg.Args[1], out value)) { configData.RadiationBuffer = value; SaveConfig(); SendReply(arg, string.Format(msg("Radiation buffer set to : {0}"), value)); } else { SendReply(arg, msg("You must enter a number value")); } } else { SendReply(arg, msg("shrink buffer <##>")); } return; case "startsize": if (arg.Args.Length == 2) { float value; if (float.TryParse(arg.Args[1], out value)) { configData.InitialZoneSize = value; SaveConfig(); SendReply(arg, string.Format(msg("Initial size set to : {0}"), value)); } else { SendReply(arg, msg("You must enter a number value")); } } else { SendReply(arg, msg("shrink startsize <##>")); } return; case "endsize": if (arg.Args.Length == 2) { float value; if (float.TryParse(arg.Args[1], out value)) { configData.FinalZoneSize = value; SaveConfig(); SendReply(arg, string.Format(msg("Final size set to : {0}"), value)); } else { SendReply(arg, msg("You must enter a number value")); } } else { SendReply(arg, msg("shrink endsize <##>")); } return; case "strength": if (arg.Args.Length == 2) { float value; if (float.TryParse(arg.Args[1], out value)) { configData.RadiationStrength = value; SaveConfig(); SendReply(arg, string.Format(msg("Radiation strength set to : {0}"), value)); } else { SendReply(arg, msg("You must enter a number value")); } } else { SendReply(arg, msg("shrink strength <##>")); } return; case "time": if (arg.Args.Length == 2) { float value; if (float.TryParse(arg.Args[1], out value)) { configData.ShrinkTime = value; SaveConfig(); SendReply(arg, string.Format(msg("Shrink time set to : {0}"), value)); } else { SendReply(arg, msg("You must enter a number value")); } } else { SendReply(arg, msg("shrink time <##>")); } return; default: break; } }
private void RadzoneFinished() { Interface.CallHook("RadzoneEnd", zoneId); }
public static void Main(string[] args) { int opcao; string entradaArq; string entrada; GeradorFicha gf = new GeradorFicha(); Console.WriteLine("Bem Vindo ao Programa de CPMSO\n"); Console.WriteLine("Digite o numero da opção que deseja\n"); Interface inter = new Interface(); inter.exibirOpcoes(); opcao = Convert.ToInt32(Console.ReadLine()); if (opcao == 1) //Gerar ficha medica da Empresa. { Console.Clear(); Console.WriteLine("Digite o nome do funcionario para Obter os dados.\n"); Console.WriteLine("Digite o motivo da Consulta.\n"); } if (opcao == 2) //Gerar ficha medica da Clinica. { Console.Clear(); Console.WriteLine("Digite o nome do funcionario para Obter os dados.\n"); Console.WriteLine("Digite o motivo da Consulta.\n"); Console.WriteLine("Empresa: {0}", gf.GetnomeEmpresa()); Console.WriteLine("/n"); Console.WriteLine("O local e horario de funcionamento da clinica são: \n"); Console.WriteLine(gf.GetlocalConsulta()); Console.WriteLine("/n"); } if (opcao == 3) //Visualizar lista de funcionarios. { Console.Clear(); FileStream arquivofuncionarios = new FileStream("listaInfFuncionarios.txt", FileMode.Open, FileAccess.Read); StreamReader lendo = new StreamReader(arquivofuncionarios, Encoding.UTF8); Console.WriteLine("|Nome |Nascimento |RG |CPF |Setor |Função |Ultimo ASO"); while (!lendo.EndOfStream) { entradaArq = lendo.ReadLine(); Console.WriteLine(entradaArq); } } if (opcao == 4) //Trocar local e horario de funcionamento da clinica.. { Console.Clear(); Console.WriteLine("O novo local e horario de funcionamento da clinica é:"); gf.SetlocalConsulta(Console.ReadLine()); Console.WriteLine("/n"); Console.WriteLine("Você trocou o local e horario para:\n"); Console.WriteLine(gf.GetlocalConsulta()); } if (opcao == 5) // { Console.Clear(); Interface.verlistaExames(); } if (opcao == 6) // { Console.Clear(); Interface.verlistaFuncoes(); } if (opcao == 7) //SAIR. { Console.Clear(); } }
private void CLProject(BaseEntity.RPCMessage msg) { BasePlayer player = msg.player; if (!this.VerifyClientAttack(player)) { this.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); } else { if (Object.op_Equality((Object)player, (Object)null) || player.IsHeadUnderwater()) { return; } if (!this.canThrowAsProjectile) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Not throwable (" + this.ShortPrefabName + ")"); player.stats.combat.Log((AttackEntity)this, "not_throwable"); } else { Item pickupItem = this.GetItem(); if (pickupItem == null) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Item not found (" + this.ShortPrefabName + ")"); player.stats.combat.Log((AttackEntity)this, "item_missing"); } else { ItemModProjectile component1 = (ItemModProjectile)((Component)pickupItem.info).GetComponent <ItemModProjectile>(); if (Object.op_Equality((Object)component1, (Object)null)) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Item mod not found (" + this.ShortPrefabName + ")"); player.stats.combat.Log((AttackEntity)this, "mod_missing"); } else { ProjectileShoot projectileShoot = ProjectileShoot.Deserialize((Stream)msg.read); if (((List <ProjectileShoot.Projectile>)projectileShoot.projectiles).Count != 1) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Projectile count mismatch (" + this.ShortPrefabName + ")"); player.stats.combat.Log((AttackEntity)this, "count_mismatch"); } else { player.CleanupExpiredProjectiles(); using (List <ProjectileShoot.Projectile> .Enumerator enumerator = ((List <ProjectileShoot.Projectile>)projectileShoot.projectiles).GetEnumerator()) { while (enumerator.MoveNext()) { ProjectileShoot.Projectile current = enumerator.Current; if (player.HasFiredProjectile((int)current.projectileID)) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Duplicate ID (" + (object)(int)current.projectileID + ")"); player.stats.combat.Log((AttackEntity)this, "duplicate_id"); } else if (this.ValidateEyePos(player, (Vector3)current.startPos)) { player.NoteFiredProjectile((int)current.projectileID, (Vector3)current.startPos, (Vector3)current.startVel, (AttackEntity)this, pickupItem.info, pickupItem); Effect effect = new Effect(); effect.Init(Effect.Type.Projectile, (Vector3)current.startPos, (Vector3)current.startVel, msg.connection); effect.scale = (__Null)1.0; effect.pooledString = component1.projectileObject.resourcePath; effect.number = current.seed; EffectNetwork.Send(effect); } } } pickupItem.SetParent((ItemContainer)null); Interface.CallHook("OnMeleeThrown", (object)player, (object)pickupItem); if (!this.canAiHearIt) { return; } float num = 0.0f; if (component1.projectileObject != null) { GameObject gameObject = component1.projectileObject.Get(); if (Object.op_Inequality((Object)gameObject, (Object)null)) { Projectile component2 = (Projectile)gameObject.GetComponent <Projectile>(); if (Object.op_Inequality((Object)component2, (Object)null)) { foreach (DamageTypeEntry damageType in component2.damageTypes) { num += damageType.amount; } } } } if (!Object.op_Inequality((Object)player, (Object)null)) { return; } Sense.Stimulate(new Sensation() { Type = SensationType.ThrownWeapon, Position = ((Component)player).get_transform().get_position(), Radius = 50f, DamagePotential = num, InitiatorPlayer = player, Initiator = (BaseEntity)player }); } } } } } }
private void OnPlayerSpawn(ClientInfo client) { // Call covalence hook Interface.Call("OnUserSpawn", covalence.PlayerManager.GetPlayer(client.playerId)); }
private void RenderLoggingSettings() { using (new UnityEngine.GUILayout.HorizontalScope()) { UnityEngine.GUILayout.Label(text: "Verbose level:"); if (UnityEngine.GUILayout.Button(text: "←", options: GUILayoutWidth(2))) { Log.SetVerboseLogging(Math.Max(verbose_logging_ - 1, 0)); verbose_logging_ = Log.GetVerboseLogging(); } UnityEngine.GUILayout.TextArea( text: Log.GetVerboseLogging().ToString(), options: GUILayoutWidth(2)); if (UnityEngine.GUILayout.Button(text: "→", options: GUILayoutWidth(2))) { Log.SetVerboseLogging(Math.Min(verbose_logging_ + 1, 4)); verbose_logging_ = Log.GetVerboseLogging(); } } float column_width = Width(3); var gui_layout_column_width = GUILayoutWidth(3); using (new UnityEngine.GUILayout.HorizontalScope()) { UnityEngine.GUILayout.Space(column_width); UnityEngine.GUILayout.Label(text: "Log", options: gui_layout_column_width); UnityEngine.GUILayout.Label(text: "stderr", options: gui_layout_column_width); UnityEngine.GUILayout.Label(text: "Flush", options: gui_layout_column_width); } using (new UnityEngine.GUILayout.HorizontalScope()) { UnityEngine.GUILayout.Space(column_width); if (UnityEngine.GUILayout.Button(text: "↑", options: gui_layout_column_width)) { Log.SetSuppressedLogging(Math.Max(suppressed_logging_ - 1, 0)); suppressed_logging_ = Log.GetSuppressedLogging(); } if (UnityEngine.GUILayout.Button(text: "↑", options: gui_layout_column_width)) { Log.SetStderrLogging(Math.Max(stderr_logging_ - 1, 0)); stderr_logging_ = Log.GetStderrLogging(); } if (UnityEngine.GUILayout.Button(text: "↑", options: gui_layout_column_width)) { Log.SetBufferedLogging(Math.Max(buffered_logging_ - 1, -1)); buffered_logging_ = Log.GetBufferedLogging(); } } for (int severity = 0; severity <= 3; ++severity) { using (new UnityEngine.GUILayout.HorizontalScope()) { UnityEngine.GUILayout.Label( text: Log.severity_names[severity], options: gui_layout_column_width); UnityEngine.GUILayout.Toggle( value: severity >= Log.GetSuppressedLogging(), text: "", options: gui_layout_column_width); UnityEngine.GUILayout.Toggle( value: severity >= Log.GetStderrLogging(), text: "", options: gui_layout_column_width); UnityEngine.GUILayout.Toggle( value: severity > Log.GetBufferedLogging(), text: "", options: gui_layout_column_width); } } using (new UnityEngine.GUILayout.HorizontalScope()) { UnityEngine.GUILayout.Space(column_width); if (UnityEngine.GUILayout.Button(text: "↓", options: gui_layout_column_width)) { Log.SetSuppressedLogging(Math.Min(suppressed_logging_ + 1, 3)); suppressed_logging_ = Log.GetSuppressedLogging(); } if (UnityEngine.GUILayout.Button(text: "↓", options: gui_layout_column_width)) { Log.SetStderrLogging(Math.Min(stderr_logging_ + 1, 3)); stderr_logging_ = Log.GetStderrLogging(); } if (UnityEngine.GUILayout.Button(text: "↓", options: gui_layout_column_width)) { Log.SetBufferedLogging(Math.Min(buffered_logging_ + 1, 3)); buffered_logging_ = Log.GetBufferedLogging(); } } using (new UnityEngine.GUILayout.HorizontalScope()) { must_record_journal_ = UnityEngine.GUILayout.Toggle( value: must_record_journal_, text: "Record journal (starts on load)"); UnityEngine.GUILayout.Label( "Journaling is " + (journaling_ ? "ON" : "OFF"), style: Style.Info(Style.RightAligned(UnityEngine.GUI.skin.label))); } if (journaling_ && !must_record_journal_) { // We can deactivate a recorder at any time, but in order for replaying to // work, we should only activate one before creating a plugin. journaling_ = false; Interface.ActivateRecorder(false); } }
private void OnPlayerDisconnected(ClientInfo client) { // Let covalence know covalence.PlayerManager.NotifyPlayerDisconnect(client); Interface.Call("OnUserDisconnected", covalence.PlayerManager.GetPlayer(client.playerId), "Unknown"); }