Example #1
0
    //高级单个糖果的爆炸逻辑
    void addIntoListBySingleComplexCandy(GameObject target,ArrayList _arr,ArrayList _arr2)
    {
        if (target && _arr != null) {
            Candy candy = target.GetComponent<Candy>();
            int type1 = candy.type;
            int count = type1/100;
            int dir = (type1 - count*100)/10;
            //单4
            if(count == 4)
            {
                if(dir == 1)
                {
                    //横
                    for(int j = 0 ; j < mapLine ; j++)
                    {
                        GameObject t = getCandyAt(candy.row,j);
                        if(t && !_arr.Contains(t) && !_arr2.Contains(t))
                        {
                            _arr.Add(t);
                            _arr2.Add(t);
                        }
                    }
                }else
                {
                    //列
                    for(int i = 0 ; i < mapRow ; i++)
                    {
                        GameObject t = getCandyAt(i,candy.line);
                        if(t && !_arr.Contains(t) && !_arr2.Contains(t))
                        {
                            _arr.Add(t);
                            _arr2.Add(t);
                        }
                    }
                }
            }
            //单5 t
            if(count == 5)
            {

                for(int i = candy.row - 1 ;i <= candy.row + 1; i++)
                {
                    for(int j = candy.line - 1; j <= candy.line + 1 ;j++)
                    {
                        GameObject t = getCandyAt(i,j);
                        if(t && !_arr.Contains(t) && !_arr2.Contains(t))
                        {
                            _arr.Add(t);
                            _arr2.Add(t);
                        }
                    }
                }
            }
        }
    }
    void SpawnLayer(int layer, ArrayList spots, bool destroyLastLayer)
    {
        if (destroyLastLayer) {
            foreach(Object o in lastLayer) {
                Destroy(o);
            }
        }
        else {
            lastLayer.Clear();
        }

        int counter = 0;

        int i, j;

        // Top left -> top right
        j = layer;
        for (i = -layer; i < layer; i++) {
            counter++;
            if (spots.Contains(counter)) {
                lastLayer.Add(Instantiate (Atom, transform.position + new Vector3(i, j, 1), transform.rotation));
            }
        }
        // Top right -> bottom right
        i = layer;
        for (j = layer; j > -layer; j--) {
            counter++;
            if (spots.Contains(counter)) {
                lastLayer.Add(Instantiate (Atom, transform.position + new Vector3(i, j, 1), transform.rotation));
            }
        }
        // bottom right -> bottom left
        j = -layer;
        for (i = layer; i > -layer; i--) {
            counter++;
            if (spots.Contains(counter)) {
                lastLayer.Add(Instantiate (Atom, transform.position + new Vector3(i, j, 1), transform.rotation));
            }
        }
        // bottom left -> top right
        i = -layer;
        for (j = -layer; j < layer; j++) {
            counter++;
            if (spots.Contains(counter)) {
                lastLayer.Add(Instantiate (Atom, transform.position + new Vector3(i, j, 1), transform.rotation));
            }
        }
    }
Example #3
0
    void CalculatePoints(bool isPhoto)
    {
        ArrayList targetHits = new ArrayList ();
        foreach (RaycastHit hit in eyes.hits)
        {
            if (hit.transform && hit.transform.tag == "Girl" && !targetHits.Contains(hit.transform.gameObject.GetHashCode()))
            {
                targetAcquire = true;
                targetHits.Add(hit.transform.gameObject.GetHashCode());
                int points = (int)(Mathf.Min(10, 20 * Mathf.Max(0f, 1 - hit.distance/eyes.fovMaxDistance)));
                if(isPhoto)
                {
                    points *= 100;
                }

                GameState gs = GameManager.getInstance().getGameState();

                if(gs == GameState.Stealth)
                    points *=2;
                else if(gs == GameState.Detected)
                    points /=2;

                GameManager.getInstance().updatePoints(points);
            }
        }
    }
    //we are only testing in one direction at a time
    public static bool DetectOtherObjects(float[] dir, Transform startingFrom)
    {
        float[] localDir = new float[2] { dir[0], dir[1] }; //since we are passing by reference we need to make our own local
        localDir[0] *= 0.9f; //scale the distance
        localDir[1] *= 0.9f;
        RaycastHit2D[] hits = Physics2D.LinecastAll(new Vector2(startingFrom.position.x + localDir[0], startingFrom.position.y + localDir[1]),
                                     new Vector2(startingFrom.position.x + (localDir[0] * 1.1f), startingFrom.position.y + (localDir[1] * 1.1f)));

        //Debug.DrawLine(new Vector3(startingFrom.position.x + localDir[0], startingFrom.position.y + localDir[1]),
        //               new Vector3(startingFrom.position.x + (localDir[0] * 1.1f), startingFrom.position.y + (localDir[1] * 1.1f)), Color.blue, 30.0f, false);

        //blacklist pseudo-children, and other placement pieces
        ArrayList blackList = new ArrayList();
        for (int j = 0; j < hits.Length; j++)
        {
            if (hits[j].collider.GetComponent<PlacementBottom>() != null &&
                hits[j].collider.GetComponent<PlacementBottom>().pseudoParent == startingFrom)
            {
                blackList.Add(j);
            }
        }

        for (int j = 0; j < hits.Length; j++)
        {
            if (blackList.Contains(j)) continue; //skip pseudo-children and placement pieces

            //okay, we found one, don't place here!
            return true;
        }

        return false;
    }
Example #5
0
    protected void bttnChangeTribeInfo_Click(object sender, EventArgs e)
    {
        this.tribe.Tag = this.txtTag.Text;
        this.tribe.Name = this.txtName.Text;
        this.tribe.Description = this.txtDescription.Content;

        if (this.fileAvatar.HasFile)
        {
            ArrayList lstExtension = new ArrayList();
            lstExtension.Add(".jpg");
            lstExtension.Add(".gif");
            lstExtension.Add(".png");
            lstExtension.Add(".jpeg");
            string filename = fileAvatar.FileName;
            if (!lstExtension.Contains(Path.GetExtension(filename).ToLower()))
                this.lblAvatarError.Text = "Định dạng file ảnh phải là jpg";
            else if (!Functions.UploadImage(fileAvatar.FileContent, Server.MapPath("~/data/images/tribe/") + this.tribe.ID.ToString() + ".jpg"))
                this.lblAvatarError.Text = "File không đúng định dạng. Vui lòng thử lại với ảnh khác";
            else
                this.tribe.Avatar = true;
        }

        ISession session = (ISession)Context.Items[Constant.NHibernateSessionSign];
        session.Update(this.tribe);
        Response.Redirect("tribe.aspx?id=" + this.village.ID.ToString(), true);
    }
Example #6
0
    private Waypoints findClosestWaypoint()
    {
        ArrayList list = new ArrayList();
        Stack stack = new Stack();

        Vector3 carPosition = car.transform.position;
        float minDistance = float.MaxValue;
        Waypoints found = null;

        if(waypoints)
            stack.Push(waypoints);

        while(stack.Count > 0) {
            Waypoints actual = (Waypoints)stack.Pop();
            list.Add(actual);

            foreach(Waypoints w in actual.next) {
                if(!list.Contains(w))
                    stack.Push(w);
            }

            Vector3 waypointPosition = actual.transform.position;

            float distance = Vector3.Distance(carPosition, waypointPosition);

            if(distance < minDistance) {
                minDistance = distance;
                found = actual;
            }
        }

        return found;
    }
Example #7
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag ("Paddle")) {
            GameObject[] bricks = BrickController.GetBricks ();
            ArrayList hitBricks = new ArrayList ();

            if (bricks.Length <= destroyBlockCount) {
                //Just break all the bricks if we only have as many bricks left as we should hit
                hitBricks.AddRange (bricks);
            } else {
                //Select some random bricks.
                for (int i = 0; i < destroyBlockCount; i++) {
                    while (hitBricks.Count < i + 1) {
                        int index = Random.Range (0, bricks.Length - 1);
                        GameObject b = bricks [index];
                        if (!hitBricks.Contains (b)) {
                            hitBricks.Add (b);
                        }
                    }
                }
            }

            //Destroy some Bricks!
            foreach (GameObject b in hitBricks) {
                BrickController.HitBrick (b);
            }
            //Remove the carrot
            Destroy (this.gameObject);
        }
    }
	public Hashtable unique(string elementValue, string elementID)
	{
		bool valid = true;
		
		ArrayList listNames = new ArrayList();
		listNames.Add("john");
		listNames.Add("david");
		listNames.Add("tim");
		listNames.Add("sheldon");
		listNames.Add("kim");
		
		if (elementValue.Trim() == string.Empty)
			valid = false;
		else
		{
			Regex objName = new Regex("^[ \t\r\n\v\f]*[a-zA-Z0-9_-]*[ \t\r\n\v\f]*$");
		
			if (!objName.IsMatch(elementValue))
				valid = false;
		}
		
		if (valid)
			if (listNames.Contains(elementValue.Trim().ToLower()))
				valid = false;
			
		Hashtable ht = new Hashtable();
		ht.Add("elementID", elementID);
		ht.Add("valid", valid);
		
		ExecBeforeLoad("ProcessValidationOnClient(response)");
		
		return ht;
	}
    // Use this for initialization
    void Start()
    {
        // Get all waypoints and store transforms
        GameObject[] temp = GameObject.FindGameObjectsWithTag("Waypoint");
        Transform[] children = new Transform[temp.Length];

        // Sort the waypoints in ascending order
        for(int i = 0; i < temp.Length; i++)
        {
            int number = int.Parse(temp[i].name.Substring(8));

            children[number] = temp[i].transform;
        }

        indices = new ArrayList(); // Array of guard positions
        guards = new ArrayList(); // Array of guards

        // Place guards at waypoints without overlap
        for(int i = 0; i < numberOfGuards; i++)
        {
            int index = Random.Range(1, 15); // Choose waypoint on outer circle
            if(!indices.Contains(index) && index != 3 && index != 6 && index != 10 && index != 13)
            {
                // Instantiate guard and add index if no overlap
                indices.Add(index);
                GameObject g = (GameObject)Instantiate(guard, children[index].position, Quaternion.identity);
                g.GetComponent<Patroller>().position = index;
                guards.Add(g);
            }
            else
            {
                i--; // Decrement if ovelap
            }
        }
    }
Example #10
0
    protected void bttnChangePlayerProfile_Click(object sender, EventArgs e)
    {
        ISession session = (ISession)Context.Items[Constant.NHibernateSessionSign];
        this.Hero.Biography = this.txtPersonalText.Text;

        ArrayList lstExtension = new ArrayList();
        lstExtension.Add(".jpg");
        lstExtension.Add(".gif");
        lstExtension.Add(".png");
        lstExtension.Add(".jpeg");

        if (this.fileAvatar.HasFile)
        {
            string filename = fileAvatar.FileName;
            if (!lstExtension.Contains(Path.GetExtension(filename).ToLower()))
                this.lblAvatarError.Text = "Sai định dạng file ảnh";
            else
            {
                if (!Functions.UploadImage(fileAvatar.FileContent, Server.MapPath("~/data/images/heroes/") + this.Hero.ID.ToString() + ".jpg"))
                    this.lblAvatarError.Text = "Có lỗi khi upload ảnh. Vui lòng thử lại sau vài phút";
                else
                {
                    this.Hero.Avatar = true;
                    this.aDeleteAvatar.Visible = true;
                }
            }
        }

        session.Update(this.Hero);
    }
Example #11
0
 // Coroutine that tells tiles above recently destroyed Tiles to fall down into their place
 IEnumerator _TellTilesToFall(ArrayList pointsToCheckForFall)
 {
     // Wait until the tile creation is done and no other tiles are falling
     while (pushInProgress && fallInProgressInt == 0)
         yield return new WaitForSeconds(1.0f);
     
     ArrayList visitedXPositions = new ArrayList();
     foreach (Vector2 currentPosVector in pointsToCheckForFall)
     {
         // If we haven't visited this column yet (We don't want to ask blocks to fall twice)
         if (!visitedXPositions.Contains(currentPosVector.x))
         {
             visitedXPositions.Add(currentPosVector.x);
             int currentXPos = (int)currentPosVector.x;
             int currentYPos = (int)currentPosVector.y;
             
             // Start at the currentYPos, and iterate upwards to all tiles in the array
             for (int incrementalY = currentYPos; incrementalY < gridHeight; incrementalY++)
             {
                 // Make sure testX and incrementalY are within the grid bounds
                 if ((currentXPos >= 0 && currentXPos <= gridWidth - 1) &&
                 (incrementalY >= 0 && incrementalY <= gridHeight - 1))
                 {
                     // Assuming tile still exists, tell it to fall
                     if (tileArray[currentXPos, incrementalY] != null)
                         tileArray[currentXPos, incrementalY].StartCoroutine(tileArray[currentXPos, incrementalY].Fall());
                 }
             }
         }
     }
     yield return null;
 }
Example #12
0
    public static ArrayList findDetachedVoxels(int [,,] mapData, int stopCode, IntVector3 point)
    {
        /*
        where i,j,k is a recently destroyed block, returns a list of IntVector3s of all blocks that should
        be detached, as well as the size of the blob that would contain them.
        */
        ArrayList detachedVoxels = new ArrayList ();

        allVisitedVoxels = new ArrayList ();
        ArrayList seeds = MDView.getNeighbors (mapData, point);

        for (int index=0; index<seeds.Count; index++) {

            IntVector3 seedPoint = (IntVector3)seeds [index];

            if (allVisitedVoxels.Contains (seedPoint)) {
                seeds.Remove (seedPoint);
                index--;
                continue;
            }

            ArrayList newVoxels = getBlob (mapData, stopCode, seedPoint);

            if (newVoxels.Count > 0) {
                detachedVoxels.AddRange (newVoxels);

            }

        }
        return detachedVoxels;
    }
    public void BindHotelList()
    {
        MessageContent.InnerHtml = "";
        _hotelfacilitiesEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _hotelfacilitiesEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _hotelfacilitiesEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _hotelfacilitiesEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity();
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity);
        hotelFacilitiesDBEntity.HotelID = hidHotelID.Value;
        DataSet dsResult = HotelFacilitiesBP.BindHotelList(_hotelfacilitiesEntity).QueryResult;

        if (dsResult.Tables.Count == 0 || dsResult.Tables[0].Rows.Count == 0)
        {
            return;
        }

        ArrayList chkList = new ArrayList();

        foreach (DataRow drRow in dsResult.Tables[0].Rows)
        {
            chkList.Add(drRow["FACILITIESCODE"].ToString());
        }

        for (int i = 0; i < dvChkList.Controls.Count; i++)
        {
            if (dvChkList.Controls[i].Controls.Count > 0)
            {
                CheckBoxList chbList = (CheckBoxList)dvChkList.Controls[i].Controls[0];
                foreach (ListItem li in chbList.Items)
                {
                    if (chkList.Contains(li.Value))
                    {
                        li.Selected = true;
                    }
                }
            }
        }
        UpdatePanel3.Update();
         //foreach (ListItem li in chkServiceList.Items)
         //{
         //    if (chkList.Contains(li.Value))
         //    {
         //       li.Selected = true;
         //    }
         //}

         //foreach (ListItem li in chkFacilitiesList.Items)
         //{
         //    if (chkList.Contains(li.Value))
         //    {
         //        li.Selected = true;
         //    }
         //}

        //UpdatePanel1.Update();
    }
