static void playWithArrayList() { ArrayList lst = new ArrayList() {1,2,3}; Debug.WriteLine("capacity {0}", lst.Capacity); Debug.WriteLine("count {0}", lst.Count); int a = 0; lst.Add(a = 15); lst.Add(null); lst.Add(new Car("diesel", 150, 200)); lst.Add(10.25f); Debug.WriteLine("capacity {0}", lst.Capacity); Debug.WriteLine("count {0}", lst.Count); lst.Insert(2, "insert"); lst.Add(15); Debug.WriteLine("capacity {0}", lst.Capacity); Debug.WriteLine("count {0}", lst.Count); lst.RemoveAt(1); lst.Add(a); lst.Remove(a); lst.Remove(15); Debug.WriteLine("capacity {0}", lst.Capacity); Debug.WriteLine("count {0}", lst.Count); Console.WriteLine(lst.IndexOf(15)); foreach (Object obj in lst) Console.WriteLine(obj); }
void initTubesArrayList() { tubes = new ArrayList (); //Tube array foreach (Transform tbAr in transform) { //actual tube foreach (Transform tb in tbAr) { tubes.Add(tb.gameObject); } tubes.Remove(tbAr.gameObject); } tubes.Remove(this.gameObject); Debug.Log ("tube count: " + tubes.Count); }
public void calculateCheckpoints() { LevelPropertiesScript properties = LevelPropertiesScript.sharedInstance(); this.checkpoints = new ArrayList(properties.powerups.Count); ArrayList placesToGo = new ArrayList(properties.powerups.Count); foreach (GameObject powerup in properties.powerups) { placesToGo.Add(powerup.transform.position); } Vector3 nextPos = (Vector3)placesToGo[0]; this.checkpoints.Add(nextPos); placesToGo.RemoveAt(0); while (placesToGo.Count > 0) { float minDistance = float.MaxValue; Vector3 closestPosition = nextPos; foreach (Vector3 position in placesToGo) { float dist = Vector3.SqrMagnitude(position - nextPos); if (dist < minDistance) { closestPosition = position; minDistance = dist; } } nextPos = closestPosition; this.checkpoints.Add(closestPosition); placesToGo.Remove(closestPosition); } }
public void RemoveChildrenFrom(ArrayList behs) { foreach(FishBehaviour child in children) { child.RemoveChildrenFrom(behs); behs.Remove(child); } }
public Team team; // which team are you on #endregion Fields #region Methods void setTeam( Team newTeam) { team = newTeam; enemyTeams = new ArrayList () { Team.Left, Team.Right, Team.Boss }; enemyTeams.Remove (newTeam); //f**k }
/// <summary> /// Informs the helper that the memento supporter that wraps this helper has lost a child. /// </summary> /// <param name="child">The child.</param> public void RemoveChild(ISupportsMementos child) { if (m_children.Contains(child)) { child.MementoChangeEvent -= m_childChangeHandler; } m_children?.Remove(child); m_problemChildren?.Remove(child); }
/// <summary> /// Removes an extender provider. /// </summary> void IExtenderProviderService.RemoveExtenderProvider(IExtenderProvider provider) { if (provider == null) { throw new ArgumentNullException(nameof(provider)); } _providers?.Remove(provider); }
public void Shuffle() { ArrayList unshuffledCards = new ArrayList(cards); ArrayList shuffledCards = new ArrayList(); while (unshuffledCards.Count > 0){ Card card = (Card)unshuffledCards[(int)UnityEngine.Random.Range(0, unshuffledCards.Count)]; unshuffledCards.Remove(card); shuffledCards.Add(card); } cards = shuffledCards; }
void Update() { timeSinceLastLaunch += Time.deltaTime; if (waitedInitialDelay) { if (!instantiatedLaunchers) { instantiatedLaunchers = true; Instantiate (launchersPrefab, Vector3.zero, Quaternion.identity); } ArrayList launchers = new ArrayList (GameObject.FindGameObjectsWithTag ("Launcher")); if (launchers.Count == 0) { ++level; staggered = level % 2 == 0; bulletVelocityRange += bulletVelocityRangeStep; // textScript.allowTextToDisappear = true; // textScript.DisplayText ("Welcome to Level: " + (level - 1)); timeSinceLastLaunch = 0.0f; waitedInitialDelay = false; instantiatedLaunchers = false; } else { int numToLaunch = Mathf.Min (level, launchers.Count); if (timeSinceLastLaunch > timeBetweenLaunches || (staggered && timeSinceLastLaunch > timeBetweenLaunches / (float)numToLaunch)) { timeSinceLastLaunch = 0.0f; for (int i = 0; i < (staggered ? 1 : numToLaunch); ++i) { if (launchers.Count == 0) return; int launcherIndex = Random.Range (0, launchers.Count); BulletLauncherBehavior launchScript = ((GameObject)launchers [launcherIndex]).GetComponent<BulletLauncherBehavior> (); float randBulletVelocity = Random.Range (bulletVelocity - bulletVelocityRange, bulletVelocity + bulletVelocityRange); if (!launchScript.destroyed) launchScript.LaunchBullet (randBulletVelocity, bulletLifetime); else --i; launchers.Remove (launcherIndex); } } } } else { if (timeSinceLastLaunch > initialDelayTime) { timeSinceLastLaunch = 0.0f; waitedInitialDelay = true; } } }
void skillActivate() { ArrayList gos; gos = GameObject.FindGameObjectWithTag("TheVoid").GetComponent<VoidAI>().GetVoidTiles(); //gos = GameObject.FindGameObjectsWithTag("VoidTile"); Vector3 playerPos = Player.transform.position; range = playerLvl; tempGos=(ArrayList)gos.Clone(); foreach (GameObject go in gos) { if (go.transform.position.x <= playerPos.x + range && go.transform.position.x >= playerPos.x - range || go.transform.position.x == playerPos.x) { if(go.transform.position.y <= playerPos.y + range && go.transform.position.y >= playerPos.y - range || go.transform.position.y == playerPos.y) { tempGos.Remove(go); Destroy(go); xp++; //createXp(go.transform.position.x,go.transform.position.y,go.transform.position.z + 5.0f); clonexpUp = Instantiate(xpUpPrefab, new Vector3(go.transform.position.x,go.transform.position.y,go.transform.position.z + 5),Quaternion.identity) as Transform; clonexpUp.transform.Rotate(new Vector3(0,1,0),180); clonexpUp.transform.localScale = new Vector3(0.2f,0.2f,0.0f); //textIn3D = new On3dText(go.transform.position.x,go.transform.position.y,go.transform.position.z + 5.0f); } } } gos.Clear(); foreach (GameObject tmp in tempGos) { gos.Add (tmp); } }
// Use this for initialization void Start() { //creates an array of an undetermined size and type ArrayList aList = new ArrayList(); //create an array of all objects in the scene Object[] AllObjects = GameObject.FindObjectsOfType(typeof(Object)) as Object[]; //iterate through all objects foreach (Object o in AllObjects) { if (o.GetType() == typeof(GameObject)) { aList.Add(o); } } if (aList.Contains(SpecificObject)) { Debug.Log(aList.IndexOf(SpecificObject)); } if (aList.Contains(gameObject)) { aList.Remove(gameObject); } //initialize the AllGameObjects array AllGameObjects = new GameObject[aList.Count]; //copy the list to the array DistanceComparer dc = new DistanceComparer(); dc.Target = gameObject; aList.Sort(dc); aList.CopyTo(AllGameObjects); ArrayList sorted = new ArrayList(); sorted.AddRange(messyInts); sorted.Sort(); sorted.Reverse(); sorted.CopyTo(messyInts); }
public static ArrayList getNeighbors(int [,,] mapData, IntVector3 point) { //print ("getNeighbors: i: " + i + " j: " + j + " k: " + k); ArrayList neighbors = new ArrayList (); neighbors.Add (new IntVector3 (point.x- 1, point.y, point.z)); neighbors.Add (new IntVector3 (point.x+ 1, point.y, point.z)); neighbors.Add (new IntVector3 (point.x, point.y - 1, point.z)); neighbors.Add (new IntVector3 (point.x, point.y + 1, point.z)); neighbors.Add (new IntVector3 (point.x, point.y, point.z - 1)); neighbors.Add (new IntVector3 (point.x, point.y, point.z + 1)); for (int index=0; index<neighbors.Count; index++) { IntVector3 neighborPoint = (IntVector3)neighbors [index]; if (! isVoxelOccupied (mapData, neighborPoint)) { neighbors.Remove (neighborPoint); index--; } } return neighbors; }
public void Update() { if (!Pause.IsPaused()){ ArrayList copyList = new ArrayList(dialogueControllers); foreach (GenericDialogueController dialogueController in copyList){ //Debug.Log("GenericDialogueAgent.Update: iterating"); bool finished = dialogueController.UpdateGenericDialogueController(); if (finished){ //Debug.Log("--- removing dialogue controller"); dialogueControllers.Remove(dialogueController); } } if (GameTime.GetRealTimeSecondsPassed() > nextRoundTimeInSeconds){ GameObject[] genericNPCs = CharacterManager.GetGenericNPCs(); ArrayList potentialSpeakers = new ArrayList(); foreach (GameObject genericNPC in genericNPCs){ ActionRunner routineCreator = (ActionRunner)genericNPC.GetComponent("ActionRunner"); if (routineCreator.CanStartDialogue(false)){ potentialSpeakers.Add(genericNPC); } } if (potentialSpeakers.Count >= NUMBER_OF_SPEAKERS){ GameObject[] speakers = new GameObject[NUMBER_OF_SPEAKERS]; for (int i = 0; i < NUMBER_OF_SPEAKERS; i++){ GameObject speaker = (GameObject)potentialSpeakers[Random.Range(0, potentialSpeakers.Count)]; speakers[i] = speaker; potentialSpeakers.Remove(speaker); } dialogueControllers.Add(new GenericDialogueController(speakers)); nextRoundTimeInSeconds += Random.Range(0.0f, MAX_CYCLE_LENGTH_IN_SECONDS); } } } }
public void remove(DefineTypeNode node) { definitions_.Remove(node); }
public Boolean runTest() { int iCountErrors = 0; int iCountTestcases = 0; Console.Error.WriteLine( strName + ": " + strTest + " runTest started..." ); Console.WriteLine( "ACTIVE BUGS " + strActiveBugs ); ArrayList arrList = null; String [] strHeroes = new String[] { "Aquaman", "Atom", "Batman", "Black Canary", "Captain America", "Captain Atom", "Catwoman", "Cyborg", "Flash", "Green Arrow", "Green Lantern", "Hawkman", null, "Ironman", "Nightwing", "Robin", "SpiderMan", "Steel", null, "Thor", "Wildcat", null }; do { ++iCountTestcases; Console.Error.WriteLine( "Normal Contains" ); try { arrList = new ArrayList(strHeroes ); for ( int i = 0; i < strHeroes.Length; i++ ) { if ( ! arrList.Contains( strHeroes[i] ) ) { ++iCountErrors; Console.WriteLine( "Err_101a, Contains returns false but shour return true at position " + i.ToString() ); } } } catch (Exception ex) { Console.WriteLine( "Err_101b, unexpected exception " + ex.ToString() ); ++iCountErrors; break; } ++iCountTestcases; Console.Error.WriteLine( "[] Normal Contains which expects false" ); try { arrList = new ArrayList(strHeroes ); for ( int i = 0; i < strHeroes.Length; i++ ) { for ( int j = 0; j < strHeroes.Length; j++ ) { arrList.Remove( strHeroes[i] ); } if ( arrList.Contains( strHeroes[i] ) ) { ++iCountErrors; Console.WriteLine( "Err_102a, Contains returns true but should return false at position " + i.ToString() ); } } } catch (Exception ex) { Console.WriteLine( "Err_102b, unexpected exception " + ex.ToString() ); ++iCountErrors; break; } ++iCountTestcases; Console.Error.WriteLine( "[] Normal Contains on empty list" ); try { arrList = new ArrayList(); for ( int i = 0; i < strHeroes.Length; i++ ) { if ( arrList.Contains( strHeroes[i] ) ) { ++iCountErrors; Console.WriteLine( "Err_103a, Contains returns true but should return false at position " + i.ToString() ); } } } catch (Exception ex) { Console.WriteLine( "Err_103b, unexpected exception " + ex.ToString() ); ++iCountErrors; break; } } while ( false ); Console.Error.Write( strName ); Console.Error.Write( ": " ); if ( iCountErrors == 0 ) { Console.Error.WriteLine( strTest + " iCountTestcases==" + iCountTestcases.ToString() + " paSs" ); return true; } else { Console.WriteLine( strTest + " FAiL"); Console.Error.WriteLine( strTest + " iCountErrors==" + iCountErrors.ToString() ); return false; } }
public void simulate() { ArrayList curList = new ArrayList(); if (resistors == null) return; foreach (Resistor r in resistors) { r.AddToGrid(); } curList.AddRange(resistors); bool found = true; while (found) { found = false; for (int i = 0; i < curList.Count; i++) { Resistor r1 = curList[i] as Resistor; if (Resistor.inSelfLoop(r1)) { MonoBehaviour.print("Self Loop"); curList.Remove(r1); i--; found = true; } } for (int i = 0; i < curList.Count; i++) { Resistor r1 = curList[i] as Resistor; for (int j = 0; j < curList.Count; j++) { if (i == j) continue; Resistor r2 = curList[j] as Resistor; if (Resistor.inParallel(r1, r2)) { MonoBehaviour.print("Parallel"); curList.Add(Resistor.CombineInParallel(r1, r2)); curList.Remove(r1); curList.Remove(r2); i--; found = true; break; } } } for (int i = 0; i < curList.Count; i++) { Resistor r1 = curList[i] as Resistor; for (int j = 0; j < curList.Count; j++) { if (i == j) continue; Resistor r2 = curList[j] as Resistor; if (Resistor.inSeries(r1, r2)) { MonoBehaviour.print("Series"); curList.Add(Resistor.CombineInSeries(r1, r2)); curList.Remove(r1); curList.Remove(r2); i--; found = true; break; } } } } for (int i = 0; i < resistors.Count; i++) { foreach (Resistor r in resistors) r.setVoltages(); } // if (curList.Count > 1) MonoBehaviour.print("Problem!"); }
internal UserItem AddNewItem(UInt32 Id, UInt32 BaseItem, string ExtraData, bool insert, bool fromRoom, UInt32 songID = 0) { isUpdated = false; if (insert) { if (fromRoom) { using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { if (dbClient.dbType == Database_Manager.Database.DatabaseType.MSSQL) { dbClient.setQuery("DELETE FROM items_users WHERE item_id = " + Id); dbClient.setQuery("INSERT INTO items_users VALUES (" + Id + "," + UserId + ")"); } else { dbClient.runFastQuery("REPLACE INTO items_users VALUES (" + Id + "," + UserId + ")"); } //dbClient.setQuery("REPLACE INTO user_items (id, user_id,base_item,extra_data) VALUES ('" + Id + "','" + UserId + "','" + BaseItem + "',@extra_data)"); //dbClient.addParameter("extra_data", ExtraData); //dbClient.runQuery(); } Item baseItem = ButterflyEnvironment.GetGame().GetItemManager().GetItem(BaseItem); if (baseItem != null && baseItem.InteractionType == InteractionType.musicdisc) { using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("DELETE FROM room_items_songs WHERE item_id = " + Id); //dbClient.runFastQuery("REPLACE INTO user_items_songs (item_id,user_id,song_id) VALUES (" + Id + "," + UserId + "," + songID + ")"); } } } else { using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { if (dbClient.dbType == Database_Manager.Database.DatabaseType.MSSQL) { dbClient.setQuery("INSERT INTO items (base_id) OUTPUT INSERTED.* VALUES (" + BaseItem + ")"); } else { dbClient.setQuery("INSERT INTO items (base_id) VALUES (" + BaseItem + ")"); } Id = (uint)dbClient.insertQuery(); if (!string.IsNullOrEmpty(ExtraData)) { dbClient.setQuery("INSERT INTO items_extradata VALUES (" + Id + ",@extradata)"); dbClient.addParameter("extradata", ExtraData); dbClient.runQuery(); } dbClient.runFastQuery("INSERT INTO items_users VALUES (" + Id + "," + UserId + ")"); //dbClient.setQuery("INSERT INTO user_items (user_id,base_item,extra_data) VALUES ('" + UserId + "','" + BaseItem + "',@extra_data)"); //dbClient.addParameter("extra_data", ExtraData); //Id = (uint)dbClient.insertQuery(); } } } UserItem ItemToAdd = new UserItem(Id, BaseItem, ExtraData); if (UserHoldsItem(Id)) { RemoveItem(Id, false); } if (ItemToAdd.GetBaseItem().InteractionType == InteractionType.musicdisc) { discs.Add(ItemToAdd.Id, ItemToAdd); } if (ItemToAdd.isWallItem) { wallItems.Add(ItemToAdd.Id, ItemToAdd); } else { floorItems.Add(ItemToAdd.Id, ItemToAdd); } if (mRemovedItems.Contains(Id)) { mRemovedItems.Remove(Id); } if (!mAddedItems.ContainsKey(Id)) { mAddedItems.Add(Id, ItemToAdd); } return(ItemToAdd); //Console.WriteLine("Item added: " + BaseItem); }
public ArrayList GenerateCellNoList(int CellNoLength, string FirstPartNumber, int CellGeneratedCount) { string static_number = FirstPartNumber; int all_count = CellNoLength; int result_count = all_count - static_number.Length; int generatecount = CellGeneratedCount; string from = "", _to = ""; for (int i = 0; i < result_count; i++) { from = from + "0"; _to = _to + "9"; } Random rnd = new Random(); ArrayList al = new ArrayList(); string no = ""; for (int i = 0; i < generatecount; i++) { no = rnd.Next(Convert.ToInt32(from), Convert.ToInt32(_to)).ToString(); int len = result_count - no.Length; for (int l = 0; l < len; l++) { no = "0" + no; } if (al.IndexOf(static_number + no) > 0) { al.Remove(static_number + no); i = i - 1; } al.Add(static_number + no); } return al; }
public void Remove(string value) { data.Remove(value); }
private void LevelView_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { Point ptMouse = ViewToWorld(new Point(e.X - AutoScrollPosition.X, e.Y - AutoScrollPosition.Y)); // If a MapItem has captured the mouse, give it a crack at the event IMapItem miT = m_miCapturedMouse; m_miCapturedMouse = null; if (miT != null) { if (miT.OnMouseUp(e, ptMouse, GetTileSize(), GetTemplateDoc())) { return; } } if (e.Button != MouseButtons.Left) { return; } if (m_fDragSelect) { m_fDragSelect = false; Graphics gWin = CreateGraphics(); Rectangle rcSrcWorld = new Rectangle(m_rcDragSelect.Left, m_rcDragSelect.Top, m_rcDragSelect.Width, m_rcDragSelect.Height); rcSrcWorld.Inflate(1, 1); Rectangle rcDstView = new Rectangle(WorldToView(rcSrcWorld.Location), WorldToViewSize(rcSrcWorld.Size)); rcDstView.Offset(AutoScrollPosition); gWin.InterpolationMode = InterpolationMode.NearestNeighbor; gWin.PixelOffsetMode = PixelOffsetMode.Half; gWin.DrawImage(m_bm, rcDstView, rcSrcWorld, GraphicsUnit.Pixel); gWin.Dispose(); } // Clear selected placement? if (m_fJustSelected) { m_fJustSelected = false; return; } IMapItem mi = m_lvld.HitTest(ptMouse.X, ptMouse.Y, GetTileSize(), GetTemplateDoc(), m_lyrf); if (mi == null) { return; } if ((Control.ModifierKeys & Keys.Control) != Keys.Control) { return; } ArrayList alsmiSelected = m_lvld.Selection; if (!alsmiSelected.Contains(mi)) { return; } alsmiSelected.Remove(mi); m_lvld.Selection = alsmiSelected; Globals.PropertyGrid.SelectedObject = null; Redraw(); }
public void UnregisterControl(Control control) { m_aControls.Remove(control); }
public static void RemoveMessageFilter(IMessageFilter value) { lock (message_filters) { message_filters.Remove(value); } }
public static int Main(string[] args) { if (args.Length < 2) { Console.WriteLine("Usage: codegen --generate <filename1...>"); return(0); } bool generate = false; string dir = ""; string custom_dir = ""; string assembly_name = ""; string glue_filename = ""; string glue_includes = ""; string gluelib_name = ""; var table = SymbolTable.Table; var gens = new ArrayList(); foreach (string arg in args) { string filename = arg; if (arg == "--generate") { generate = true; continue; } else if (arg == "--include") { generate = false; continue; } else if (arg.StartsWith("-I:")) { generate = false; filename = filename.Substring(3); } else if (arg.StartsWith("--outdir=")) { generate = false; dir = arg.Substring(9); continue; } else if (arg.StartsWith("--customdir=")) { generate = false; custom_dir = arg.Substring(12); continue; } else if (arg.StartsWith("--assembly-name=")) { generate = false; assembly_name = arg.Substring(16); continue; } else if (arg.StartsWith("--glue-filename=")) { generate = false; glue_filename = arg.Substring(16); continue; } else if (arg.StartsWith("--glue-includes=")) { generate = false; glue_includes = arg.Substring(16); continue; } else if (arg.StartsWith("--gluelib-name=")) { generate = false; gluelib_name = arg.Substring(15); continue; } var p = new Parser(); IGeneratable[] curr_gens = p.Parse(filename); table.AddTypes(curr_gens); if (generate) { gens.AddRange(curr_gens); } } // Now that everything is loaded, validate all the to-be- // generated generatables and then remove the invalid ones. var invalids = new ArrayList(); foreach (IGeneratable gen in gens) { if (!gen.Validate()) { invalids.Add(gen); } } foreach (IGeneratable gen in invalids) { gens.Remove(gen); } GenerationInfo gen_info = null; if (dir != "" || assembly_name != "" || glue_filename != "" || glue_includes != "" || gluelib_name != "") { gen_info = new GenerationInfo(dir, custom_dir, assembly_name, glue_filename, glue_includes, gluelib_name); } foreach (IGeneratable gen in gens) { if (gen_info == null) { gen.Generate(); } else { gen.Generate(gen_info); } } ObjectGen.GenerateMappers(); if (gen_info != null) { gen_info.CloseGlueWriter(); } Statistics.Report(); return(0); }
internal SoapParameters(XmlMembersMapping request, XmlMembersMapping response, string[] parameterOrder, CodeIdentifiers identifiers) { ArrayList mappingsList = new ArrayList(); ArrayList list2 = new ArrayList(); AddMappings(mappingsList, request); if (response != null) { AddMappings(list2, response); } if (parameterOrder != null) { for (int i = 0; i < parameterOrder.Length; i++) { string elementName = parameterOrder[i]; XmlMemberMapping requestMapping = FindMapping(mappingsList, elementName); SoapParameter parameter = new SoapParameter(); if (requestMapping != null) { if (RemoveByRefMapping(list2, requestMapping)) { parameter.codeFlags = CodeFlags.IsByRef; } parameter.mapping = requestMapping; mappingsList.Remove(requestMapping); this.AddParameter(parameter); } else { XmlMemberMapping mapping2 = FindMapping(list2, elementName); if (mapping2 != null) { parameter.codeFlags = CodeFlags.IsOut; parameter.mapping = mapping2; list2.Remove(mapping2); this.AddParameter(parameter); } } } } foreach (XmlMemberMapping mapping3 in mappingsList) { SoapParameter parameter2 = new SoapParameter(); if (RemoveByRefMapping(list2, mapping3)) { parameter2.codeFlags = CodeFlags.IsByRef; } parameter2.mapping = mapping3; this.AddParameter(parameter2); } if (list2.Count > 0) { if (!((XmlMemberMapping)list2[0]).CheckSpecified) { this.ret = (XmlMemberMapping)list2[0]; list2.RemoveAt(0); } foreach (XmlMemberMapping mapping4 in list2) { SoapParameter parameter3 = new SoapParameter { mapping = mapping4, codeFlags = CodeFlags.IsOut }; this.AddParameter(parameter3); } } foreach (SoapParameter parameter4 in this.parameters) { parameter4.name = identifiers.MakeUnique(CodeIdentifier.MakeValid(parameter4.mapping.MemberName)); } }
public void Remove(DockObject obj) { if (obj == null) { return; } // remove from locked/unlocked hashes and property change if that's the case if (obj is DockItem && ((DockItem)obj).HasGrip) { int locked = Locked; if (lockedItems.Contains(obj)) { lockedItems.Remove(obj); if (Locked != locked) { EmitNotifyLocked(); } } if (unlockedItems.Contains(obj)) { unlockedItems.Remove(obj); if (Locked != locked) { EmitNotifyLocked(); } } } if (obj is Dock) { toplevelDocks.Remove(obj); obj.Docked -= new DockedHandler(OnItemDocked); if (obj == controller) { DockObject newController = null; // now find some other non-automatic toplevel to use as a // new controller. start from the last dock, since it's // probably a non-floating and manual ArrayList reversed = toplevelDocks; reversed.Reverse(); foreach (DockObject item in reversed) { if (!item.IsAutomatic) { newController = item; break; } } if (newController != null) { controller = newController; } else { // no controller, no master controller = null; } } } // disconnect the signals if (obj is DockItem) { DockItem item = obj as DockItem; item.Detached -= new DetachedHandler(OnItemDetached); item.Docked -= new DockedHandler(OnItemDocked); item.DockItemDragBegin -= new DockItemDragBeginHandler(OnDragBegin); item.DockItemMotion -= new DockItemMotionHandler(OnDragMotion); item.DockItemDragEnd -= new DockItemDragEndHandler(OnDragEnd); item.PropertyChanged -= new PropertyChangedHandler(OnItemPropertyChanged); } // remove the object from the hash if it is there if (obj.Name != null && dockObjects.Contains(obj.Name)) { dockObjects.Remove(obj.Name); } /* post a layout_changed emission if the item is not automatic * (since it should be removed from the items model) */ if (!obj.IsAutomatic) { EmitLayoutChangedEvent(); } }
public override void Remove(object value) { _parameters.Remove(value); }
public override CResultAErreur SaveAll(CContexteSauvegardeObjetsDonnees contexteSauvegarde, System.Data.DataRowState etatsAPrendreEnCompte) { ArrayList listeFichiersToDelete = null; ArrayList listeFichiersToValide = null; ArrayList listeFichiersANePasSupprimer = null; GetListesPourValidation(ref listeFichiersToDelete, ref listeFichiersToValide, ref listeFichiersANePasSupprimer); CResultAErreur result = CResultAErreur.True; m_commitEventHandlerNote = new OnCommitTransEventHandler(OnCommitTrans); DataTable table = contexteSauvegarde.ContexteDonnee.Tables[GetNomTable()]; if (table != null) { foreach (DataRow row in table.Rows) { if (row.RowState == DataRowState.Modified || row.RowState == DataRowState.Added) { if (!CDocumentGED.IsControleDocumentsALaSauvegardeDesactive(contexteSauvegarde.ContexteDonnee)) //si désactivation des ids auto, on est dans un processus //de synchronisation, donc , pas de contrôle de document { CDocumentGED doc = new CDocumentGED(row); CReferenceDocument newReference = doc.ReferenceDoc; bool bRefAsChange = true; if (row.RowState == DataRowState.Modified) { doc.VersionToReturn = DataRowVersion.Original; CReferenceDocument oldRef = doc.ReferenceDoc; bRefAsChange = false; if ((newReference == null) != (oldRef == null)) { bRefAsChange = true; } if (oldRef != null && !oldRef.Equals(newReference)) { listeFichiersToDelete.Add(oldRef); bRefAsChange = true; } doc.VersionToReturn = DataRowVersion.Current; } if (bRefAsChange) { result = PreValideDocument(newReference); } if (!result) { return(result); } if (bRefAsChange) { listeFichiersToValide.Add(doc.ReferenceDoc); } listeFichiersANePasSupprimer.Add(doc.ReferenceDoc); listeFichiersToDelete.Remove(doc.ReferenceDoc);//Il ne faut pas le supprimer ! } } if (row.RowState == DataRowState.Deleted) { CDocumentGED doc = new CDocumentGED(row); doc.VersionToReturn = DataRowVersion.Original; string strRefString = doc.ReferenceString; if (!listeFichiersToValide.Contains(doc.ReferenceDoc) && !listeFichiersANePasSupprimer.Contains(doc.ReferenceDoc)) { listeFichiersToDelete.Add(doc.ReferenceDoc); } doc.VersionToReturn = DataRowVersion.Current; } } } IDatabaseConnexion con = CSc2iDataServer.GetInstance().GetDatabaseConnexion(IdSession, GetType()); if (con != null) { con.OnCommitTrans += m_commitEventHandlerNote; } result = base.SaveAll(contexteSauvegarde, etatsAPrendreEnCompte); return(result); }
//下位机串口2接收数据 private void sp2_DataReceived(object sender, EventArgs e) { System.Threading.Thread.Sleep(100); this.Invoke((EventHandler)(delegate { System.Threading.Thread.Sleep(100); Byte[] rb = new Byte[sp2.BytesToRead]; sp2.Read(rb, 0, rb.Length); //手动状态下 if (radioHand.Checked) { //存储回复FF信号的板子编号(04) if (rb[3] == 0XFF) { strs += rb[2].ToString(); } else//(03) { string xYPoints = childToPcPointChange(rb); childRandnum += rb[2].ToString(); adressPoints += xYPoints; MessageBox.Show("定位成功子板id为" + childRandnum + "+-------收到的板子ID为:" + strs); if (strs == childRandnum&&RexvData.Text!="") { lightSet.ForeColor = Color.Green; string pointDingWei = ""; for (int i = 0; i < adressPoints.Split(',').Length; i++) { pointDingWei += adressPoints.Split(',')[i]; } string[] pointDingWeiStrs = Regex.Replace(pointDingWei, @"(\w{4})", "$1,").Trim(',').Split(','); DataTable dt = new DataTable(); dt.Rows.Add(); for (int i = 0; i < pointDingWeiStrs.Length; i++) { dt.Columns.Add("P" + (i + 1), System.Type.GetType("System.String")); dt.Rows[0][i] = pointDingWeiStrs[i]; } DataSet ds2 = new DataSet(); ds2.Tables.Add(dt); //sda.Fill(ds2); dataAdressView1.DataSource = ds2.Tables[0]; dataAdressView1.ReadOnly = true; string machineId = RexvData.Text; string newAdrsssPints = adressPoints.TrimEnd(','); int n = adressPoints.Split(',').Length / 2; string pointNumber = n > 10 ? n.ToString() : "0" + n; String sqlHandMes = "select id from machines where machineId='" + RexvData.Text + "';"; MySqlDataReader msdrHand=DataBaseSys.GetDataReaderValue(sqlHandMes); if (msdrHand.HasRows) { MessageBoxButtons ButtonHandAdress = MessageBoxButtons.OKCancel; DialogResult drHand = MessageBox.Show("定位成功,存在相关的机种,需要修改吗?", "提示", ButtonHandAdress); if (drHand == DialogResult.OK) { if (!vip) MessageBox.Show("您没有管理员权限无法修改!"); else { string sql = "update machines set childNumber='" + pointNumber + "' ,adressNumber='" + newAdrsssPints + "' where machineId= '" + RexvData.Text + "'"; DataBaseSys.ExecuteNonQuery(sql); MessageBox.Show("修改成功!"); } } } else { MessageBoxButtons messButton = MessageBoxButtons.OKCancel; DialogResult dr = MessageBox.Show("定位成功,无相关的机种,确定添加吗?", "提示", messButton); if (dr == DialogResult.OK)//如果点击“确定”按钮 { string addSql = "insert into machines(machineId,childNumber,adressNumber) values('" + machineId + "','" + pointNumber + "','" + newAdrsssPints + "')"; DataBaseSys.ExecuteNonQuery(addSql); MessageBox.Show("添加成功!"); } } adressPoints = ""; MessageBoxButtons messButtonAdd = MessageBoxButtons.OKCancel; DialogResult dr2 = MessageBox.Show("需要继续手动添加新机种吗?", "提示", messButtonAdd); if (dr2 == DialogResult.OK) { insertButton.Enabled = false; radioHand_MouseClick(null, null); } else radioAuto.Checked = true; } } } //自动状态下 else { b++; if (rb[3] == 0X00)//纠错成功回复00(05) { childNumList.Remove("0" + rb[2]); b = b - 1; if (childNumList.Count==0) { for (int k = 0; k < dataAdressView1.ColumnCount; k++) { dataAdressView1.Rows[0].Cells[k].Style.ForeColor = Color.Black; } lightSet.ForeColor = Color.Green; timer1.Enabled = false; timer1.Stop(); childNumList.Clear(); return; } } else//有错误子板回复带坐标的(05) { string[] pointNums = Regex.Replace(dataBasePoints, @"(\w{4})", "$1,").Trim(',').Split(',');//把数据库查的坐标以一组4位以逗号分隔 string xYPoints = childToPcPointChange(rb); autoAdressPoints += xYPoints; string[] autoPoints= Regex.Replace(autoAdressPoints.Replace(",",""), @"(\w{4})", "$1,").Trim(',').Split(',');//把下位机传来查的坐标以一组4位以逗号分隔 for (int i = 0; i < pointNums.Length; i++) { for (int j = 0; j < autoPoints.Length; j++) { if (pointNums[i] == autoPoints[j]) { sameMesList.Add(autoPoints[j]); break ; } } } /*去重 for (int i = 0; i < sameMesList.Count - 1; i++) { for (int j = i + 1; j < sameMesList.Count; j++) { if (sameMesList[i].Equals(sameMesList[j])) { sameMesList.RemoveAt(j); j--; } } }*/ } if (b == childNumList.Count) { string s = ""; foreach (var item in sameMesList) { s+= item.ToString()+","; } for (int k = 0; k < dataAdressView1.ColumnCount; k++) { //string strData = dataAdressView1[j, 0].Value.ToString(); for (int j = 0; j < sameMesList.Count; j++) { if (dataAdressView1.Rows[0].Cells[k].Value.ToString() == sameMesList[j].ToString()) { dataAdressView1.Rows[0].Cells[k].Style.ForeColor = Color.Red; lightSet.ForeColor = Color.Red; break; } else dataAdressView1.Rows[0].Cells[k].Style.ForeColor = Color.Black; } } autoAdressPoints = ""; sameMesList.Clear(); b = 0; } } sp2.DiscardInBuffer(); })); }
/// <summary> /// Returns array list from hidden field. /// </summary> /// <param name="field">Hidden field with values separated with |</param> private static ArrayList GetHiddenValues(HiddenField field) { string hiddenValue = field.Value.Trim('|'); ArrayList list = new ArrayList(); string[] values = hiddenValue.Split('|'); foreach (string value in values) { if (!list.Contains(value)) { list.Add(value); } } list.Remove(""); return list; }
public void Detach(Observer observer) { observers.Remove(observer); }
private Cell.CellController[,] GetPaintArray(Color baseColor, Color newColor) { var arrPaint = new Cell.CellController[Width, Height]; var cells = new ArrayList(); cells.Add(_cells[0, Height - 1]); while (cells.Count > 0) { var cell = cells[0] as Cell.CellController; for (int x = cell.X; x >= 0; x--) { if (_cells[x, cell.Y].Color != baseColor) break; arrPaint[x, cell.Y] = _cells[x, cell.Y]; if (cell.Y + 1 < Height) if (arrPaint[x, cell.Y + 1] == null && _cells[x, cell.Y + 1].Color == baseColor) cells.Add(_cells[x, cell.Y + 1]); if (cell.Y - 1 >= 0) if (arrPaint[x, cell.Y - 1] == null && _cells[x, cell.Y - 1].Color == baseColor) cells.Add(_cells[x, cell.Y - 1]); } for (int x = cell.X; x < Width; x++) { if (_cells[x, cell.Y].Color != baseColor) break; arrPaint[x, cell.Y] = _cells[x, cell.Y]; if (cell.Y + 1 < Height) if (arrPaint[x, cell.Y + 1] == null && _cells[x, cell.Y + 1].Color == baseColor) cells.Add(_cells[x, cell.Y + 1]); if (cell.Y - 1 >= 0) if (arrPaint[x, cell.Y - 1] == null && _cells[x, cell.Y - 1].Color == baseColor) cells.Add(_cells[x, cell.Y - 1]); } cells.Remove(cell); } for (int x = 0; x < Width; x++) for (int y = 0; y < Height; y++) if (arrPaint[x, y] != null) arrPaint[x, y].Color = newColor; return arrPaint; }
public void removeTuioObject(TuioObject o) { objects.Remove(o); }
public void RemoveFadeoutTarget(FadeoutPlugin fadeoutPlugin) { _fadeBlocks.Remove(fadeoutPlugin); }
public void removeTuioCursor(TuioCursor o) { cursors.Remove(o); }
/// <summary> /// Removes an extender provider. /// </summary> void IExtenderProviderService.RemoveExtenderProvider(IExtenderProvider provider) { ArgumentNullException.ThrowIfNull(provider); _providers?.Remove(provider); }
public Boolean runTest() { int iCountErrors = 0; int iCountTestcases = 0; Console.Error.WriteLine( strName + ": " + strTest + " runTest started..." ); Console.WriteLine( "ACTIVE BUGS " + strActiveBugs ); ArrayList arrList = null; String[] arrCopy = null; String [] strHeroes = new String[] { "Aquaman", "Atom", "Batman", "Black Canary", "Captain America", "Captain Atom", "Catwoman", "Cyborg", "Flash", "Green Arrow", "Green Lantern", "Hawkman", null, "Ironman", "Nightwing", "Robin", "SpiderMan", "Steel", null, "Thor", "Wildcat", null }; do { ++iCountTestcases; Console.Error.WriteLine( "[] Normal Copy Test 1" ); try { arrList = new ArrayList(strHeroes ); arrCopy = new String[strHeroes.Length]; arrList.CopyTo( arrCopy); for ( int i = 0; i < arrCopy.Length; i++ ) { if ( (arrCopy[i] == null && strHeroes[i] != null ) || (arrCopy[i] != null && ! arrCopy[i].Equals( strHeroes[i] ) ) ) { ++iCountErrors; Console.WriteLine( "Err_101a arrays do not match at position " + i.ToString() ); } } } catch (Exception ex) { Console.WriteLine( "Err_101c, unexpected exception " + ex.ToString() ); ++iCountErrors; break; } ++iCountTestcases; Console.Error.WriteLine( "[] Normal Copy Test 2 - copy 0 elements" ); try { arrList = new ArrayList(); arrList.Add( null ); arrList.Add( arrList ); arrList.Add( null ); arrList.Remove( null ); arrList.Remove( null ); arrList.Remove( arrList ); if ( arrList.Count != 0 ) { ++iCountErrors; Console.WriteLine( "Err_102b, count should be zero but is " + arrList.Count.ToString() ); } arrCopy = new String[strHeroes.Length]; for ( int i = 0; i < strHeroes.Length; i++ ) { arrCopy[i] = strHeroes[i]; } arrList.CopyTo( arrCopy ); for ( int i = 0; i < arrCopy.Length; i++ ) { if ( (arrCopy[i] == null && strHeroes[i] != null ) || (arrCopy[i] != null && ! arrCopy[i].Equals( strHeroes[i] ) ) ) { ++iCountErrors; Console.WriteLine( "Err_102a, arrays do not match at position " + i.ToString() ); } } } catch (Exception ex) { Console.WriteLine( "Err_102c, unexpected exception " + ex.ToString() ); ++iCountErrors; break; } arrList = new ArrayList(); if ( arrList.Count != 0 ) { ++iCountErrors; Console.WriteLine( "Err_102b, count should be zero but is " + arrList.Count.ToString() ); } arrCopy = new String[0]; arrList.CopyTo( arrCopy ); if ( arrCopy.Length != 0 ) { ++iCountErrors; Console.WriteLine( "Err_630vfd, count should be zero but is " + arrCopy.Length ); } ++iCountTestcases; Console.Error.WriteLine( "[] Copy so that exception should be thrown " ); try { arrList = new ArrayList(); if ( arrList.Count != 0 ) { ++iCountErrors; Console.WriteLine( "Err_105b, count should be zero but is " + arrList.Count.ToString() ); } arrCopy = null; arrList.CopyTo( arrCopy ); ++iCountErrors; Console.WriteLine( "Err_649vdf! EXception not thrown" ); } catch(ArgumentNullException) { } catch (Exception ex) { Console.WriteLine( "Err_105a, unexpected exception " + ex.ToString() ); ++iCountErrors; break; } } while ( false ); Console.Error.Write( strName ); Console.Error.Write( ": " ); if ( iCountErrors == 0 ) { Console.Error.WriteLine( strTest + " iCountTestcases==" + iCountTestcases.ToString() + " paSs" ); return true; } else { Console.WriteLine( strTest + " FAiL"); Console.Error.WriteLine( strTest + " iCountErrors==" + iCountErrors.ToString() ); return false; } }
private static void ApplicationsFor (OpenWithMenu menu, string [] mime_types, out ArrayList union, out ArrayList intersection) { //Console.WriteLine ("Getting applications"); union = new ArrayList (); intersection = new ArrayList (); if (mime_types == null || mime_types.Length < 1) return; bool first = true; foreach (string mime_type in mime_types) { if (mime_type == null) continue; MimeApplication [] apps = Gnome.Vfs.Mime.GetAllApplications (mime_type); for (int i = 0; i < apps.Length; i++) { apps [i] = apps [i].Copy (); } foreach (MimeApplication app in apps) { // Skip apps that don't take URIs if (! app.SupportsUris ()) continue; // Skip apps that we were told to ignore if (menu.IgnoreApp != null) if (app.BinaryName.IndexOf (menu.IgnoreApp) != -1) continue; if (! union.Contains (app)) union.Add (app); if (first) intersection.Add (app); } if (! first) { for (int i = 0; i < intersection.Count; i++) { MimeApplication app = intersection [i] as MimeApplication; if (System.Array.IndexOf (apps, app) == -1) { intersection.Remove (app); i--; } } } first = false; } }
public ArrayList GetAdjacentCells(ArrayList allCells, int cellsPerRow) { ArrayList adjacentCells = new ArrayList(); Cell neighbourUpperLeft = null; Cell neighbourUpper = null; Cell neighbourUpperRight = null; Cell neighbourLeft = null; Cell neighbourRight = null; Cell neighbourLowerLeft = null; Cell neighbourLower = null; Cell neighbourLowerRight = null; //check each neighbour if(id % cellsPerRow != 0 && IsInBounds(id + cellsPerRow - 1, allCells)) neighbourUpperLeft = ((GameObject) allCells[id + cellsPerRow - 1]).GetComponent<Cell>(); if(IsInBounds(id + cellsPerRow, allCells)) neighbourUpper = ((GameObject) allCells[id + cellsPerRow]).GetComponent<Cell>(); if((id + 1) % cellsPerRow != 0 && IsInBounds(id + cellsPerRow + 1, allCells)) neighbourUpperRight = ((GameObject) allCells[id + cellsPerRow + 1]).GetComponent<Cell>(); if(id % cellsPerRow != 0) neighbourLeft = ((GameObject) allCells[id - 1]).GetComponent<Cell>(); if((id + 1) % cellsPerRow != 0) neighbourRight = ((GameObject) allCells[id + 1]).GetComponent<Cell>(); if(id % cellsPerRow != 0 && IsInBounds(id - cellsPerRow - 1, allCells)) neighbourLowerLeft = ((GameObject) allCells[id - cellsPerRow - 1]).GetComponent<Cell>(); if(IsInBounds(id - cellsPerRow, allCells)) neighbourLower = ((GameObject) allCells[id - cellsPerRow]).GetComponent<Cell>(); if((id + 1) % cellsPerRow != 0 && IsInBounds(id - cellsPerRow + 1, allCells)) neighbourLowerRight = ((GameObject) allCells[id - cellsPerRow + 1]).GetComponent<Cell>(); //if neighbor exists and is valid, add to neighbour-array if(IsCellValid(neighbourUpperLeft)) adjacentCells.Add(neighbourUpperLeft); if(IsCellValid(neighbourUpper)) adjacentCells.Add(neighbourUpper); if(IsCellValid(neighbourUpperRight)) adjacentCells.Add(neighbourUpperRight); if(IsCellValid(neighbourLeft)) adjacentCells.Add(neighbourLeft); if(IsCellValid(neighbourRight)) adjacentCells.Add(neighbourRight); if(IsCellValid(neighbourLowerLeft)) adjacentCells.Add(neighbourLowerLeft); if(IsCellValid(neighbourLower)) adjacentCells.Add(neighbourLower); if(IsCellValid(neighbourLowerRight)) adjacentCells.Add(neighbourLowerRight); //diagonal-edge-detection. if at an edge, remove from neighbour-array if(IsCellInvalid(neighbourRight)) { adjacentCells.Remove(neighbourUpperRight); adjacentCells.Remove(neighbourLowerRight); } if(IsCellInvalid(neighbourLeft)) { adjacentCells.Remove(neighbourUpperLeft); adjacentCells.Remove(neighbourLowerLeft); } if(IsCellInvalid(neighbourUpper)) { adjacentCells.Remove(neighbourUpperRight); adjacentCells.Remove(neighbourUpperLeft); } if(IsCellInvalid(neighbourLower)) { adjacentCells.Remove(neighbourLowerRight); adjacentCells.Remove(neighbourLowerLeft); } return adjacentCells; }
private void CreateStairsAtEdges() { bool placingHorizontally = (Random.Range(0, 2) == 0); ArrayList potentialPositions0 = new ArrayList(); ArrayList potentialPositions1 = new ArrayList(); if (placingHorizontally) { for (int i = 0; i < NumBuildingBlocksAcross; ++i) { potentialPositions0 = GetPotentialStairPositionsInColumn(i); if (potentialPositions0.Count > 0) { break; } } for (int i = NumBuildingBlocksAcross - 1; i >= 0; --i) { potentialPositions1 = GetPotentialStairPositionsInColumn(i); if (potentialPositions1.Count > 0) { break; } } } else { for (int i = 0; i < NumBuildingBlocksUp; ++i) { potentialPositions0 = GetPotentialStairPositionsInRow(i); if (potentialPositions0.Count > 0) { break; } } for (int i = NumBuildingBlocksUp - 1; i >= 0; --i) { potentialPositions1 = GetPotentialStairPositionsInRow(i); if (potentialPositions1.Count > 0) { break; } } } if (potentialPositions0.Count <= 0 || potentialPositions1.Count <= 0) { Debug.LogWarning("DungeonGenerator::CreateStairsAtEdges() couldn't find valid potential placement stairs up/down positions!"); } bool stairsUpFromPositions0 = (Random.Range(0, 2) == 0); if (stairsUpFromPositions0) { int chosenUpIndex = Random.Range(0, potentialPositions0.Count); CellLocation chosenUp = (CellLocation)potentialPositions0[chosenUpIndex]; potentialPositions1.Remove(new CellLocation(chosenUp.x, chosenUp.z)); int chosenDownIndex = Random.Range(0, potentialPositions1.Count); CellLocation chosenDown = (CellLocation)potentialPositions1[chosenDownIndex]; InstantiateStairs(chosenUp, chosenDown); } else { int chosenUpIndex = Random.Range(0, potentialPositions1.Count); CellLocation chosenUp = (CellLocation)potentialPositions1[chosenUpIndex]; potentialPositions0.Remove(new CellLocation(chosenUp.x, chosenUp.z)); int chosenDownIndex = Random.Range(0, potentialPositions0.Count); CellLocation chosenDown = (CellLocation)potentialPositions0[chosenDownIndex]; InstantiateStairs(chosenUp, chosenDown); } }
protected void btnBorrarFoto_Click(object sender, EventArgs e) { string url = this.hidURL.Value; this.hidPID.Value = this.hidPID.Value; ArrayList fotosTemporal = new ArrayList(); //Recorro el ArrayList de fotos y voy creando la visualización if (Session["fotosTemporal"] != null) fotosTemporal = (ArrayList)Session["fotosTemporal"]; if (fotosTemporal != null && fotosTemporal.Count > 0) { if (fotosTemporal.Contains(url)) { fotosTemporal.Remove(url); } } this.CargarFotos(); }
static int Main (string [] args) { ArrayList sources = new ArrayList (); int top = args.Length; link_paths.Add ("."); DetectOS (); for (int i = 0; i < top; i++){ switch (args [i]){ case "--help": case "-h": case "-?": Help (); return 1; case "-c": compile_only = true; break; case "-o": if (i+1 == top){ Help (); return 1; } output = args [++i]; break; case "-oo": if (i+1 == top){ Help (); return 1; } object_out = args [++i]; break; case "-L": if (i+1 == top){ Help (); return 1; } link_paths.Add (args [++i]); break; case "--nodeps": autodeps = false; break; case "--deps": autodeps = true; break; case "--keeptemp": keeptemp = true; break; case "--static": if (style == "windows") { Console.Error.WriteLine ("The option `{0}' is not supported on this platform.", args [i]); return 1; } static_link = true; Console.WriteLine ("Note that statically linking the LGPL Mono runtime has more licensing restrictions than dynamically linking."); Console.WriteLine ("See http://www.mono-project.com/Licensing for details on licensing."); break; case "--config": if (i+1 == top) { Help (); return 1; } config_file = args [++i]; break; case "--machine-config": if (i+1 == top) { Help (); return 1; } machine_config_file = args [++i]; Console.WriteLine ("WARNING:\n Check that the machine.config file you are bundling\n doesn't contain sensitive information specific to this machine."); break; case "--config-dir": if (i+1 == top) { Help (); return 1; } config_dir = args [++i]; break; case "-z": compress = true; break; case "--nomain": nomain = true; break; default: sources.Add (args [i]); break; } } Console.WriteLine ("Sources: {0} Auto-dependencies: {1}", sources.Count, autodeps); if (sources.Count == 0 || output == null) { Help (); Environment.Exit (1); } ArrayList assemblies = LoadAssemblies (sources); ArrayList files = new ArrayList (); foreach (Assembly a in assemblies) QueueAssembly (files, a.CodeBase); // Special casing mscorlib.dll: any specified mscorlib.dll cannot be loaded // by Assembly.ReflectionFromLoadFrom(). Instead the fx assembly which runs // mkbundle.exe is loaded, which is not what we want. // So, replace it with whatever actually specified. foreach (string srcfile in sources) { if (Path.GetFileName (srcfile) == "mscorlib.dll") { foreach (string file in files) { if (Path.GetFileName (new Uri (file).LocalPath) == "mscorlib.dll") { files.Remove (file); files.Add (new Uri (Path.GetFullPath (srcfile)).LocalPath); break; } } break; } } GenerateBundles (files); //GenerateJitWrapper (); return 0; }
public void FloodFillAll () { area = 0; int areaTimeStamp = Mathf.RoundToInt (Random.Range (0,10000)); int searched = 0; ArrayList open = new ArrayList (); Node current = null; ArrayList areaColorsArr = new ArrayList (); areaColorsArr.Add (new Color (Random.value,Random.value,Random.value)); int totalWalkableNodeAmount = 0;//The amount of nodes which are walkable for (int y=0;y<grids.Length;y++) {//Height Grid grid = grids[y]; for (int z=0;z<grid.depth;z++) {//Depth for (int x=0;x<grid.width;x++) {//Depth Node node = GetNode (x,y,z); if (node.walkable) { totalWalkableNodeAmount++; } } } } while (searched < totalWalkableNodeAmount) { area++; areaColorsArr.Add (area <= presetAreaColors.Length ? presetAreaColors[area-1] : new Color (Random.value,Random.value,Random.value)); if (area > 400) { Debug.Log ("Preventing possible Infinity Loop (Searched " + searched+" nodes in the flood fill pass)"); break; } for (int y=0;y<grids.Length;y++) {//Height Grid grid = grids[y]; for (int z=0;z<grid.depth;z++) {//Depth for (int x=0;x<grid.width;x++) {//Depth Node node = GetNode (x,y,z); if (node.walkable && node.areaTimeStamp != areaTimeStamp && node.enabledConnections.Length>0) { node.areaTimeStamp = areaTimeStamp; //searched++; open.Add (node); z = grid.depth; x = grid.width; y = grids.Length; } } } } if (open.Count==0) { searched=totalWalkableNodeAmount; area--; break; } while (open.Count > 0) { searched++; if (searched > totalWalkableNodeAmount) { Debug.LogError ("Infinity Loop, can't flood fill more than the total node amount (System Failure)"); break; } current = open[0] as Node; current.area = area; current.areaTimeStamp = areaTimeStamp; open.Remove (current); for (int i=0;i<current.enabledConnections.Length;i++) { if (current.enabledConnections[i].endNode.areaTimeStamp != areaTimeStamp) { current.enabledConnections[i].endNode.areaTimeStamp = areaTimeStamp; open.Add (current.enabledConnections[i].endNode); } } } open.Clear (); } areaColors = areaColorsArr.ToArray (typeof(Color)) as Color[]; Debug.Log ("Grid contains "+(area)+" Area(s)"); }
//! 移除精灵 public void Remove(Sprite sprite) { m_Sprites.Remove(sprite); }
public void Detach(Investor investor) { investors.Remove(investor); }
private void ComplainAboutInterruption(DialogueAction interruptedSpeaker) { ArrayList otherSpeakers = new ArrayList(speakers); otherSpeakers.Remove(interruptedSpeaker); DialogueAction complainer = (DialogueAction)otherSpeakers[(int)Random.Range(0, otherSpeakers.Count)]; complainer.StartQuickReaction(new OneLinerAction(complainer.GetActor(), "interrupted", CharacterManager.GetPC())); }
public void removeListener(TUIOListener listener) { listenerList.Remove(listener); }
private void Temporary() { int CValLength, RequestLength; if (ViewState["CurrentValue"].ToString() == "") { CValLength = 0; } else { CValLength = ViewState["CurrentValue"].ToString().Split(',').Length; } if (CheckForm("user_id") == "") { RequestLength = 0; } else { RequestLength = Request.Form["user_id"].Split(',').Length; } ArrayList tmpArray = new ArrayList(); if (Session["Usertemporary"].ToString() != "") { string[] ChangeAry = Session["Usertemporary"].ToString().Split(','); for (int j = 0; j < ChangeAry.Length; j++) { tmpArray.Add(ChangeAry[j]); } } string strUserID1 = ""; //移除這一頁舊有的資料 if (CValLength > 0) { string[] aBeforeUserID = ViewState["CurrentValue"].ToString().Split(','); foreach (string strUserID in aBeforeUserID) { if (tmpArray.Count > 0) //Session("Usertemporary")記錄未上傳前,所挑選的使用者 { foreach (string strTemp in tmpArray) { strUserID1 = strTemp.Split('_')[0]; if (strUserID1 == strUserID) { tmpArray.Remove(strTemp); break; } } } } } //新增這一頁的現有資料 string[] pick_user; if (CheckForm("user_id") != "") { pick_user = Request.Form["user_id"].Split(','); if (RequestLength > 0) { for (int i = 0; i < pick_user.Length; i++) { tmpArray.Add(pick_user[i]); } } } //將ArrayList轉成字串 string strTemporary = ""; if (tmpArray.ToString() != "" && tmpArray != null) { for (int k = 0; k < tmpArray.Count; k++) { strTemporary += tmpArray[k] + ","; } if (strTemporary != "") strTemporary = strTemporary.Substring(0, strTemporary.Length - 1); } Session["Usertemporary"] = strTemporary; }
//------------------------------ public void Find_way() { ArrayList S = new ArrayList(1); ArrayList Sr = new ArrayList(1); int[] Indexof_distance = new int[this.row]; for (int i = 0; i < row; i++) { Indexof_distance[i] = i; } S.Add(Indexof_distance[0]); for (int i = 0; i < this.row; i++) { Sr.Add(Indexof_distance[i]); } Sr.RemoveAt(0); int[] D = new int[this.row]; //存放中心点到每个点的距离 //---------------以上已经初始化了,S和Sr(里边放的都是点的编号)------------------ int Count = this.row - 1; while (Count > 0) { //假定中心点的编号是0的贪吃法求路径 for (int i = 0; i < row; i++) { D[i] = this.distance[i]; } int min_num = (int)Sr[0]; //距中心点的最小距离点编号 foreach (int s in Sr) { if (D[s] < D[min_num]) { min_num = s; } } //以上可以排序优化 S.Add(min_num); Sr.Remove(min_num); //-----------把最新包含进来的点也加到路径中------------- ((ArrayList)ways[min_num]).Add(min_num); //----------------------------------------------- foreach (int element in Sr) { int position = element * (this.row) + min_num; bool exchange = false; //有交换标志 if (D[element] < D[min_num] + this.distance[position]) { D[element] = D[element]; } else { D[element] = this.distance[position] + D[min_num]; exchange = true; } //修改距离矩阵 this.distance[element] = D[element]; position = element * this.row; this.distance[position] = D[element]; //修改路径--------------- if (exchange == true) { ((ArrayList)ways[element]).Clear(); foreach (int point in (ArrayList)ways[min_num]) { ((ArrayList)ways[element]).Add(point); } } } --Count; } }
public void FloodFill (Node node,int areaTimeStamp) { if (node.areaTimeStamp == areaTimeStamp || !node.walkable) { return; } area++; ArrayList areaColorsArr = new ArrayList (areaColors); areaColorsArr.Add (area <= presetAreaColors.Length ? presetAreaColors[area-1] : new Color (Random.value,Random.value,Random.value)); areaColors = areaColorsArr.ToArray (typeof(Color)) as Color[]; int searched = 0; ArrayList open = new ArrayList (); Node current = null; open.Add (node); while (open.Count > 0) { searched++; if (searched > totalNodeAmount) { Debug.Log ("Infinity Loop"); } current = open[0] as Node; current.area = area; open.Remove (current); for (int i=0;i<current.enabledConnections.Length;i++) { if (current.enabledConnections[i].endNode.areaTimeStamp != areaTimeStamp) { current.enabledConnections[i].endNode.areaTimeStamp = areaTimeStamp; open.Add (current.enabledConnections[i].endNode); } } } Debug.Log ("Flood Filled "+searched+ " Nodes, The Grid now contains "+area +" Areas"); }
public void Unadvise(IEngineNotification sink) { clientSinks.Remove(sink); }
public TDPath checkPath(TDMap map, TDTile start, int maxStamina) { TDTile selected = new TDTile(); TDTile finalSelected = new TDTile(); TDTile pathRun = new TDTile(); ArrayList finalPath = new ArrayList(); ArrayList unvisited = new ArrayList(); for (int i = start.position - maxStamina - maxStamina * map.getWidth(); i < start.position + maxStamina + maxStamina * map.getWidth(); i++) { if (i > 0 && i < map.getWidth() * map.getHeight()) { map.getTile(i).distance = 20000; map.getTile(i).previousTile = null; unvisited.Add(map.getTile(i)); } Debug.Log("On position " + i); if (i % map.getWidth() == start.x + maxStamina) { i += map.getWidth() - maxStamina * 2 - 1; Debug.Log("Switched Rows " + i); } } map.getTile(start.position).distance = 0; int looped = 0; int finalDistance = -1; while (unvisited.Count > 0 && !selected.equals(map.getTile((int)currentTileCoord.x, (int)currentTileCoord.z)) && selected.distance < maxStamina) { looped++; selected.distance = 200000; for (int i = 0; i < unvisited.Count; i++) { TDTile comparing = (TDTile)unvisited[i]; if (comparing.distance < selected.distance) { selected = comparing; if (selected.equals(map.getTile((int)currentTileCoord.x, (int)currentTileCoord.z))) { if (selected.distance > maxStamina) { return null; } finalDistance = selected.distance; finalSelected = selected; pathRun = finalSelected; while (pathRun.previousTile != null) { finalPath.Add(pathRun); pathRun = pathRun.previousTile; } return new TDPath(finalPath, finalDistance); } Debug.Log(" Selected: " + selected + " " + selected.distance + "looped: " + looped); } unvisited.Remove(selected); for (int j = 0; j < selected.findNeighbors().Length; j++) { TDTile neighbor = map.getTile(selected.findNeighbors()[j]); if (neighbor != null) { if (unvisited.Contains(neighbor)) { int alternate = selected.distance + 1; if (alternate < neighbor.distance) { neighbor.distance = alternate; neighbor.previousTile = selected; } } } } } } return null; }
public override void Execute(GameLiving living) { if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return; GamePlayer player = living as GamePlayer; if (player == null) return; if (player.ControlledBrain == null) return; if (player.ControlledBrain.Body == null) return; ArrayList targets = new ArrayList(); //select targets if (player.Group == null) { if(player.Health < player.MaxHealth) targets.Add(player); } else { foreach (GamePlayer tplayer in player.Group.GetPlayersInTheGroup()) { if (tplayer.IsAlive && player.IsWithinRadius(tplayer, m_healRange ) && tplayer.Health < tplayer.MaxHealth) targets.Add(player); } } if (targets.Count == 0) { player.Out.SendMessage(((player.Group != null) ? "Your group is" : "You are") + " fully healed!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow); return; } //send spelleffect foreach (GamePlayer visPlayer in player.GetPlayersInRadius((ushort)WorldMgr.VISIBILITY_DISTANCE)) visPlayer.Out.SendSpellEffectAnimation(player, player, 7075, 0, false, 0x01); int petHealthPercent = player.ControlledBrain.Body.HealthPercent; m_healthpool *= (petHealthPercent * 0.01); //[StephenxPimentel] //1.108 - This ability will no longer stun or sacrifice the pet. //player.ControlledBrain.Body.Die(player); int pool = (int)m_healthpool; while (pool > 0 && targets.Count > 0) { //get most injured player GamePlayer mostInjuredPlayer = null; int LowestHealthPercent = 100; foreach (GamePlayer tp in targets) { byte tpHealthPercent = tp.HealthPercent; if (tpHealthPercent < LowestHealthPercent) { LowestHealthPercent = tpHealthPercent; mostInjuredPlayer = tp; } } if (mostInjuredPlayer == null) break; //target has been healed targets.Remove(mostInjuredPlayer); int healValue = Math.Min(600, (mostInjuredPlayer.MaxHealth - mostInjuredPlayer.Health)); healValue = Math.Min(healValue, pool); mostInjuredPlayer.ChangeHealth(player, GameLiving.eHealthChangeType.Spell, healValue); } DisableSkill(living); }
/// <summary> /// 射击 /// </summary> public void shoot() { //print("2"); if(!shootBool) { return ; } RaycastHit[] hits; Vector3 vc3=vReticle; vc3.x +=rectWidth / 2; //print(vc3.y); vc3.y =Screen.height-rectHeight/2-vc3.y; vc3.z = 0; ray = camera.ScreenPointToRay(vc3); // mainCamera.transform.position = ray.origin; hits = Physics.RaycastAll(ray.origin, transform.forward, 100.0F); print(ray.origin); ArrayList lifeLists = new ArrayList(); if (hits.Length > 0) { print(hits.Length); for (int i = 0; i <= (hits.Length - 1); i++) { Transform hit = hits[i].transform; do { Life lifeTemp = hit.gameObject.GetComponent<Life>(); if (lifeTemp) { foreach (Life lList in lifeLists) { if (lList == lifeTemp) { lifeLists.Remove(lList); } } lifeLists.Add(lifeTemp); lifeTemp = null; } hit = hit.parent; } while (hit); } } foreach (Life lList in lifeLists) { lList.injure(sniperObject.GetComponent<SniperEntrance>().getSniperData().damage); } shootBool=false; shootTime.enabled=true; }
protected override void OnClosed(EventArgs e) { base.OnClosed(e); OpenForms.Remove(this); }
void AssignPictures(){ tilesUnassigned = new ArrayList (); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { tilesUnassigned.Add(grid [x, y]); } } //tilesAssigned = new ArrayList (); int idNumber = 0; //Select 2 unassigned tiles while (tilesUnassigned.Count != 0) { //Generate first random tile int randomX = Random.Range (0, width); int randomY = Random.Range (0, height); Tile tile1 = grid [randomX, randomY]; //Check to see if it's unassinged if (tilesUnassigned.Contains (tile1)) { //Generate random pair int randomX2 = Random.Range (0, width); int randomY2 = Random.Range (0, height); //Make sure the same index isnt picked. Tile tile2 = grid [randomX2, randomY2]; if (randomX == randomX2 && randomY == randomY2) { continue; } //Check to see if second tile is unassinged if (tilesUnassigned.Contains (tile2)) { //Give them both the same contents and make them aware of their twin grid[randomX, randomY].setPair(grid[randomX2, randomY2]); grid [randomX2, randomY2].setPair (grid [randomX, randomY]); grid [randomX2, randomY2].setID (idNumber); grid [randomX, randomY].setID (idNumber); //TODO Add in content of boxes here. //Add them to the assigned list. Remove them from the unassinged list. tilesUnassigned.Remove(tile1); tilesUnassigned.Remove(tile2); idNumber++; // Debug.Log ("Tile [" + randomX + "," + randomY + "] and tile [" + randomX2 + "," + randomY2 + "] are now paired"); } else { //It's assigned already, move on continue; } } else { //Is assigned already, move on. continue; } } }
private static void OnSendStatus(IMAC macInstance, DateTime time, SendPacketStatus ACKStatus, uint transmitDestination, ushort index) { var pipe = macInstance as MACPipe; switch (ACKStatus) { case SendPacketStatus.SendACKed: #if DBG_DIAGNOSTIC Debug.Print("\t\tApp Message Handler: Retry queue length = " + _retriedPackets.Count); #endif #if !DBG_LOGIC Debug.Print("Detect to " + transmitDestination.ToString() + " ACKed"); #endif // Update link metrics if ((ushort)transmitDestination == RoutingGlobal.Parent) { RoutingGlobal.UpdateNumReceivedInCurrentWindow_Parent(1); #if !DBG_LOGIC Debug.Print("Updated numReceivedInCurrentWindow for parent " + transmitDestination + "; new value = " + RoutingGlobal.GetNumReceivedInCurrentWindow_Parent()); #endif } else { byte cindex = CandidateTable.findIndex((ushort)transmitDestination); if (cindex < byte.MaxValue) { CandidateTable._candidateList[cindex].UpdateNumReceivedInCurrentWindow(1); #if !DBG_LOGIC Debug.Print("Updated numReceivedInCurrentWindow for candidate " + transmitDestination + "; new value = " + CandidateTable._candidateList[cindex].GetNumReceivedInCurrentWindow()); #endif } } if (_retriedPackets.Contains(index)) // If this was a re-try, remove packet from queue { _retriedPackets.Remove(index); } break; case SendPacketStatus.SendNACKed: #if !DBG_LOGIC Debug.Print("Detect to " + transmitDestination.ToString() + " NACKed"); #endif // Update link metrics if ((ushort)transmitDestination == RoutingGlobal.Parent) { RoutingGlobal.UpdateNumTriesInCurrentWindow_Parent(1); #if !DBG_LOGIC Debug.Print("Updated numTriesInCurrentWindow for parent " + transmitDestination + "; new value = " + RoutingGlobal.GetNumTriesInCurrentWindow_Parent()); #endif } else { byte cindex = CandidateTable.findIndex((ushort)transmitDestination); if (cindex < byte.MaxValue) { CandidateTable._candidateList[cindex].UpdateNumTriesInCurrentWindow(1); #if !DBG_LOGIC Debug.Print("Updated numTriesInCurrentWindow for candidate " + transmitDestination + "; new value = " + CandidateTable._candidateList[cindex].GetNumTriesInCurrentWindow()); #endif } } break; case SendPacketStatus.SendFailed: #if DBG_DIAGNOSTIC Debug.Print("\t\tApp Message Handler: Retry queue length = " + _retriedPackets.Count); #endif // Update link metrics if ((ushort)transmitDestination == RoutingGlobal.Parent) { RoutingGlobal.UpdateNumTriesInCurrentWindow_Parent(1); #if !DBG_LOGIC Debug.Print("Updated numTriesInCurrentWindow for parent " + transmitDestination + "; new value = " + RoutingGlobal.GetNumTriesInCurrentWindow_Parent()); #endif } else { byte cindex = CandidateTable.findIndex((ushort)transmitDestination); if (cindex < byte.MaxValue) { CandidateTable._candidateList[cindex].UpdateNumTriesInCurrentWindow(1); #if !DBG_LOGIC Debug.Print("Updated numTriesInCurrentWindow for candidate " + transmitDestination + "; new value = " + CandidateTable._candidateList[cindex].GetNumTriesInCurrentWindow()); #endif } } // Retry if (!_retriedPackets.Contains(index) && RoutingGlobal._color == Color.Green) // If packet not there, enqueue it and retry it once { RoutingGlobal.CleanseCandidateTable(pipe); Candidate tmpBst = CandidateTable.GetBestCandidate(false); AppGlobal.TempParent = tmpBst.GetMacID(); byte[] msg = new byte[AppGlobal.DetectionMessageSize]; if (pipe.GetMsgWithMsgID(ref msg, index) == DeviceStatus.Success) { AppGlobal.SendToTempParent(pipe, msg, msg.Length); tmpBst.UpdateNumTriesInCurrentWindow(1); #if !DBG_LOGIC Debug.Print("Updated numTriesInCurrentWindow for TempParent " + transmitDestination + "; new value = " + tmpBst.GetNumTriesInCurrentWindow()); #endif _retriedPackets.Add(index); } } else // Retried once; drop packet { _retriedPackets.Remove(index); } break; default: break; } }
private void RememberOldValues() { ArrayList categoryIDList = new ArrayList(); int index = -1; foreach (GridViewRow row in grdvwSite.Rows) { index = (int)grdvwSite.DataKeys[row.RowIndex].Value; bool result = ((CheckBox)row.FindControl("CheckAll")).Checked; // Check in the Session if (Session["CHECKED_ITEMS"] != null) categoryIDList = (ArrayList)Session["CHECKED_ITEMS"]; if (result) { if (!categoryIDList.Contains(index)) categoryIDList.Add(index); } else categoryIDList.Remove(index); } if (categoryIDList != null && categoryIDList.Count > 0) Session["CHECKED_ITEMS"] = categoryIDList; }
public void Remove(object value) { _List.Remove(value); }
/// <summary> /// Removes the first occurrence of a specific object from the PropertySpecCollection. /// </summary> /// <param name="obj">The PropertySpec to remove from the PropertySpecCollection.</param> public void Remove(PropertySpec obj) { innerArray.Remove(obj); }
//use override method the same as method in abstract class public override void InsertPhone(string personName, string personPhone) { //int length = Int32.MaxValue; phoneList = new ArrayList(); //int i = 0; //bool isTru = true; //while (isTru) //{ //PhoneBook p = new PhoneBook(null,null,phoneList); phoneNumber = new ArrayList(); p = new PhoneBook(); //if (p != null) { //PhoneBook p = null; //for (int i = 0; i < phoneList.Count; i++) //{ // p = new PhoneBook(personName, phoneNumber, phoneList); // phoneList.Add(p); // p.getPhone().Add(personPhone); // Console.WriteLine("The information has been inserted into the database"); //} //for (int i = 0; i <= phoneList.Count; i++) //{ phoneList.Add(p); int count = 1; //Console.WriteLine(p.getName()); for (int i = 0; i < phoneList.Count; i++) { PhoneBook pb = (PhoneBook)phoneList[i]; if (pb.getName() == personName) { //phoneNumber.Add(personPhone); //phoneList[i] = new PhoneBook(personName, , phoneList) //Phone number : name, list of phone number. pb.getPhone().Add(personPhone); //p = new PhoneBook(personName, phoneNumber, phoneList); Console.WriteLine("The information has been inserted into the database"); break; } else if (pb.getName() != personName && phoneList.Count == 1) { p = new PhoneBook(personName, phoneNumber, phoneList); phoneList.Add(p); p.getPhone().Add(personPhone); Console.WriteLine("The information has been inserted into the database"); break; } } //foreach (PhoneBook pb in phoneList) //{ // Console.WriteLine(pb.getName() + " "); //} //Console.WriteLine(count); for (int i = 0; i < phoneList.Count; i++) { PhoneBook pb = (PhoneBook)phoneList[i]; if (phoneList.Contains(pb) && count == 2) { phoneList.Remove(pb); break; } else if (phoneList.Contains(pb) && count == 1) { count++; break; } } phoneList.RemoveAt(0); foreach (PhoneBook pb in phoneList) { Console.Write("Name: " + pb.getName() + " Phone Number: "); foreach (string ph in phoneNumber) { Console.Write(ph + " "); } Console.WriteLine(); } //} //isTru = false; // } }