public TeacherController(Timer timer, InputFilter inputFilter, InputBox inputBox, OutputBox outputBox1, OutputBox outputBox2, Taskbar taskbar, Input input, TeacherView teacherView, TaskbarController taskbarController, OutputBoxController outputBoxController1, OutputBoxController outputBoxController2, InputBoxController inputBoxController, BorderController borderController, User user, QueryCreator queryCreator, TeacherDBController teacherDBController) { this.timer = timer; this.inputFilter = inputFilter; this.queryCreator = queryCreator; this.inputBox = inputBox; this.outputBox1 = outputBox1; this.outputBox2 = outputBox2; this.taskbar = taskbar; this.input = input; this.taskbarController = taskbarController; this.outputBoxController1 = outputBoxController1; this.outputBoxController2 = outputBoxController2; this.inputBoxController = inputBoxController; this.borderController = borderController; this.teacherDBController = teacherDBController; this.teacherView = teacherView; this.teacher = new Teacher(user.Password, user.Username, user.LetterID, user.FirstName, user.LastName, user.FieldID, user.Subject); timer.Tick += KeyActive; timer.Tick += this.borderController.BordarChange; }
private static void smethod_19(Session session_0, ClientMessage clientMessage_0) { if (!session_0.CharacterInfo.IsMuted) { uint actorId = clientMessage_0.ReadUnsignedInteger(); clientMessage_0.ReadUnsignedInteger(); string messageText = InputFilter.FilterString(clientMessage_0.ReadString().Trim(), false); clientMessage_0.ReadUnsignedInteger(); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if (actorByReferenceId != null) { SpaceActor actor = instanceBySpaceId.GetActor(actorId); if ((actor != null) && (messageText.Length != 0)) { if (messageText.Length > 100) { messageText = messageText.Substring(0, 100); } uint referenceId = actor.ReferenceId; if (referenceId > 0) { actorByReferenceId.Whisper(messageText, referenceId, false); } } } } } }
private static void smethod_18(Session session_0, ClientMessage clientMessage_0) { if (!session_0.CharacterInfo.IsMuted) { SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if (actorByReferenceId != null) { CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject; clientMessage_0.ReadUnsignedInteger(); string input = InputFilter.FilterString(clientMessage_0.ReadString().Trim(), false); int messageColor = clientMessage_0.ReadInteger(); if (input.Length != 0) { if (input.Length > 100) { input = input.Substring(0, 100); } if ((messageColor == 2) && (referenceObject.Staff == 0)) { messageColor = 1; } if (!input.StartsWith("@") || !ChatCommands.HandleCommand(session_0, input)) { actorByReferenceId.Chat(input, messageColor, referenceObject.Staff == 1); } } } } } }
// Filter for keys public void KeyFilter(object sender, KeyEventArgs e) { if (!InputFilter.IsKeyAllowed(e.Key)) { e.Handled = true; } }
public StudentController(Timer timer, InputFilter inputFilter, InputBox inputBox, OutputBox outputBox, StudentView studentView, Input input, InputBoxController inputBoxController, OutputBoxController outputBoxController, BorderController borderController, User user, QueryCreator queryCreator, StudentDBController studentDBController ) { this.timer = timer; this.inputFilter = inputFilter; this.queryCreator = queryCreator; this.inputBox = inputBox; this.outputBox = outputBox; this.student = new Student(user.Password, user.Username, user.LetterID, user.FirstName, user.LastName, user.FieldID, user.Subject); this.studentView = studentView; this.input = input; this.inputBoxController = inputBoxController; this.outputBoxController = outputBoxController; this.borderController = borderController; this.studentDBController = studentDBController; timer.Tick += this.borderController.BordarChange; timer.Tick += KeyActive; }
private static void smethod_18(Session session_0, ClientMessage clientMessage_0) { if (!session_0.CharacterInfo.IsMuted) { SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if (actorByReferenceId != null) { CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject; clientMessage_0.ReadUnsignedInteger(); string input = InputFilter.FilterString(clientMessage_0.ReadString().Trim(), false); int messageColor = clientMessage_0.ReadInteger(); if (input.Length != 0) { if (input.Length > 100) { input = input.Substring(0, 100); } if (referenceObject.Staff == 0) { messageColor = 1; } if (referenceObject.Staff == 1) { messageColor = 9; } if (referenceObject.Staff == 2) { messageColor = 2; } if (!input.StartsWith("@") || !ChatCommands.HandleCommand(session_0, input)) { actorByReferenceId.Chat(input, messageColor, referenceObject.Staff == 1); } //1 white, 2 gold, 6 pink, 7 red, 8 blue, 9 orange, 10 green /* * * White = Normal * Gold = RetroMods * Green = Designer * Blue = Translators * Pink = VIP * Red = Admin * Orange = XAT Staff * */ } } } } }
public static string ReadLine(int maxLength = 32, InputFilter filter = InputFilter.All) { string history = string.Empty; do { var keyInfo = Console.ReadKey(true); if (keyInfo.Key == ConsoleKey.Backspace) { if (history.Length > 0) { history = history.Substring(0, history.Length - 1); Console.Write("\b \b"); } } else if (keyInfo.Key == ConsoleKey.Enter) { Console.Write('\n'); break; } else if (TestFilter(filter, keyInfo.KeyChar)) { if (history.Length < maxLength) { history += keyInfo.KeyChar; Console.Write(keyInfo.KeyChar); } } } while (true); return(history); }
private static void smethod_9(Session session_0, ClientMessage clientMessage_0) { uint num = clientMessage_0.ReadUnsignedInteger(); string str = InputFilter.FilterString(clientMessage_0.ReadString(), false).Trim(); if ((((num > 0) && (str.Length >= 1)) && (num != session_0.CharacterId)) && session_0.LaptopFriendCache.Friends.Contains(num)) { Session sessionByCharacterId = SessionManager.GetSessionByCharacterId(num); if (sessionByCharacterId == null) { using (SqlDatabaseClient client = SqlDatabaseManager.GetClient()) { client.SetParameter("sender", session_0.CharacterId); client.SetParameter("receptor", num); client.SetParameter("text", str); client.SetParameter("time", UnixTimestamp.GetCurrent()); client.SetParameter("color", session_0.CharacterInfo.Staff); client.ExecuteNonQuery("INSERT INTO laptop_mensajes (emisor, receptor, contenido, timestamp, color, leido) VALUES (@sender, @receptor, @text, @time, @color, 0)"); } } else { sessionByCharacterId.SendData(LaptopMessageComposer.Compose(session_0.CharacterId, str, session_0.CharacterInfo.Staff), false); } } }
private void InputUpdate() { this.prevState = this.state; this.state = GamePad.GetState(this.playerIndex); if (this._pos < this._maxLength) { if (this.state.IsConnected) { InputThread.InputStruct inputStruct = this.inputsIn[this._pos]; InputFilter inputFilter = this.leftXFilter; GamePadThumbSticks thumbSticks = this.state.ThumbSticks; GamePadThumbSticks.StickValue left = thumbSticks.Left; inputStruct.leftX = inputFilter.Filter((double)left.X); InputThread.InputStruct inputStruct1 = this.inputsIn[this._pos]; InputFilter inputFilter1 = this.leftYFilter; thumbSticks = this.state.ThumbSticks; left = thumbSticks.Left; inputStruct1.leftY = inputFilter1.Filter((double)left.Y); InputThread.InputStruct inputStruct2 = this.inputsIn[this._pos]; InputFilter inputFilter2 = this.rightXFilter; thumbSticks = this.state.ThumbSticks; left = thumbSticks.Right; inputStruct2.rightX = inputFilter2.Filter((double)left.X); InputThread.InputStruct inputStruct3 = this.inputsIn[this._pos]; InputFilter inputFilter3 = this.rightYFilter; thumbSticks = this.state.ThumbSticks; left = thumbSticks.Right; inputStruct3.rightY = inputFilter3.Filter((double)left.Y); this.inputsIn[this._pos].time = DateTime.UtcNow.Ticks; this.inputsIn[this._pos].leftXVel = this.GetVel(this.inputsIn[this._pos].leftX, this._lastFrameData.leftX, this.inputsIn[this._pos].time, this._lastFrameData.time); this.inputsIn[this._pos].leftYVel = this.GetVel(this.inputsIn[this._pos].leftY, this._lastFrameData.leftY, this.inputsIn[this._pos].time, this._lastFrameData.time); this.inputsIn[this._pos].rightXVel = this.GetVel(this.inputsIn[this._pos].rightX, this._lastFrameData.rightX, this.inputsIn[this._pos].time, this._lastFrameData.time); this.inputsIn[this._pos].rightYVel = this.GetVel(this.inputsIn[this._pos].rightY, this._lastFrameData.rightY, this.inputsIn[this._pos].time, this._lastFrameData.time); this._lastFrameData.leftX = this.inputsIn[this._pos].leftX; this._lastFrameData.leftY = this.inputsIn[this._pos].leftY; this._lastFrameData.rightX = this.inputsIn[this._pos].rightX; this._lastFrameData.rightY = this.inputsIn[this._pos].rightY; this._lastFrameData.time = this.inputsIn[this._pos].time; this._pos++; return; } this.inputsIn[this._pos].leftX = this.leftXFilter.Filter((double)((Mathf.Abs(this.inputController.player.GetAxis("LeftStickX")) < 0.1f ? 0f : this.inputController.player.GetAxis("LeftStickX")))); this.inputsIn[this._pos].leftY = this.leftYFilter.Filter((double)this.inputController.player.GetAxis("LeftStickY")); this.inputsIn[this._pos].rightX = this.rightXFilter.Filter((double)((Mathf.Abs(this.inputController.player.GetAxis("RightStickX")) < 0.1f ? 0f : this.inputController.player.GetAxis("RightStickX")))); this.inputsIn[this._pos].rightY = this.rightYFilter.Filter((double)this.inputController.player.GetAxis("RightStickY")); this.inputsIn[this._pos].time = DateTime.UtcNow.Ticks; this.inputsIn[this._pos].leftXVel = this.GetVel(this.inputsIn[this._pos].leftX, this._lastFrameData.leftX, this.inputsIn[this._pos].time, this._lastFrameData.time); this.inputsIn[this._pos].leftYVel = this.GetVel(this.inputsIn[this._pos].leftY, this._lastFrameData.leftY, this.inputsIn[this._pos].time, this._lastFrameData.time); this.inputsIn[this._pos].rightXVel = this.GetVel(this.inputsIn[this._pos].rightX, this._lastFrameData.rightX, this.inputsIn[this._pos].time, this._lastFrameData.time); this.inputsIn[this._pos].rightYVel = this.GetVel(this.inputsIn[this._pos].rightY, this._lastFrameData.rightY, this.inputsIn[this._pos].time, this._lastFrameData.time); this._lastFrameData.leftX = this.inputsIn[this._pos].leftX; this._lastFrameData.leftY = this.inputsIn[this._pos].leftY; this._lastFrameData.rightX = this.inputsIn[this._pos].rightX; this._lastFrameData.rightY = this.inputsIn[this._pos].rightY; this._lastFrameData.time = this.inputsIn[this._pos].time; this._pos++; } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); lastUpdateTime = DateTime.Now; inputFilter = new InputFilter(); }
public SettingsForm() { InitializeComponent(); cboLogLevel.SetEnum <LogLevel>(LogContract.GetString); InputFilter.AddControl(cboLogLevel, InputFilterOptions.Any); InputFilter.AddControl(updMonitorInterval, InputFilterOptions.UnsignedInteger | InputFilterOptions.AllowZero, new DoubleRange(1, 60)); }
//фильтр ввода только цифр private void textBox_PreviewTextInput(object sender, TextCompositionEventArgs e) { char ch = e.Text[0]; if (InputFilter.CheckDigit(ch)) { e.Handled = true; } }
public static PropertyMap GetInputFilterMap(InputFilter inputFilter) { var defaultValue = ""; var map = new PropertyMap(); var accepted = inputFilter.Accepted == null ? defaultValue : inputFilter.Accepted; var rejected = inputFilter.Rejected == null ? defaultValue : inputFilter.Rejected; map.Add(0, accepted); map.Add(1, rejected); return(map); }
public static InputFilter GetInputFilterStruct(PropertyMap map) { var inputFilter = new InputFilter(); if (null != map) { var defaultValue = ""; inputFilter.Accepted = GetStringFromMap(map, 0, defaultValue); inputFilter.Rejected = GetStringFromMap(map, 1, defaultValue); } return(inputFilter); }
private void setAddressLayout(int layout, bool inputTypeClassText) { addressLinearLayout.removeAllViews(); int count = 0; int maxInputLength = 0; if (layout == LAYOUT_MAC_ADDRESS) { count = 6; maxInputLength = 2; } else if (layout == LAYOUT_IP_ADDRESS) { count = 4; maxInputLength = 3; } if (count > 0) { for (int i = 0; i < count; i++) { EditText editText = new EditText(Activity); if (inputTypeClassText) { editText.InputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; } else { editText.InputType = InputType.TYPE_CLASS_NUMBER; } InputFilter[] filters = new InputFilter[1]; filters[0] = new InputFilter.LengthFilter(maxInputLength); editText.Filters = filters; if (i == count - 1) { editText.ImeOptions = EditorInfo.IME_ACTION_DONE; } else { editText.ImeOptions = EditorInfo.IME_ACTION_NEXT; } addressLinearLayout.addView(editText, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1f)); } } }
private void VerifyUniqueElementsExist() { LableShowEntries.Verify(); DropDownNumberOfEntriesToShow.Verify(); InputFilter.Verify(); CheckBoxRemoveRecord.Verify(); LabelFilter.Verify(); Column1Header.Verify(); Column2Header.Verify(); Column3Header.Verify(); ShowingEntries.Verify(); TableIdValueFromFirstRow.Verify(); Column1Row1FromTable.Verify(); Column2Row1FromTable.Verify(); Showing1ToXofYentries.Verify(); }
public static void NewVerb() { string inputString = InputFilter.ReadL(); mods.Clear(); inputString = inputString.ToLower(); string[] inputAr = inputString.Split(' '); if (inputAr.Length != 0) { verb = inputAr[0]; foreach (Verb item in Game.verbs) // goes through all verbs that are in the list Game.verbs { if (verb == item.name.ToLower()) //if player first input is one of the verbs name { if (item.hasMods && inputAr.Length > 1) { foreach (string allowed in item.allowedMods) { if (allowed.ToLower() == inputAr[1]) { mods.Add(inputAr[1]); } } if (mods.Count > 0) { return; } } else if (!item.hasMods || (item.hasMods && item.allowedMods.Count == 0)) { return; } else if (item.modsAllowedEmpty && mods.Count == 0) { return; } if (item.hasMods) { Output.ErrorText("Allowed mods: " + item.allowedMods.ReturnAllString(), true); } } } } Output.ErrorText("Incorrect input", true); NewVerb(); }
private static bool TestFilter(InputFilter filter, char character) { switch (filter) { case InputFilter.All: return(true); case InputFilter.Numeric: return(char.IsDigit(character)); case InputFilter.Text: return(char.IsLetter(character) || char.IsPunctuation(character) || char.IsWhiteSpace(character)); default: return(false); } }
void Update() { Game.Update(Time.deltaTime); foreach (var e in Game.Buildings) { if (e.GameObject == null) { AttachGameObject(e); } var obj = e.GameObject; var h = Game.Terrain.AverageHeight(e.Cell.i, e.Cell.j, e.type.w, e.type.h); var center = e.Cell.ToVector + 0.5f * new Vector3(e.type.w, 0, e.type.h); obj.transform.position = center + new Vector3(0, h, 0); obj.transform.localScale = new Vector3(1, (0.2f + 0.8f * e.BuildProgress), 1); e.GameObject.GetComponent <Renderer>().material.color = BuildingColor(e); } PruneDead(Game.Buildings); Game.Buildings.RemoveAll(e => e.IsDead); foreach (var e in Game.Entities) { if (Game.NeighbourDist[e.Pos] > Game.VisionRange) { continue; } if (e.GameObject == null) { AttachGameObject(e); } e.GameObject.transform.position = e.Pos; e.GameObject.transform.rotation = Quaternion.LookRotation(e.Dir, Vector3.up); } PruneDead(Game.Entities); Game.Entities.RemoveAll(e => e.IsDead); InputFilter.Update(); if (InputFilter.IsStartOfTap && Input.mousePosition.x > 110) { Game.SelectCell(); } if (InputFilter.Hold) { var delta = new Vector3(InputFilter.Swipe.x, 0, InputFilter.Swipe.y); Game.Pan += 0.003f * Game.Zoom * delta; } }
private void VerifyUniqueElementsExist() { LableShowEntries.Verify(); DropDownNumberOfEntriesToShow.Verify(); InputFilter.Verify(); CheckBoxRemoveRecord.Verify(); LabelFilter.Verify(); ColumnHeader1.Verify(); ColumnHeader2.Verify(); ColumnHeader3.Verify(); ColumnHeader4.Verify(); ShowingEntries.Verify(); TableIdValueFromFirstRow.Verify(); Column1Row1FromTable.Verify(); Column2Row1FromTable.Verify(); Showing1ToXofYentries.Verify(); Console.WriteLine("Verified elements show expected content"); }
public Filter(InputFilter f) { this.inputFilter = f; regex = inputFilter.Regex; filterName = inputFilter.Filter_name; filterType = inputFilter.Filter_type; filterSubType = inputFilter.Filter_sub_type; if (inputFilter.Check_digit_class.Trim().Length > 0) { try { checkDigit = Assembly.GetExecutingAssembly().CreateInstance(inputFilter.Check_digit_class) as CheckDigit; } catch { } } }
private static void smethod_3(Session session_0, ClientMessage clientMessage_0) { string str = InputFilter.FilterString(clientMessage_0.ReadString().Replace('%', ' '), false); if (str.Length >= 1) { CharacterInfo characterInfo = null; using (SqlDatabaseClient client = SqlDatabaseManager.GetClient()) { client.SetParameter("query", str); DataRow row = client.ExecuteQueryRow("SELECT id FROM usuarios WHERE usuario = @query LIMIT 1"); if (row != null) { characterInfo = CharacterInfoLoader.GetCharacterInfo(client, (uint)row["id"]); } } session_0.SendData(LaptopSearchResultComposer.Compose(characterInfo), false); } }
/// <summary> /// Create an InputFilter_JPanel for creating where clauses /// for StateMod diversion station queries. This is used by the StateMod GUI. </summary> /// <param name="dataset"> StateMod_DataSet instance. </param> /// <returns> a JPanel containing InputFilter instances for StateMod_Diversion queries. </returns> /// <exception cref="Exception"> if there is an error. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public StateMod_Diversion_InputFilter_JPanel(StateMod_DataSet dataset) throws Exception public StateMod_Diversion_InputFilter_JPanel(StateMod_DataSet dataset) : base() { IList <InputFilter> input_filters = new List <InputFilter>(15); InputFilter filter = null; input_filters.Add(new InputFilter("", "", StringUtil.TYPE_STRING, null, null, true)); // Blank to disable filter input_filters.Add(new InputFilter("ID", "ID", StringUtil.TYPE_STRING, null, null, true)); input_filters.Add(new InputFilter("Name", "Name", StringUtil.TYPE_STRING, null, null, true)); input_filters.Add(new InputFilter("River Node ID", "RiverNodeID", StringUtil.TYPE_STRING, null, null, true)); filter = new InputFilter("On/Off Switch", "OnOff", StringUtil.TYPE_INTEGER, StateMod_Diversion.getIdivswChoices(true), StateMod_Diversion.getIdivswChoices(false), true); filter.setTokenInfo(" ", 0); input_filters.Add(filter); input_filters.Add(new InputFilter("Capacity", "Capacity", StringUtil.TYPE_DOUBLE, null, null, true)); filter = new InputFilter("Replacement Reservoir Option", "ReplaceResOption", StringUtil.TYPE_INTEGER, StateMod_Diversion.getIreptypeChoices(true), StateMod_Diversion.getIreptypeChoices(false), true); filter.setTokenInfo(" ", 0); input_filters.Add(filter); input_filters.Add(new InputFilter("Daily ID", "DailyID", StringUtil.TYPE_STRING, null, null, true)); input_filters.Add(new InputFilter("User Name", "UserName", StringUtil.TYPE_STRING, null, null, true)); filter = new InputFilter("Demand Type", "DemandType", StringUtil.TYPE_INTEGER, StateMod_Diversion.getIdvcomChoices(true), StateMod_Diversion.getIdvcomChoices(false), true); filter.setTokenInfo(" ", 0); input_filters.Add(filter); /* * input_filters.addElement ( new InputFilter ( * "Number of Returns", "NumReturns", * StringUtil.TYPE_INTEGER, * null, null, true ) ); */ input_filters.Add(new InputFilter("Efficiency (Annual)", "EffAnnual", StringUtil.TYPE_DOUBLE, null, null, true)); input_filters.Add(new InputFilter("Area (ACRE)", "Area", StringUtil.TYPE_DOUBLE, null, null, true)); filter = new InputFilter("Use Type", "UseType", StringUtil.TYPE_INTEGER, StateMod_Diversion.getIrturnChoices(true), StateMod_Diversion.getIrturnChoices(false), true); filter.setTokenInfo(" ", 0); input_filters.Add(filter); filter = new InputFilter("Demand Source", "DemandSource", StringUtil.TYPE_INTEGER, StateMod_Diversion.getDemsrcChoices(true), StateMod_Diversion.getDemsrcChoices(false), true); filter.setTokenInfo(" ", 0); input_filters.Add(filter); // TODO SAM 2004-10-25 monthly efficiencies? Returns? setToolTipText("<html>HydroBase queries can be filtered<br>based on station data.</html>"); setInputFilters(input_filters, 3, -1); }
public LoginController(Timer timer, Input input, LoginView loginView, InputBoxController inputBoxController1, InputBoxController inputBoxController2, OutputBoxController outputBoxController, BorderController borderController, InputFilter inputFilter, LoginDBController loginDBController ) { this.timer = timer; this.inputFilter = inputFilter; this.input = input; this.loginView = loginView; this.inputBoxController1 = inputBoxController1; this.inputBoxController2 = inputBoxController2; this.outputBoxController = outputBoxController; this.borderController = borderController; this.loginDBController = loginDBController; this.timer.Tick += this.borderController.BordarChange; this.timer.Tick += KeyActive; }
public static bool HandleCommand(Session Session, string Input) { Input = Input.Substring(1, Input.Length - 1); string[] input = Input.Split(new char[] { ' ' }); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(Session.CurrentSpaceId); SpaceActor actor = (instanceBySpaceId == null) ? null : instanceBySpaceId.GetActorByReferenceId(Session.CharacterId, SpaceActorType.UserCharacter); CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject; switch (input[0]) { case "alerta": if (referenceObject.Staff == 1) { string messageText = InputFilter.FilterString(InputFilter.MergeString(input, 1), false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, messageText, 3, ChatType.Say), 0, false); return(true); } return(false); } return(false); }
public Filters(int filterType) : base() { InputFilter filter = new InputFilter(); filter.Filter_type = filterType; DataSet data = filter.LoadAllByFilterType(); DataTable dt = data.Tables[0]; foreach (DataRow dr in dt.Rows) { InputFilter inputFilter2 = new InputFilter(); inputFilter2.Filter_id = int.Parse(dr["filter_id"].ToString()); inputFilter2.Filter_type = int.Parse(dr["filter_type"].ToString()); inputFilter2.Filter_sub_type = int.Parse(dr["filter_sub_type"].ToString()); inputFilter2.Filter_name = dr["filter_name"].ToString(); inputFilter2.Display_name = dr["display_name"].ToString(); inputFilter2.Regex = dr["regex"].ToString(); inputFilter2.Check_digit_class = dr["check_digit_class"].ToString(); inputFilter2.Filter_class = dr["filter_class"].ToString(); Filter filter2 = new Filter(inputFilter2); this.Add(filter2); } }
/// <summary> /// Perform the query. Currently only diversion stations are supported. /// </summary> private void doQuery() { string routine = "StateMod_QueryTool_JFrame.doQuery", message; InputFilter_JPanel ifp = __input_filter_diversion_JPanel; InputFilter filter = null; int size; // Size of data Vector int i; // Loop for data items. DataSetComponent comp = null; string where, @operator, input; int where_length = 0; // Length of "where", to optimize code. bool do_int, do_double, do_string; string input_string; // Data parameters to check, as int input_int; // transferred from the data objects. double input_double; bool do_ID, do_Name, do_RiverNodeID, do_OnOff, do_Capacity, do_ReplaceResOption, do_DailyID, do_UserName, do_DemandType, do_EffAnnual, do_Area, do_UseType, do_DemandSource; bool[] matches = null; // Indicates if a data item matches all // the filter criteria. bool item_matches; // Indicates whether the itme matches a // single filter criteria. bool[] @checked = null; // Indicates whether a data item has // already been checked for a criteria. // If checked and false, then a "true" // should not reset the false. int nfg = 0; // Number of filter groups. do_int = false; // Whether the data item is an integer. do_double = false; // Whether the data item is a double. do_string = false; // Whether the data item is a string. StateMod_Diversion dds = null; __status_JTextField.setText(__Wait); JGUIUtil.setWaitCursor(this, true); if (ifp is StateMod_Diversion_InputFilter_JPanel) { input_int = StateMod_Util.MISSING_INT; input_double = StateMod_Util.MISSING_DOUBLE; input_string = StateMod_Util.MISSING_STRING; comp = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_DIVERSION_STATIONS); //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Diversion> dds_Vector = (java.util.List<StateMod_Diversion>)comp.getData(); IList <StateMod_Diversion> dds_Vector = (IList <StateMod_Diversion>)comp.getData(); size = 0; if (dds_Vector != null) { size = dds_Vector.Count; } // REVISIT SAM 2004-10-27 Remove when debugging is complete //Message.printStatus ( 2, routine, //"Searching " + size + " diversion stations." ); // Initialize the arrays indicating if data objects have been // checked and whether they matched the filter(s)... if (size > 0) { matches = new bool[size]; @checked = new bool[size]; } for (i = 0; i < size; i++) { matches[i] = false; @checked[i] = false; } // Loop through the where clauses... nfg = ifp.getNumFilterGroups(); for (int ifg = 0; ifg < nfg; ifg++) { // Get the filter information... filter = ifp.getInputFilter(ifg); where = filter.getWhereInternal(); where_length = where.Length; @operator = ifp.getOperator(ifg); input = filter.getInput(false); // REVISIT SAM 2004-10-27 Remove when debugging is // complete //Message.printStatus ( 2, routine, //"where=" + where + " operator=" + operator + //" input=" + input ); // Initialize flags to indicate what data will be // checked... do_int = false; do_double = false; do_string = false; do_ID = false; do_Name = false; do_RiverNodeID = false; do_OnOff = false; do_Capacity = false; do_ReplaceResOption = false; do_DailyID = false; do_UserName = false; do_DemandType = false; do_EffAnnual = false; do_Area = false; do_UseType = false; do_DemandSource = false; // The following checks on "where" need to match the // input filter internal where labels assigned in // StateMod_Diversion_InputFilter_JPanel. // List in the order of the StateMod documentation... if (where.Equals("ID", StringComparison.OrdinalIgnoreCase)) { do_string = true; do_ID = true; } else if (where.Equals("Name", StringComparison.OrdinalIgnoreCase)) { do_string = true; do_Name = true; } else if (where.Equals("RiverNodeID", StringComparison.OrdinalIgnoreCase)) { do_string = true; do_RiverNodeID = true; } else if (where.Equals("OnOff", StringComparison.OrdinalIgnoreCase) && StringUtil.isInteger(input)) { do_int = true; do_OnOff = true; } else if (where.Equals("Capacity", StringComparison.OrdinalIgnoreCase) && StringUtil.isDouble(input)) { do_double = true; do_Capacity = true; } else if (where.Equals("ReplaceResOption", StringComparison.OrdinalIgnoreCase) && StringUtil.isInteger(input)) { do_int = true; do_ReplaceResOption = true; } else if (where.Equals("DailyID", StringComparison.OrdinalIgnoreCase)) { do_string = true; do_DailyID = true; } else if (where.Equals("UserName", StringComparison.OrdinalIgnoreCase)) { do_string = true; do_UserName = true; } else if (where.Equals("DemandType", StringComparison.OrdinalIgnoreCase)) { do_int = true; do_DemandType = true; } else if (where.Equals("EffAnnual", StringComparison.OrdinalIgnoreCase) && StringUtil.isDouble(input)) { do_double = true; do_EffAnnual = true; } else if (where.Equals("Area", StringComparison.OrdinalIgnoreCase) && StringUtil.isDouble(input)) { do_double = true; do_Area = true; } else if (where.Equals("UseType", StringComparison.OrdinalIgnoreCase) && StringUtil.isInteger(input)) { do_int = true; do_UseType = true; } else if (where.Equals("DemandSource", StringComparison.OrdinalIgnoreCase) && StringUtil.isInteger(input)) { do_int = true; do_DemandSource = true; } else if (where_length == 0) { // WIll match anything. } else { // Unrecognized where... continue; } // REVISIT SAM 2004-10-27 Remove when debugging is // complete /* * Message.printStatus ( 2, routine, * "do_string=" + do_string + " do_int=" + do_int + * "do_double=" + do_double + * " " + do_ID + * " " + do_Name + * " " + do_RiverNodeID + * " " + do_OnOff + * " " + do_Capacity + * " " + do_ReplaceResOption + * " " + do_DailyID + * " " + do_UserName + * " " + do_DemandType + * " " + do_EffAnnual + * " " + do_Area + * " " + do_UseType + * " " + do_DemandSource ); */ for (i = 0; i < size; i++) { dds = (StateMod_Diversion)dds_Vector[i]; // Get the specific data to compare... if (do_ID) { input_string = dds.getID(); } else if (do_Name) { input_string = dds.getName(); } else if (do_RiverNodeID) { input_string = dds.getCgoto(); } else if (do_OnOff) { input_int = dds.getSwitch(); } else if (do_Capacity) { input_double = dds.getDivcap(); } else if (do_ReplaceResOption) { input_int = dds.getIreptype(); } else if (do_DailyID) { input_string = dds.getCdividy(); } else if (do_UserName) { input_string = dds.getUsername(); } else if (do_DemandType) { input_int = dds.getIdvcom(); } else if (do_EffAnnual) { input_double = dds.getDivefc(); } else if (do_Area) { input_double = dds.getArea(); } else if (do_UseType) { input_int = dds.getIrturn(); } else if (do_DemandSource) { input_int = dds.getDemsrc(); } else { // Unrecognized... continue; } // Compare the data with the input filter... item_matches = false; if (do_string) { item_matches = filter.matches(input_string, @operator, true); } else if (do_int) { item_matches = filter.matches(input_int, @operator); } else if (do_double) { item_matches = filter.matches(input_double, @operator); } if (where_length == 0) { // Always consider a match... item_matches = true; } if (item_matches && (!@checked[i] || (@checked[i] && matches[i]))) { // So far the item matches all // filters... matches[i] = true; } else if (@checked[i] && !item_matches) { // Does not match this filter to reset // result to false... matches[i] = false; } // Indicate that we have checked the item // against at least one filter... @checked[i] = true; } } // Get a count so the Vector can be sized appropriately (this // should be fast)... int match_count = 0; for (i = 0; i < size; i++) { if (matches[i]) { ++match_count; } } // Loop through and set up the matches_Vector... __matches_Vector = null; if (match_count > 0) { __matches_Vector = new List <StateMod_Diversion> (match_count); for (i = 0; i < size; i++) { if (matches[i]) { // The diversion station matches so add // to the list... __matches_Vector.Add(dds_Vector[i]); } } } message = "Matched " + match_count + " diversion stations (from original " + size + ")."; Message.printStatus(2, routine, message); __message_JTextField.setText(message); __status_JTextField.setText(__Ready); JGUIUtil.setWaitCursor(this, false); } if (__matches_Vector == null) { __display_JButton.setEnabled(false); } else { __display_JButton.setEnabled(true); } }
/// <summary> /// Erzeugt einen Graphen und startet ihn. /// </summary> /// <param name="location">Der Ursprung, über den die Quellgruppe empfangen wird.</param> /// <param name="group">Die gewünschte Quellgruppe.</param> /// <exception cref="ArgumentException">Es wurden nicht alle Parameter gesetzt.</exception> public void Create( GroupLocation location, SourceGroup group ) { // Get rid of it Destroy(); // Create new graph builder var graph = Activator.CreateInstance( Type.GetTypeFromCLSID( BDAEnvironment.GraphBuilderClassIdentifier ) ); try { // Convert interface m_Graph = (IMediaFilter) graph; } catch { // Cleanup BDAEnvironment.Release( ref graph ); // Forward throw; } // See if we should register the graph m_ExternalRegistration = BDASettings.RegisterBDAGRaph( m_Graph, false ); // Attach to alternate interface var builder = (IGraphBuilder) m_Graph; // Check log var logFile = BDASettings.BDALogPath; if (logFile != null) { // Open path m_LogFile = new FileStream( logFile.FullName, FileMode.Create, FileAccess.Write, FileShare.Read ); // Enable logging on graph builder builder.SetLogFile( m_LogFile.SafeFileHandle ); } // Start with network provider NetworkProvider = AddFilter( "Network Provider", BDAEnvironment.GetNetworkProviderMoniker( DVBType ) ); // Initialize provider Tune( location, group ); // Always create the tuner if (TunerInformation != null) TunerFilter = AddFilter( "Tuner", TunerInformation ); else throw new ArgumentException( Properties.Resources.Exception_MissingTuner, "Tuner" ); // Optionally create capture if (CaptureInformation != null) CaptureFilter = AddFilter( "Capture", CaptureInformation ); // Add additional filter foreach (var additionalFilter in AdditionalFilterInformations) if (additionalFilter == null) throw new ArgumentNullException( "AdditionalFilters" ); else AdditionalFilters.Add( AddFilter( additionalFilter.DisplayName, additionalFilter ) ); // Connect network provider to streaming instance Connect( NetworkProvider, CaptureFilter ?? TunerFilter ); // Initialize provider Tune( location, group ); // Create the primary filter and add it AddFilter( "TS", TransportStreamAnalyser = new InputFilter() ); // Connect device output for analysis Connect( CaptureFilter ?? TunerFilter, TransportStreamAnalyser ); // Create the demultiplexer - needed to keep the infrastructure alive using (var demux = AddFilter( "TIF", BDAEnvironment.MicrosoftDemultiplexerMoniker )) { // Connect to the dedicated pin of our analyser TransportStreamAnalyser.DataManager.TIFConnector.Connect( demux, BDAEnvironment.TransportStreamMediaType1 ); // Pins to remove var remove = new List<string>(); // Prepare the demultiplexer pins demux.InspectAllPins( pin => { // See if this is the SI pin bool isSectionPin = false; pin.InspectAllMediaTypes( type => { // Check major if (!type.MajorType.Equals( BDAEnvironment.DataFormatTypeSections )) return true; // Check minor isSectionPin = type.SubType.Equals( BDAEnvironment.DataFormatSubtypeSI ); // Report return !isSectionPin; } ); // Check the mode if (isSectionPin) { // Connect using (var comPin = ComIdentity.Create( pin )) builder.Render( comPin.Interface ); // Load connection data IntPtr tifIn = IntPtr.Zero; if (pin.ConnectedTo( ref tifIn ) < 0) throw new InvalidOperationException( Properties.Resources.Exception_TIF ); // Reconstruct var tifPin = Marshal.GetObjectForIUnknown( tifIn ); try { // Request pin context var info = new PinInfo(); ((IPin) tifPin).QueryPinInfo( ref info ); // Request from pin m_TIF = info.GetAndDisposeFilter(); } finally { // Cleanup BDAEnvironment.Release( ref tifPin ); } } else if (pin.QueryDirection() == PinDirection.Output) { // Prepare to kill remove.Add( pin.QueryId() ); } } ); // Prepare to remove all unconnected pins if (remove.Count > 0) using (var demuxInstance = demux.MarshalToManaged()) { // Change type var mpeg2 = (IMpeg2Demultiplexer) demuxInstance.Object; // Remove all foreach (var id in remove) mpeg2.DeleteOutputPin( id ); } } // Install the PMT watchdog TransportStreamAnalyser.DataManager.TSParser.PMTFound += ProcessPMT; }
public static bool HandleCommand(Session Session, string Input) { Input = Input.Substring(1, Input.Length - 1); string[] input = Input.Split(new char[] { ' ' }); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(Session.CurrentSpaceId); SpaceActor actor = (instanceBySpaceId == null) ? null : instanceBySpaceId.GetActorByReferenceId(Session.CharacterId, SpaceActorType.UserCharacter); CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject; switch (input[0]) { case "position": { Session.SendData(SpaceChatComposer.Compose(0, string.Concat(new object[] { "Tu posici\x00f3n actual es - X: ", actor.Position.Int32_0, ", Y: ", actor.Position.Int32_1, ", Z: ", actor.Position.Int32_2 }), 3, ChatType.Say), false); return(true); } case "block": if (referenceObject.Staff != 0) { instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + " ha bloqueado el punch.", 3, ChatType.Say), 0, false); block = true; return(true); } return(false); case "unblock": if (referenceObject.Staff != 0) { instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + " ha desbloqueado el punch.", 3, ChatType.Say), 0, false); block = false; return(true); } return(false); case "ban": if (referenceObject.Staff == 2) { SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint UserID = CharacterResolverCache.GetUidFromName(username); Moderation.ModerationBanManager.BanHammer(mySqlClient, UserID, reason2, actor.Name); string ban = string.Format("{0} ha baneado a {1} por {2}", actor.Name, username, reason2); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(username); if (SessionManager.ContainsCharacterId(ID)) { Session Session_ID = SessionManager.GetSessionByCharacterId(ID); uint session_id2 = Session_ID.CharacterInfo.SessionId; SessionManager.StopSession(session_id2); } else { } instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, ban, 3, ChatType.Say), 0, false); return(true); } return(false); case "alert": if (referenceObject.Staff != 0) { string messageText = InputFilter.FilterString(InputFilter.MergeString(input, 1), false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, messageText, 3, ChatType.Say), 0, false); return(true); } return(false); case "la": if (referenceObject.Staff != 0) { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, Input.Replace("la", ""), 2)); } return(true); } return(false); case "give": if (referenceObject.Staff == 2) { Session session_0; string userthatadded = actor.Name; SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); int credits = 0; string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); credits = int.Parse(reason2); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint ID = CharacterResolverCache.GetUidFromName(username); session_0 = SessionManager.GetSessionByCharacterId(ID); //givecredits2(mySqlClient, credits, username); referenceObject.UpdateGoldCreditsBalance(mySqlClient, +credits); session_0.SendData(CharacterCoinsComposer.AddGoldCompose(Convert.ToUInt32(credits)), false); //Punch cost 200 string str = string.Format("{0} le ha dado a {1} {2} Creditos!", userthatadded, username, credits); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); return(true); } return(false); case "take": if (referenceObject.Staff == 2) { Session session_0; string userthatadded = actor.Name; SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); int credits = 0; string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); credits = int.Parse(reason2); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint ID = CharacterResolverCache.GetUidFromName(username); session_0 = SessionManager.GetSessionByCharacterId(ID); referenceObject.UpdateGoldCreditsBalance(mySqlClient, -credits); session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(Convert.ToUInt32(credits)), false); //Punch cost 200 string str = string.Format("{0} le ha quitado {1} Creditos a {2}!", userthatadded, credits, username); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); return(true); } return(false); case "kick": if (referenceObject.Staff != 0) { Session session_0; Input = Input.Replace("kick", ""); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(Input); if (SessionManager.ContainsCharacterId(ID)) { session_0 = SessionManager.GetSessionByCharacterId(ID); SpaceManager.RemoveUserFromSpace(session_0); string str = string.Format("{0} echa a {1} de la isla", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); } return(true); } return(false); case "kickoffline": if (referenceObject.Staff == 2) { Session session_0; Input = Input.Replace("kickoffline", ""); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(Input); if (SessionManager.ContainsCharacterId(ID)) { session_0 = SessionManager.GetSessionByCharacterId(ID); uint session_id2 = session_0.CharacterInfo.SessionId; SessionManager.StopSession(session_id2); string str = string.Format("{0} desconectó a {1}", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); } //SpaceManager.GetInstanceBySpaceId //SpaceUserRemovedComposer.BroadcastCompose( return(true); } return(false); case "chest1": if (referenceObject.Staff == 2) { return(true); } return(false); } return(false); }
public void SetUp() { this.subject = new InputFilter(); }
public static bool HandleCommand(Session Session, string Input) { Input = Input.Substring(1, Input.Length - 1); string[] input = Input.Split(new char[] { ' ' }); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(Session.CurrentSpaceId); SpaceActor actor = (instanceBySpaceId == null) ? null : instanceBySpaceId.GetActorByReferenceId(Session.CharacterId, SpaceActorType.UserCharacter); CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject; switch (input[0]) { case "alerta": if (referenceObject.Staff == 1) { string messageText = InputFilter.FilterString(InputFilter.MergeString(input, 1), false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, messageText, 3, ChatType.Say), 0, false); return(true); } return(false); case "effect": if (referenceObject.Vip == 1) { Input = Input.Replace("effect", ""); Input = Input.Replace(" ", ""); switch (int.Parse(Input)) { case 1: actor.ApplyEffect(1, true); actor.UpdateNeeded = true; break; case 2: actor.ApplyEffect(2, true); actor.UpdateNeeded = true; break; case 3: actor.ApplyEffect(3, true); actor.UpdateNeeded = true; break; case 4: actor.ApplyEffect(4, true); actor.UpdateNeeded = true; break; case 5: actor.ApplyEffect(5, true); actor.UpdateNeeded = true; break; case 6: actor.ApplyEffect(6, true); actor.UpdateNeeded = true; break; case 7: actor.ApplyEffect(7, true); actor.UpdateNeeded = true; break; case 8: actor.ApplyEffect(8, true); actor.UpdateNeeded = true; break; } return(true); } return(false); } return(false); }
void Start() { f = InputFilter.Instance; f.OnUp += MoveUp; f.OnDown += MoveDown; f.OnRight += MoveRight; f.OnLeft += MoveLeft; //f.OnFire += Fire; }
private static void OnInputFilterPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs arg) { var textBox = source as TextBox; if (textBox == null) { return; } if (!(arg.NewValue is InputFilter)) { return; } InputFilter inputFilter = (InputFilter)arg.NewValue; DataObjectPastingEventHandler dataPastingHandle = (s, e) => { if (e.DataObject.GetDataPresent(typeof(String))) { String text = (String)e.DataObject.GetData(typeof(String)); if (inputFilter == InputFilter.OnlyInteger) { if (int_regex.IsMatch(text)) { e.CancelCommand(); } } else if (inputFilter == InputFilter.Numeric) { if (num_regex.IsMatch(text)) { e.CancelCommand(); } } } else { e.CancelCommand(); } }; if (inputFilter == InputFilter.OnlyInteger || inputFilter == InputFilter.Numeric) { InputMethod.SetIsInputMethodEnabled(textBox, false); DataObject.RemovePastingHandler(textBox, dataPastingHandle); DataObject.AddPastingHandler(textBox, dataPastingHandle); } TextCompositionEventHandler inputHandle = (s, e) => { if (inputFilter == InputFilter.OnlyInteger) { e.Handled = int_regex.IsMatch(e.Text); } else if (inputFilter == InputFilter.Numeric) { e.Handled = num_regex.IsMatch(e.Text); } }; textBox.PreviewTextInput -= inputHandle; textBox.PreviewTextInput += inputHandle; }
public static bool HandleCommand(Session Session, string Input) { Input = Input.Substring(1, Input.Length - 1); string[] input = Input.Split(new char[] { ' ' }); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(Session.CurrentSpaceId); SpaceActor actor = (instanceBySpaceId == null) ? null : instanceBySpaceId.GetActorByReferenceId(Session.CharacterId, SpaceActorType.UserCharacter); CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject; switch (input[0]) { case "position": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { Session.SendData(SpaceChatComposer.Compose(0, string.Concat(new object[] { "Tu posici\x00f3n actual es - X: ", actor.Position.Int32_0, ", Y: ", actor.Position.Int32_1, ", Z: ", actor.Position.Int32_2 }), 3, ChatType.Say), false); return(true); } return(false); case "bm": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { if (!UpperBlock.Contains(actor.Name)) { string str = string.Format("{0}: Has activated Block User Upper.", actor.Name); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, str, 3, ChatType.Say), 0, false); UpperBlock.Add(actor.Name); } return(true); } return(false); case "uub": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { Input = Input.Replace("uub", ""); Input = Input.Replace(" ", ""); uint IDtoblock = CharacterResolverCache.GetUidFromName(Input); if (!UpperBlockUser.Contains(IDtoblock)) { string str = string.Format("{0}: Has activated Block User Upper For {1}", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, str, 3, ChatType.Say), 0, false); UpperBlockUser.Add(IDtoblock); } return(true); } return(false); case "ub": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { Input = Input.Replace("ub", ""); Input = Input.Replace(" ", ""); uint IDtoblock = CharacterResolverCache.GetUidFromName(Input); if (UpperBlockUser.Contains(IDtoblock)) { string str = string.Format("{0}: Has deactivated Block User Upper For {1}", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, str, 3, ChatType.Say), 0, false); UpperBlockUser.Remove(IDtoblock); } return(true); } return(false); case "ubm": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { if (UpperBlock.Contains(actor.Name)) { string str = string.Format("{0}: Has deactivated Block User Upper.", actor.Name); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, str, 3, ChatType.Say), 0, false); UpperBlock.Remove(actor.Name); } return(true); } return(false); case "block_upper": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + " ha bloqueado el punch.", 3, ChatType.Say), 0, false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Has turned Block Punch On.", 3, ChatType.Say), 0, false); block_upper = true; return(true); } return(false); case "unblock_upper": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + " ha desbloqueado el punch.", 3, ChatType.Say), 0, false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Has turned Block Punch Off.", 3, ChatType.Say), 0, false); block_upper = false; return(true); } return(false); case "checkcredits": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { Input = Input.Replace("checkcredits", ""); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(actor.Name); actor.Whisper(checkcredits(Input), ID, false); return(true); } return(false); case "block_coco": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Ha bloqueado el coco.", 3, ChatType.Say), 0, false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Has turned Block Coco On.", 3, ChatType.Say), 0, false); block_coco = true; return(true); } return(false); case "unblock_coco": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": ha desbloqueado el coco.", 3, ChatType.Say), 0, false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Has turned Block Coco Off.", 3, ChatType.Say), 0, false); block_coco = false; return(true); } return(false); case "ban": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 && actor.Name != "DaLoe" || referenceObject.Staff == 6) { SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint UserID = CharacterResolverCache.GetUidFromName(username); Moderation.ModerationBanManager.BanHammer(mySqlClient, UserID, reason2, actor.Name); string ban = string.Format("{0}: Banned: {1}, For: {2}", actor.Name, username, reason2); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(username); if (SessionManager.ContainsCharacterId(ID)) { Session Session_ID = SessionManager.GetSessionByCharacterId(ID); uint session_id2 = Session_ID.CharacterInfo.SessionId; SessionManager.StopSession(session_id2); } else { } instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, ban, 3, ChatType.Say), 0, false); return(true); } return(false); case "unban": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 && actor.Name != "DaLoe" && actor.Name != "Fran" || referenceObject.Staff == 6) { SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); Input = Input.Replace("unban", ""); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(Input); Moderation.ModerationBanManager.Unban(mySqlClient, ID); string unban = string.Format("{0}: Unbanned User {1}", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, unban, 3, ChatType.Say), 0, false); return(true); } return(false); case "ipban": if (referenceObject.Staff == 2 && actor.Name != "DaLoE" && actor.Name != "Fran" || referenceObject.Staff == 6) { SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint UserID = CharacterResolverCache.GetUidFromName(username); Sessions.Session session_0; session_0 = SessionManager.GetSessionByCharacterId(UserID); string str = session_0.RemoteAddress.ToString(); Moderation.ModerationBanManager.BanHammer3(mySqlClient, UserID, reason2, actor.Name, str); string ban = string.Format("{0}: IP Banned: {1}, For: {2}", actor.Name, username, reason2); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(username); if (SessionManager.ContainsCharacterId(ID)) { Session Session_ID = SessionManager.GetSessionByCharacterId(ID); uint session_id2 = Session_ID.CharacterInfo.SessionId; SessionManager.StopSession(session_id2); } else { } instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, ban, 3, ChatType.Say), 0, false); return(true); } return(false); case "alert": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { string messageText = InputFilter.FilterString(InputFilter.MergeString(input, 1), false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, messageText, 3, ChatType.Say), 0, false); return(true); } return(false); case "la": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { if (actor.Name == "Brandon" || actor.Name == "Mike") { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { Input = Input.Replace("la", ""); string send = string.Format("{0} - From Burbian Creator {1}", Input, actor.Name); pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2)); } } else if (actor.Name == "Kyle") { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { Input = Input.Replace("la", ""); string send = string.Format("{0} - From Burbian Main Programmer {1}", Input, actor.Name); pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2)); } } else if (referenceObject.Staff == 1) { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { Input = Input.Replace("la", ""); string send = string.Format("{0} - From Burbian Moderator {1}", Input, actor.Name); pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2)); } } else if (referenceObject.Staff == 2 && actor.Name != "Brandon" && actor.Name != "Mike") { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { Input = Input.Replace("la", ""); string send = string.Format("{0} - From Burbian Administrator {1}", Input, actor.Name); pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2)); } } else if (referenceObject.Staff == 6 && actor.Name != "Kyle") { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { Input = Input.Replace("la", ""); string send = string.Format("{0} - From Burbian Programmer {1}", Input, actor.Name); pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2)); } } else { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { Input = Input.Replace("la", ""); string send = string.Format("{0} - From Burbian Moderator {1}", Input, actor.Name); pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2)); } } return(true); } return(false); case "effect": if (referenceObject.Vip == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { Input = Input.Replace("effect", ""); Input = Input.Replace(" ", ""); switch (int.Parse(Input)) { case 1: actor.ApplyEffect(1, true); actor.UpdateNeeded = true; break; case 2: actor.ApplyEffect(2, true); actor.UpdateNeeded = true; break; case 3: actor.ApplyEffect(3, true); actor.UpdateNeeded = true; break; case 4: actor.ApplyEffect(4, true); actor.UpdateNeeded = true; break; } return(true); } return(false); case "give": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { Session session_0; string userthatadded = actor.Name; SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); int credits = 0; string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); credits = int.Parse(reason2); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint ID = CharacterResolverCache.GetUidFromName(username); session_0 = SessionManager.GetSessionByCharacterId(ID); //givecredits2(mySqlClient, credits, username); referenceObject.UpdateGoldCreditsBalance(mySqlClient, +credits); session_0.SendData(CharacterCoinsComposer.AddGoldCompose(Convert.ToUInt32(credits)), false); //Punch cost 200 string str = string.Format("{0}: Gave {1}, {2} Credits!", userthatadded, username, credits); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); return(true); } return(false); case "share": if (referenceObject.Staff == 0 || referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 3 || referenceObject.Staff == 4 || referenceObject.Staff == 5 || referenceObject.Staff == 6) { string BeforeComma = string.Empty; string AfterComma = string.Empty; SqlDatabaseClient client = SqlDatabaseManager.GetClient(); Session session_0; Session session_1; Input = Input.Replace("share", ""); Input = Input.Replace(" ", ""); BeforeComma = Input.Remove(Input.LastIndexOf(',')); AfterComma = Input.Substring(Input.IndexOf(',') + 1); string username = BeforeComma.Replace(" ", ""); string amountofcredits_0 = AfterComma.Replace(" ", ""); int amount = int.Parse(amountofcredits_0); uint actorID = CharacterResolverCache.GetUidFromName(actor.Name); uint actorID2 = CharacterResolverCache.GetUidFromName(username); session_0 = SessionManager.GetSessionByCharacterId(actorID); session_1 = SessionManager.GetSessionByCharacterId(actorID2); SpaceInstance instanceBySpaceId2 = SpaceManager.GetInstanceBySpaceId(session_1.CurrentSpaceId); SpaceActor actor2 = (instanceBySpaceId2 == null) ? null : instanceBySpaceId2.GetActorByReferenceId(session_1.CharacterId, SpaceActorType.UserCharacter); CharacterInfo referenceObject2 = (CharacterInfo)actor2.ReferenceObject; if (enoughcredits(session_0, amount)) { referenceObject.UpdateGoldCreditsBalance(client, -amount); session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(Convert.ToUInt32(amount)), false); referenceObject2.UpdateGoldCreditsBalance(client, +amount); session_1.SendData(CharacterCoinsComposer.AddGoldCompose(Convert.ToUInt32(amount)), false); string str = string.Format("{0}: Shared {1} Credits To {2}!", actor.Name, amount, username); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); } else { string str = string.Format("Could not send {0} the credits, did you have enough?", username); actor.Whisper(str, actorID, false); } return(true); } return(false); case "take": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { Session session_0; Session session_1; uint actoeid = CharacterResolverCache.GetUidFromName(actor.Name); string userthatadded = actor.Name; SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); int credits = 0; string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); credits = int.Parse(reason2); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint ID = CharacterResolverCache.GetUidFromName(username); session_0 = SessionManager.GetSessionByCharacterId(ID); //givecredits2(mySqlClient, credits, username); session_1 = SessionManager.GetSessionByCharacterId(ID); int gold = session_1.CharacterInfo.GoldCoins; int minusgold = gold - credits; if (minusgold < 0) { actor.Whisper("Error, the amount you tried to give was below 0", actoeid, false); } else { referenceObject.UpdateGoldCreditsBalance(mySqlClient, -credits); session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(Convert.ToUInt32(credits)), false); string str = string.Format("{0}: Took Away {1} Credits From {2}!", userthatadded, credits, username); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); } return(true); } return(false); case "kick": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { Session session_0; Input = Input.Replace("kick", ""); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(Input); if (SessionManager.ContainsCharacterId(ID)) { session_0 = SessionManager.GetSessionByCharacterId(ID); SpaceManager.RemoveUserFromSpace(session_0); string str = string.Format("{0}: Has Kicked {1} From Island.", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); } else { } //SpaceManager.GetInstanceBySpaceId //SpaceUserRemovedComposer.BroadcastCompose( return(true); } return(false); case "kickoffline": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { Session session_0; Input = Input.Replace("kickoffline", ""); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(Input); if (SessionManager.ContainsCharacterId(ID)) { session_0 = SessionManager.GetSessionByCharacterId(ID); uint session_id2 = session_0.CharacterInfo.SessionId; SessionManager.StopSession(session_id2); string str = string.Format("{0}: Has kicked {1} Offline!", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); } else { } //SpaceManager.GetInstanceBySpaceId //SpaceUserRemovedComposer.BroadcastCompose( return(true); } return(false); case "mod": if (actor.Name == "Kyle" || actor.Name == "Brandon" || actor.Name == "Mike") { Session session_0; SqlDatabaseClient client; client = SqlDatabaseManager.GetClient(); Input = Input.Replace("mod", ""); Input = Input.Replace(" ", ""); string Input2 = Input; string level = Input2.Substring(Input2.IndexOf(",") + 1); uint mod = Convert.ToUInt32(level); if (Input.Contains(",")) { Input = Input.Substring(0, Input.LastIndexOf(",")); } givemod(client, Input, mod); string str = string.Format("{0}: Gave {1} Level {2} Mod Ability.", actor.Name, Input, mod); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); uint ID = CharacterResolverCache.GetUidFromName(Input); session_0 = SessionManager.GetSessionByCharacterId(ID); uint session_id2 = session_0.CharacterInfo.SessionId; SessionManager.StopSession(session_id2); return(true); } return(false); case "getmod": if (actor.Name == "Kyle" || actor.Name == "Brandon" || actor.Name == "Mike") { SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient(); Input = Input.Replace("getmod", ""); Input = Input.Replace(" ", ""); uint ID2 = CharacterResolverCache.GetUidFromName(actor.Name); uint ID = CharacterResolverCache.GetUidFromName(Input); Session session_1; session_1 = SessionManager.GetSessionByCharacterId(ID); uint modlevel = session_1.CharacterInfo.Staff; string str = string.Format("User {0} is mod level {1}", Input, modlevel); actor.Whisper(str, ID2, false); SessionManager.StopSession(session_1.AbsoluteSpaceId); return(true); } return(false); } return(false); }