Example #14
0
 // Just for string arrays.
 public static bool IsStringArrayEqual(ArrayList a1, ArrayList a2)
 {
     if (a1.Count != a2.Count) return false;
       foreach (string str in a1) {
         if (!a2.Contains(str)) return false;
       }
       return true;
 }
Example #15
0
 public static ArrayList GetIntersection(ArrayList src, ArrayList dst)
 {
     ArrayList intersectedlist = new ArrayList();
       foreach (object s in src) {
         if (dst.Contains(s)) intersectedlist.Add(s);
       }
       return intersectedlist;
 }
Example #16
0
File: HexTile.cs Project: gelum/TBA
    public bool ArrayListsIntersect( ArrayList a1, ArrayList a2)
    {
        foreach (Object obj in a1) {
            if ( a2.Contains( obj))
                return true;
        }

        return false;
    }
Example #17
0
 public void run()
 {
     SocksClient();
     ArrayList readList=new ArrayList();
     while(true)
     {
         readList.Add(socks);
         readList.Add(browser);
         try {
             Socket.Select(readList,null,null,60000000);
             if(readList.Contains(socks)) {
                 Byte[] buf=new Byte[8192];
                 int nr=socks.Receive(buf);
                 if(nr <= 0)
                 {
                     socks.Close();
                     browser.Close();
                     return;
                 }
                 SimpleDecode(buf,nr);
                 browser.Send(buf,nr,SocketFlags.None);
             }
             if(readList.Contains(browser)) {
                 Byte[] buf=new Byte[8192];
                 int nr=browser.Receive(buf);
                 if(nr <= 0)
                 {
                     socks.Close();
                     browser.Close();
                     return;
                 }
                 SimpleEncode(buf,nr);
                 socks.Send(buf,nr,SocketFlags.None);
             }
         }
         catch (Exception e)
         {
             Console.WriteLine("Exception: " + e.Message);
             socks.Close();
             browser.Close();
             return;
         }
     }
 }
    void createGridPieces()
    {
        pieceGrid.Clear ();

        ArrayList pieceIndexes = new ArrayList ();
        int showedPiecesCounter = 1;
        for(int i = 0; i < availablePieces; i++)
        {
            int random = Random.Range(0, (int)(gridHeight * gridWidth));
            while(pieceIndexes.Contains(random))
            {
                random = Random.Range(0, (int)(gridHeight * gridWidth));
            }
            pieceIndexes.Add(random);
        }

        float zAxis = 0.3f;
        float xAxis = -1.34f;
        float yAxis = 0.87f;

        Vector3 gridSize = new Vector3 (horizontalSpace * gridWidth, verticalSpace * gridHeight, 0.0f);
        for(int i = 0; i < gridHeight; i++)
        {
            for(int j = 0; j < gridWidth ; j++)
            {
                int index = i * gridWidth + j;
                Vector3 pos = new Vector3(xAxis, yAxis, zAxis);
                GameObject piece = (GameObject)Instantiate (piecePrefab, pos, Quaternion.identity);
                piece.transform.parent = this.transform;
                piece.transform.localPosition = pos;

                ZinlockPiece script = piece.GetComponent<ZinlockPiece>();
                script.index = index;
                script.hasPiece = pieceIndexes.Contains (index);
                if(script.hasPiece){
                    GameObject skin = (GameObject)Instantiate(Resources.Load("puzzlePieces/PuzzlePiece"+showedPiecesCounter));
                    skin.transform.parent = piece.transform;
                    skin.transform.localPosition = Vector3.zero;
                    skin.transform.eulerAngles = new Vector3(0f,270f,0f);
                    skin.transform.localScale = new Vector3(550,175,150);
                    script.validIndex = (int)solutionArray[showedPiecesCounter - 1];
                    showedPiecesCounter++;
                }else{
                    script.validIndex = -1;
                }
                script.gridSize = gridSize;

                xAxis += horizontalSpace;

                pieceGrid.Add (script);
            }

            xAxis = -1.34f;
            yAxis -= verticalSpace;
        }
    }
Example #19
0
	private ArrayList FindMatch (GameObject[,] cells)
	{
		ArrayList stack = new ArrayList ();
		for (var x = 0; x <= cells.GetUpperBound (0); x++) {
			for (var y = 0; y <= cells.GetUpperBound (1); y++) {
				var thiscell = cells [x, y];
				if (thiscell.name == "empty(Clone)")
					continue;
				int matchCount = 0;
				int y2 = cells.GetUpperBound (1);
				int y1;
				for (y1 = y + 1; y1 <= y2; y1++) {
					if (cells [x, y1].name == "empty(Clone)" ||
					    (thiscell.name != cells [x, y1].name))
						break;
					matchCount++;
				}
				if (matchCount >= 2) {
					y1 = Mathf.Min (cells.GetUpperBound (1), y1 - 1);
					for (var y3 = y; y3 <= y1; y3++) {
						if (!stack.Contains (cells [x, y3])) {
							stack.Add (cells [x, y3]);
						}
					}
				}
			}
		}

		for (var y = 0; y <= cells.GetUpperBound (1); y++) {
			for (var x = 0; x <= cells.GetUpperBound (0); x++) {
				var thiscell = cells [x, y];
				if (thiscell.name == "empty(Clone)")
					continue;


				int matchCount = 0;
				int x2 = cells.GetUpperBound (0);
				int x1;
				for (x1 = x + 1; x1 <= x2; x1++) {
					if (cells [x1, y].name == "empty(Clone)" ||
					    (thiscell.name != cells [x1, y].name))
						break;
					matchCount++;
				}
				if (matchCount >= 2) {
					x1 = Mathf.Min (cells.GetUpperBound (0), x1 - 1);
					for (var x3 = x; x3 <= x1; x3++) {
						if (!stack.Contains (cells [x3, y])) {
							stack.Add (cells [x3, y]);
						}
					}
				}
			}
		}
		return stack;
	}
Example #20
0
    // 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);
    }
Example #21
0
    private ArrayList aStar(GameObject startTile, GameObject endTile)
    {
        if (!startTile || !endTile)
            return null;

        ArrayList openList;
        ArrayList closedList;
        GameObject currentTile = null;

        closedList = new ArrayList();
        openList = new ArrayList();
        openList.Add(startTile);

        Dictionary<GameObject, float> g = new Dictionary<GameObject, float>();
        g.Add(startTile, 0);
        Dictionary<GameObject, float> f = new Dictionary<GameObject, float>();
        f.Add(startTile, (startTile.transform.position - endTile.transform.position).magnitude);

        Dictionary<GameObject, GameObject> cameFrom = new Dictionary<GameObject, GameObject>();
        fScoreComparer fc = new fScoreComparer();
        fc.fList = f;

        do {
            openList.Sort(fc);
            currentTile = (GameObject)openList[0];
            if (currentTile == endTile)
                return reconstructPath(cameFrom, currentTile);

            openList.RemoveAt(0);
            closedList.Add(currentTile);

            foreach (GameObject item in currentTile.GetComponent<NeighboringTile>().getNeighbors()) {
                if (item == null || closedList.Contains(item))
                    continue;

                float currentScore = g[currentTile];
                float approx = currentScore + (currentTile.transform.position - endTile.transform.position).magnitude;

                if (!openList.Contains(item))
                    openList.Add(item);
                else if (approx >= g[item])
                    continue;

                cameFrom[item] = currentTile;
                g[item] = approx;
                f[item] = approx + 0; // 0 = heuristic cost. Not implemented yet.
            }

        } while (openList.Count > 0);

        return null;
    }
 public bool CanBeHeldBy(ArrayList npcs)
 {
     if (participants.Count == 1){
         return false;
     } else {
         foreach (GameObject participant in participants){
             if (!npcs.Contains(participant)){
                 return false;
             }
         }
         return true;
     }
 }
    public static Hashtable GetBullk(int[] patient_ids, DateTime start_date)
    {
        if (patient_ids.Length == 0)
            return new Hashtable();

        // remove duplicates
        ArrayList uniquePatientIDs = new ArrayList();
        for (int i = 0; i < patient_ids.Length; i++)
            if (!uniquePatientIDs.Contains(patient_ids[i]))
                uniquePatientIDs.Add(patient_ids[i]);
        patient_ids = (int[])uniquePatientIDs.ToArray(typeof(int));

        return HealthCardEPCRemainingDB.GetTotalServicesRemainingByPatients(patient_ids, start_date);
    }
    public static Hashtable GetBullk(int[] patient_ids, int year)
    {
        if (patient_ids.Length == 0)
            return new Hashtable();

        // remove duplicates
        ArrayList uniquePatientIDs = new ArrayList();
        for (int i = 0; i < patient_ids.Length; i++)
            if (!uniquePatientIDs.Contains(patient_ids[i]))
                uniquePatientIDs.Add(patient_ids[i]);
        patient_ids = (int[])uniquePatientIDs.ToArray(typeof(int));

        return InvoiceDB.GetMedicareCountByPatientsAndYear(patient_ids, year);
    }
    public static Hashtable GetBullk(string contact_type_group_ids, string contact_type_ids, int[] entity_ids, int site_id)
    {
        if (entity_ids.Length == 0)
            return new Hashtable();

        // remove duplicates
        ArrayList uniqueIDs = new ArrayList();
        for (int i = 0; i < entity_ids.Length; i++)
            if (!uniqueIDs.Contains(entity_ids[i]))
                uniqueIDs.Add(entity_ids[i]);
        entity_ids = (int[])uniqueIDs.ToArray(typeof(int));

        Hashtable phoneNumbers = new Hashtable();
        if (Utilities.GetAddressType().ToString() == "Contact")
        {
            Contact[] phoneNbrs = ContactDB.GetByEntityIDs(contact_type_group_ids, entity_ids, contact_type_ids, site_id);
            for (int i = 0; i < phoneNbrs.Length; i++)
            {
                if (phoneNumbers[phoneNbrs[i].EntityID] == null)
                    phoneNumbers[phoneNbrs[i].EntityID] = new ArrayList();
                ((ArrayList)phoneNumbers[phoneNbrs[i].EntityID]).Add(phoneNbrs[i]);
            }
        }
        else if (Utilities.GetAddressType().ToString() == "ContactAus")
        {
            ContactAus[] phoneNbrs = ContactAusDB.GetByEntityIDs(contact_type_group_ids, entity_ids, contact_type_ids, site_id);
            for (int i = 0; i < phoneNbrs.Length; i++)
            {
                if (phoneNumbers[phoneNbrs[i].EntityID] == null)
                    phoneNumbers[phoneNbrs[i].EntityID] = new ArrayList();
                ((ArrayList)phoneNumbers[phoneNbrs[i].EntityID]).Add(phoneNbrs[i]);
            }
        }
        else
            throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString());

        // convert arraylists to arrays (and sort if necessary)
        ArrayList keys = new ArrayList();
        foreach (DictionaryEntry de in phoneNumbers)
            keys.Add(de.Key);
        foreach (int key in keys)
        {
            if (Utilities.GetAddressType().ToString() == "Contact")
                phoneNumbers[key] = (Contact[])((ArrayList)phoneNumbers[key]).ToArray(typeof(Contact));
            else if (Utilities.GetAddressType().ToString() == "ContactAus")
                phoneNumbers[key] = (ContactAus[])((ArrayList)phoneNumbers[key]).ToArray(typeof(ContactAus));
        }

        return phoneNumbers;
    }
Example #26
0
    private ArrayList GetAllCameraAngles()
    {
        ArrayList angles = new ArrayList();
        for( int i = 1; i < Config.ClientData.Count; i++ )
        {
            float angle = ( Config.ClientData[i] as ClientCameraInfo ).AngleOffset;
            if( !angles.Contains( angle ) )
            {
                angles.Add( angle );
            }
        }

        angles.Sort();
        return angles;
    }
Example #27
0
 public bool HasAnswered(string s)
 {
     DataTable dt = College_Answer.GetAllAnswer(questionId, "0");
     if (dt == null)
         return false;
     ArrayList al = new ArrayList();
     int j = 0;
     while (j < dt.Rows.Count)
     {
         al.Add(Convert.ToString(dt.Rows[j]["user_id"]));
         j += 1;
     }
     if (al.Contains(s))
         return true;
     return false;
 }
Example #28
0
    public static ArrayList getBlob(int [,,] mapData, int stopCode, IntVector3 point)
    {
        /*
        returns a list of IntVector3 voxels that are all connected to i,j,k

        returns an empty list if it finds a voxelCode=hullBase

        prioritize search on neighbors going down, then neighbors at same level, then up
        */
        ArrayList visitedVoxels = new ArrayList ();
        allVisitedVoxels.Add (point);
        visitedVoxels.Add (point);

        frontier = new ArrayList ();
        frontier.Add (point);

        //print ("getBlob " + i + " " + j + " " + k);

        while (frontier.Count>0) {
            IntVector3 seedPoint = (IntVector3)frontier [0];
            frontier.RemoveAt (0);

            foreach (IntVector3 neighbor in MDView.getNeighbors(mapData,seedPoint)) {
                if (! visitedVoxels.Contains (neighbor)) {
                    allVisitedVoxels.Add (neighbor);
                    visitedVoxels.Add (neighbor);

                    //print ("adding to visitedVoxels " + neighbor.i + " " + neighbor.j + " " + neighbor.k);

                    if (neighbor.y < point.y) {
                        frontier.Insert (0, neighbor);
                    } else if (neighbor.y == point.y) {
                        frontier.Insert (frontier.Count / 2, neighbor);
                    } else if (neighbor.y > point.y) {
                        frontier.Insert (frontier.Count, neighbor);
                    }

                    if (mapData [neighbor.x, neighbor.y, neighbor.z] == stopCode) {
                        return new ArrayList ();
                    }
                }
            }
        }

        return visitedVoxels;
    }
Example #29
0
    void FixedUpdate()
    {
        if (body) {
            Collider[] cols = Physics.OverlapSphere (body.transform.position, range);

            ArrayList rbs = new ArrayList ();

            foreach (Collider c in cols) {
                Rigidbody rb = c.attachedRigidbody;
                if (rb != null && rb != body && !rbs.Contains (rb)) {
                    rbs.Add (rb);
                    Vector3 offset = body.transform.position - c.transform.position;
                    rb.AddForce (offset / offset.sqrMagnitude * body.GetComponent<Rigidbody>().mass);
                }
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        float [] possibleX = new float[] { -2.0f, 0f, 2.0f};
        ArrayList powers = new ArrayList();
        int pickedIndex;
        float posOffset = 0;
        int platformNumber = Random.Range(2,12);
        Debug.Log("platformNumber = "+platformNumber);
        for(int i = 0;i < platformNumber;i++ ){

            int platformPosPower = Random.Range(1,6);
            float posX = possibleX[Random.Range(0,3)];
            Vector2 platformPos = new Vector2(platformPosPower,possibleX[Random.Range(0,3)]);
            while( powers.Contains(platformPosPower) ){
                platformPosPower = Random.Range(1,6);
                posX = possibleX[Random.Range(0,3)];
                platformPos = new Vector2(platformPosPower, posX);
            }
            Debug.Log("platformPosPower = "+platformPosPower);
            powers.Add(platformPos);
            if( platformNumber - i < 2 ){
                pickedIndex = Random.Range(2,4);
                posOffset = 8.0f;
            }else{
                pickedIndex = Random.Range(0,2);
            }
            GameObject pickedPlatform = platforms[pickedIndex];
            GameObject mPlatform = ( GameObject )Instantiate (pickedPlatform, new Vector3( posX, 0, (transform.position.z - 90.0f - posOffset) +  30.0f * platformPosPower ),Quaternion.identity);
            mPlatform.transform.parent = gameObject.transform;
        }
        /*powers = new ArrayList();
        int itemNumber = Random.Range(2,6);
        for(int i = 0;i < itemNumber;i++ ){

            int itemPosPower = Random.Range(1,6);

            while( powers.Contains(itemPosPower) ){
                itemPosPower = Random.Range(1,6);
            }
            powers.Add(itemPosPower);
            GameObject pickedItem = items[Random.Range(0,items.Length)];
            GameObject mItem= ( GameObject )Instantiate (pickedItem, new Vector3( possibleX[Random.Range(0,3)], 0, (transform.position.z - 90.0f) +  30.0f * itemPosPower ),Quaternion.identity);
            mItem.transform.parent = gameObject.transform;
        }*/
    }
Example #31
0
        public string GetLayoutEx()
        {
            ArrayList fl = new ArrayList();

            if (_fieldList != null)
            {
                fl.AddRange(_fieldList);
            }

            int           i  = 0;
            StringBuilder sb = new StringBuilder();

            sb.Append(LayoutBuilder.GetHeader());

            if (fl.Contains("IdProveedorObservacion") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "IdProveedorObservacion", "IdProveedorObservacion", true));
            }
            if (fl.Contains("Nombre") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "Nombre", "Proveedor", 150));
            }
            if (fl.Contains("Titulo") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "Titulo", "Título", 280));
            }
            if (fl.Contains("Observacion") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "Observacion", "Observación", true));
            }
            if (fl.Contains("Fecha") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "Fecha", "Fecha", 130));
            }
            if (fl.Contains("Usuario") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "Responsable", "Responsable", 100));
            }
            if (fl.Contains("Tipo") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "Tipo", "Tipo", !fl.Contains("Tipo")));
            }
            if (fl.Contains("SubTipo") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "SubTipo", "SubTipo", !fl.Contains("SubTipo")));
            }
            if (fl.Contains("Estado") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "Estado", "Estado", !fl.Contains("Estado")));
            }
            if (fl.Contains("FechaAviso") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "FechaAviso", "Fecha Aviso", 130));
            }
            if (fl.Contains("FechaVencimiento") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "FechaVencimiento", "Fecha Venc.", 130));
            }


            sb.Append(LayoutBuilder.GetFooter());

            return(sb.ToString());
        }
Example #32
0
        private void ara()
        {
            string[] anahtarlist = txtanahtar.Text.Split(new Char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
            string[] urllist = txturl.Text.Split(new Char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
            ArrayList suburllist = new ArrayList();
            for (int UrlSayisi = 0; UrlSayisi < urllist.Length; UrlSayisi++)
            {
                suburllist.Add(scanner.Url(urllist[UrlSayisi]));
            }

            ArrayList fullsonuclist = new ArrayList();
            for (int anaurl = 0; anaurl < urllist.Length; anaurl++)
            {
                fullsonuclist.Add(0);
            }

            for (int anaurl = 0; anaurl < urllist.Length; anaurl++)
            {
                ArrayList sonuclist = new ArrayList();
                ArrayList alturl = (ArrayList)suburllist[anaurl];
                ArrayList sublinklist = new ArrayList();
                foreach (string item in alturl)
                {
                    lblsonuc.Visible = true;
                    if (sublinklist.Contains(item)) { }
                    else
                    {
                        if (item.Contains(scanner.getDomainName(urllist[anaurl])))
                            sublinklist.Add(item);
                    }
                }

                WebClient wc = new WebClient();
                lblsonuc.Visible = true;
                ArrayList ArySonuclar = new ArrayList();
                ArrayList ArySonuclar2 = new ArrayList();
                wc.Encoding = Encoding.UTF8;
                ArrayList hatalilar = new ArrayList();
                #region Ortalama
                for (int UrlSayisi = 0; UrlSayisi < sublinklist.Count; UrlSayisi++)
                {
                    try
                    {
                        int gercerkurlsayisi = UrlSayisi - hatalilar.Count;
                        var htmltotext = NUglify.Uglify.HtmlToText(wc.DownloadString(sublinklist[UrlSayisi].ToString()));
                        int toplamsonuc = 0;
                        for (int kelime = 0; kelime < anahtarlist.Length; kelime++)
                        {
                            int sonuc = Regex.Matches(htmltotext.Code.ToLower(), anahtarlist[kelime].ToLower()).Count;
                            toplamsonuc += sonuc;
                            ArySonuclar2.Add(gercerkurlsayisi + "," + kelime + "," + sonuc);
                        }
                        ArySonuclar.Add(toplamsonuc);
                    }
                    catch
                    {
                        hatalilar.Add(sublinklist[UrlSayisi]);

                    }
                }

                foreach (var item in hatalilar)
                {
                    sublinklist.Remove(item);
                }

                ArrayList ortalamalist = new ArrayList();
                for (int UrlSayisi = 0; UrlSayisi < (sublinklist.Count); UrlSayisi++)
                {
                    ortalamalist.Add(Convert.ToInt32(ArySonuclar[UrlSayisi]) / anahtarlist.Length);
                }
                #endregion

                #region Fark
                ArrayList farklist = new ArrayList();
                foreach (var aryin in ArySonuclar2)
                {
                    string[] ayrim = aryin.ToString().Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    farklist.Add(ayrim[0] + "," + ayrim[1] + "," + (Convert.ToInt32(ayrim[2]) - Convert.ToInt32(ortalamalist[Convert.ToInt32(ayrim[0])])));
                }
                #endregion

                #region Mutlak
                ArrayList mutlaklist = new ArrayList();
                foreach (var farkin in farklist)
                {
                    string[] ayrim = farkin.ToString().Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    mutlaklist.Add(ayrim[0] + "," + ayrim[1] + "," + Math.Abs(Convert.ToInt32(ayrim[2])));
                }
                #endregion

                #region Toplam
                ArrayList toplamlist = new ArrayList();
                foreach (var subin in sublinklist)
                {
                    toplamlist.Add(0);
                }

                foreach (var mutlaklistİn in mutlaklist)
                {
                    string[] ayrim = mutlaklistİn.ToString().Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    toplamlist[Convert.ToInt32(ayrim[0])] = Convert.ToInt32(toplamlist[Convert.ToInt32(ayrim[0])]) + Convert.ToInt32(ayrim[2]);
                }
                #endregion

                #region Sonuç
                double[] dizi = new double[sublinklist.Count];
                for (int i = 0; i < sublinklist.Count; i++)
                {
                    double tplm = Convert.ToDouble(toplamlist[i]);
                    double ortlm = Convert.ToDouble(ortalamalist[i]);
                    //  dizi[i] = (tplm / ortlm);
                    sonuclist.Add(tplm / ortlm);

                }
                #endregion

                int sayac = 0;
                foreach (var item in sonuclist)
                {
                    if (item.ToString() == "NaN" || item.ToString() == "∞") { }
                    else
                    {
                        fullsonuclist[anaurl] = Convert.ToDouble(sonuclist[sayac]) + Convert.ToDouble(fullsonuclist[anaurl]);

                    }

                    lblsonuc.Visible = true;
                    lblsonuc.Text += sublinklist[sayac] + " | " + item.ToString() + " </br> ";
                    sayac++;
                }
            }
            double[] sıra = new double[urllist.Length];
            double[] sıra2 = new double[urllist.Length];

            for (int anaurl = 0; anaurl < urllist.Length; anaurl++)
            {

                ArrayList alturl2 = (ArrayList)suburllist[anaurl];
                ArrayList sublinklist2 = new ArrayList();
                foreach (string item in alturl2)
                {
                    lblsonuc.Visible = true;
                    if (sublinklist2.Contains(item)) { }
                    else
                    {
                        if (item.Contains(scanner.getDomainName(urllist[anaurl])))
                            sublinklist2.Add(item);
                    }
                }
                sıra[anaurl] = Convert.ToDouble(fullsonuclist[anaurl]) / Convert.ToDouble(sublinklist2.Count);
                sıra2[anaurl] = Convert.ToDouble(fullsonuclist[anaurl]) / Convert.ToDouble(sublinklist2.Count);

            }

            Array.Sort(sıra);
            Array.Reverse(sıra);
            int count = 1;
            for (int urls = 0; urls < urllist.Length; urls++)
            {

                for (int urls2 = 0; urls2 < urllist.Length; urls2++)
                {

                    if (sıra[urls] == sıra2[urls2])
                    {

                        lblsonuc.Text += " | " + count + "-" + urllist[urls2] + "-" + sıra2[urls2];
                        count++;

                    }
                }
            }
        }
Example #33
0
 public bool IsUserInBlackList(string username)
 {
     return(blacklistedUsers.Contains(username));
 }
Example #34
0
 public bool Contains(BnfoCustomerItem item)
 {
     return(list.Contains(item));
 }
 public bool Contains(object item)
 {
     return(list.Contains(item));
 }
Example #36
0
 // Used to see if the config file is already stored.
 private static bool ContainsDup(string Needle, bool Config)
 {
     return(ConfigResults.Contains(Needle));
 }
Example #37
0
 public void lstSortSettings_Selected(object sender, int row, int col)
 {
     try
     {
         HudList.HudListRowAccessor acc = MainView.lstSortSettings[row];
         String   code    = ((HudStaticText)acc[0]).Text.ToString();
         SortFlag flag    = SortFlag.decode(code);
         bool     changed = false;
         if (col < 2) // DUMP PROPERTIES
         {
             flag.propertyDumpSelection();
         }
         else if (col == 2) // MOVE UP
         {
             if (sortFlags.Contains(flag))
             {
                 int index = sortFlags.IndexOf(flag);
                 if (index > 0)
                 {
                     SortFlag f = (SortFlag)sortFlags[index - 1];
                     sortFlags[index - 1] = sortFlags[index];
                     sortFlags[index]     = f;
                     changed = true;
                 }
             }
         }
         else if (col == 3) // MOVE DOWN
         {
             if (sortFlags.Contains(flag))
             {
                 int index = sortFlags.IndexOf(flag);
                 if (index < sortFlags.Count - 1)
                 {
                     SortFlag f = (SortFlag)sortFlags[index + 1];
                     sortFlags[index + 1] = sortFlags[index];
                     sortFlags[index]     = f;
                     changed = true;
                 }
             }
         }
         else if (col == 4) // REMOVE
         {
             if (sortFlags.Contains(flag))
             {
                 sortFlags.Remove(flag);
                 flag.descending = false;
             }
             else
             {
                 sortFlags.Add(flag);
             }
             changed = true;
         }
         else if (col == 5)
         {
             if (sortFlags.Contains(flag))
             {
                 flag.descending = !flag.descending;
                 changed         = true;
             }
         }
         if (changed)
         {
             MainView.edtSortString.Text = sortFlagListToString();
             rebuildLstSortSettings();
         }
     }
     catch (Exception ex) { Util.LogError(ex); }
 }
 public bool Contains(object value)
 {
     return(_nodeArray.Contains(value));
 }
Example #39
0
        private void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // Add the external Validation.js to the Page
                const string csname = "ExtValidationScriptFile";
                var          cstype = MethodBase.GetCurrentMethod().GetType();
                var          cstext = "<script src=\"" + ResolveUrl("~/DesktopModules/Events/Scripts/Validation.js") +
                                      "\" type=\"text/javascript\"></script>";
                if (!Page.ClientScript.IsClientScriptBlockRegistered(csname))
                {
                    Page.ClientScript.RegisterClientScriptBlock(cstype, csname, cstext, false);
                }

                ddlLocations.EmptyMessage = Localization.GetString("NoLocations", LocalResourceFile);
                ddlLocations.Localization.AllItemsCheckedString =
                    Localization.GetString("AllLocations", LocalResourceFile);
                ddlLocations.Localization.CheckAllString =
                    Localization.GetString("SelectAllLocations", LocalResourceFile);
                if (Settings.Enablelocations == EventModuleSettings.DisplayLocations.SingleSelect)
                {
                    ddlLocations.CheckBoxes = false;
                }

                if (!Page.IsPostBack)
                {
                    //Bind DDL
                    var ctrlEventLocations = new EventLocationController();
                    var lstLocations       = ctrlEventLocations.EventsLocationList(PortalId);

                    var arrLocations = new ArrayList();
                    if (Settings.Restrictlocations)
                    {
                        foreach (EventLocationInfo dbLocation in lstLocations)
                        {
                            foreach (int location in Settings.ModuleLocationIDs)
                            {
                                if (dbLocation.Location == location)
                                {
                                    arrLocations.Add(dbLocation);
                                }
                            }
                        }
                    }
                    else
                    {
                        arrLocations.AddRange(lstLocations);
                    }

                    if (lstLocations.Count == 0)
                    {
                        Visible = false;
                        SelectedLocation.Clear();
                        return;
                    }

                    //Restrict locations by events in time frame.
                    if (Settings.RestrictLocationsToTimeFrame)
                    {
                        //Only for list view.
                        var whichView = string.Empty;
                        if (!(Request.QueryString["mctl"] == null) && ModuleId ==
                            Convert.ToInt32(Request.QueryString["ModuleID"]))
                        {
                            if (Request["mctl"].EndsWith(".ascx"))
                            {
                                whichView = Request["mctl"];
                            }
                            else
                            {
                                whichView = Request["mctl"] + ".ascx";
                            }
                        }
                        if (whichView.Length == 0)
                        {
                            if (!ReferenceEquals(
                                    Request.Cookies.Get("DNNEvents" + Convert.ToString(ModuleId)), null))
                            {
                                whichView = Request.Cookies.Get("DNNEvents" + Convert.ToString(ModuleId)).Value;
                            }
                            else
                            {
                                whichView = Settings.DefaultView;
                            }
                        }

                        if (whichView == "EventList.ascx" || whichView == "EventRpt.ascx")
                        {
                            var objEventInfoHelper =
                                new EventInfoHelper(ModuleId, TabId, PortalId, Settings);
                            var lstEvents = default(ArrayList);

                            var getSubEvents = Settings.MasterEvent;
                            var numDays      = Settings.EventsListEventDays;
                            var displayDate  = default(DateTime);
                            var startDate    = default(DateTime);
                            var endDate      = default(DateTime);
                            if (Settings.ListViewUseTime)
                            {
                                displayDate = DisplayNow();
                            }
                            else
                            {
                                displayDate = DisplayNow().Date;
                            }
                            if (Settings.EventsListSelectType == "DAYS")
                            {
                                startDate = displayDate.AddDays(Settings.EventsListBeforeDays * -1);
                                endDate   = displayDate.AddDays(Settings.EventsListAfterDays * 1);
                            }
                            else
                            {
                                startDate = displayDate;
                                endDate   = displayDate.AddDays(numDays);
                            }

                            lstEvents = objEventInfoHelper.GetEvents(startDate, endDate, getSubEvents,
                                                                     new ArrayList(Convert.ToInt32(new[] { "-1" })),
                                                                     new ArrayList(Convert.ToInt32(new[] { "-1" })), -1,
                                                                     -1);

                            var eventLocationIds = new ArrayList();
                            foreach (EventInfo lstEvent in lstEvents)
                            {
                                eventLocationIds.Add(lstEvent.Location);
                            }
                            foreach (EventLocationInfo lstLocation in lstLocations)
                            {
                                if (!eventLocationIds.Contains(lstLocation.Location))
                                {
                                    arrLocations.Remove(lstLocation);
                                }
                            }
                        }
                    }

                    //Bind locations.
                    ddlLocations.DataSource = arrLocations;
                    ddlLocations.DataBind();

                    if (Settings.Enablelocations == EventModuleSettings.DisplayLocations.SingleSelect)
                    {
                        ddlLocations.Items.Insert(
                            0,
                            new RadComboBoxItem(Localization.GetString("AllLocations", LocalResourceFile),
                                                "-1"));
                        ddlLocations.SelectedIndex = 0;
                    }
                    ddlLocations.OnClientDropDownClosed =
                        "function() { btnUpdateClick('" + btnUpdate.UniqueID + "','" + ddlLocations.ClientID +
                        "');}";
                    ddlLocations.OnClientLoad = "function() { storeText('" + ddlLocations.ClientID + "');}";
                    if (Settings.Enablelocations == EventModuleSettings.DisplayLocations.SingleSelect)
                    {
                        foreach (int location in SelectedLocation)
                        {
                            ddlLocations.SelectedIndex =
                                ddlLocations.FindItemByValue(location.ToString()).Index;
                            break;
                        }
                    }
                    else
                    {
                        foreach (int location in SelectedLocation)
                        {
                            foreach (RadComboBoxItem item in ddlLocations.Items)
                            {
                                if (item.Value == location.ToString())
                                {
                                    item.Checked = true;
                                }
                            }
                        }

                        if (Convert.ToInt32(SelectedLocation[0]) == -1)
                        {
                            foreach (RadComboBoxItem item in ddlLocations.Items)
                            {
                                item.Checked = true;
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                //ProcessModuleLoadException(Me, exc)
            }
        }
Example #40
0
 public bool Contains(object node)
 {
     return(nodes.Contains(node));
 }
Example #41
0
        /// <summary>
        /// 五星计划
        /// </summary>
        public void wuxing()
        {
            try
            {
                string html = method.GetUrl("https://data.baobaojh8.com/getPlanContent.php?UA=2&id=255&sign=6656B0ED872D077429A4F68A68A40E91&token=NzI3OTU1LTI3OGFkOGQzYTU4ZjY3NDIyODVlMzg4NGVlYTZlOTRiLTE1ODE5MTM5NDM%3D", "utf-8");


                Match    value1 = Regex.Match(html, @"""content"":""([\s\S]*?)----------------------------------------");
                string[] a1s    = Unicode2String(value1.Groups[1].Value).Split(new string[] { "\\r\\n" }, StringSplitOptions.None);

                foreach (string a1 in a1s)
                {
                    string[] value = a1.Split(new string[] { " " }, StringSplitOptions.None);
                    if (value.Length > 5)
                    {
                        if (!list3.Contains(value[value.Length - 3]))
                        {
                            list3.Add(value[value.Length - 3]);
                            ListViewItem lv1 = listView3.Items.Add((listView3.Items.Count).ToString()); //使用Listview展示数据
                            lv1.SubItems.Add(value[value.Length - 5]);
                            lv1.SubItems.Add(value[value.Length - 3]);
                            lv1.SubItems.Add(value[value.Length - 2]);
                            lv1.SubItems.Add(value[value.Length - 1]);
                        }
                    }
                }


                Match    value2 = Regex.Match(html, @"----------------------------------------([\s\S]*?)----------------------------------------([\s\S]*?)----------------------------------------");
                string[] a2s    = Unicode2String(value2.Groups[1].Value).Split(new string[] { "\\r\\n" }, StringSplitOptions.None);

                foreach (string a2 in a2s)
                {
                    string[] value = a2.Split(new string[] { " " }, StringSplitOptions.None);
                    if (value.Length > 5)
                    {
                        if (!list4.Contains(value[value.Length - 3]))
                        {
                            list4.Add(value[value.Length - 3]);
                            ListViewItem lv1 = listView4.Items.Add((listView4.Items.Count).ToString()); //使用Listview展示数据
                            lv1.SubItems.Add(value[value.Length - 5]);
                            lv1.SubItems.Add(value[value.Length - 3]);
                            lv1.SubItems.Add(value[value.Length - 2]);
                            lv1.SubItems.Add(value[value.Length - 1]);
                        }
                    }
                }

                string[] a3s = Unicode2String(value2.Groups[2].Value).Split(new string[] { "\\r\\n" }, StringSplitOptions.None);

                foreach (string a3 in a3s)
                {
                    string[] value = a3.Split(new string[] { " " }, StringSplitOptions.None);
                    if (value.Length > 5)
                    {
                        if (!list5.Contains(value[value.Length - 3]))
                        {
                            list5.Add(value[value.Length - 3]);
                            ListViewItem lv1 = listView5.Items.Add((listView5.Items.Count).ToString()); //使用Listview展示数据
                            lv1.SubItems.Add(value[value.Length - 5]);
                            lv1.SubItems.Add(value[value.Length - 3]);
                            lv1.SubItems.Add(value[value.Length - 2]);
                            lv1.SubItems.Add(value[value.Length - 1]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Example #42
0
 /// <summary>
 /// Determines whether a PropertySpec is in the PropertySpecCollection.
 /// </summary>
 /// <param name="item">The PropertySpec to locate in the PropertySpecCollection. The element to locate
 /// can be a null reference (Nothing in Visual Basic).</param>
 /// <returns>true if item is found in the PropertySpecCollection; otherwise, false.</returns>
 public bool Contains(PropertySpec item)
 {
     return(innerArray.Contains(item));
 }
Example #43
0
        protected void btnCheck_Click(object sender, EventArgs e)
        {
            if (txtOrderList.Text != "")
            {
                string strNoValidate = "";
                string strValidate   = "";
                try
                {
                    string[] strAllOrderList = txtOrderList.Text.Split("\n".ToCharArray());

                    for (int x = 0; x < strAllOrderList.Length; x++)
                    {
                        strAllOrderList[x] = strAllOrderList[x].Replace("\r", "");
                    }

                    ArrayList al = new ArrayList();

                    ArrayList a2 = new ArrayList();

                    for (int i = 0; i < strAllOrderList.Length; i++)
                    {
                        //判断数组值是否已经存在
                        if (al.Contains(strAllOrderList[i]) == false)
                        {
                            if (a2.Contains(strAllOrderList[i]) == false)
                            {
                                al.Add(strAllOrderList[i]);
                            }
                        }
                        else
                        {
                            if (a2.Contains(strAllOrderList[i]) == false)
                            {
                                al.Remove(strAllOrderList[i]);
                                a2.Add(strAllOrderList[i]);
                            }
                        }
                    }

                    string[] strOrderList = new string[al.Count];
                    strOrderList = (string[])al.ToArray(typeof(string));

                    for (int j = 0; j < a2.Count; j++)
                    {
                        strNoValidate += a2[j].ToString().Trim() + "(有重复订单)<br/>";
                    }


                    if (Request.QueryString[""] == null || Request.QueryString["ID"].ToString() == "")
                    {
                        for (int i = 0; i < strOrderList.Length; i++)
                        {
                            if (strOrderList[i].ToString().Trim() == "")
                            {
                                continue;
                            }
                            else
                            {
                                DataSet ds1 = BusinessFacadeDLT.IsActivityBlack(strOrderList[i].ToString().Trim());

                                if (ds1.Tables[0].Rows[0][0].ToString() == "1")
                                {
                                    DataSet ds = BusinessFacadeDLT.CheckActivityOrder(Request.QueryString["ID"].ToString(), strOrderList[i].ToString().Trim());

                                    string result = ds.Tables[0].Rows[0][0].ToString();
                                    if (result == "-1")
                                    {
                                        strNoValidate += strOrderList[i].ToString().Trim() + "(订单已添加!)<br/>";
                                        continue;
                                    }
                                    else if (result == "1")
                                    {
                                        strValidate += strOrderList[i].ToString().Trim() + "\n";
                                    }
                                    else if (result == "-2")
                                    {
                                        strNoValidate += strOrderList[i].ToString().Trim() + "(游戏不匹配)<br/>";
                                        continue;
                                    }
                                    else if (result == "-3")
                                    {
                                        strNoValidate += strOrderList[i].ToString().Trim() + "(已在已删除)<br/>";
                                        continue;
                                    }
                                    else if (result == "-4")
                                    {
                                        strNoValidate += strOrderList[i].ToString().Trim() + "(在其它活动)<br/>";
                                        continue;
                                    }
                                    else
                                    {
                                        strNoValidate += strOrderList[i].ToString().Trim() + "(订单号错误)<br/>";
                                        continue;
                                    }
                                }
                                else
                                {
                                    strNoValidate += strOrderList[i].ToString().Trim() + "(存在黑名单)<br/>";
                                    continue;
                                }
                            }
                        }
                        btnAdd.Enabled     = true;
                        txtOrderList.Text  = strValidate;
                        lblNoValidate.Text = strNoValidate;
                    }
                    else
                    {
                        Response.Write("<script language='javascript'>alert('请先选择一个具体活动!');</script>");
                        return;
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("<script language='javascript'>alert('订单录入格式有误,请保证一行一个订单号,不要有任何其它杂乱字符!');</script>");
                    return;
                }
            }
            else
            {
                Response.Write("<script language='javascript'>alert('请输入需要批量加入的订单列表!');</script>");
                return;
            }
        }
Example #44
0
        /// <summary>
        /// Create the table in mysql
        /// </summary>
        /// <param name="table">the table to create</param>
        public void CheckOrCreateTable(DataTable table)
        {
            if (connType == ConnectionType.DATABASE_MYSQL || connType == ConnectionType.DATABASE_SQLITE)
            {
                var currentTableColumns = new ArrayList();
                try
                {
                    if (connType == ConnectionType.DATABASE_MYSQL)
                    {
                        ExecuteSelect("DESCRIBE `" + table.TableName + "`", delegate(IDataReader reader)
                        {
                            while (reader.Read())
                            {
                                currentTableColumns.Add(reader.GetString(0).ToLower());
                                log.Debug(reader.GetString(0).ToLower());
                            }
                            if (log.IsDebugEnabled)
                            {
                                log.Debug(currentTableColumns.Count + " in table");
                            }
                        }, Transaction.IsolationLevel.DEFAULT);
                    }
                    else if (connType == ConnectionType.DATABASE_SQLITE)
                    {
                        ExecuteSelect("PRAGMA TABLE_INFO(\"" + table.TableName + "\")", delegate(IDataReader reader)
                        {
                            while (reader.Read())
                            {
                                currentTableColumns.Add(reader.GetString(1).ToLower());
                                log.Debug(reader.GetString(1).ToLower());
                            }
                            if (log.IsDebugEnabled)
                            {
                                log.Debug(currentTableColumns.Count + " in table");
                            }
                        }, Transaction.IsolationLevel.DEFAULT);
                    }
                }
                catch (Exception e)
                {
                    if (log.IsDebugEnabled)
                    {
                        log.Debug(e.ToString());
                    }

                    if (log.IsWarnEnabled)
                    {
                        log.Warn("Table " + table.TableName + " doesn't exist, creating it...");
                    }
                }

                var sb          = new StringBuilder();
                var primaryKeys = new Dictionary <string, DataColumn>();
                for (int i = 0; i < table.PrimaryKey.Length; i++)
                {
                    primaryKeys[table.PrimaryKey[i].ColumnName] = table.PrimaryKey[i];
                }

                var  columnDefs         = new List <string>();
                var  alterAddColumnDefs = new List <string>();
                bool alterPrimaryKey    = false;
                for (int i = 0; i < table.Columns.Count; i++)
                {
                    Type systype = table.Columns[i].DataType;

                    string column = "";

                    column += "`" + table.Columns[i].ColumnName + "` ";

                    if (connType == ConnectionType.DATABASE_SQLITE && (table.Columns[i].AutoIncrement || systype == typeof(sbyte) || systype == typeof(byte) ||
                                                                       systype == typeof(short) || systype == typeof(ushort) || systype == typeof(int) ||
                                                                       systype == typeof(uint) || systype == typeof(long) || systype == typeof(ulong)))
                    {
                        column += "INTEGER";
                    }
                    else if (systype == typeof(char))
                    {
                        column += "SMALLINT UNSIGNED";
                    }
                    else if (systype == typeof(DateTime))
                    {
                        column += "DATETIME DEFAULT '2000-01-01'";
                    }
                    else if (systype == typeof(sbyte))
                    {
                        column += "TINYINT";
                    }
                    else if (systype == typeof(short))
                    {
                        column += "SMALLINT";
                    }
                    else if (systype == typeof(int))
                    {
                        column += "INT";
                    }
                    else if (systype == typeof(long))
                    {
                        column += "BIGINT";
                    }
                    else if (systype == typeof(byte))
                    {
                        column += "TINYINT UNSIGNED";
                    }
                    else if (systype == typeof(ushort))
                    {
                        column += "SMALLINT UNSIGNED";
                    }
                    else if (systype == typeof(uint))
                    {
                        column += "INT UNSIGNED";
                    }
                    else if (systype == typeof(ulong))
                    {
                        column += "BIGINT UNSIGNED";
                    }
                    else if (systype == typeof(float))
                    {
                        column += "FLOAT";
                    }
                    else if (systype == typeof(double))
                    {
                        column += "DOUBLE";
                    }
                    else if (systype == typeof(bool))
                    {
                        column += "TINYINT(1)";
                    }
                    else if (systype == typeof(string))
                    {
                        if (primaryKeys.ContainsKey(table.Columns[i].ColumnName) ||
                            table.Columns[i].ExtendedProperties.ContainsKey("INDEX") ||
                            table.Columns[i].ExtendedProperties.ContainsKey("VARCHAR") ||
                            table.Columns[i].Unique)
                        {
                            if (table.Columns[i].ExtendedProperties.ContainsKey("VARCHAR"))
                            {
                                column += "VARCHAR(" + table.Columns[i].ExtendedProperties["VARCHAR"] + ")";
                            }
                            else
                            {
                                column += "VARCHAR(255)";
                            }
                        }
                        else
                        {
                            column += "TEXT";
                        }
                    }
                    else
                    {
                        column += "BLOB";
                    }

                    if (!table.Columns[i].AllowDBNull)
                    {
                        if (!(connType == ConnectionType.DATABASE_SQLITE && table.Columns[i].AutoIncrement))
                        {
                            column += " NOT NULL";
                        }
                    }

                    if (table.Columns[i].AutoIncrement)
                    {
                        if (connType == ConnectionType.DATABASE_SQLITE)
                        {
                            column += " PRIMARY KEY AUTOINCREMENT";
                        }
                        else
                        {
                            column += " AUTO_INCREMENT";
                        }
                    }
                    columnDefs.Add(column);

                    // if the column doesnt exist but the table, then alter table
                    if (currentTableColumns.Count > 0 && !currentTableColumns.Contains(table.Columns[i].ColumnName.ToLower()))
                    {
                        log.Debug("added for alteration " + table.Columns[i].ColumnName.ToLower());

                        // if this column is added for alteration and is a primary key, we must switch key.
                        if (table.Columns[i].AutoIncrement)
                        {
                            alterPrimaryKey = true;
                            column         += " PRIMARY KEY";
                        }

                        // Column def, without index or anything else.
                        alterAddColumnDefs.Add(column);
                    }
                }

                string        columndef        = string.Join(", ", columnDefs.ToArray());
                List <string> followingQueries = new List <string>();

                // create primary keys
                if (table.PrimaryKey.Length > 0)
                {
                    bool hasAutoInc = false;

                    foreach (DataColumn col in table.PrimaryKey)
                    {
                        if (col.AutoIncrement)
                        {
                            hasAutoInc = true;
                            break;
                        }
                    }


                    if ((connType == ConnectionType.DATABASE_SQLITE) && hasAutoInc)
                    {
                        columndef += ", UNIQUE (";
                    }
                    else
                    {
                        columndef += ", PRIMARY KEY (";
                    }

                    bool first = true;
                    for (int i = 0; i < table.PrimaryKey.Length; i++)
                    {
                        if (!first)
                        {
                            columndef += ", ";
                        }
                        else
                        {
                            first = false;
                        }
                        columndef += "`" + table.PrimaryKey[i].ColumnName + "`";
                    }
                    columndef += ")";
                }

                // unique indexes
                for (int i = 0; i < table.Columns.Count; i++)
                {
                    if (table.Columns[i].Unique && !primaryKeys.ContainsKey(table.Columns[i].ColumnName))
                    {
                        if (connType == ConnectionType.DATABASE_SQLITE)
                        {
                            followingQueries.Add("CREATE UNIQUE INDEX IF NOT EXISTS \"" + table.TableName + "." + table.Columns[i].ColumnName + "\" ON \"" + table.TableName + "\"(\"" + table.Columns[i].ColumnName + "\")");
                        }
                        else
                        {
                            columndef += ", UNIQUE INDEX (`" + table.Columns[i].ColumnName + "`)";
                        }
                    }
                }

                // indexes
                for (int i = 0; i < table.Columns.Count; i++)
                {
                    if (table.Columns[i].ExtendedProperties.ContainsKey("INDEX") &&
                        !primaryKeys.ContainsKey(table.Columns[i].ColumnName) &&
                        !table.Columns[i].Unique)
                    {
                        if (connType == ConnectionType.DATABASE_SQLITE)
                        {
                            string indexQuery = "CREATE INDEX IF NOT EXISTS \"" + table.TableName + "." + table.Columns[i].ColumnName + "\" ON \"" + table.TableName + "\"(\"" + table.Columns[i].ColumnName + "\"";

                            if (table.Columns[i].ExtendedProperties.ContainsKey("INDEXCOLUMNS"))
                            {
                                indexQuery += ", " + table.Columns[i].ExtendedProperties["INDEXCOLUMNS"];
                            }

                            indexQuery += ")";

                            followingQueries.Add(indexQuery);
                        }
                        else
                        {
                            columndef += ", INDEX (`" + table.Columns[i].ColumnName + "`";

                            if (table.Columns[i].ExtendedProperties.ContainsKey("INDEXCOLUMNS"))
                            {
                                columndef += ", " + table.Columns[i].ExtendedProperties["INDEXCOLUMNS"];
                            }

                            columndef += ")";
                        }
                    }
                }

                sb.Append("CREATE TABLE IF NOT EXISTS `" + table.TableName + "` (" + columndef + ")");

                try
                {
                    if (log.IsDebugEnabled)
                    {
                        log.Debug(sb.ToString());
                    }

                    ExecuteNonQuery(sb.ToString());

                    if (followingQueries.Count > 0)
                    {
                        foreach (string folqr in followingQueries)
                        {
                            ExecuteNonQuery(folqr);
                        }
                    }
                }
                catch (Exception e)
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("Error while creating table " + table.TableName, e);
                    }
                }


                // alter table if needed

                // alter primary key, only work for migration to Auto Inc for now
                if (alterPrimaryKey)
                {
                    string alterTable = "ALTER TABLE `" + table.TableName + "` DROP PRIMARY KEY";

                    try
                    {
                        log.Warn("Altering table " + table.TableName);
                        if (log.IsDebugEnabled)
                        {
                            log.Debug(alterTable);
                        }
                        ExecuteNonQuery(alterTable);
                    }
                    catch (Exception e)
                    {
                        if (log.IsErrorEnabled)
                        {
                            log.ErrorFormat("Error while altering table table {0} : {1}\n{2}", table.TableName, alterTable, e);
                        }
                    }
                }


                if (alterAddColumnDefs.Count > 0)
                {
                    columndef = string.Join(", ", alterAddColumnDefs.ToArray());
                    string alterTable = "ALTER TABLE `" + table.TableName + "` ADD (" + columndef + ")";

                    try
                    {
                        log.Warn("Altering table " + table.TableName);
                        if (log.IsDebugEnabled)
                        {
                            log.Debug(alterTable);
                        }
                        ExecuteNonQuery(alterTable);
                    }
                    catch (Exception e)
                    {
                        if (log.IsErrorEnabled)
                        {
                            log.ErrorFormat("Error while altering table table {0} : {1}\n{2}", table.TableName, alterTable, e);
                        }
                    }
                }
            }
        }
Example #45
0
 /// <summary>
 /// IList implementation.
 /// Search for a specified object in the list.
 /// If the list is sorted, a <see cref="ArrayList.BinarySearch">BinarySearch</see> is performed using IComparer interface.
 /// Else the <see cref="Equals">Object.Equals</see> implementation is used.
 /// </summary>
 /// <param name="O">The object to look for</param>
 /// <returns>true if the object is in the list, otherwise false.</returns>
 public bool Contains(object O)
 {
     return(_IsSorted ? _List.BinarySearch(O, _Comparer) >= 0 : _List.Contains(O));
 }
Example #46
0
 public bool IsUserInWhiteList(string username)
 {
     return(whitelistedUsers.Contains(username));
 }
        static void Main(string[] args)
        {
            try
            {
                //Class to convert user input
                InputConverter inputConverter = new InputConverter();

                //Class to perform actual calculations


                CalculatorEngineLibrary calculatorEngine = new CalculatorEngineLibrary();



                //isDouble1 and 2 and used to verify code instead of directly sending the Console.ReadLine() value to the InputConverter Class
                //this is mainly used to prevent the user from throwing an exception from a non-numeric number like "six" or "cat"

                Console.WriteLine("write first number");
                String firstNumberPlaceHolder = Console.ReadLine();


                bool isDouble1 = Double.TryParse(firstNumberPlaceHolder, out double firstNumber);

                while (!isDouble1)
                {
                    Console.WriteLine("Enter numeric characters only like '5' or '-34' ");
                    firstNumberPlaceHolder = Console.ReadLine();
                    isDouble1 = Double.TryParse(firstNumberPlaceHolder, out firstNumber);
                }
                firstNumber = inputConverter.ConvertInputToNumeric(firstNumberPlaceHolder);


                Console.WriteLine("write second number");

                String secondNumberPlaceHolder = Console.ReadLine();

                Console.WriteLine("write operator type");
                bool isDouble2 = Double.TryParse(secondNumberPlaceHolder, out double secondNumber);

                while (!isDouble2)
                {
                    Console.WriteLine("Enter numeric characters only like '5' or '-34' ");
                    secondNumberPlaceHolder = Console.ReadLine();
                    isDouble2 = Double.TryParse(secondNumberPlaceHolder, out secondNumber);
                }
                secondNumber = inputConverter.ConvertInputToNumeric(secondNumberPlaceHolder);



                //arraylist containing all compatible operators
                ArrayList arrayOfOperators = new ArrayList();
                arrayOfOperators.Add("-");
                arrayOfOperators.Add("+");
                arrayOfOperators.Add("*");
                arrayOfOperators.Add("/");
                arrayOfOperators.Add("add");
                arrayOfOperators.Add("substract");
                arrayOfOperators.Add("multiply");
                arrayOfOperators.Add("divide");
                arrayOfOperators.Add("^");
                arrayOfOperators.Add("exponent");
                String operation = Console.ReadLine();

                //used to check if one of the operators is present
                bool isInArray = false;



                while (!isInArray)
                {
                    if (arrayOfOperators.Contains(operation.ToLower()))
                    {
                        Console.WriteLine("Calculating....");

                        isInArray = true;
                    }

                    else
                    {
                        Console.WriteLine("you typed an invalid operator. Please enter one such as '-' or 'divide' ");
                        operation = Console.ReadLine();
                    }
                }


                //displays formated result with stringbuilder and string formatting

                StringBuilder myStringBuild = new StringBuilder();
                double        result        = calculatorEngine.Calculate(operation, firstNumber, secondNumber);

                myStringBuild.Insert(0, firstNumber + " " + operation + " " + secondNumber);


                myStringBuild.AppendFormat(" equals : {0:n2}", result);
                Console.WriteLine(myStringBuild);

                //Code for the extra functionality , calculates the circumference.



                Console.WriteLine(" Would you like to calculate the circumference ? y/n ? ");

                bool   yourAnswer          = false;
                String answerCircumference = Console.ReadLine();
                String radius = "";
                // asks user if you want to calculate circumference or exit


                if (answerCircumference.Equals("y"))
                {
                    radius = Console.ReadLine();
                }
                else
                {
                    Console.WriteLine("goodbye"); Environment.Exit(0);
                }


                bool isDouble3 = Double.TryParse(radius, out double radiusNumber);

                //prevents user from entering negative or invalid type
                while (!isDouble3 || radiusNumber < 0)
                {
                    Console.WriteLine("Invalid number type");
                    radius    = Console.ReadLine();
                    isDouble3 = Double.TryParse(radius, out radiusNumber);
                }

                //object of type circumferenceCalculator(a class that we created)
                circumferenceCalculator myCircumferenceCalculator = new circumferenceCalculator();

                Console.WriteLine(myCircumferenceCalculator.radiant(radiusNumber));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #48
0
        static void Lucky(int totalNum, int perNum, int times, ArrayList must)
        {
            //***********************************************
            //ArrayList must = new ArrayList {  };
            //***********************************************


            #region 显示

            Console.Write("参加抽奖的总人数: " + totalNum);
            Console.Write("\n每次中奖的人数: " + perNum);
            Console.Write("      抽奖的次数: " + times);

            int nums = times * perNum;
            Console.WriteLine("     中奖人数为: " + nums);

            if (nums > totalNum)
            {
                Console.WriteLine("\n中奖人数多于参加人数,请重新设定。\n");
                Console.ReadLine();
                return;
            }
            #endregion

            //生成数组,长度为参加的人数
            ArrayList al = new ArrayList();
            for (int i = 0; i < totalNum; i++)
            {
                al.Add(i + 1);
            }

            #region 判断设置是否正确
            bool flag = true;
            foreach (int p in must)
            {
                if (!al.Contains(p))
                {
                    flag = false;
                    break;
                }
            }
            #endregion

            ArrayList a = new ArrayList();
            if (flag == false)//设置不正确,按原始数据抽取
            {
                a = RandomArray(al, nums);
            }
            else//设置正确
            {
                #region 抽奖
                int mustNum = must.Count;
                if (nums <= mustNum)
                {
                    a = RandomArray(must, nums);
                }
                else
                {
                    foreach (int p in must)
                    {
                        al.Remove(p);
                    }
                    ArrayList t = new ArrayList();
                    t = RandomArray(al, nums - mustNum);
                    foreach (int p in must)
                    {
                        t.Add(p);
                    }
                    a = RandomArray(t, nums);
                }
                #endregion
            }
            Console.WriteLine("\n恭喜以下人员中奖!");
            for (int i = 0; i < nums; i++)
            {
                Console.Write(a[i] + " ");
                if ((i + 1) % perNum == 0)
                {
                    Console.WriteLine("");
                }
            }
        }
Example #49
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
            case 0:                     // Closed or Cancel
            {
                return;
            }

            default:
            {
                // Make sure that the OK, button was pressed
                if (info.ButtonID == 1)
                {
                    // Get the array of switches selected
                    ArrayList Selections = new ArrayList(info.Switches);
                    string    prefix     = Server.Commands.CommandSystem.Prefix;

                    from.Say("CREATING WORLD...");

                    // Now use any selected command
                    if (Selections.Contains(101) == true)
                    {
                        from.Say("Generating moongates...");
                        CommandSystem.Handle(from, String.Format("{0}moongen", prefix));
                    }

                    if (Selections.Contains(102) == true)
                    {
                        from.Say("Generating doors...");
                        CommandSystem.Handle(from, String.Format("{0}doorgen", prefix));
                    }

                    if (Selections.Contains(103) == true)
                    {
                        from.Say("Decorating world...");
                        CommandSystem.Handle(from, String.Format("{0}decorate", prefix));
                    }

                    if (Selections.Contains(104) == true)
                    {
                        from.Say("Generating signs...");
                        CommandSystem.Handle(from, String.Format("{0}signgen", prefix));
                    }

                    if (Selections.Contains(105) == true)
                    {
                        from.Say("Generating teleporters...");
                        CommandSystem.Handle(from, String.Format("{0}telgen", prefix));
                    }

                    if (Selections.Contains(106) == true)
                    {
                        from.Say("Generating Gauntlet spawners...");
                        CommandSystem.Handle(from, String.Format("{0}gengauntlet", prefix));
                    }

                    if (Selections.Contains(107) == true)
                    {
                        // champions message in champions script
                        CommandSystem.Handle(from, String.Format("{0}genchampions", prefix));
                    }

                    if (Selections.Contains(108) == true)
                    {
                        CommandSystem.Handle(from, String.Format("{0}genkhaldun", prefix));
                    }

                    if (Selections.Contains(109) == true)
                    {
                        CommandSystem.Handle(from, String.Format("{0}generatefactions", prefix));
                        from.Say("Factions Generated!");
                    }

                    if (Selections.Contains(110) == true)
                    {
                        CommandSystem.Handle(from, String.Format("{0}genstealarties", prefix));
                        from.Say("Stealable Artifacts Generated!");
                    }

                    if (Selections.Contains(111) == true)
                    {
                        CommandSystem.Handle(from, String.Format("{0}shtelgen", prefix));
                    }

                    if (Selections.Contains(112) == true)
                    {
                        CommandSystem.Handle(from, String.Format("{0}secretlocgen", prefix));
                    }

                    if (Selections.Contains(113) == true)
                    {
                        CommandSystem.Handle(from, String.Format("{0}decorateml", prefix));
                    }
                }

                from.Say("World generation completed!");

                break;
            }
            }
        }
Example #50
0
        public static string GetLayout()
        {
            ArrayList fl = new ArrayList();

            if (_fieldList != null)
            {
                fl.AddRange(_fieldList);
            }

            int           i  = 0;
            StringBuilder sb = new StringBuilder();

            sb.Append(LayoutBuilder.GetHeader());
            if (fl.Contains("IdProducto") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "IdProducto", "IdProducto", true));                                                                    //true no lo muestra en la grilla
            }
            if (fl.Contains("Codigo") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "Codigo", "Código", 100, false));
            }
            if (fl.Contains("CodigoSecundario") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "CodigoSecundario", "Codigo secundario", 100, true));
            }
            if (fl.Contains("Descripcion") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "Descripcion", "Descripción", 125, true));
            }
            if (fl.Contains("DescripcionCorta") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "DescripcionCorta", "Descripcion corta", 125, true));
            }
            if (fl.Contains("DescripcionLarga") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "DescripcionLarga", "Descripcion larga", 300, false));
            }
            if (fl.Contains("UnidadesPedido") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "UnidadesPedido", "UnidadesPedido", true));
            }
            if (fl.Contains("MAC") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "MAC", "MAC", true));
            }
            if (fl.Contains("PrecioDeCostoRef") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "PrecioDeCostoRef", "PrecioDeCostoRef", true));
            }
            if (fl.Contains("PrecioDeVentaNeto") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "PrecioDeVentaNeto", "PrecioDeVentaNeto", true));
            }
            if (fl.Contains("MaxDescuentoPorcentual") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "MaxDescuentoPorcentual", "MaxDescuentoPorcentual", true));
            }
            if (fl.Contains("MaxDescuento") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "MaxDescuento", "MaxDescuento", true));
            }
            if (fl.Contains("PrecioDeVentaBruto") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "PrecioDeVentaBruto", "PrecioDeVentaBruto", true));
            }
            if (fl.Contains("ObligaCodigoBarra") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "ObligaCodigoBarra", "ObligaCodigoBarra", true));
            }
            if (fl.Contains("ObligaNumeroSerie") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "ObligaNumeroSerie", "ObligaNumeroSerie", true));
            }
            if (fl.Contains("IdCuentaImputacion") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "IdCuentaImputacion", "IdCuentaImputacion", true));
            }
            if (fl.Contains("IdUnidad") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "IdUnidad", "IdUnidad", true));
            }
            if (fl.Contains("IdConversion") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "IdConversion", "IdConversion", true));
            }
            if (fl.Contains("CampoAuxiliar1") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "CampoAuxiliar1", "CampoAuxiliar1", true));
            }
            if (fl.Contains("CampoAuxiliar2") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "CampoAuxiliar2", "CampoAuxiliar2", true));
            }
            if (fl.Contains("CampoAuxiliar3") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "CampoAuxiliar3", "CampoAuxiliar3", true));
            }
            if (fl.Contains("CampoAuxiliar4") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "CampoAuxiliar4", "CampoAuxiliar4", true));
            }
            if (fl.Contains("CampoAuxiliar5") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "CampoAuxiliar5", "CampoAuxiliar5", true));
            }
            if (fl.Contains("FechaUltimaCompra") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "FechaUltimaCompra", "FechaUltimaCompra", true));
            }
            if (fl.Contains("Activo") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "Activo", "Activo", true));
            }
            if (fl.Contains("FechaCreacion") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "FechaCreacion", "FechaCreacion", true));
            }
            if (fl.Contains("IdConexionCreacion") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "IdConexionCreacion", "IdConexionCreacion", true));
            }
            if (fl.Contains("UltimaModificacion") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "UltimaModificacion", "UltimaModificacion", true));
            }
            if (fl.Contains("IdConexionUltimaModificacion") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "IdConexionUltimaModificacion", "IdConexionUltimaModificacion", true));
            }
            if (fl.Contains("IdReservado") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "IdReservado", "IdReservado", true));
            }
            if (fl.Contains("RowId") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "RowId", "RowId", true));
            }
            if (fl.Contains("IdEmpresa") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "IdEmpresa", "IdEmpresa", true));
            }
            if (fl.Contains("IdSucursal") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "IdSucursal", "IdSucursal", true));
            }
            if (fl.Contains("IdBonificacion") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "IdBonificacion", "IdBonificacion", true));
            }
            if (fl.Contains("PrecioFinalEstimado") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "PrecioFinalEstimado", "Precio final", 150, false));
            }
            if (fl.Contains("FechaUltimaModificacion") || _fieldList == null)
            {
                sb.Append(LayoutBuilder.GetRow(i++, "FechaUltimaModificacion", "Fecha de modificación", 180, false));
            }


            sb.Append(LayoutBuilder.GetFooter());

            return(sb.ToString());
        }
 public bool Contains(int index)
 {
     return(indices.Contains(index));
 }
Example #52
0
 public bool Contains(object value)
 {
     return(list.Contains(value));
 }
Example #53
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                Mobile from = sender.Mobile;
                int    i;

                switch (info.ButtonID)
                {
                case 101:
                {          //deal
                    m_From.pokermsg = "Golden Coin Casino";

                    if (!from.InRange(m_From.Location, 4))
                    {
                        m_From.roundend = true;
                        m_From.busy     = false;
                    }
                    else
                    {
                        if (m_From.dwin == 0)
                        {
                            if (m_From.paydealer(from, m_From.playerbet))
                            {
                                if ((m_From.m_current_card + 10) > 52)
                                {
                                    Effects.PlaySound(from.Location, from.Map, 0x3D);
                                    m_From.ShuffleCards();
                                }

                                for (i = 0; i <= 4; ++i)
                                {
                                    m_From.playercards[i] = 0;
                                }
                                m_From.dwin     = 1;
                                m_From.roundend = false;
                                m_From.pokermsg = "Click on the cards you want re-dealt.";
                            }
                            else
                            {
                                m_From.pokermsg = "You need more money!";
                            }
                        }
                        else if (m_From.dwin == 2)
                        {
                            m_From.dwin = 3;

                            ArrayList Selections = new ArrayList(info.Switches);

                            for (i = 0; i <= 4; ++i)
                            {
                                if (Selections.Contains(i + 1))
                                {
                                    m_From.playercards[i] = m_From.pickcard(from);
                                }
                            }
                            finishpokergame(from);
                        }
                    }
                    from.SendGump(new PokerGump(from, m_From));
                    break;
                }

                case 105:
                {         // bet
                    if (m_From.roundend)
                    {
                        m_From.playerbet += 100;
                        if (m_From.playerbet > 500)
                        {
                            m_From.playerbet = 100;
                        }
                    }
                    from.SendGump(new PokerGump(from, m_From));
                    break;
                }

                case 666:
                {         // quit
                    m_From.roundend = true;
                    m_From.busy     = false;
                    Effects.PlaySound(from.Location, from.Map, 0x1e9);
                    break;
                }
                }
            }
        protected void ExtractAllUsingCueList(string destinationFolder)
        {
            CriUtfTable waveformTableUtf;
            ushort      waveformIndex;
            byte        encodeType;
            string      rawFileName;
            var         rawFileFormat = "{0}.{1}{2}";

            FileStream internalFs = null;
            FileStream externalFs = null;

            var internalIdsExtracted = new ArrayList();
            var externalIdsExtracted = new ArrayList();

            var acbAwbDestinationFolder = Path.Combine(destinationFolder, ACB_AWB_EXTRACTION_FOLDER);
            var extAwbDestinationFolder = Path.Combine(destinationFolder, EXT_AWB_EXTRACTION_FOLDER);
            var acbCpkDestinationFolder = Path.Combine(destinationFolder, ACB_CPK_EXTRACTION_FOLDER);
            var extCpkDestinationFolder = Path.Combine(destinationFolder, EXT_CPK_EXTRACTION_FOLDER);

            try
            {
                // open streams
                if (InternalAwb != null)
                {
                    internalFs = File.Open(InternalAwb.SourceFile, FileMode.Open, FileAccess.Read, FileShare.Read);
                }
                else if (InternalCpk != null)
                {
                    internalFs = File.Open(InternalCpk.SourceFileName, FileMode.Open, FileAccess.Read, FileShare.Read);
                }

                if (ExternalAwb != null)
                {
                    externalFs = File.Open(ExternalAwb.SourceFile, FileMode.Open, FileAccess.Read, FileShare.Read);
                }
                else if (ExternalCpk != null)
                {
                    externalFs = File.Open(ExternalCpk.SourceFileName, FileMode.Open, FileAccess.Read, FileShare.Read);
                }

                // loop through cues and extract
                for (var i = 0; i < CueList.Length; i++)
                {
                    var cue = CueList[i];

                    if (cue.IsWaveformIdentified)
                    {
                        if (cue.IsStreaming) // external AWB file
                        {
                            if (ExternalAwb != null)
                            {
                                ParseFile.ExtractChunkToFile64(externalFs,
                                                               (ulong)ExternalAwb.Files[cue.WaveformId].FileOffsetByteAligned,
                                                               (ulong)ExternalAwb.Files[cue.WaveformId].FileLength,
                                                               Path.Combine(extAwbDestinationFolder, FileUtil.CleanFileName(cue.CueName)), false,
                                                               false);
                            }
                            else if (ExternalCpk != null)
                            {
                                ParseFile.ExtractChunkToFile64(externalFs,
                                                               (ulong)ExternalCpk.ItocFiles[cue.WaveformId].FileOffsetByteAligned,
                                                               (ulong)ExternalCpk.ItocFiles[cue.WaveformId].FileLength,
                                                               Path.Combine(extCpkDestinationFolder, FileUtil.CleanFileName(cue.CueName)), false,
                                                               false);
                            }

                            externalIdsExtracted.Add(cue.WaveformId);
                        }
                        else // internal AWB file (inside ACB)
                        {
                            if (InternalAwb != null)
                            {
                                ParseFile.ExtractChunkToFile64(internalFs,
                                                               (ulong)InternalAwb.Files[cue.WaveformId].FileOffsetByteAligned,
                                                               (ulong)InternalAwb.Files[cue.WaveformId].FileLength,
                                                               Path.Combine(acbAwbDestinationFolder, FileUtil.CleanFileName(cue.CueName)), false,
                                                               false);
                            }
                            else if (InternalCpk != null)
                            {
                                ParseFile.ExtractChunkToFile64(internalFs,
                                                               (ulong)InternalCpk.ItocFiles[cue.WaveformId].FileOffsetByteAligned,
                                                               (ulong)InternalCpk.ItocFiles[cue.WaveformId].FileLength,
                                                               Path.Combine(acbCpkDestinationFolder, FileUtil.CleanFileName(cue.CueName)), false,
                                                               false);
                            }

                            internalIdsExtracted.Add(cue.WaveformId);
                        }
                    } // if (cue.IsWaveformIdentified)
                }

                // extract leftovers
                using (var acbStream = File.Open(SourceFile, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    waveformTableUtf = new CriUtfTable();
                    waveformTableUtf.Initialize(acbStream, (long)WaveformTableOffset);
                }

                if (ExternalAwb != null)
                {
                    var unextractedExternalFiles = ExternalAwb.Files.Keys.Where(x => !externalIdsExtracted.Contains(x));
                    foreach (var key in unextractedExternalFiles)
                    {
                        waveformIndex = GetWaveformRowIndexForWaveformId(waveformTableUtf, key, true);

                        encodeType = (byte)GetUtfFieldForRow(waveformTableUtf, waveformIndex, "EncodeType");

                        rawFileName = string.Format(rawFileFormat,
                                                    Path.GetFileName(ExternalAwb.SourceFile), key.ToString("D5"),
                                                    GetFileExtensionForEncodeType(encodeType));

                        // extract file
                        ParseFile.ExtractChunkToFile64(externalFs,
                                                       (ulong)ExternalAwb.Files[key].FileOffsetByteAligned,
                                                       (ulong)ExternalAwb.Files[key].FileLength,
                                                       Path.Combine(extAwbDestinationFolder, rawFileName), false, false);
                    }
                }
                else if (ExternalCpk != null)
                {
                    var unextractedExternalFiles =
                        ExternalCpk.ItocFiles.Keys.Where(x => !externalIdsExtracted.Contains(x));
                    foreach (var key in unextractedExternalFiles)
                    {
                        waveformIndex = GetWaveformRowIndexForWaveformId(waveformTableUtf, key, true);

                        encodeType = (byte)GetUtfFieldForRow(waveformTableUtf, waveformIndex, "EncodeType");

                        rawFileName = string.Format(rawFileFormat,
                                                    Path.GetFileName(ExternalCpk.SourceFileName), key.ToString("D5"),
                                                    GetFileExtensionForEncodeType(encodeType));

                        // extract file
                        ParseFile.ExtractChunkToFile64(externalFs,
                                                       (ulong)ExternalCpk.ItocFiles[key].FileOffsetByteAligned,
                                                       (ulong)ExternalCpk.ItocFiles[key].FileLength,
                                                       Path.Combine(extCpkDestinationFolder, rawFileName), false, false);
                    }
                }

                if (InternalAwb != null)
                {
                    var unextractedInternalFiles = InternalAwb.Files.Keys.Where(x => !internalIdsExtracted.Contains(x));
                    foreach (var key in unextractedInternalFiles)
                    {
                        waveformIndex = GetWaveformRowIndexForWaveformId(waveformTableUtf, key, false);

                        encodeType = (byte)GetUtfFieldForRow(waveformTableUtf, waveformIndex, "EncodeType");

                        rawFileName = string.Format(rawFileFormat,
                                                    Path.GetFileName(InternalAwb.SourceFile), key.ToString("D5"),
                                                    GetFileExtensionForEncodeType(encodeType));

                        // extract file
                        ParseFile.ExtractChunkToFile64(internalFs,
                                                       (ulong)InternalAwb.Files[key].FileOffsetByteAligned,
                                                       (ulong)InternalAwb.Files[key].FileLength,
                                                       Path.Combine(acbAwbDestinationFolder, rawFileName), false, false);
                    }
                }
                else if (InternalCpk != null)
                {
                    var unextractedInternalFiles =
                        InternalCpk.ItocFiles.Keys.Where(x => !internalIdsExtracted.Contains(x));
                    foreach (var key in unextractedInternalFiles)
                    {
                        waveformIndex = GetWaveformRowIndexForWaveformId(waveformTableUtf, key, false);

                        encodeType = (byte)GetUtfFieldForRow(waveformTableUtf, waveformIndex, "EncodeType");

                        rawFileName = string.Format(rawFileFormat,
                                                    Path.GetFileName(InternalCpk.SourceFileName), key.ToString("D5"),
                                                    GetFileExtensionForEncodeType(encodeType));

                        // extract file
                        ParseFile.ExtractChunkToFile64(internalFs,
                                                       (ulong)InternalCpk.ItocFiles[key].FileOffsetByteAligned,
                                                       (ulong)InternalCpk.ItocFiles[key].FileLength,
                                                       Path.Combine(acbCpkDestinationFolder, rawFileName), false, false);
                    }
                }
            }
            finally
            {
                if (internalFs != null)
                {
                    internalFs.Close();
                    internalFs.Dispose();
                }

                if (externalFs != null)
                {
                    externalFs.Close();
                    externalFs.Dispose();
                }
            }
        }
Example #55
0
        internal static bool ParseTypeName(string inputTypeName, ParseTypeNameLanguage parseTypeNameLanguage, out string typeName, out string[] parameters, out string elemantDecorator)
        {
            typeName         = string.Empty;
            parameters       = null;
            elemantDecorator = string.Empty;
            if (parseTypeNameLanguage == ParseTypeNameLanguage.VB)
            {
                inputTypeName = inputTypeName.Replace('(', '[').Replace(')', ']');
            }
            else if (parseTypeNameLanguage == ParseTypeNameLanguage.CSharp)
            {
                inputTypeName = inputTypeName.Replace('<', '[').Replace('>', ']');
            }
            int length = inputTypeName.LastIndexOfAny(new char[] { ']', '&', '*' });

            if (length == -1)
            {
                typeName = inputTypeName;
            }
            else if (inputTypeName[length] == ']')
            {
                int num2 = length;
                int num3 = 1;
                while ((num2 > 0) && (num3 > 0))
                {
                    num2--;
                    if (inputTypeName[num2] == ']')
                    {
                        num3++;
                    }
                    else if (inputTypeName[num2] == '[')
                    {
                        num3--;
                    }
                }
                if (num3 != 0)
                {
                    return(false);
                }
                typeName = inputTypeName.Substring(0, num2) + inputTypeName.Substring(length + 1);
                string str = inputTypeName.Substring(num2 + 1, (length - num2) - 1).Trim();
                if ((str == string.Empty) || (str.TrimStart(new char[0])[0] == ','))
                {
                    elemantDecorator = "[" + str + "]";
                }
                else
                {
                    int    num4    = 0;
                    char[] chArray = str.ToCharArray();
                    for (int i = 0; i < chArray.Length; i++)
                    {
                        if (chArray[i] == '[')
                        {
                            num4++;
                        }
                        else if (chArray[i] == ']')
                        {
                            num4--;
                        }
                        else if ((chArray[i] == ',') && (num4 == 0))
                        {
                            chArray[i] = '$';
                        }
                    }
                    parameters = new string(chArray).Split(new char[] { '$' });
                    for (int j = 0; j < parameters.Length; j++)
                    {
                        parameters[j] = parameters[j].Trim();
                        if (parameters[j][0] == '[')
                        {
                            parameters[j] = parameters[j].Substring(1, parameters[j].Length - 2);
                        }
                        if ((parseTypeNameLanguage == ParseTypeNameLanguage.VB) && parameters[j].StartsWith("Of ", StringComparison.OrdinalIgnoreCase))
                        {
                            parameters[j] = parameters[j].Substring(3).TrimStart(new char[0]);
                        }
                    }
                }
            }
            else
            {
                typeName         = inputTypeName.Substring(0, length) + inputTypeName.Substring(length + 1);
                elemantDecorator = inputTypeName.Substring(length, 1);
            }
            if ((parseTypeNameLanguage == ParseTypeNameLanguage.CSharp) && CSKeywords.Contains(typeName))
            {
                typeName = DotNetKeywords[CSKeywords.IndexOf(typeName)];
            }
            else if ((parseTypeNameLanguage == ParseTypeNameLanguage.VB) && VBKeywords.Contains(typeName))
            {
                typeName = DotNetKeywords[VBKeywords.IndexOf(typeName)];
            }
            return(true);
        }
Example #56
0
        static int Main(string[] args)
        {
            ArrayList skipStrings = new ArrayList();

            if (args.Length != 0)
            {
                Console.WriteLine(GetAssemblyAbout(null));
                Console.WriteLine("Generates an IrfanPaint language file from the IrfanPaint.rc resource file.");
                Console.WriteLine("The input is read from stdin.");
                Console.WriteLine("To obtain a valid language file the input file must be preprocessed.");
                Console.WriteLine();
                Console.WriteLine("Usage example:");
                Console.WriteLine("  cl /D \"RC_INVOKED\" /E IrfanPaint.rc | IPLFGen > IP_English.lng");
                return(0);
            }
            string          inString = "", tstr;
            MatchCollection matches;

            info.lundin.Math.ExpressionParser parser = new info.lundin.Math.ExpressionParser();
            while ((tstr = Console.ReadLine()) != null)
            {
                inString += tstr + "\n";
            }
            //Comments
            Console.WriteLine(";Language file template generated on " + DateTime.Now.ToString("r") + " by " + GetAssemblyAbout(null));
            Console.WriteLine(@";=== FILE STRUCTURE ===");
            Console.WriteLine(@";The language file contains a [FileInfo] section, a [General] section and some numbered sections (e.g. [101], [102], ...)");
            Console.WriteLine(@";The [FileInfo] sections contains informations about the translator, the language name and the target IrfanPaint version.");
            Console.WriteLine(@";In the TargetVersion value you can insert a * so that the comparison between the TargetVersion and the IrfanPaint version stop there.");
            Console.WriteLine(@";For example, if you want to make the language file work with all the 0.4.11 builds, just insert 0.4.11.*; be careful, always insert the asterisk after a dot.");
            Console.WriteLine(@";The [General] section contains the strings of the string table; they are usually strings that are displayed in error messages, tooltips, ...");
            Console.WriteLine(@";Each numbered section contains the strings of a dialog; the strings numbers are the IDs of the controls in which they will be displayed.");
            Console.WriteLine(@";The 0 string is the title of the dialog.");
            Console.WriteLine(@";=== ACCELERATORS ===");
            Console.WriteLine(@";The & symbol is put before the accelerator letter; for example if you find a &Bold it means that the button that contains that text can be pressed also pressing ALT+B.");
            Console.WriteLine(@";You can change the accelerator letter (e.g. in Italian &Italic becomes &Corsivo), but be careful: the accelerators of the same dialog must not conflict.");
            Console.WriteLine(@";=== ESCAPE SEQUENCES ===");
            Console.WriteLine(@";The recognised escape sequences are:");
            Console.WriteLine(@";   \n      newline          (ASCII 0x0A)");
            Console.WriteLine(@";   \r      carriage return  (ASCII 0x0D)");
            Console.WriteLine(@";   \\      backslash        (ASCII 0x5C)");
            Console.WriteLine(@";Unrecognized escape sequences are treated as left as they are.");
            Console.WriteLine(@";In most of controls to make a new line you need to insert a \r\n.");
            Console.WriteLine(@";=== PLACEHOLDERS ===");
            Console.WriteLine(@";Text enclosed between two ""%"" is a placeholder for something else that will be put there at runtime.");
            Console.WriteLine(@";You can move the placeholder where you want in the string, so you'll be able to arrange the sentence as you like more.");
            Console.WriteLine(@";These text placeholders are specific of each string; you cannot use the placeholders of a string in another.");
            Console.WriteLine(@";The placeholders names are usually self-descriptive. Anyway, here's a list of the currently used placeholders:");
            Console.WriteLine(@";   %translator%    Translator name as stated in the [FileInfo]\TranslatorName key.");
            Console.WriteLine(@";   %language%      Language name as stated in the [FileInfo]\LanguageName key.");
            Console.WriteLine(@";=== COMMENTS ===");
            Console.WriteLine(@";If a row begins with a ; it is a comment; it is completely ignored by the parser.");
            Console.WriteLine(@";You can put any comment you want, but all the comments will be stripped out when the file will be distributed to reduce file size unless you ask to keep them.");
            Console.WriteLine(@";It is very appreciated if you strip out all the comments (including these that you are reading now) by yourself. Thank you!");
            Console.WriteLine(@";=== MISC ===");
            Console.WriteLine(@";If you do not translate a string it will remain untranslated in the interface, no error message (like ""incomplete language file"") will be issued.");
            //FileInfo section
            string version;

            Console.WriteLine("[FileInfo]");
            Console.WriteLine("TranslatorName=Put your name here");
            Console.WriteLine("LanguageName=Put the language name (in its language, not in English) here");
            //Get the version
            {
                Match mc = versionRe.Match(inString);
                try
                {
                    version = mc.Groups["Major"].Value + "." + mc.Groups["Minor"].Value + "." + mc.Groups["Revision"].Value + ".*" /*+ mc.Groups["Build"].Value*/;
                }
                catch
                {
                    version = null;
                }
                if (version != null && version != "...")
                {
                    Console.Write("TargetVersion=");
                    Console.WriteLine(version);
                }
            }
            //String skip
            matches = skipStrsRe.Matches(inString);
            foreach (Match mc in matches)
            {
                skipStrings.Add((int)parser.Parse(mc.Groups["StringID"].Value, null));
            }
            //String tables
            matches = strsRe.Matches(inString);
            Console.WriteLine("[General]");
            foreach (Match mc in matches)
            {
                Group strGrp = mc.Groups["String"], strIDGrp = mc.Groups["StringID"];
                for (int i = 0; i < strIDGrp.Captures.Count; i++)
                {
                    if (strGrp.Captures[i].Value != "")
                    {
                        int  parsedVal = 0;
                        bool skip      = false;
                        try
                        {
                            parsedVal = (int)parser.Parse(strIDGrp.Captures[i].Value, null);
                        }
                        catch
                        {
                            skip = true;
                        }
                        skip |= skipStrings.Contains(parsedVal);
                        if (!skip)
                        {
                            Console.Write(parsedVal);
                            Console.Write("=");
                            Console.WriteLine(strGrp.Captures[i].Value.Replace("\"\"", "\""));
                        }
                    }
                }
            }
            //Control captions
            matches = ctrlsRe.Matches(inString);
            foreach (Match mc in matches)
            {
                Console.WriteLine("[" + mc.Groups["DialogID"].Value + "]");
                Console.WriteLine("0=" + mc.Groups["DialogCaption"].Value.Replace("\"\"", "\""));
                Group captionGrp = mc.Groups["ControlCaption"], ctrlIDGrp = mc.Groups["ControlID"];
                for (int i = 0; i < captionGrp.Captures.Count; i++)
                {
                    if (captionGrp.Captures[i].Value != "")
                    {
                        Console.Write(ctrlIDGrp.Captures[i].Value);
                        Console.Write("=");
                        Console.WriteLine(captionGrp.Captures[i].Value.Replace("\"\"", "\""));
                    }
                }
            }
            Console.ReadLine();
            return(0);
        }
Example #57
0
/*
 * Function: e_closure
 * Description: Alters input set.
 */
        public void e_closure()
        {
            Nfa state = null;

            /*
             * Debug checks
             */
#if DEBUG
            Utility.assert(null != nfa_set);
            Utility.assert(null != nfa_bit);
#endif

            accept       = null;
            anchor       = Spec.NONE;
            accept_index = Utility.INT_MAX;

            /*
             * Create initial stack.
             */
            Stack nfa_stack = new Stack();
            int   size      = nfa_set.Count;

            for (int i = 0; i < size; i++)
            {
                state = (Nfa)nfa_set[i];
#if DEBUG
                Utility.assert(nfa_bit.Get(state.GetLabel()));
#endif
                nfa_stack.Push(state);
            }

            /*
             * Main loop.
             */
            while (nfa_stack.Count > 0)
            {
                Object o = nfa_stack.Pop();
                if (o == null)
                {
                    break;
                }
                state = (Nfa)o;

#if OLD_DUMP_DEBUG
                if (null != state.GetAccept())
                {
                    Console.WriteLine("Looking at accepting state "
                                      + state.GetLabel()
                                      + " with <"
                                      + state.GetAccept().action
                                      + ">");
                }
#endif
                if (null != state.GetAccept() && state.GetLabel() < accept_index)
                {
                    accept_index = state.GetLabel();
                    accept       = state.GetAccept();
                    anchor       = state.GetAnchor();

#if OLD_DUMP_DEBUG
                    Console.WriteLine("Found accepting state "
                                      + state.GetLabel()
                                      + " with <"
                                      + state.GetAccept().action
                                      + ">");
#endif
#if DEBUG
                    Utility.assert(null != accept);
                    Utility.assert(Spec.NONE == anchor ||
                                   0 != (anchor & Spec.END) ||
                                   0 != (anchor & Spec.START));
#endif
                }

                if (Nfa.EPSILON == state.GetEdge())
                {
                    if (state.GetNext() != null)
                    {
                        if (false == nfa_set.Contains(state.GetNext()))
                        {
#if DEBUG
                            Utility.assert(false == nfa_bit.Get(state.GetNext().GetLabel()));
#endif
                            nfa_bit.Set(state.GetNext().GetLabel(), true);
                            nfa_set.Add(state.GetNext());
                            nfa_stack.Push(state.GetNext());
                        }
                    }
                    if (null != state.GetSib())
                    {
                        if (false == nfa_set.Contains(state.GetSib()))
                        {
#if DEBUG
                            Utility.assert(false == nfa_bit.Get(state.GetSib().GetLabel()));
#endif
                            nfa_bit.Set(state.GetSib().GetLabel(), true);
                            nfa_set.Add(state.GetSib());
                            nfa_stack.Push(state.GetSib());
                        }
                    }
                }
            }
            if (null != nfa_set)
            {
                sort_states();
            }
        }
Example #58
0
        static void Main(string[] args)
        {
            ArrayList tickedValues = new ArrayList();
            string    userLetter;
            int       welcome = 1;

            do
            {
                tickedValues.Clear();
                string[,] fields = new string[3, 3]
                {
                    { "1", "2", "3" },
                    { "4", "5", "6" },
                    { "7", "8", "9" }
                };

                bool player1Turn = true;

                bool player1Win = false;
                bool player2Win = false;

                int input;

                //useful for a draw
                int moveCounter = 0;

                Console.Clear();
                do
                {
                    ShowBoard(fields);

                    ShowWelcomeMessage(welcome);

                    ShowPlayerInstructions(player1Turn);

                    do
                    {
                        input = DataValidation();
                        if (!tickedValues.Contains(input))
                        {
                            tickedValues.Add(input);
                            break;
                        }
                        else
                        {
                            Console.WriteLine("Field already marked. Please enter the other field.");
                        }
                    } while (true);

                    moveCounter++;

                    if (welcome == 1)
                    {
                        welcome = 0;
                    }

                    if (player1Turn)
                    {
                        switch (input)
                        {
                        case 1:
                            fields[0, 0] = "O";
                            break;

                        case 2:
                            fields[0, 1] = "O";
                            break;

                        case 3:
                            fields[0, 2] = "O";
                            break;

                        case 4:
                            fields[1, 0] = "O";
                            break;

                        case 5:
                            fields[1, 1] = "O";
                            break;

                        case 6:
                            fields[1, 2] = "O";
                            break;

                        case 7:
                            fields[2, 0] = "O";
                            break;

                        case 8:
                            fields[2, 1] = "O";
                            break;

                        case 9:
                            fields[2, 2] = "O";
                            break;
                        }
                    }
                    else
                    {
                        switch (input)
                        {
                        case 1:
                            fields[0, 0] = "X";
                            break;

                        case 2:
                            fields[0, 1] = "X";
                            break;

                        case 3:
                            fields[0, 2] = "X";
                            break;

                        case 4:
                            fields[1, 0] = "X";
                            break;

                        case 5:
                            fields[1, 1] = "X";
                            break;

                        case 6:
                            fields[1, 2] = "X";
                            break;

                        case 7:
                            fields[2, 0] = "X";
                            break;

                        case 8:
                            fields[2, 1] = "X";
                            break;

                        case 9:
                            fields[2, 2] = "X";
                            break;
                        }
                    }
                    if (player1Turn)
                    {
                        if (DidPlayer1Win(fields))
                        {
                            player1Win = true;
                        }
                        else
                        {
                            player1Turn = false;
                        }
                    }
                    else
                    {
                        if (DidPlayer2Win(fields))
                        {
                            Console.WriteLine("\n\nWell done player 2! You have won!");
                            player2Win = true;
                        }
                        else
                        {
                            player1Turn = true;
                        }
                    }
                    Console.Clear();

                    if (player1Win || player2Win)
                    {
                        ShowBoard(fields);
                        if (player1Win)
                        {
                            Console.WriteLine("Well done Player 1! You have won! Would you like to play again?" +
                                              "\n'y' for yes" +
                                              "\n'n' for no");
                        }
                        else
                        {
                            Console.WriteLine("Well done Player 2! You have won! Would you like to play again?" +
                                              "\n'y' for yes" +
                                              "\n'n' for no");
                        }
                    }

                    else if (moveCounter == 9)
                    {
                        ShowBoard(fields);
                        Console.WriteLine("Game finished as a draw. Would you like to play again?\n" +
                                          "'y' for yes\n" +
                                          "'n' for no");
                        player1Win = true;
                    }
                } while (!(player1Win || player2Win));
                do
                {
                    userLetter = Console.ReadLine();
                    if (!(userLetter.Equals("y") || userLetter.Equals("n")))
                    {
                        Console.WriteLine("You have entered wrong value. Please try again.");
                    }
                } while (!(userLetter.Equals("y") || userLetter.Equals("n")));
            } while (userLetter.Equals("y"));
        }
 /// <summary>
 /// Determines whether a PluginWrapper exists in the collection.
 /// </summary>
 /// <param name="plugin">The PluginWrapper to locate in the collection.</param>
 /// <returns></returns>
 /// <history>
 /// [Curtis_Beard]		07/31/2006	Created
 /// </history>
 public bool Contains(PluginWrapper plugin)
 {
     return(__List.Contains(plugin));
 }
Example #60
0
    private void FillData(DataRow dr)
    {
        //  this.ViewState["CustomType"] = dr["CustomType"].ToString() ;
        this.ViewState["Title"]     = dr["Title"].ToString();
        this.ViewState["CustomCyc"] = dr["CustomCyc"].ToString();
        this.ViewState["ItemCount"] = dr["ItemCount"].ToString();//每次发送数量


        this.ViewState["Email"]        = dr["Email"].ToString();
        this.ViewState["Accept"]       = dr["Accept"].ToString();       //是否接收中国招商投资网的订阅信息邮件
        this.ViewState["ValidateTerm"] = dr["ValidateTerm"].ToString(); //订阅周期


        //2010-06-23修改
        string CustomType = Request.QueryString["CustomType"].ToString();

        #region 政府招商
        if (CustomType == "0")   //政府招商
        {
            //投资行业
            if (dr["Calling"].ToString() != "")
            {
                this.lisTzhyRight.Items.Clear();
                string[]  arrType    = dr["Calling"].ToString().Split('|');
                string[]  arrTypeTxt = dr["CallingTxt"].ToString().Split('|');
                ArrayList arrTyp     = new ArrayList();
                for (int i = 0; i < arrType.Length; i++) //(int i = 0; i < arrType.Length; i++)
                {
                    arrTyp.Add(arrType[i]);
                    ListItem listItem = new ListItem();
                    listItem.Value = arrType[i].Trim();
                    listItem.Text  = GetCallingTxt(arrType[i].Trim());
                    this.lisTzhyRight.Items.Add(listItem);

                    if (dr["CustomType"].ToString() == "3")
                    {
                        listItem.Value = arrType[i].Trim();
                        listItem.Text  = GetCallingTxtCarveout(arrType[i].Trim());
                        this.lisTzhyRight.Items.Add(listItem);
                    }

                    if (dr["CustomType"].ToString() == "4")
                    {
                        listItem.Value = arrType[i].Trim();
                        listItem.Text  = GetCallingTxtOpportunity(arrType[i].Trim());
                        this.lisTzhyRight.Items.Add(listItem);
                    }
                }
            }

            ////投资区域
            if (dr["City"].ToString() != "")
            {
                this.lisTzQyRight.Items.Clear();
                string[]  arrType    = dr["City"].ToString().Split('|');
                string[]  arrTypeTxt = dr["CityTxt"].ToString().Split('|');
                ArrayList arrTyp     = new ArrayList();
                for (int i = 0; i < arrType.Length; i++) //(int i = 0; i < arrType.Length; i++)
                {
                    arrTyp.Add(arrType[i]);
                    ListItem listItem = new ListItem();
                    listItem.Value = arrType[i].Trim();
                    listItem.Text  = GetCityTxt(arrType[i].Trim());
                    this.lisTzQyRight.Items.Add(listItem);

                    if (dr["CustomType"].ToString() == "3")
                    {
                        listItem.Value = arrType[i].Trim();
                        listItem.Text  = GetCallingTxtCarveout(arrType[i].Trim());
                        this.lisTzQyRight.Items.Add(listItem);
                    }

                    if (dr["CustomType"].ToString() == "4")
                    {
                        listItem.Value = arrType[i].Trim();
                        listItem.Text  = GetCallingTxtOpportunity(arrType[i].Trim());
                        this.lisTzQyRight.Items.Add(listItem);
                    }
                }
            }
        }
        #endregion

        #region 资本资源
        if (CustomType == "1")
        {
            //投资方式
            if (dr["CooperationDemandTypeID"].ToString() != "")
            {
                string[]  arrType = dr["CooperationDemandTypeID"].ToString().Split('|');
                ArrayList arrTyp  = new ArrayList();
                for (int i = 0; i < arrType.Length; i++)
                {
                    if (arrType[i].Trim() != "")
                    {
                        arrTyp.Add(arrType[i]);
                    }
                }
                for (int i = 0; i < this.chTzfsZb.Items.Count; i++)
                {
                    this.chTzfsZb.Items[i].Selected = arrTyp.Contains(this.chTzfsZb.Items[i].Value.Trim());
                }
            }

            //单项目可投资金额
            if (dr["Money"].ToString() != "")
            {
                string[]  arrType = dr["Money"].ToString().Split('|');
                ArrayList arrTyp  = new ArrayList();
                for (int i = 0; i < arrType.Length; i++)
                {
                    if (arrType[i].Trim() != "")
                    {
                        arrTyp.Add(arrType[i]);
                    }
                }
                for (int i = 0; i < this.chkCapital.Items.Count; i++)
                {
                    //this.chkCapital.Items[i].Selected = arrTyp.Contains(this.chkCapital.Items[i].Value.Trim());
                    for (int j = 0; j < arrType.Length; j++)
                    {
                        if (int.Parse(chkCapital.Items[i].Value.Trim()) == int.Parse(arrType[j].Trim()))
                        {
                            chkCapital.Items[i].Selected = true;
                        }
                    }
                }
            }


            //投资行业
            if (dr["Calling"].ToString() != "")
            {
                this.lstIndustryBRight.Items.Clear();
                string[]  arrType    = dr["Calling"].ToString().Split('|');
                string[]  arrTypeTxt = dr["CallingTxt"].ToString().Split('|');
                ArrayList arrTyp     = new ArrayList();
                for (int i = 0; i < arrType.Length; i++) //(int i = 0; i < arrType.Length; i++)
                {
                    arrTyp.Add(arrType[i]);
                    ListItem listItem = new ListItem();
                    listItem.Value = arrType[i].Trim();
                    listItem.Text  = GetCallingTxt(arrType[i].Trim());
                    this.lstIndustryBRight.Items.Add(listItem);

                    if (dr["CustomType"].ToString() == "3")
                    {
                        listItem.Value = arrType[i].Trim();
                        listItem.Text  = GetCallingTxtCarveout(arrType[i].Trim());
                        this.lstIndustryBRight.Items.Add(listItem);
                    }

                    if (dr["CustomType"].ToString() == "4")
                    {
                        listItem.Value = arrType[i].Trim();
                        listItem.Text  = GetCallingTxtOpportunity(arrType[i].Trim());
                        this.lstIndustryBRight.Items.Add(listItem);
                    }
                }
            }

            ////投资区域
            if (dr["City"].ToString() != "")
            {
                this.lstProvinceRight.Items.Clear();
                string[]  arrType    = dr["City"].ToString().Split('|');
                string[]  arrTypeTxt = dr["CityTxt"].ToString().Split('|');
                ArrayList arrTyp     = new ArrayList();
                for (int i = 0; i < arrType.Length; i++) //(int i = 0; i < arrType.Length; i++)
                {
                    arrTyp.Add(arrType[i]);
                    ListItem listItem = new ListItem();
                    listItem.Value = arrType[i].Trim();
                    listItem.Text  = GetCityTxt(arrType[i].Trim());
                    this.lstProvinceRight.Items.Add(listItem);

                    if (dr["CustomType"].ToString() == "3")
                    {
                        listItem.Value = arrType[i].Trim();
                        listItem.Text  = GetCallingTxtCarveout(arrType[i].Trim());
                        this.lstProvinceRight.Items.Add(listItem);
                    }

                    if (dr["CustomType"].ToString() == "4")
                    {
                        listItem.Value = arrType[i].Trim();
                        listItem.Text  = GetCallingTxtOpportunity(arrType[i].Trim());
                        this.lstProvinceRight.Items.Add(listItem);
                    }
                }
            }
        }
        #endregion

        #region 企业项目
        else if (CustomType == "2")
        {
            //融资类型
            if (dr["Type"].ToString() != "")
            {
                string[]  arrType = dr["Type"].ToString().Split('|');
                ArrayList arrTyp  = new ArrayList();
                for (int i = 0; i < arrType.Length; i++)
                {
                    if (arrType[i].Trim() != "")
                    {
                        arrTyp.Add(arrType[i]);
                    }
                }
                for (int i = 0; i < this.ckRzlxQy.Items.Count; i++)
                {
                    for (int j = 0; j < arrType.Length; j++)
                    {
                        if (int.Parse(ckRzlxQy.Items[i].Value.Trim()) == int.Parse(arrType[j].Trim()))
                        {
                            ckRzlxQy.Items[i].Selected = true;
                        }
                    }
                    //this.ckRzlxQy.Items[i].Selected = arrTyp.Contains(this.ckRzlxQy.Items[i].Value.Trim());
                }
            }

            //投资行业
            if (dr["Calling"].ToString() != "")
            {
                this.lisTzhyQyRight.Items.Clear();
                string[]  arrType    = dr["Calling"].ToString().Split('|');
                string[]  arrTypeTxt = dr["CallingTxt"].ToString().Split('|');
                ArrayList arrTyp     = new ArrayList();
                for (int i = 0; i < arrType.Length; i++) //(int i = 0; i < arrType.Length; i++)
                {
                    arrTyp.Add(arrType[i]);
                    ListItem listItem = new ListItem();
                    listItem.Value = arrType[i].Trim();
                    listItem.Text  = GetCallingTxt(arrType[i].Trim());
                    this.lisTzhyQyRight.Items.Add(listItem);

                    if (dr["CustomType"].ToString() == "3")
                    {
                        listItem.Value = arrType[i].Trim();
                        listItem.Text  = GetCallingTxtCarveout(arrType[i].Trim());
                        this.lisTzhyQyRight.Items.Add(listItem);
                    }

                    if (dr["CustomType"].ToString() == "4")
                    {
                        listItem.Value = arrType[i].Trim();
                        this.lisTzhyQyRight.Items.Add(listItem);
                    }
                }
            }

            ////投资区域
            if (dr["City"].ToString() != "")
            {
                this.lisTzqyQyRight.Items.Clear();
                string[]  arrType    = dr["City"].ToString().Split('|');
                string[]  arrTypeTxt = dr["CityTxt"].ToString().Split('|');
                ArrayList arrTyp     = new ArrayList();
                for (int i = 0; i < arrType.Length; i++) //(int i = 0; i < arrType.Length; i++)
                {
                    arrTyp.Add(arrType[i]);
                    ListItem listItem = new ListItem();
                    listItem.Value = arrType[i].Trim();
                    listItem.Text  = GetCityTxt(arrType[i].Trim());
                    this.lisTzqyQyRight.Items.Add(listItem);

                    if (dr["CustomType"].ToString() == "3")
                    {
                        listItem.Value = arrType[i].Trim();
                        listItem.Text  = GetCallingTxtCarveout(arrType[i].Trim());
                        this.lisTzqyQyRight.Items.Add(listItem);
                    }

                    if (dr["CustomType"].ToString() == "4")
                    {
                        listItem.Value = arrType[i].Trim();
                        listItem.Text  = GetCallingTxtOpportunity(arrType[i].Trim());
                        this.lisTzqyQyRight.Items.Add(listItem);
                    }
                }
            }
            //借款金额
            if (dr["Money"].ToString() != "")
            {
                string[]  arrType = dr["Money"].ToString().Split('|');
                ArrayList arrTyp  = new ArrayList();
                for (int i = 0; i < arrType.Length; i++)
                {
                    if (arrType[i].Trim() != "")
                    {
                        arrTyp.Add(arrType[i]);
                    }
                }
                for (int i = 0; i < this.ckJkjeQy.Items.Count; i++)
                {
                    //this.chkCapital.Items[i].Selected = arrTyp.Contains(this.chkCapital.Items[i].Value.Trim());
                    for (int j = 0; j < arrType.Length; j++)
                    {
                        if (int.Parse(ckJkjeQy.Items[i].Value.Trim()) == int.Parse(arrType[j].Trim()))
                        {
                            ckJkjeQy.Items[i].Selected = true;
                        }
                    }
                }
            }
        }
        #endregion

        #region
        //关键字
        this.txtKey.Text = dr["Keyword"].ToString();
        //发布时间
        for (int i = 0; i < ddlValidateTerm.Items.Count; i++)
        {
            if (ddlValidateTerm.Items[i].Value == dr["ValidateTerm"].ToString())
            {
                ddlValidateTerm.Items[i].Selected = true;
            }
        }
        #endregion

        #region 根据参数改变样式
        if (CustomType == "0")
        {
            div0.Attributes["class"] = "btn_on";
            div1.Attributes["class"] = "";
            div2.Attributes["class"] = "";
            panel0.Style["display"]  = "block";
            panel1.Style["display"]  = "none";
            panel2.Style["display"]  = "none";
        }
        else if (CustomType == "1")
        {
            div1.Attributes["class"] = "btn_on";
            div0.Attributes["class"] = "";
            div2.Attributes["class"] = "";
            panel1.Style["display"]  = "block";
            panel0.Style["display"]  = "none";
            panel2.Style["display"]  = "none";
        }
        else if (CustomType == "2")
        {
            div2.Attributes["class"] = "btn_on";
            div0.Attributes["class"] = "";
            div1.Attributes["class"] = "";
            panel2.Style["display"]  = "block";
            panel1.Style["display"]  = "none";
            panel0.Style["display"]  = "none";
        }
        #endregion
    }