public void getfiles(string dir) { ddFilesMovie.Items.Clear(); ListItem li1 = new ListItem(); li1.Text = "-- select --"; li1.Value = "-1"; ddFilesMovie.Items.Add(li1); ArrayList af = new ArrayList(); string[] Filesmovie = Directory.GetFiles(dir); foreach (string file in Filesmovie) { string appdir = Server.MapPath("~/App_Uploads_Img/") + ddCatMovie.SelectedValue; string filename = file.Substring(appdir.Length + 1); if ((!filename.Contains("_svn")) && (!filename.Contains(".svn"))) { if (filename.ToLower().Contains(".mov") || filename.ToLower().Contains(".flv") || filename.ToLower().Contains(".wmv") ) { ListItem li = new ListItem(); li.Text = filename; li.Value = filename; ddFilesMovie.Items.Add(li); } } } UpdatePanel1Movie.Update(); }
public static GameObject GetClosestEnemy(Transform transform, bool onScreen) { GameObject[] enemies = GameObject.FindGameObjectsWithTag ("Enemy"); ArrayList offscreenEnemies = new ArrayList(); // Filter offscreen enemies foreach(GameObject enemy in enemies) { if(IsOnScreen(enemy) == onScreen) { offscreenEnemies.Add(enemy); } } if (offscreenEnemies.Count < 1) return null; // TODO implement closest logic GameObject closestEnemy = enemies[0]; float dist = Vector3.Distance(transform.position, enemies[0].transform.position); for(var i=0;i < enemies.Length; i++) { var tempDist = Vector3.Distance(transform.position, enemies[i].transform.position); if(tempDist < dist) { closestEnemy = enemies[i]; dist = tempDist; } } return closestEnemy; }
//MDS // GUIMultiDotSlider mds; public GUIGridV2(int d,int actId,string inTxt,string bOn,string bOf/*,GUIStyle iOn,GUIStyle iOf*/,GUIInterface o) : base(d,actId,inTxt,bOn,bOf/*,iOn,iOf*/,o) { subItems = new ArrayList(); // mds = new GUIMultiDotSlider(1); thumbs = new Texture2D[0]; }
/// <summary> /// 指定されたフォルダ以下にあるすべてのファイルを取得する(サブフォルダは含まれない) /// </summary> /// <param name="folder">ファイルを検索するフォルダ名。</param> /// <param name="searchPattern">ファイル名検索文字列 /// ワイルドカード指定子(*, ?)を使用する。</param> /// <param name="files">見つかったファイル名のリスト</param> public static void GetDirectoryFiles(string folder, string searchPattern, ref ArrayList files) { //folderにあるファイルを取得する string[] fs = System.IO.Directory.GetFiles (folder, searchPattern); //ArrayListに追加する files.AddRange (fs); }
public ArrayList Neighbours( Moveable peep) { Character peepChar = peep.gameObject.GetComponent<Character> (); bool peepCanPathThroughEnemies = peep.canPathThroughEnemies; ArrayList neighbourhood = new ArrayList (); if (left != null && !peep.unpathables.Contains(left.GetComponent<HexTile>().Type) && ( peepCanPathThroughEnemies || !ArrayListsIntersect( left.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams))) neighbourhood.Add (left); if (right != null && !peep.unpathables.Contains(right.GetComponent<HexTile>().Type) && ( peepCanPathThroughEnemies || !ArrayListsIntersect( right.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams))) neighbourhood.Add (right); if (up_left != null && !peep.unpathables.Contains(up_left.GetComponent<HexTile>().Type) && ( peepCanPathThroughEnemies || !ArrayListsIntersect( up_left.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams))) neighbourhood.Add (up_left); if (up_right != null && !peep.unpathables.Contains(up_right.GetComponent<HexTile>().Type) && ( peepCanPathThroughEnemies || !ArrayListsIntersect( up_right.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams))) neighbourhood.Add (up_right); if (down_right != null && !peep.unpathables.Contains(down_right.GetComponent<HexTile>().Type) && ( peepCanPathThroughEnemies || !ArrayListsIntersect( down_right.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams))) neighbourhood.Add (down_right); if (down_left != null && !peep.unpathables.Contains(down_left.GetComponent<HexTile>().Type) && ( peepCanPathThroughEnemies || !ArrayListsIntersect( down_left.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams))) neighbourhood.Add (down_left); return neighbourhood; }
//type = a:1/10, b:1/100, c:1/1000 public Auth_GetAutoTokenCommand( string playerId,string secret, CompleteDelegate completeDelegate, ErrorDelegate errorDelegate) { Hashtable batchHash = new Hashtable (); batchHash.Add ("authKey", AuthUtils.generateRequestToken (playerId, secret)); ArrayList commands = new ArrayList(); Hashtable command = new Hashtable (); command.Add ("action", "auth.getAuthToken"); command.Add ("time", TimeUtils.UnixTime); command.Add ("args", new Hashtable () { { "playerId", playerId }, { "secret", secret }}); // command.Add ("expectedStatus",""); command.Add ("requestId", 123); // command.Add ("token", ""); commands.Add(command); batchHash.Add("commands",commands); batch = MiniJSON.jsonEncode(batchHash); //////// this.onComplete = delegate(Hashtable t){ //{"requestId":null,"messages":{},"result":"aWeha_JMFgzaF5zWMR3tnObOtLZNPR4rO70DNdfWPvc.eyJ1c2VySWQiOiIyMCIsImV4cGlyZXMiOiIxMzg1NzA5ODgyIn0","status":0} Hashtable completeParam = new Hashtable(); completeParam.Add("result",t["result"]); completeDelegate(completeParam); }; ///////// this.onError = delegate(string err_code,string err_msg, Hashtable data){ errorDelegate(err_code,err_msg,data); }; }
void Update() { ArrayList list = new ArrayList (); DeviceOrientation orientation = Input.deviceOrientation; if (_lastOrientation != orientation) { switch (orientation) { case DeviceOrientation.LandscapeLeft: case DeviceOrientation.LandscapeRight: case DeviceOrientation.Portrait: case DeviceOrientation.PortraitUpsideDown: list.Add (new FageScreenEvent (_lastOrientation, Input.deviceOrientation)); _lastOrientation = orientation; break; } } if ((_lastWidth != Screen.width) || (_lastHeight != Screen.height)) { list.Add (new FageScreenEvent (_lastWidth, _lastHeight, Screen.width, Screen.height)); _lastWidth = Screen.width; _lastHeight = Screen.height; } if (_lastDpi != Screen.dpi) { list.Add (new FageScreenEvent (_lastDpi, Screen.dpi)); _lastDpi = Screen.dpi; } foreach (FageScreenEvent fsevent in list) { DispatchEvent(fsevent); } }
public MemberInfo[] GetTestedMethods() { Type type = typeof(Convert); ArrayList list = new ArrayList(); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Byte)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(SByte)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Int16)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Int32)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Int64)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(UInt16)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(UInt32)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(UInt64)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(String), typeof(IFormatProvider)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(String)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Boolean)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Char)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Object)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Object), typeof(IFormatProvider)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Single)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Double)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(DateTime)})); list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Decimal)})); MethodInfo[] methods = new MethodInfo[list.Count]; list.CopyTo(methods, 0); return methods; }
public Node getNext() { //transform.position= new Vector3(0, target[0], target[1]); ArrayList list = new ArrayList (); ArrayList popularity = new ArrayList (); while (true) { int randomNumber = (int)Random.Range (0, 4); Debug.Log (randomNumber); if (n != null && randomNumber == 0) { list.Add (n); popularity.Add (n.popularity); return n; } if (e != null&& randomNumber == 1) { list.Add (e); popularity.Add (e.popularity); return e; } if (s != null&& randomNumber == 2) { list.Add (s); popularity.Add (s.popularity); return s; } if (w != null&& randomNumber == 3) { list.Add (w); popularity.Add (w.popularity); return w; } } return null; //perform the algorithm here, biased against turning around //for (int i=0; i<list.Count; i++) { //} //return null; }
// Use this for initialization void Start () { if (IntroScript == null) IntroScript = new ArrayList(); if (IntroScript != null && IntroScript.Count != 0) IntroScript.Clear(); if (IntroScript != null && IntroScript.Count == 0) AddScriptToList(); ContinueButton_Click(); }
protected void Button1_Click(object sender, EventArgs e) { localhostWebService.WebService service = new localhostWebService.WebService(); localhostWebService.ContactDetails contact = new localhostWebService.ContactDetails(); phoneFriendList = new ArrayList(); foreach (ListItem friend in CheckBoxListFriends.Items) { // רשימה של החברים שאיתם // מעוניינים לשתף חברים if (friend.Selected) { phoneFriendList.Add(friend.Value); } } foreach (ListItem contactItem in CheckBoxListContacts.Items) { // עבור כל איש קשר ברשימה לשיתוף מעתיק לחבר //יצירת רשימה של אנשי הקשר if (contactItem.Selected) { contact = service.GetContactsByID(int.Parse(contactItem.Value)); for (int i = 0; i < phoneFriendList.Count; i++ ) { moveContactsToAFriend(contact, phoneFriendList[i].ToString()); } } } }
public static string[] GetCompletionList(string prefixText, int count) { //連線字串 //string connStr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=" //+ System.Web.HttpContext.Current.Server.MapPath("~/App_Data/NorthwindChinese.mdf") + ";Integrated Security=True;User Instance=True"; ArrayList array = new ArrayList();//儲存撈出來的字串集合 //using (SqlConnection conn = new SqlConnection(connStr)) using (SqlConnection conn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString)) { DataSet ds = new DataSet(); string selectStr = @"SELECT Top (" + count + ") Account_numbers FROM Account_Order_M_View Where Account_numbers Like '" + prefixText + "%'"; SqlDataAdapter da = new SqlDataAdapter(selectStr, conn); conn.Open(); da.Fill(ds); foreach (DataRow dr in ds.Tables[0].Rows) { array.Add(dr["Account_numbers"].ToString()); } } return (string[])array.ToArray(typeof(string)); }
//comes from gui/stats.cs public StatType(string statisticType, string statisticSubType, string statisticApplyTo, Gtk.TreeView treeview_stats, ArrayList sendSelectedSessions, bool sex_active, int statsJumpsType, int limit, ArrayList markedRows, int evolution_mark_consecutives, GraphROptions gRO, bool graph, bool toReport, Preferences preferences) { //some of this will disappear when we use myStatTypeStruct in all classes: this.statisticType = statisticType; this.statisticSubType = statisticSubType; this.statisticApplyTo = statisticApplyTo; this.treeview_stats = treeview_stats ; this.markedRows = markedRows; this.evolution_mark_consecutives = evolution_mark_consecutives; this.graph = graph; this.toReport = toReport; myStatTypeStruct = new StatTypeStruct ( statisticApplyTo, sendSelectedSessions, sex_active, statsJumpsType, limit, markedRows, gRO, toReport, preferences); myStat = new Stat(); //create an instance of myStat fakeButtonRowCheckedUnchecked = new Gtk.Button(); fakeButtonRowsSelected = new Gtk.Button(); fakeButtonNoRowsSelected = new Gtk.Button(); }
/// <summary> /// Puts an array of OscMessages into a packet (byte[]). /// </summary> /// <param name="messages">An ArrayList of OscMessages.</param> /// <param name="packet">An array of bytes to be populated with the OscMessages.</param> /// <param name="length">The size of the array of bytes.</param> /// <returns>The length of the packet</returns> public static int OscMessagesToPacket(ArrayList messages, byte[] packet, int length) { int index = 0; if (messages.Count == 1) index = OscMessageToPacket((OscMessage)messages[0], packet, 0, length); else { // Write the first bundle bit index = InsertString("#bundle", packet, index, length); // Write a null timestamp (another 8bytes) int c = 8; while (( c-- )>0) packet[index++]++; // Now, put each message preceded by it's length foreach (OscMessage oscM in messages) { int lengthIndex = index; index += 4; int packetStart = index; index = OscMessageToPacket(oscM, packet, index, length); int packetSize = index - packetStart; packet[lengthIndex++] = (byte)((packetSize >> 24) & 0xFF); packet[lengthIndex++] = (byte)((packetSize >> 16) & 0xFF); packet[lengthIndex++] = (byte)((packetSize >> 8) & 0xFF); packet[lengthIndex++] = (byte)((packetSize) & 0xFF); } } return index; }
// Update is called once per frame void Update() { int cnt = Input.touchCount; if (cnt == 0) return; // event check flag bool begin, move, end, stationary; begin = move = end = stationary = false; // parameter ArrayList result = new ArrayList (); for (int i=0; i<cnt; i++) { Touch touch = Input.GetTouch (i); result.Add (touch); // if(touch.phase==TouchPhase.Began&&touchBegin!=null) begin = true; // else if(touch.phase==TouchPhase.Moved&&touchMove!=null) move = true; // else if(touch.phase==TouchPhase.Ended&&touchEnd!=null) end = true; // else if(touch.phase==TouchPhase.Stationary&&touchStationary!=null) stationary = true; // // if(begin) touchBegin(result); // else if(end) touchEnd(result); // else if(move) touchMove(result); // else if(stationary) touchStationary(result); if (touch.phase == TouchPhase.Stationary && touchStationary != null) stationary = true; // else if(touch.phase==TouchPhase.Ended&&touchEnd!=null) end = true; if (stationary) touchStationary (result); if (end) touchEnd(result); } }
ArrayList LoadFile(string path,string name) { //使用流的形式读取 StreamReader sr =null; try{ sr = File.OpenText(path+"//"+ name); }catch(Exception e) { //路径与名称未找到文件则直接返回空 return null; } string line; ArrayList arrlist = new ArrayList(); while ((line = sr.ReadLine()) != null) { //一行一行的读取 //将每一行的内容存入数组链表容器中 arrlist.Add(line); } //关闭流 sr.Close(); //销毁流 sr.Dispose(); //将数组链表容器返回 return arrlist; }
/** * Controle la balle avec des deplacements gauche, * droite et profondeur * return listFloat */ ArrayList StyleJeuSimple(){ Frame frame = controller.Frame(); Hand hand = frame.Hands.Rightmost; handPosition = hand.PalmPosition; ArrayList listFloat = new ArrayList(); float moveSimpleX = 0; float moveSimpleZ = 0; export.AddRow(); export["Time in ms"] = Time.timeSinceLevelLoad; export["Pos hand in x"] = handPosition.x; export["Pos hand in z"] = handPosition.z; if(hand.IsValid){ if(moveSimpleX == (handPosition.x)/10 * Time.deltaTime * 3){ moveSimpleX = 0; }else{ moveSimpleX = (handPosition.x)/10 * Time.deltaTime * 3; } if (moveSimpleZ == (-handPosition.z) / 10 * Time.deltaTime * 3){ moveSimpleZ = 0; }else{ moveSimpleZ = (-handPosition.z) / 10 * Time.deltaTime * 3; } } listFloat.Add(moveSimpleX); listFloat.Add(moveSimpleZ); return listFloat; }
public void fill4(int x, int y, Color32 oldColor, Color32 newColor) { ArrayList stack = new ArrayList(); stack.Add(new Vec2i(x,y)); int emergency = 10000; while(stack.Count > 0 && emergency >= 0) { Vec2i pixel = (Vec2i)stack[stack.Count - 1]; stack.RemoveAt(stack.Count - 1); if(canvas.GetPixel(pixel.x, pixel.y) == oldColor) { canvas.SetPixel(pixel.x, pixel.y, newColor); if(pixel.x + 1 < 96 && canvas.GetPixel(pixel.x + 1, pixel.y) == oldColor) stack.Add(new Vec2i(pixel.x + 1, pixel.y)); if(pixel.x - 1 >= 0 && canvas.GetPixel(pixel.x - 1, pixel.y) == oldColor) stack.Add(new Vec2i(pixel.x - 1, pixel.y)); if(pixel.y + 1 < 64 && canvas.GetPixel(pixel.x, pixel.y + 1) == oldColor) stack.Add(new Vec2i(pixel.x, pixel.y + 1)); if(pixel.y - 1 >= 0 && canvas.GetPixel(pixel.x, pixel.y - 1) == oldColor) stack.Add(new Vec2i(pixel.x, pixel.y - 1)); } emergency--; } }
public GraphSerie(string Title, bool IsLeftAxis, ArrayList SerieData) { this.Title = Title; this.IsLeftAxis = IsLeftAxis; this.SerieData = SerieData; Avg = 0; }
private ArrayList GetGotoStation() { ArrayList ret = new ArrayList(); try { IList<ConstValueInfo> list = iReleaseProductIDHold.GetGotoStationList("GoToStationWithUnPack"); this.cmbGotoStation.Items.Clear(); this.cmbGotoStation.Items.Add(string.Empty); foreach (ConstValueInfo item in list) { ListItem Info = new ListItem(); Info.Text = item.name; Info.Value = item.value; this.cmbGotoStation.Items.Add(Info); } return ret; } catch (FisException ex) { throw new Exception(ex.mErrmsg); } catch (Exception ex) { throw ex; } }
//使用winrar压缩文件 public static void CompressFiles(string rarPath, ArrayList fileArray) { string rar; RegistryKey reg; object obj; string info; ProcessStartInfo startInfo; Process rarProcess; try { reg = Registry.ClassesRoot.OpenSubKey("Applications\\WinRAR.exe\\Shell\\Open\\Command"); obj = reg.GetValue(""); rar = obj.ToString(); reg.Close(); rar = rar.Substring(1, rar.Length - 7); info = " a -as -r -EP1 " + rarPath; foreach (string filepath in fileArray) info += " " + filepath; startInfo = new ProcessStartInfo(); startInfo.FileName = rar; startInfo.Arguments = info; startInfo.WindowStyle = ProcessWindowStyle.Hidden; rarProcess = new Process(); rarProcess.StartInfo = startInfo; rarProcess.Start(); } catch { } }
public OrderedDictionary (int capacity, IEqualityComparer equalityComparer) { initialCapacity = (capacity < 0) ? 0 : capacity; list = new ArrayList (initialCapacity); hash = new Hashtable (initialCapacity, equalityComparer); comparer = equalityComparer; }
public void refreshItemShow() { ArrayList lItemList = bagControl.getItemList(); //Debug.Log(lItemList); itemIndexList = lItemList; int lItemUIIndex = 0; zzIndexTable lItemTypeTable = bagControl .getItemSystem().getItemTypeTable(); foreach (int i in lItemList) { ItemTypeInfo lItemType = (ItemTypeInfo)lItemTypeTable.getData(i); itemListUI[lItemUIIndex].setImage(lItemType.getImage()); itemListUI[lItemUIIndex].setVisible(true); ++lItemUIIndex; } itemNum = lItemUIIndex; //Debug.Log(lItemUIIndex); //更新选择的位置 if (showSelected && lItemUIIndex < selectedIndex) setSelected(lItemUIIndex); //将剩余的图标空间清空 for (; lItemUIIndex < numOfShowItem; ++lItemUIIndex) itemListUI[lItemUIIndex].setVisible(false); }
// Use this for initialization void Start() { Zoom.OnChangeZoom += OnChangeZoom; mg = GameObject.Find ("Manager").GetComponent<Manager> (); locationList = new ArrayList (); locationListScreen = new ArrayList (); using (StreamReader reader = new StreamReader(Application.dataPath + "\\"+RouteListPath)) { while (!reader.EndOfStream) { string line = reader.ReadLine (); string[] parts = line.Split (",".ToCharArray ()); locationList.Add(new double[]{double.Parse(parts[0]),double.Parse(parts[1])}); } reader.Close(); } lineParameter = "&path=color:0xff0030"; for (int i=0; i< locationList.Count; i++) { double[] d_pos = (double[])locationList [i]; lineParameter += "|" + d_pos [0].ToString () + "," + d_pos [1].ToString (); double[] point = {(double)d_pos [1], (double)d_pos [0]}; Vector3 pos = mg.GIStoPos (point); locationListScreen.Add (pos); } #if !(UNITY_IPHONE) mg.sy_Map.addParameter = lineParameter; #endif }
//type = a:1/10, b:1/100, c:1/1000 public Player_PackageUpdateCommand( string playerId,string authToken, CompleteDelegate completeDelegate, ErrorDelegate errorDelegate) { Hashtable batchHash = new Hashtable (); batchHash.Add ("authKey", authToken); ArrayList commands = new ArrayList(); Hashtable command = new Hashtable (); command.Add ("action", "player.bpackUpdate"); command.Add ("time", TimeUtils.UnixTime); command.Add ("args", new Hashtable () { { "playerId", playerId },{"bpack", EquipManager.Instance.dumpDynamicData()}}); command.Add ("requestId", 123); commands.Add(command); batchHash.Add("commands",commands); batch = MiniJSON.jsonEncode(batchHash); //////// this.onComplete = delegate(Hashtable t){ completeDelegate(t); }; ///////// this.onError = delegate(string err_code,string err_msg, Hashtable data){ errorDelegate(err_code,err_msg,data); }; }
public DataTable GetCustomListDt(int modelId) { DataTable dt = bllModelField.GetList(modelId); DataRow dr = dt.NewRow(); dr["Alias"] = "搜索链接"; dr["Name"] = "$search$"; dt.Rows.Add(dr); ArrayList erArrayList = new ArrayList(); for (int i = 0; i < dt.Rows.Count; i++) { string[] erArray = new string[3]; DataRow tdr = dt.Rows[i]; if (tdr["type"].ToString().ToLower() == "erlinkagetype") { erArray[0] = i.ToString(); erArray[1] = bllModelField.GetFieldContent(tdr["content"].ToString(), 1, 1); erArray[2] = bllModelField.GetFieldContent(tdr["content"].ToString(), 2, 1); erArrayList.Add(erArray); } } for (int i = 0; i < erArrayList.Count; i++) { dr = dt.NewRow(); string[] tmp = (string[])erArrayList[i]; dr["Alias"] = tmp[1]; dr["Name"] = tmp[2]; int pos = int.Parse(tmp[0]); dt.Rows.InsertAt(dr, pos + 1+ i); } ctmFildCount = dt.Rows.Count; return dt; }
public void removeBullet(ArrayList prams) { GameObject scene = objs[0] as GameObject; GameObject caller = objs[1] as GameObject; GameObject bltObj = prams[0] as GameObject; GameObject targetObj = prams[1] as GameObject; Destroy(bltObj); if(targetObj == null) { return; } if(icePrb == null) { icePrb = Resources.Load("eft/StarLord/SkillEft_STARLORD15A_Ice") as GameObject; } GameObject ice = Instantiate(icePrb) as GameObject; ice.transform.position = targetObj.transform.position + new Vector3(0, 80, targetObj.transform.position.z - (targetObj.transform.position.z + 100)); StarLord heroDoc = (prams[2] as GameObject).GetComponent<StarLord>(); Character c = targetObj.GetComponent<Character>(); SkillDef skillDef = SkillLib.instance.getSkillDefBySkillID("STARLORD15A"); Hashtable tempNumber = skillDef.activeEffectTable; int tempAtkPer = (int)((Effect)tempNumber["atk_PHY"]).num; c.realDamage(c.getSkillDamageValue(heroDoc.realAtk, tempAtkPer)); }
public MenuTemplate(string name) { menuName = name; itemTemplates = new ArrayList (); mainBackground = Resources.Load ("Textures/MainBackground") as Texture; setStyles (); }
public override IEnumerator Cast(ArrayList objs) { GameObject scene = objs[0] as GameObject; GameObject caller = objs[1] as GameObject; GameObject target = objs[2] as GameObject; parms = objs; Hero drax = caller.GetComponent<Hero>(); drax.castSkill("Skill15B_a"); yield return new WaitForSeconds(.34f); MusicManager.playEffectMusic("SFX_Drax_Fear_Me_1a"); yield return new WaitForSeconds(.7f); StartCoroutine(ShowStones(stones_a)); yield return new WaitForSeconds(.46f); caller.transform.position = new Vector3(0, 0, StaticData.objLayer); drax.castSkill("Skill15B_b"); if(!drax.isDead){ Debug.LogError("4343"); StartCoroutine(ShowStones(stones_b)); StartCoroutine(ShowGrownLight()); StartCoroutine(ShowBigHolo()); ReadData(); FearMe(); } }
/* ============================================================================ Data handling functions ============================================================================ */ public Hashtable GetData(Hashtable ht) { if(this.active) { ArrayList s = new ArrayList(); ht.Add("distance", this.distance.ToString()); ht.Add("layermask", this.layerMask.ToString()); if(this.ignoreUser) ht.Add("ignoreuser", "true"); ht = this.mouseTouch.GetData(ht); ht.Add("rayorigin", this.rayOrigin.ToString()); VectorHelper.ToHashtable(ref ht, this.offset); if(TargetRayOrigin.USER.Equals(this.rayOrigin)) { s.Add(HashtableHelper.GetContentHashtable(TargetRaycast.CHILD, this.pathToChild)); if(!this.mouseTouch.Active()) { VectorHelper.ToHashtable(ref ht, this.rayDirection, "dx", "dy", "dz"); } } s.Add(HashtableHelper.GetContentHashtable(TargetRaycast.TARGETCHILD, this.pathToTarget)); VectorHelper.ToHashtable(ref ht, this.targetOffset, "tx", "ty", "tz"); if(s.Count > 0) ht.Add(XMLHandler.NODES, s); } return ht; }
/// <summary> /// 加载库存批号数量 /// </summary> private static string LoadWHStorgeLotQty(string p_SBitID) { string outstr = string.Empty; ArrayList al = new ArrayList();//临时ArrayList foreach (DataRow dr in m_StorgeData.Rows) { if (dr["SBitID"].ToString().ToUpper() == p_SBitID.ToUpper()) { string[] tempa = new string[] { dr["Batch"].ToString(), dr["Qty"].ToString(), dr["SBitCellID"].ToString() }; al.Add(tempa); //if (outstr != string.Empty) //{ // outstr += " "; //} //outstr += dr["Batch"].ToString() + "("+dr["Qty"].ToString()+")"; } } string[,] lastA = new string[al.Count, 3]; //最终序号 for (int i = 0; i < al.Count; i++) //复制数据 { string[] tempa = (string[])al[i]; lastA[i, 0] = tempa[0]; lastA[i, 1] = tempa[1]; lastA[i, 2] = tempa[2]; } int moveIndex = 0; string curBatch = string.Empty; string[] tempMoveA = new string[] { "", "", "" }; //整理无相邻批号的数据到最后BEGIN for (int i = 0; i < al.Count; i++) { curBatch = lastA[i, 0].ToUpper(); moveIndex = i; } //整理无相邻批号的数据到最后EN //整理相邻批号在一起BEGIN for (int i = 0; i < al.Count; i++) { curBatch = lastA[i, 0].ToUpper(); moveIndex = i; for (int j = i + 1; j < al.Count; j++) { if (lastA[j, 2].ToUpper() == curBatch)//找到临近的批号数据 { moveIndex = j; break; } } if (moveIndex != i && moveIndex != i + 1) //需要移动到相邻批号数据 { for (int k = 0; k < 3; k++) //把下一行数据移动到临时行 { tempMoveA[k] = lastA[i + 1, k]; } for (int k = 0; k < 3; k++)//把临近批号数据移动到下一行 { lastA[i + 1, k] = lastA[moveIndex, k]; } for (int k = 0; k < 3; k++)//把临时行数据移动到邻近批号行; { lastA[moveIndex, k] = tempMoveA[k]; } } } //整理相邻批号在一起END for (int i = 0; i < al.Count; i++) { if (outstr != string.Empty) { outstr += " "; } outstr += lastA[i, 0] + "(" + lastA[i, 1] + ")"; } return(outstr); }
public virtual bool runTest() { int iCountErrors = 0; int iCountTestcases = 0; Console.Error.WriteLine( s_strClassMethod + ": " + s_strTFName + " runTest started..." ); ArrayList list = null; ArrayList fixedList = null; String strLoc = "Loc_000oo"; try { strLoc = "Loc_001o1"; iCountTestcases++; list = new ArrayList(); if(list.IsFixedSize) { iCountErrors++; Console.WriteLine( "Err_983475dsg! wrong value returned" + list.IsFixedSize); } iCountTestcases++; try { for(int i=0; i<100;i++) { list.Add(i); } } catch(Exception ex) { iCountErrors++; Console.WriteLine( "Err_983475dsg! Exception thrown, " + ex.GetType().Name); } strLoc = "Loc_384sdg"; iCountTestcases++; list = new ArrayList(); fixedList = ArrayList.FixedSize(list); if(!fixedList.IsFixedSize) { iCountErrors++; Console.WriteLine( "Err_93745sdg! wrong value returned" + fixedList.IsFixedSize); } iCountTestcases++; try { fixedList.Add(100); iCountErrors++; Console.WriteLine( "Err_3947sdg! Exception not thrown"); } catch(NotSupportedException) { } catch(Exception ex) { iCountErrors++; Console.WriteLine( "Err_983475dsg! Exception thrown, " + ex.GetType().Name); } } catch (Exception exc_general ) { ++iCountErrors; Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy! strLoc=="+ strLoc +", exc_general==\n"+exc_general.ToString()); } Console.Error.Write( s_strClassMethod ); Console.Error.Write( ": " ); if ( iCountErrors == 0 ) { Console.Error.WriteLine( s_strTFName + " iCountTestcases==" + iCountTestcases + " paSs" ); return true; } else { Console.WriteLine( s_strTFName+ s_strTFPath ); Console.WriteLine( s_strTFName+ "FAiL" ); Console.Error.WriteLine( s_strTFName + " iCountErrors==" + iCountErrors ); return false; } }
public string GetTimeslotDetails() { string retVal = ""; lock (TimeSlotConfig) { for (int pos = 0; pos < TimeSlotConfig.Length; pos++) { Hashtable handlers = new Hashtable(); retVal += " ------------------------------------------------------------------------------------ - - - -" + Environment.NewLine; retVal += " | ARFCN: " + ArfcnMapRev[pos / 2]; switch ((eLinkDirection)(pos % 2)) { case eLinkDirection.Downlink: retVal += " Downlink" + Environment.NewLine; break; case eLinkDirection.Uplink: retVal += " Uplink" + Environment.NewLine; break; } retVal += " | TS || Handlers (FC=FCCH, SC=SCH, BC=BCCH, CC=CCCH, SD=SDCCH, SA=SACCH, TC=TCH" + Environment.NewLine; retVal += " |----||------------------------------------------------------------------------------ - - - -" + Environment.NewLine; sTimeSlotInfo[] info = TimeSlotConfig[pos / 2, pos % 2]; for (int slot = 0; slot < 8; slot++) { retVal += " | " + slot + " || "; if (info == null || info[slot].Handlers == null) { retVal += "(Unused)"; } else { for (int frame = 0; frame < info[slot].Handlers.Length; frame++) { Burst handler = info[slot].Handlers[frame].Burst; int seq = info[slot].Handlers[frame].Sequence; if (seq == 0) { if (frame != 0) { retVal += "|"; } } else { retVal += " "; } if (handler != null) { retVal += handler.ShortName; } else { retVal += " - "; } } } retVal += " |" + Environment.NewLine; } retVal += " ------------------------------------------------------------------------------------ - - - -" + Environment.NewLine; ArrayList lines = new ArrayList(); } if (LogBursts) { retVal += Environment.NewLine; retVal += "Handler details:" + Environment.NewLine; lock (UsedBursts) { foreach (NormalBurst burst in UsedBursts) { retVal += string.Format(" {0,12}: [Data: {1,6}] [Crypt: {2,6}] [Dummy: {3,6}] [{4}] - [{5}]" + Environment.NewLine, burst.Name, burst.DataBursts, burst.CryptedFrames, burst.DummyBursts, burst.AllocationTime, (burst.Released ? burst.ReleaseTime.ToString() : "now")); } } } } retVal += Environment.NewLine; return(retVal); }
/// <summary> /// 获得全是或操作的where /// </summary> /// <typeparam name="T">具体数据类型</typeparam> /// <param name="names">筛选名称</param> /// <param name="values">筛选值</param> /// <param name="signs">筛选符号,默认都是等于</param> /// <returns>返回where</returns> public Expression <Func <T, bool> > GetOrLambdaExpression <T>(ArrayList names, ArrayList values, ArrayList signs = null) { if (signs == null) { signs = NewDuplicateArray(SIGN.Equal, names.Count); } ArrayList andors = NewDuplicateArray(false, names.Count); return(GetAndOrLambdaExpression <T>(names, values, signs, andors)); }
/// <summary> /// 根据多重条件获得一个lambda表达式 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="names">筛选名称</param> /// <param name="values">筛选值</param> /// <param name="signs">筛选符号</param> /// <param name="andor">与或关系</param> /// <returns></returns> private Expression <Func <T, bool> > GetAndOrLambdaExpression <T>(ArrayList names, ArrayList values, ArrayList signs, ArrayList andor) //, bool bIsIn = false) { Expression expression_return = Expression.Constant(Convert.ToBoolean(andor[0])); //除非全或,否则第一个肯定是与关系 ParameterExpression expression_param = Expression.Parameter(typeof(T), "c"); for (int i = 0; i < names.Count; i++) { Expression equal = null; Expression left; List <Expression> right = new List <Expression>(); Type tp = GetPropertyInfo <T>(names[i].ToString()).PropertyType; //判断是否为nullable泛型类 if (tp.IsGenericType && tp.GetGenericTypeDefinition().Equals(typeof(Nullable <>))) { var left1 = GetMemberExpression(expression_param, names[i].ToString()); left = Expression.Convert(left1, tp.GetGenericArguments()[0]); tp = tp.GetGenericArguments()[0]; } else { left = GetMemberExpression(expression_param, names[i].ToString()); } if ((Convert.ToInt16(signs[i]) == SIGN.In) || (Convert.ToInt16(signs[i]) == SIGN.NotIn)) { string[] ss = values[i].ToString().Split(CosValue.SPLITOPERATOR2); foreach (string s in ss) { right.Add(Expression.Constant(Convert.ChangeType(s, tp))); } } else if ((Convert.ToInt16(signs[i]) == SIGN.Contain1) || (Convert.ToInt16(signs[i]) == SIGN.Contain2)) { right.Add(Expression.Constant(Convert.ChangeType(values[i], TypeCode.String))); } else { right.Add(Expression.Constant(Convert.ChangeType(values[i], tp))); } switch (Convert.ToInt16(signs[i])) { case SIGN.Equal: equal = Expression.Equal(left, right[0]); break; case SIGN.NotEqual: equal = Expression.NotEqual(left, right[0]); break; case SIGN.GreaterThanOrEqual: equal = Expression.GreaterThanOrEqual(left, right[0]); break; case SIGN.LessThanOrEqual: equal = Expression.LessThanOrEqual(left, right[0]); break; case SIGN.GreaterThan: equal = Expression.GreaterThan(left, right[0]); break; case SIGN.LessThan: equal = Expression.LessThan(left, right[0]); break; case SIGN.Like: equal = Expression.Call(left, typeof(string).GetMethod("Contains"), right); break; case SIGN.NotLike: equal = Expression.Not(Expression.Call(left, typeof(string).GetMethod("Contains"), right)); break; case SIGN.In: equal = Expression.Equal(left, right[0]); for (int k = 1; k < right.Count; k++) { var equal1 = Expression.Equal(left, right[k]); equal = Expression.Or(equal, equal1); } break; case SIGN.NotIn: equal = Expression.NotEqual(left, right[0]); for (int k = 1; k < right.Count; k++) { var equal1 = Expression.NotEqual(left, right[k]); equal = Expression.And(equal, equal1); } break; case SIGN.Contain1: equal = Expression.Equal(left, right[0]); List <Expression> right2 = new List <Expression>(); List <Expression> right3 = new List <Expression>(); List <Expression> right4 = new List <Expression>(); right2.Add(Expression.Constant(Convert.ChangeType(right[0].ToString().Trim('\"') + CosValue.SPLITOPERATOR1, TypeCode.String))); right3.Add(Expression.Constant(Convert.ChangeType(CosValue.SPLITOPERATOR1 + right[0].ToString().Trim('\"'), TypeCode.String))); right4.Add(Expression.Constant(Convert.ChangeType(CosValue.SPLITOPERATOR1 + right[0].ToString().Trim('\"') + CosValue.SPLITOPERATOR1, TypeCode.String))); MethodInfo startsWithMethod = typeof(string).GetMethod("StartsWith", new[] { typeof(string) }); MethodInfo endsWithMethod = typeof(string).GetMethod("EndsWith", new[] { typeof(string) }); var equal2 = Expression.Call(left, startsWithMethod, right2); var equal3 = Expression.Call(left, endsWithMethod, right3); var equal4 = Expression.Call(left, typeof(string).GetMethod("Contains"), right4); equal = Expression.Or(equal, equal2); equal = Expression.Or(equal, equal3); equal = Expression.Or(equal, equal4); break; case SIGN.Contain2: equal = Expression.Equal(left, right[0]); List <Expression> right5 = new List <Expression>(); List <Expression> right6 = new List <Expression>(); List <Expression> right7 = new List <Expression>(); right5.Add(Expression.Constant(Convert.ChangeType(right[0].ToString().Trim('\"') + CosValue.SPLITOPERATOR2, TypeCode.String))); right6.Add(Expression.Constant(Convert.ChangeType(CosValue.SPLITOPERATOR2 + right[0].ToString().Trim('\"'), TypeCode.String))); right7.Add(Expression.Constant(Convert.ChangeType(CosValue.SPLITOPERATOR2 + right[0].ToString().Trim('\"') + CosValue.SPLITOPERATOR2, TypeCode.String))); MethodInfo startsWithMethod2 = typeof(string).GetMethod("StartsWith", new[] { typeof(string) }); MethodInfo endsWithMethod2 = typeof(string).GetMethod("EndsWith", new[] { typeof(string) }); var equal5 = Expression.Call(left, startsWithMethod2, right5); var equal6 = Expression.Call(left, endsWithMethod2, right6); var equal7 = Expression.Call(left, typeof(string).GetMethod("Contains"), right7); equal = Expression.Or(equal, equal5); equal = Expression.Or(equal, equal6); equal = Expression.Or(equal, equal7); break; default: equal = Expression.Equal(left, right[0]); break; } if (Convert.ToBoolean(andor[i])) { expression_return = Expression.AndAlso(expression_return, equal); } else { expression_return = Expression.Or(expression_return, equal); } } return(Expression.Lambda <Func <T, bool> >(expression_return, new ParameterExpression[] { expression_param })); }
public SelectorActiveAxis(Asttree axisTree, ConstraintStruct cs) : base(axisTree) { this.KSs = new ArrayList(); this.cs = cs; }
/// <summary> /// <rexpr>=<Bexpr> |fun “(“ <arglist>“)” <retType> <Statments> “;” /// </summary> /// <param name="pb"></param> /// <returns></returns> public Stmt ParseReturnStatement(ProcedureBuilder pb) { GetNext(); //return fun (x numeric)numeric{..... if (Current_Token == TOKEN.TOK_FUNCTION) { GetNext(); pb.InitClsr(); pb.clsoure.Name = pb.Name + "1"; ///////////////////now parse for parameters//////////////////////////// if (Current_Token != TOKEN.TOK_OPAREN) { return(null); } GetNext(); // remove ( //(a int)||() ArrayList lst_types = new ArrayList(); while (Current_Token == TOKEN.TOK_UNQUOTED_STRING) { SYMBOL_INFO inf = new SYMBOL_INFO(); inf.SymbolName = last_str; GetNext(); if (Current_Token == TOKEN.TOK_VAR_BOOL || Current_Token == TOKEN.TOK_VAR_NUMBER || Current_Token == TOKEN.TOK_VAR_STRING) { inf.Type = (Current_Token == TOKEN.TOK_VAR_BOOL) ? TYPE_INFO.TYPE_BOOL : (Current_Token == TOKEN.TOK_VAR_NUMBER) ? TYPE_INFO.TYPE_NUMERIC : TYPE_INFO.TYPE_STRING; } else { return(null); } lst_types.Add(inf.Type); pb.clsoure.AddFormals(inf); pb.clsoure.AddLocal(inf); GetNext(); if (Current_Token != TOKEN.TOK_COMMA) { break; } GetNext(); } if (Current_Token != TOKEN.TOK_CPAREN) { return(null); } GetNext(); //parse for return type (= number/bool/function) if (!(Current_Token == TOKEN.TOK_VAR_BOOL || Current_Token == TOKEN.TOK_VAR_NUMBER || Current_Token == TOKEN.TOK_VAR_STRING || Current_Token == TOKEN.TOK_FUNCTION)) { return(null); } ///-------- Assign the return type pb.clsoure.TYPE = (Current_Token == TOKEN.TOK_VAR_BOOL) ? TYPE_INFO.TYPE_BOOL : (Current_Token == TOKEN.TOK_VAR_NUMBER) ? TYPE_INFO.TYPE_NUMERIC : (Current_Token == TOKEN.TOK_FUNCTION) ?TYPE_INFO.TYPE_FUNCTION:TYPE_INFO.TYPE_STRING; //////////////////////////////////// GetNext(); if (Current_Token != TOKEN.TOK_OCBR) { return(null); } GetNext(); ////***********/******************************************** ///add statments ArrayList lst = StatementList(pb.clsoure); foreach (Stmt st in lst) { pb.clsoure.AddStatement(st); } //ClsrStmt: if (Current_Token != TOKEN.TOK_CCBR) { throw new Exception("} expected in the function"); } return(null); } else { Exp exp = BExpr(pb); if (Current_Token != TOKEN.TOK_SEMI) { throw new Exception(pb.Name + "; expected "); } pb.TypeCheck(exp); return(new ReturnStatement(exp)); } }
/// <summary> /// <Procudure>::= fun identifier “(“ <arglist>“)” <retType> <Statments> /// Parse A Single Function. /// </summary> /// <returns></returns> //List of argument type ProcedureBuilder ParseFunction() { ProcedureBuilder p = new ProcedureBuilder("", new COMPILATION_CONTEXT()); if (Current_Token != TOKEN.TOK_FUNCTION) { return(null); } GetNext(); // parse function name if (Current_Token != TOKEN.TOK_UNQUOTED_STRING) { return(null); } p.Name = this.last_str; GetNext();//name ///////////////////now parse for parameters//////////////////////////// if (Current_Token != TOKEN.TOK_OPAREN) { return(null); } GetNext(); // remove ( //(a numeric)||() ArrayList lst_types = new ArrayList(); while (Current_Token == TOKEN.TOK_UNQUOTED_STRING) { SYMBOL_INFO inf = new SYMBOL_INFO(); inf.SymbolName = last_str; GetNext(); if (Current_Token == TOKEN.TOK_VAR_BOOL || Current_Token == TOKEN.TOK_VAR_NUMBER || Current_Token == TOKEN.TOK_VAR_STRING) { inf.Type = (Current_Token == TOKEN.TOK_VAR_BOOL) ? TYPE_INFO.TYPE_BOOL : (Current_Token == TOKEN.TOK_VAR_NUMBER) ? TYPE_INFO.TYPE_NUMERIC : TYPE_INFO.TYPE_STRING; } else { return(null); } lst_types.Add(inf.Type); p.AddFormals(inf); p.AddLocal(inf); GetNext(); if (Current_Token != TOKEN.TOK_COMMA) { break; } GetNext(); } if (Current_Token != TOKEN.TOK_CPAREN) {//(a int ... return(null); } //(a int) int GetNext(); ///parse for return type (= number/bool/function) if (!(Current_Token == TOKEN.TOK_VAR_BOOL || Current_Token == TOKEN.TOK_VAR_NUMBER || Current_Token == TOKEN.TOK_VAR_STRING || Current_Token == TOKEN.TOK_FUNCTION)) { return(null); } ///-------- Assign the return type p.TYPE = (Current_Token == TOKEN.TOK_VAR_BOOL) ? TYPE_INFO.TYPE_BOOL : (Current_Token == TOKEN.TOK_VAR_NUMBER) ? TYPE_INFO.TYPE_NUMERIC : (Current_Token == TOKEN.TOK_FUNCTION) ?TYPE_INFO.TYPE_FUNCTION:TYPE_INFO.TYPE_STRING; //FUNCTION_INFO cls= new FUNCTION_INFO("" prog.AddFunctionProtoType(p.Name, p.TYPE, lst_types); GetNext(); // remove return type /////////////////////addStmts/////// //if (Current_Token != TOKEN.TOK_OCBR) // return null; if (p.TYPE == TYPE_INFO.TYPE_FUNCTION) { while (Current_Token != TOKEN.TOK_OCBR) { GetNext(); } } if (Current_Token != TOKEN.TOK_OCBR) { return(null); } GetNext();// remove { ArrayList lst = StatementList(p); if (Current_Token != TOKEN.TOK_CCBR) { throw new Exception("} expected in the function"); } // Accumulate all statements to // Procedure builder // foreach (Stmt s in lst) { p.AddStatement(s); } return(p); }
public response Insert() { response toReturn = Validare(); if (!toReturn.Status) { return(toReturn); } PropertyInfo[] props = this.GetType().GetProperties(); ArrayList _parameters = new ArrayList(); var col = CommonFunctions.table_columns(authenticatedUserId, connectionString, "plati"); foreach (PropertyInfo prop in props) { if (col != null && col.ToUpper().IndexOf(prop.Name.ToUpper()) > -1) // ca sa includem in Array-ul de parametri doar coloanele tabelei, nu si campurile externe si/sau alte proprietati { string propName = prop.Name; string propType = prop.PropertyType.ToString(); object propValue = prop.GetValue(this, null); propValue = propValue ?? DBNull.Value; if (propType != null) { if (propName.ToUpper() != "ID") // il vom folosi doar la Edit! { _parameters.Add(new MySqlParameter(String.Format("_{0}", propName.ToUpper()), propValue)); } } } } DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "PLATIsp_insert", _parameters.ToArray()); toReturn = da.ExecuteInsertQuery(); if (toReturn.Status) { this.ID = toReturn.InsertedId; if (toReturn.Status) { try { Dosar d = new Dosar(authenticatedUserId, connectionString, Convert.ToInt32(this.ID_DOSAR)); d.UpdateCounterPlati(1); } catch (Exception exp) { LogWriter.Log(exp); } } if (toReturn.Status) { try { Dosar d = new Dosar(this.authenticatedUserId, this.connectionString, Convert.ToInt32(this.ID_DOSAR)); d.REZERVA_DAUNA -= this.SUMA; d.GetNewStatus(false); response r = d.Update(); if (!r.Status) { toReturn = r; } } catch (Exception exp) { toReturn = new response(false, exp.ToString(), null, null, new List <Error>() { new Error(exp) }); LogWriter.Log(exp); } } } return(toReturn); }
/// <summary> /// Create new cleared filter collection /// </summary> public FilterCollection() { _Frames = new ArrayList(); }
static void Main() { int[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; string[] conStrings = { "서울특별시", "대전", "수원시", "부산", "섬" }; // Aggregate Functions Console.WriteLine(numbers.Min()); Console.WriteLine(numbers.Where(x => x % 2 == 0).Min()); Console.WriteLine(numbers.Max()); Console.WriteLine(numbers.Sum()); Console.WriteLine(numbers.Count(x => x % 2 == 0)); Console.WriteLine(numbers.Average()); Console.WriteLine(numbers.Aggregate((a, b) => a * b)); Console.WriteLine(Enumerable.Range(1, 10).Aggregate((a, b) => a + b)); Enumerable.Repeat("Hello", 10).ToList().ForEach(x => Console.WriteLine(x)); Console.WriteLine("-----------------------------------"); Console.WriteLine(conStrings.Min(x => x.Length)); Console.WriteLine(conStrings.First(x => x.Length == 2).ToString()); Console.WriteLine(conStrings.OrderByDescending(s => s).First(s => s.Contains("시")).ToString()); Console.WriteLine(conStrings.Aggregate((a, b) => a + ", " + b)); conStrings.ToList().Where(x => x.Contains("시")).ToList() .ForEach(c => Console.WriteLine(c.ToString())); Console.WriteLine("-----------------------------------"); // Restriction Operators var result = numbers.ToList() .Select((num, index) => new { Numbers = num, Index = index }) .Where(x => x.Numbers % 2 != 0); //.Select(x => x.Index); foreach (var item in result) { Console.WriteLine($"{item} : {item.Numbers} {item.Index}"); } var resultEmp = Employee.GetAllEmployees() .Where(x => x.Salary >= 2000) .Select(e => new { e.ID, e.Name, e.Gender, MonthlySalary = e.Salary / 12 }); foreach (var item in resultEmp) { Console.WriteLine($"{item.ID} {item.Name} {item.Gender} {item.MonthlySalary}"); } Console.WriteLine("-----------------------------------"); // SelectMany Operator string[] stringArray = { "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "0123456789" }; var resultChar = stringArray.SelectMany(s => s); foreach (var c in resultChar) { Console.WriteLine(c); } // var sj = from student in Student.GetAllStudents() // from subject in student.Subjects // select subject; var subjects = Student.GetAllStudents().SelectMany(s => s.Subjects).Distinct(); foreach (var item in subjects) { Console.WriteLine($"{item}"); } var subjects1 = Student.GetAllStudents() .SelectMany(s => s.Subjects, (student, subject) => new { StudentName = student.Name, SubjectName = subject }); foreach (var item in subjects1) { Console.WriteLine($"{item.StudentName} {item.SubjectName}"); } Console.WriteLine("-----------------------------------"); // Ordering Operators var r = Employee.GetAllEmployees() .OrderByDescending(s => s.Name) .OrderBy(s => s.Gender) .ThenBy(s => s.Salary) .Reverse(); foreach (var student in r) { Console.WriteLine(student.Name); } Console.WriteLine("-----------------------------------"); // Partitioning Operators var c1 = conStrings.Take(3); foreach (var i in c1) Console.WriteLine("c1: " + i); var c2 = conStrings.Skip(3); foreach (var i in c2) Console.WriteLine("c2: " + i); var c3 = conStrings.TakeWhile(s => s.Length >= 2); foreach (var i in c3) Console.WriteLine("c3: " + i); var c4 = conStrings.SkipWhile(s => s.Length > 2); foreach (var i in c4) Console.WriteLine("c4: " + i); // pagiing //students.Skip((pageNumber - 1) * pageSize).Take(pageSize) Console.WriteLine("-----------------------------------"); // Cast and OfType operators // ToList:Cast, ToArray:OfType, ToDictionary:AsEnumerable, ToLookup:AsQueryable ArrayList list = new ArrayList { 1, 2, 3, "ABC", "DEF" }; IEnumerable<int> r1 = list.OfType<int>(); foreach (int i in r1) Console.WriteLine(i); Console.WriteLine("-----------------------------------"); // GroupBy var empGroup = Employee.GetAllEmployees().GroupBy(x => x.Gender); foreach (var i in empGroup) { Console.WriteLine(i.Key + " c: " + i.Count()); Console.WriteLine(i.Key + " x: " + i.Count(x => x.Gender == "M")); Console.WriteLine(i.Key + " m: " + i.Max(x => x.Salary)); Console.WriteLine(i.Key + " s: " + i.Sum(x => x.Salary)); } Console.WriteLine("-----------------------------------"); // Group by multiple var e1 = Employee.GetAllEmployees() .GroupBy(x => new { x.Department, x.Gender }) .OrderBy(g => g.Key.Department).ThenBy(g => g.Key.Gender) .Select(g => new { Dept = g.Key.Department, g.Key.Gender, Employees = g.OrderBy(x => x.Name) }); foreach (var i in e1) Console.WriteLine(i.Dept + "/" + i.Gender + "/" + i.Employees.Count()); Console.WriteLine("-----------------------------------"); // Element Operations int[] num = { }; //Console.WriteLine(num.First()); Console.WriteLine(num.FirstOrDefault()); Console.WriteLine(numbers.First(x => x % 2 == 0)); Console.WriteLine(numbers.ElementAt(1)); Console.WriteLine(numbers.Where(x => x == 1).Single()); //Single:sequence var r2 = num.DefaultIfEmpty(100); foreach (var i in r2) Console.WriteLine(i); Console.WriteLine("-----------------------------------"); // Group Join // var query = dept.Join(emp, d => d.DeptNO, e => e.Department.DeptNO, (d, e) => // new {d.DeptNO, d.DeptName, e.EmpNO, e.EmpName}); /* var result = Employee.GetAllEmployees() .GroupJoin(Department.GetAllDepartments(), e => e.DepartmnetID d => d.ID, (emp, depts) => new {emp, depts}) .SelectMany(z => z.depts.DefaultIfEmpty(), (a, b) => new { EmployeeName = a.emp.Name, DepartmentName = b == null ? "No Department" : b.Name } */ // Set operators string[] con = { "KR", "kr", "KO", "KO", "ko" }; con.Distinct().ToList().ForEach(x => Console.WriteLine(x)); Console.WriteLine("-----------------------------------"); con.Distinct(StringComparer.OrdinalIgnoreCase).ToList().ForEach(x => Console.WriteLine(x)); int[] num1 = { 1, 2, 3, 7 }; int[] num2 = { 4, 5, 6, 7 }; num1.Concat(num2).ToList().ForEach(x => Console.WriteLine(x)); Console.WriteLine("-----------------------------------"); num1.Union(num2).ToList().ForEach(x => Console.WriteLine(x)); Console.WriteLine("-----------------------------------"); num1.Intersect(num2).ToList().ForEach(x => Console.WriteLine(x)); Console.WriteLine("-----------------------------------"); num1.Except(num2).ToList().ForEach(x => Console.WriteLine(x)); // SequenceEqual Operator string[] con1 = {"ABC", "DF"}; string[] con2 = {"abc", "df"}; Console.WriteLine(con1.SequenceEqual(con2).ToString()); Console.WriteLine(con1.SequenceEqual(con2, StringComparer.OrdinalIgnoreCase).ToString()); }
private ArrayList myGetFiles(Neusoft.HISFC.Models.File.DataFileParam param, string strSql) { ArrayList al = new ArrayList(); Neusoft.HISFC.Models.File.DataFileInfo DataFileInfo = null; if (this.ExecQuery(strSql) == -1) { return(null); } while (this.Reader.Read()) { DataFileInfo = new Neusoft.HISFC.Models.File.DataFileInfo(); DataFileInfo.Param = (Neusoft.HISFC.Models.File.DataFileParam)param.Clone(); // TODO: 添加 DataFileInfo.GetList 实现 try { DataFileInfo.ID = this.Reader[0].ToString();//文件编号 } catch { } try { DataFileInfo.Param.ID = this.Reader[1].ToString();//参数名 } catch { } try { DataFileInfo.Param.Type = this.Reader[2].ToString();//系统类型 0 电子病历 1 手术申请单 } catch { } try { DataFileInfo.Type = this.Reader[3].ToString();//文件类型 数据文件 模板文件 } catch { } try { DataFileInfo.Name = this.Reader[4].ToString();//文件名 说明名称 } catch { } try { DataFileInfo.Param.Http = this.Reader[5].ToString();//http } catch { } try { DataFileInfo.Param.IP = this.Reader[6].ToString();//主机名 } catch { } try { DataFileInfo.Param.Folders = this.Reader[7].ToString();//路径名 } catch { } try { DataFileInfo.Param.FileName = this.Reader[8].ToString();//文件名 } catch { } try { DataFileInfo.Index1 = this.Reader[9].ToString();//索引1 } catch { } try { DataFileInfo.Index2 = this.Reader[10].ToString();//索引2 } catch { } try { DataFileInfo.Memo = this.Reader[11].ToString();//备注 } catch { } try { DataFileInfo.DataType = this.Reader[12].ToString();//特定类型 } catch { } try { DataFileInfo.valid = Neusoft.FrameWork.Function.NConvert.ToInt32(this.Reader[13].ToString());//有效标志 } catch { } try { DataFileInfo.UseType = Neusoft.FrameWork.Function.NConvert.ToInt32(this.Reader[14].ToString()); //用户类型 DataFileInfo.Count = Neusoft.FrameWork.Function.NConvert.ToInt32(this.Reader[15].ToString()); //使用次数 } catch { } al.Add(DataFileInfo); } this.Reader.Close(); return(al); }
private void FillTableSingleSku(string sku, OleDbConnection cnn) { AddFirstRow(); TableRow tr; TableCell tc; Label labSku; HiddenField hidSku; TextBox txCodMaga; //TextBox txTipoR; DropDownList dropTipoR; CheckBox chklav; TextBox txQtS; CheckBox chkMCS; DropDownList dropVett; ImageButton imgB; DataTable vettori = UtilityMaietta.Vettore.GetVettori(cnn); ArrayList risposte = AmazonOrder.Comunicazione.GetAllRisposte(amzSettings.amzComunicazioniFile, aMerchant); int count = 0; { tr = new TableRow(); //SKU tc = new TableCell(); labSku = new Label(); labSku.ID = "labSku#" + sku + "#si" + count.ToString(); labSku.Text = sku; hidSku = new HiddenField(); hidSku.ID = "hidSku#" + sku + "#si" + count.ToString(); hidSku.Value = sku; tc.Controls.Add(labSku); tc.Controls.Add(hidSku); tr.Cells.Add(tc); //CODICE MAGA tc = new TableCell(); txCodMaga = new TextBox(); txCodMaga.ID = "txCodMaga#" + sku; txCodMaga.Text = (AmazonOrder.SKUItem.SkuExistsMaFra(cnn, sku) ? sku.ToUpper() : ""); tc.Controls.Add(txCodMaga); tr.Cells.Add(tc); //TIPO RISPOSTA tc = new TableCell(); dropTipoR = new DropDownList(); dropTipoR.ID = "dropTpr#" + sku; dropTipoR.Width = 160; dropTipoR.DataSource = risposte; dropTipoR.DataTextField = "nome"; dropTipoR.DataValueField = "id"; dropTipoR.DataBind(); tc.Controls.Add(dropTipoR); /*txTipoR = new TextBox(); * txTipoR.ID = "txTpr#" + oi.sellerSKU; * txTipoR.Width = 30; * tc.Controls.Add(txTipoR);*/ tr.Cells.Add(tc); //LAVORAZIONE tc = new TableCell(); chklav = new CheckBox(); chklav.ID = "chkLav#" + sku; tc.Controls.Add(chklav); tr.Cells.Add(tc); //QT SCARICARE tc = new TableCell(); txQtS = new TextBox(); txQtS.ID = "txQtS#" + sku; txQtS.Width = 30; tc.Controls.Add(txQtS); tr.Cells.Add(tc); //OFFERTA tc = new TableCell(); chkMCS = new CheckBox(); chkMCS.ID = "chkMCS#" + sku; tc.Controls.Add(chkMCS); tr.Cells.Add(tc); //VETTORE tc = new TableCell(); dropVett = new DropDownList(); dropVett.ID = "dropVett#" + sku; dropVett.DataSource = vettori; dropVett.DataTextField = "sigla"; dropVett.DataValueField = "id"; dropVett.DataBind(); dropVett.SelectedValue = amzSettings.amzDefVettoreID.ToString(); tc.Controls.Add(dropVett); tr.Cells.Add(tc); // AGGIUNGI RIGA tc = new TableCell(); imgB = new ImageButton(); imgB.ID = "add_" + sku; imgB.ImageUrl = "pics/add.png"; imgB.Width = 35; imgB.Height = 35; imgB.OnClientClick = "return addRow(this);"; tc.Controls.Add(imgB); tr.Cells.Add(tc); if ((count % 2) != 0) { tr.BackColor = System.Drawing.Color.LightGray; } tabCodes.Rows.Add(tr); count++; } }
// Copyright (c) 2008 - 2011, Pure Krome // All rights reserved. // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. // * Neither the name of World Domination Technologies nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. public static string Compress(string css, int columnWidth) { if (string.IsNullOrEmpty(css)) { throw new ArgumentNullException("css"); } int totalLen = css.Length; int startIndex = 0; ArrayList comments = new ArrayList(); ArrayList preservedTokens = new ArrayList(); int max; while ((startIndex = css.IndexOf(@"/*", startIndex, StringComparison.OrdinalIgnoreCase)) >= 0) { var endIndex = css.IndexOf(@"*/", startIndex + 2, StringComparison.OrdinalIgnoreCase); if (endIndex < 0) { endIndex = totalLen; } // Note: java substring-length param = end index - 2 (which is end index - (startindex + 2)) var token = css.Substring(startIndex + 2, endIndex - (startIndex + 2)); comments.Add(token); var newResult = css.Replace(startIndex + 2, endIndex, "___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + (comments.Count - 1) + "___"); //var newResult = css.Substring(startIndex + 2, endIndex - (startIndex + 2)) + "___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + // (comments.Count - 1) + "___" + css.Substring(endIndex + 1); startIndex += 2; css = newResult; } // Preserve strings so their content doesn't get accidently minified StringBuilder stringBuilder = new StringBuilder(); Regex pattern = new Regex("(\"([^\\\\\"]|\\\\.|\\\\)*\")|(\'([^\\\\\']|\\\\.|\\\\)*\')"); Match match = pattern.Match(css); int index = 0; while (match.Success) { string text = match.Groups[0].Value; if (!string.IsNullOrEmpty(text)) { var token = match.Value; char quote = token[0]; // Java code: token.substring(1, token.length() -1) .. but that's ... // token.substring(start index, end index) .. while .NET it's length for the 2nd arg. token = token.Substring(1, token.Length - 2); // Maybe the string contains a comment-like substring? // one, maybe more? put'em back then. if (token.IndexOf("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_") >= 0) { max = comments.Count; for (int i = 0; i < max; i += 1) { token = token.Replace("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___", comments[i].ToString()); } } // Minify alpha opacity in filter strings. token = token.RegexReplace("(?i)progid:DXImageTransform.Microsoft.Alpha\\(Opacity=", "alpha(opacity="); preservedTokens.Add(token); var preserver = quote + "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.Count - 1) + "___" + quote; index = match.AppendReplacement(stringBuilder, css, preserver, index); match = match.NextMatch(); } } stringBuilder.AppendTail(css, index); css = stringBuilder.ToString(); // Strings are safe, now wrestle the comments. max = comments.Count; for (int i = 0; i < max; i += 1) { string token = comments[i].ToString(); var placeholder = "___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___"; // ! in the first position of the comment means preserve // so push to the preserved tokens while stripping the ! if (token.StartsWith("!")) { preservedTokens.Add(token); css = css.Replace(placeholder, "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.Count - 1) + "___"); continue; } // \ in the last position looks like hack for Mac/IE5 // shorten that to /*\*/ and the next one to /**/ if (token.EndsWith("\\")) { preservedTokens.Add("\\"); css = css.Replace(placeholder, "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.Count - 1) + "___"); i = i + 1; // attn: advancing the loop. preservedTokens.Add(string.Empty); css = css.Replace("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___", "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.Count - 1) + "___"); continue; } // keep empty comments after child selectors (IE7 hack) // e.g. html >/**/ body if (token.Length == 0) { startIndex = css.IndexOf(placeholder); if (startIndex > 2) { if (css[startIndex - 3] == '>') { preservedTokens.Add(string.Empty); css = css.Replace(placeholder, "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.Count - 1) + "___"); } } } // In all other cases kill the comment. css = css.Replace("/*" + placeholder + "*/", string.Empty); } // Normalize all whitespace strings to single spaces. Easier to work with that way. css = css.RegexReplace("\\s+", " "); // Remove the spaces before the things that should not have spaces before them. // But, be careful not to turn "p :link {...}" into "p:link{...}" // Swap out any pseudo-class colons with the token, and then swap back. stringBuilder = new StringBuilder(); pattern = new Regex("(^|\\})(([^\\{:])+:)+([^\\{]*\\{)"); match = pattern.Match(css); index = 0; while (match.Success) { string text = match.Value; text = text.Replace(":", "___YUICSSMIN_PSEUDOCLASSCOLON___"); text = text.Replace("\\\\", "\\\\\\\\"); text = text.Replace("\\$", "\\\\\\$"); index = match.AppendReplacement(stringBuilder, css, text, index); match = match.NextMatch(); } stringBuilder.AppendTail(css, index); css = stringBuilder.ToString(); // Remove spaces before the things that should not have spaces before them. css = css.RegexReplace("\\s+([!{};:>+\\(\\)\\],])", "$1"); // Bring back the colon. css = css.RegexReplace("___YUICSSMIN_PSEUDOCLASSCOLON___", ":"); // Retain space for special IE6 cases. css = css.RegexReplace(":first\\-(line|letter)(\\{|,)", ":first-$1 $2"); // no space after the end of a preserved comment. css = css.RegexReplace("\\*/ ", "*/"); // If there is a @charset, then only allow one, and push to the top of the file. css = css.RegexReplace("^(.*)(@charset \"[^\"]*\";)", "$2$1"); css = css.RegexReplace("^(\\s*@charset [^;]+;\\s*)+", "$1"); // Put the space back in some cases, to support stuff like // @media screen and (-webkit-min-device-pixel-ratio:0){ css = css.RegexReplace("\\band\\(", "and ("); // Remove the spaces after the things that should not have spaces after them. css = css.RegexReplace("([!{}:;>+\\(\\[,])\\s+", "$1"); // remove unnecessary semicolons. css = css.RegexReplace(";+}", "}"); // Replace 0(px,em,%) with 0. css = css.RegexReplace("([\\s:])(0)(px|em|%|in|cm|mm|pc|pt|ex)", "$1$2"); // Replace 0 0 0 0; with 0. css = css.RegexReplace(":0 0 0 0(;|})", ":0$1"); css = css.RegexReplace(":0 0 0(;|})", ":0$1"); css = css.RegexReplace(":0 0(;|})", ":0$1"); // Replace background-position:0; with background-position:0 0; // same for transform-origin stringBuilder = new StringBuilder(); pattern = new Regex("(?i)(background-position|transform-origin|webkit-transform-origin|moz-transform-origin|o-transform-origin|ms-transform-origin):0(;|})"); match = pattern.Match(css); index = 0; while (match.Success) { index = match.AppendReplacement(stringBuilder, css, match.Groups[1].Value.ToLowerInvariant() + ":0 0" + match.Groups[2], index); match = match.NextMatch(); } stringBuilder.AppendTail(css, index); css = stringBuilder.ToString(); // Replace 0.6 to .6, but only when preceded by : or a white-space. css = css.RegexReplace("(:|\\s)0+\\.(\\d+)", "$1.$2"); // Shorten colors from rgb(51,102,153) to #336699 // This makes it more likely that it'll get further compressed in the next step. stringBuilder = new StringBuilder(); pattern = new Regex("rgb\\s*\\(\\s*([0-9,\\s]+)\\s*\\)"); match = pattern.Match(css); index = 0; int value; while (match.Success) { string[] rgbcolors = match.Groups[1].Value.Split(','); StringBuilder hexcolor = new StringBuilder("#"); foreach (string rgbColour in rgbcolors) { if (!Int32.TryParse(rgbColour, out value)) { value = 0; } if (value < 16) { hexcolor.Append("0"); } hexcolor.Append(value.ToHexString().ToLowerInvariant()); } index = match.AppendReplacement(stringBuilder, css, hexcolor.ToString(), index); match = match.NextMatch(); } stringBuilder.AppendTail(css, index); css = stringBuilder.ToString(); // Shorten colors from #AABBCC to #ABC. Note that we want to make sure // the color is not preceded by either ", " or =. Indeed, the property // filter: chroma(color="#FFFFFF"); // would become // filter: chroma(color="#FFF"); // which makes the filter break in IE. stringBuilder = new StringBuilder(); pattern = new Regex("([^\"'=\\s])(\\s*)#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])"); match = pattern.Match(css); index = 0; while (match.Success) { // Test for AABBCC pattern. if (match.Groups[3].Value.EqualsIgnoreCase(match.Groups[4].Value) && match.Groups[5].Value.EqualsIgnoreCase(match.Groups[6].Value) && match.Groups[7].Value.EqualsIgnoreCase(match.Groups[8].Value)) { var replacement = String.Concat(match.Groups[1].Value, match.Groups[2].Value, "#", match.Groups[3].Value, match.Groups[5].Value, match.Groups[7].Value); index = match.AppendReplacement(stringBuilder, css, replacement, index); } else { index = match.AppendReplacement(stringBuilder, css, match.Value, index); } match = match.NextMatch(); } stringBuilder.AppendTail(css, index); css = stringBuilder.ToString(); // border: none -> border:0 stringBuilder = new StringBuilder(); pattern = new Regex("(?i)(border|border-top|border-right|border-bottom|border-right|outline|background):none(;|})"); match = pattern.Match(css); index = 0; while (match.Success) { var replacement = match.Groups[1].Value.ToLowerInvariant() + ":0" + match.Groups[2].Value; index = match.AppendReplacement(stringBuilder, css, replacement, index); match = match.NextMatch(); } stringBuilder.AppendTail(css, index); css = stringBuilder.ToString(); // Shorter opacity IE filter. css = css.RegexReplace("(?i)progid:DXImageTransform.Microsoft.Alpha\\(Opacity=", "alpha(opacity="); // Remove empty rules. css = css.RegexReplace("[^\\}\\{/;]+\\{\\}", string.Empty); if (columnWidth >= 0) { // Some source control tools don't like it when files containing lines longer // than, say 8000 characters, are checked in. The linebreak option is used in // that case to split long lines after a specific column. int i = 0; int linestartpos = 0; stringBuilder = new StringBuilder(css); while (i < stringBuilder.Length) { char c = stringBuilder[i++]; if (c == '}' && i - linestartpos > columnWidth) { stringBuilder.Insert(i, '\n'); linestartpos = i; } } css = stringBuilder.ToString(); } // Replace multiple semi-colons in a row by a single one. // See SF bug #1980989. css = css.RegexReplace(";;+", ";"); // Restore preserved comments and strings. max = preservedTokens.Count; for (int i = 0; i < max; i++) { css = css.Replace("___YUICSSMIN_PRESERVED_TOKEN_" + i + "___", preservedTokens[i].ToString()); } // Trim the final string (for any leading or trailing white spaces). css = css.Trim(); // Write the output... return(css); }
private void mnuImport_Click(object sender, EventArgs e) { try { ArrayList customerList = new ArrayList(); string filePath = ""; string readline = ""; bool isquotation = false; int pointer = 0; int startIndex = 0; int fieldIndex = 0; string[] recordFields; FileStream fileStream; StreamReader streamReader; dgvCustomer.Rows.Clear(); openFileDialog1.ShowDialog(); filePath = openFileDialog1.FileName; //Validating file existence and file type of selected file if (File.Exists(filePath) && Path.GetExtension(filePath) == ".txt") { //Open file as Read fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read); streamReader = new StreamReader(fileStream); //Set pointer to read from start of file streamReader.BaseStream.Seek(0, SeekOrigin.Begin); //read the first line and check the file contain valid data readline = streamReader.ReadLine(); if (!readline.Substring(0, 9).Equals("Customer,")) { throw new System.ArgumentException("Wrong File Selected!"); } //if selected file is valis, set the gridview headers GridSettings(readline); //start reading records from file till Last Record defined by "." while ((readline = streamReader.ReadLine()) != null && readline != ".") { //if record is empty, escaped to next record if (readline.Length == 0) { readline = streamReader.ReadLine(); continue; } startIndex = 0; fieldIndex = 0; recordFields = new string[4]; isquotation = false; pointer = 0; //serch till end of record while (pointer < readline.Length) { /*check every character in record until finding ',' * if before finding ',' it was a '"' in record, ignore the ',' until you find another '"'*/ while (pointer < readline.Length && (isquotation || readline[pointer] != ',')) { //if current character is '"', change value of isquotation if (readline[pointer] == '"') { isquotation = !isquotation; } pointer++; } //extratct the found field by substring from record recordFields[fieldIndex] = readline.Substring(startIndex, pointer - startIndex); pointer++; fieldIndex++; //Set start Index to position of first character of next field startIndex = pointer; } //create a new object of CustomerLoan from extracted fields and add to an arraylist customerList.Add(new customerLoan(recordFields[0].Replace("\"", ""), double.Parse(recordFields[1]), double.Parse(recordFields[2]), int.Parse(recordFields[3]))); } streamReader.Close(); fileStream.Close(); //fill all records in arraylist to datagrid FillGridView(customerList, dgvCustomer); } else { throw new System.ArgumentException("Selected wrong File Type!"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Crosskey", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 创建总的区分类图 /// </summary> /// <param name="p_Parent"></param> /// <param name="p_SectionParam"></param> /// <param name="p_SBitParam"></param> private static void CreatePanel(GroupControl p_Parent, ArrayList p_WHPicParam, ArrayList p_WHPicParam2, ToolTip p_Tip) { for (int i = 0; i < p_WHPicParam.Count; i++) { string[] tempa = (string[])p_WHPicParam[i]; CreateOnePanel(p_Parent, SysConvert.ToInt32(tempa[0]), SysConvert.ToInt32(tempa[1]), SysConvert.ToInt32(tempa[2]), SysConvert.ToInt32(tempa[3]), tempa[4], (ArrayList)p_WHPicParam2[i], p_Tip); } }
// Loader routine to handle XML public void RulesetLoader() { Ruleset = new ArrayList(); XmlDocument xdoc = new XmlDocument(); string filePath = Path.Combine("Data", "TourneyStone.xml"); if (!File.Exists(filePath)) throw (new FileNotFoundException()); xdoc.Load(filePath); XmlElement root = xdoc["Ruleset"]; RulesetVersion = Convert.ToDouble(Accounts.GetAttribute(root, "version", "0")); // Rules foreach (XmlElement node in root.GetElementsByTagName("Rule")) { try { Rule ReadRule = new Rule(); ReadRule.Desc = Accounts.GetText(node["Desc"], ""); ReadRule.FailText = Accounts.GetText(node["FailText"], ""); // Conditions ReadRule.Conditions = new ArrayList(); foreach (XmlElement ConNode in node.GetElementsByTagName("Condition")) { string rDef = Accounts.GetText(ConNode["Typ"], ""); RuleCondition RuleCon; if (rDef == "Property") { RuleCon = new PropertyCondition(); } else if (rDef == "ItemProperty") { RuleCon = new ItemPropertyCondition(); } else if (rDef == "Item") { RuleCon = new ItemCondition(); } else continue; RuleCon.Quantity = Accounts.GetInt32(Accounts.GetText(ConNode["Quantity"], ""), 0); RuleCon.Property = Accounts.GetText(ConNode["Property"], ""); RuleCon.PropertyVal = Accounts.GetText(ConNode["PropertyVal"], ""); RuleCon.Limit = Accounts.GetInt32(Accounts.GetText(ConNode["Limit"], ""), 0); string sItemType = Accounts.GetText(ConNode["ItemType"], ""); string Configurable = Accounts.GetText(ConNode["Configurable"], ""); if (Configurable.ToUpper() == "TRUE") RuleCon.Configurable = true; else RuleCon.Configurable = false; // Divine the type from the string if there is one if (sItemType != "") { Type tItemType = ScriptCompiler.FindTypeByName(sItemType); if (tItemType != null) RuleCon.ItemType = tItemType; } RuleCon.Rule = ReadRule; ReadRule.Conditions.Add(RuleCon); } // Default activation to false (set through gump + // deserialization process) ReadRule.Active = false; // Add to the stone's RuleSet Ruleset.Add(ReadRule); } catch (Exception e) { Console.WriteLine("TourneyStoneaddon : Exception reading XML - {0}", e); } } }
/// <summary> /// 创建 /// </summary> /// <param name="p_Parent"></param> /// <param name="p_X"></param> /// <param name="p_Y"></param> /// <param name="p_Caption"></param> /// <param name="p_Value"></param> /// <param name="p_SectionParam"></param> private static void CreateOnePanel(GroupControl p_Parent, int p_X, int p_Y, int p_Width, int p_Height, string p_Caption, ArrayList p_SectionParam, ToolTip p_Tip) { GroupControl whpicGroup = new GroupControl(); whpicGroup.Text = p_Caption; whpicGroup.Tag = p_Caption; whpicGroup.Left = p_X * m_MinPixel; whpicGroup.Top = p_Y * m_MinPixel; whpicGroup.Width = p_Width * m_MinPixel; whpicGroup.Height = p_Height * m_MinPixel; whpicGroup.AutoScroll = true; whpicGroup.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple; p_Parent.Controls.Add(whpicGroup); for (int i = 0; i < p_SectionParam.Count; i++) { string[] tempa = (string[])p_SectionParam[i]; CreateOneSection(whpicGroup, SysConvert.ToInt32(tempa[0]), SysConvert.ToInt32(tempa[1]), SysConvert.ToInt32(tempa[2]), SysConvert.ToInt32(tempa[3]), tempa[4], tempa[5], p_Tip); } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack) { var targetNodeID = int.Parse(NodeIDTo.SelectedValue); var targetPublishmentSystemID = int.Parse(PublishmentSystemIDDropDownList.SelectedValue); var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetPublishmentSystemID); var isChecked = false; var checkedLevel = 0; if (targetPublishmentSystemInfo.CheckContentLevel == 0 || AdminUtility.HasChannelPermissions(Body.AdministratorName, targetPublishmentSystemID, targetNodeID, AppManager.Cms.Permission.Channel.ContentAdd, AppManager.Cms.Permission.Channel.ContentCheck)) { isChecked = true; checkedLevel = 0; } else { var UserCheckLevel = 0; var OwnHighestLevel = false; if (AdminUtility.HasChannelPermissions(Body.AdministratorName, targetPublishmentSystemID, targetNodeID, AppManager.Cms.Permission.Channel.ContentCheckLevel1)) { UserCheckLevel = 1; if (AdminUtility.HasChannelPermissions(Body.AdministratorName, targetPublishmentSystemID, targetNodeID, AppManager.Cms.Permission.Channel.ContentCheckLevel2)) { UserCheckLevel = 2; if (AdminUtility.HasChannelPermissions(Body.AdministratorName, targetPublishmentSystemID, targetNodeID, AppManager.Cms.Permission.Channel.ContentCheckLevel3)) { UserCheckLevel = 3; if (AdminUtility.HasChannelPermissions(Body.AdministratorName, targetPublishmentSystemID, targetNodeID, AppManager.Cms.Permission.Channel.ContentCheckLevel4)) { UserCheckLevel = 4; if (AdminUtility.HasChannelPermissions(Body.AdministratorName, targetPublishmentSystemID, targetNodeID, AppManager.Cms.Permission.Channel.ContentCheckLevel5)) { UserCheckLevel = 5; } } } } } if (UserCheckLevel >= targetPublishmentSystemInfo.CheckContentLevel) { OwnHighestLevel = true; } if (OwnHighestLevel) { isChecked = true; checkedLevel = 0; } else { isChecked = false; checkedLevel = UserCheckLevel; } } try { var translateType = ETranslateTypeUtils.GetEnumType(TranslateType.SelectedValue); var nodeIDStrArrayList = ControlUtils.GetSelectedListControlValueArrayList(NodeIDFrom); var nodeIDArrayList = new ArrayList();//需要转移的栏目ID foreach (string nodeIDStr in nodeIDStrArrayList) { var nodeID = int.Parse(nodeIDStr); if (translateType != ETranslateType.Content)//需要转移栏目 { if (!NodeManager.IsAncestorOrSelf(PublishmentSystemId, nodeID, targetNodeID)) { nodeIDArrayList.Add(nodeID); } } if (translateType == ETranslateType.Content)//转移内容 { TranslateContent(targetPublishmentSystemInfo, nodeID, targetNodeID, isChecked, checkedLevel); } } if (translateType != ETranslateType.Content)//需要转移栏目 { var nodeIDArrayListToTranslate = new ArrayList(nodeIDArrayList); foreach (int nodeID in nodeIDArrayList) { var subNodeIDArrayList = DataProvider.NodeDao.GetNodeIdListForDescendant(nodeID); if (subNodeIDArrayList != null && subNodeIDArrayList.Count > 0) { foreach (int nodeIDToDelete in subNodeIDArrayList) { if (nodeIDArrayListToTranslate.Contains(nodeIDToDelete)) { nodeIDArrayListToTranslate.Remove(nodeIDToDelete); } } } } var nodeInfoList = new List <NodeInfo>(); foreach (int nodeID in nodeIDArrayListToTranslate) { var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeID); nodeInfoList.Add(nodeInfo); } TranslateChannelAndContent(nodeInfoList, targetPublishmentSystemID, targetNodeID, translateType, isChecked, checkedLevel, null, null); if (IsDeleteAfterTranslate.Visible && EBooleanUtils.Equals(IsDeleteAfterTranslate.SelectedValue, EBoolean.True)) { foreach (int nodeID in nodeIDArrayListToTranslate) { try { DataProvider.NodeDao.Delete(nodeID); } catch { } } } } Submit.Enabled = false; var builder = new StringBuilder(); foreach (ListItem listItem in NodeIDFrom.Items) { if (listItem.Selected) { builder.Append(listItem.Text).Append(","); } } if (builder.Length > 0) { builder.Length = builder.Length - 1; } Body.AddSiteLog(PublishmentSystemId, "批量转移", $"栏目:{builder},转移后删除:{IsDeleteAfterTranslate.SelectedValue}"); SuccessMessage("批量转移成功!"); if (Body.IsQueryExists("ChannelIDCollection")) { PageUtils.Redirect(returnUrl); } else { PageUtils.Redirect(GetRedirectUrl(PublishmentSystemId)); } } catch (Exception ex) { FailMessage(ex, "批量转移失败!"); LogUtils.AddErrorLog(ex); } } }
/// <summary> /// 通过OU选择岗位 /// </summary> /// <param name="actionContext"></param> /// <param name="httpContext"></param> /// <returns>null</returns> public Forward GetDepartmentNodes(ActionContext actionContext, HttpContext httpContext) { AjaxForwardUtils.InitResponse(httpContext.Response); string node = RequestUtils.GetStringParameter(httpContext, "node", "");// 指定的ou的unid(点击树节点) string type = RequestUtils.GetStringParameter(httpContext, "type", "all"); string ouType = RequestUtils.GetStringParameter(httpContext, "ouType", null); if (logger.IsDebugEnabled) { logger.Debug("node=" + node); logger.Debug("type=" + type); logger.Debug("ouType=" + ouType); } bool isRoot = false; // 判断当前用户可选的权限范围 IList ouInfoLists = new ArrayList(); User userInfo = TSWEBContext.Current.CurUser; if (userInfo.HasPrivilege(Constants.DP_ALL)) // 用户拥有查看所有单位结构的权限 { if (node == "-1" || node == "root" || node == "") { isRoot = true; ouInfoLists = this.ouInfoService.FindChilds("", OUInfo.OT_UNIT);// 所有单位信息 } else { ouInfoLists = getChildOUInfos(node, type, ouType); } if (logger.IsDebugEnabled) { logger.Debug("Constants.DP_ALL"); logger.Debug("Count1=" + ouInfoLists.Count.ToString()); } } else if (userInfo.HasPrivilege(Constants.DP_LOCALANDCHILD)) // 用户拥有查看本级单位结构的权限 { if (node == "-1" || node == "root" || node == "") { isRoot = true; OUInfo ouInfo = this.ouInfoService.Load(userInfo.UnitUnid);// 当前用户所在单位 if (null != ouInfo) { ouInfoLists.Add(ouInfo); } } else { ouInfoLists = getChildOUInfos(node, type, ouType); } if (logger.IsDebugEnabled) { logger.Debug("Constants.DP_LOCALANDCHILD"); } } else // 用户只拥有查看本单位结构的权限 { if (node == "-1" || node == "root" || node == "") { isRoot = true; OUInfo ouInfo = this.ouInfoService.Load(userInfo.UnitUnid);// 当前用户所在单位 if (null != ouInfo) { ouInfoLists.Add(ouInfo); } } else { if (!OUInfo.OT_UNIT.Equals(ouType, StringComparison.OrdinalIgnoreCase)) { ouInfoLists = this.ouInfoService.FindChilds(node, OUInfo.OT_DEPARTMENT);// ou下的所有子部门 } } if (logger.IsDebugEnabled) { logger.Debug("Constants.DP_LOCAL"); } } // 获取是否需要产生链接(不推荐使用) string link = RequestUtils.GetStringParameter(httpContext, "link", "N"); bool isLink = false; if (link.Equals(Constants.YESNO_YES, StringComparison.OrdinalIgnoreCase)) { isLink = true; } bool singleClickExpand = RequestUtils.GetBoolParameter(httpContext, "singleClickExpand", false); // 组合返回的信息 JavaScriptArray jsonArray = createOUInfosJsonArray(ouInfoLists, isLink, singleClickExpand); if (logger.IsDebugEnabled) { logger.Debug("Count2=" + ouInfoLists.Count.ToString()); } // 如果是加载根节点的子节点,则同时预加载第一个子节点的下一级子节点 if (isRoot && ouInfoLists.Count > 0) { OUInfo ouInfo = (OUInfo)ouInfoLists[0]; IList ouInfos2 = getChildOUInfos(ouInfo.Unid, type, ouType); JavaScriptArray childJsonArray = createOUInfosJsonArray(ouInfos2, isLink, singleClickExpand); ((JavaScriptObject)jsonArray[0]).Add("children", childJsonArray); if (logger.IsDebugEnabled) { logger.Debug("firstNode.children.Count=" + ouInfos2.Count.ToString()); } } string jsonStr = JavaScriptConvert.SerializeObject(jsonArray); if (logger.IsDebugEnabled) { logger.Debug("isRoot=" + isRoot.ToString()); logger.Debug("json=" + jsonStr); } httpContext.Response.Write(jsonStr); return(null); }
public IQ() { items = new ArrayList(); }
// Validate the mobile passed and add into arraylist // passed by reference public void Validate(PlayerMobile pm, ref ArrayList fp) { // Make sure we have a ruleset if (TourneyStone.Ruleset.Count == 0) return; Player = pm; ArrayList failures = new ArrayList(); ArrayList Rules = new ArrayList(); ArrayList Fallthroughs = new ArrayList(); // Grab the ruleset Rules = TourneyStone.Ruleset; int RulesetCount = Rules.Count; // Create a HeldStuff instance to figure out // what they have HeldStuff CurrentHeld = new HeldStuff(pm); // Loop through each rule & condition... deal for (int rpos = 0; rpos < RulesetCount; rpos++) { Rule RuleChecking = (Rule)Rules[rpos]; if (RuleChecking.Conditions.Count == 0 || RuleChecking.Active == false) continue; foreach (RuleCondition rc in RuleChecking.Conditions) { // What kind of condition are we dealing with here? if (rc is ItemCondition) { // ITEM CONDITION // (validate entire held item list against rule) string FailText = RuleChecking.FailText; string sDynFails = ""; bool bFails = false; // wea: 25/Feb/2007 Modified call to pass CurrentHeld rather // than one item at a time if (!rc.Guage(CurrentHeld.Contents, ref Fallthroughs)) { sDynFails += string.Format("{0}{1}", (sDynFails == "" ? "" : ", "), RuleChecking.FailTextDyn); bFails = true; } if (bFails) { if (sDynFails != "") FailText += " You have : " + sDynFails; FailText = RuleChecking.DynFill(FailText); failures.Add(FailText); } } else if (rc is ItemPropertyCondition) // wea: 28/Feb/2007 Incorrect rule handling fix { // ITEM PROPERTY CONDITION string FailText = RuleChecking.FailText; string sDynFails = ""; bool bFails = false; foreach (HeldItem hi in CurrentHeld.Contents) { if (!rc.Guage(hi, ref Fallthroughs)) { sDynFails += string.Format("{0}{1}", (sDynFails == "" ? "" : ", "), RuleChecking.FailTextDyn); bFails = true; } } if (bFails) { if (sDynFails != "") FailText += " You have : " + sDynFails; FailText = RuleChecking.DynFill(FailText); failures.Add(FailText); } } else if (rc is PropertyCondition) { // MOBILE PROPERTY CONDITION // (validate using the mobile) if (!rc.Guage(Player)) { string FailText = RuleChecking.FailText + " " + RuleChecking.FailTextDyn; FailText = RuleChecking.DynFill(FailText); failures.Add(FailText); } } } } fp = failures; }
protected void btnAssign_Click(object sender, EventArgs e) { string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } try { if (ddlSpeciality.SelectedValue.Equals("0")) { usrMessage.PutMessage("Speciality is not selected."); usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_ErrorMessage); usrMessage.Show(); } else { ArrayList lstDoc = (ArrayList)Session["SelectedDocList"]; if (lstDoc == null) { lstDoc = new ArrayList(); } string[] Documents = new string[100]; Documents = hfselectedNode.Value.Split(','); lbSelectedDocs.Items.Clear(); ArrayList lstRemoved = new ArrayList(); for (int i = 0; i < Documents.Length - 1; i++) { DAO_Assign_Doc DAO = new DAO_Assign_Doc(); DAO.SelectedText = Documents[i].Split('~')[0]; DAO.SelectedId = Documents[i].Split('~')[2]; DAO.SelectedSpeciality = ddlSpeciality.SelectedItem.Text; DAO.SelectedSpecialityID = ddlSpeciality.SelectedItem.Value; DAO.ORDER = i; for (int j = 0; j < lstDoc.Count; j++) { DAO_Assign_Doc DAO1 = new DAO_Assign_Doc(); DAO1 = (DAO_Assign_Doc)lstDoc[j]; if (DAO1.SelectedSpecialityID.Equals(DAO.SelectedSpecialityID)) { lstDoc.Remove(DAO1); lstRemoved.Add(DAO1); j--; } } } if (Documents.Length - 1 == 0) { for (int j = 0; j < lstDoc.Count; j++) { DAO_Assign_Doc DAO1 = new DAO_Assign_Doc(); DAO1 = (DAO_Assign_Doc)lstDoc[j]; if (ddlSpeciality.SelectedValue.Equals(DAO1.SelectedSpecialityID)) { lstDoc.Remove(DAO1); lstRemoved.Add(DAO1); j--; } } } for (int i = 0; i < Documents.Length - 1; i++) { ListItem list = new ListItem(); list.Text = ""; list.Value = ""; if (!Documents[i].Split('~')[0].Equals("")) { lbSelectedDocs.Items.Add(list); } } hfselectedNode.Value = ""; ArrayList lstDoc1 = new ArrayList(); DataSet ds = new DataSet(); ds = objBillSysDocBO.GetAllSecialityDoc(txtCompanyID.Text); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DAO_Assign_Doc DAO = new DAO_Assign_Doc(); DAO.SelectedId = ds.Tables[0].Rows[i][0].ToString(); DAO.SelectedText = objBillSysDocBO.GetFullPathOfNode(ds.Tables[0].Rows[i][0].ToString()); DAO.SelectedSpeciality = objBillSysDocBO.GetSpecialityNameUsingId(ds.Tables[0].Rows[i][1].ToString()); DAO.SelectedSpecialityID = ds.Tables[0].Rows[i][1].ToString(); DAO.ORDER = Convert.ToInt32(ds.Tables[0].Rows[i][2]); DAO.REQUIRED_MULTIPLE = Convert.ToBoolean(ds.Tables[0].Rows[i][3]); lstDoc1.Add(DAO); } for (int i = 0; i < Documents.Length - 1; i++) { ListItem list = new ListItem(); if (!Documents[i].Split('~')[0].Equals("")) { list.Text = Documents[i].Split('~')[0]; list.Value = Documents[i].Split('~')[1] + "~" + Documents[i].Split('~')[2]; lbSelectedDocs.Items.Insert(i, list); lbSelectedDocs.Items.RemoveAt(i + 1); DAO_Assign_Doc DAO = new DAO_Assign_Doc(); DAO.SelectedText = Documents[i].Split('~')[0]; DAO.SelectedId = Documents[i].Split('~')[2]; DAO.SelectedSpeciality = ddlSpeciality.SelectedItem.Text; DAO.SelectedSpecialityID = ddlSpeciality.SelectedItem.Value; DAO.ORDER = i; int flag = 0; for (int j = 0; j < lstDoc1.Count; j++) { DAO_Assign_Doc DAO1 = new DAO_Assign_Doc(); DAO1 = (DAO_Assign_Doc)lstDoc1[j]; if (DAO.SelectedSpecialityID.Equals(DAO1.SelectedSpecialityID) && DAO.SelectedId.Equals(DAO1.SelectedId)) { DAO.REQUIRED_MULTIPLE = DAO1.REQUIRED_MULTIPLE; flag = 1; int ins = 0; for (int k = 0; k < lstDoc.Count; k++) { DAO_Assign_Doc DAODocInSession = new DAO_Assign_Doc(); DAODocInSession = (DAO_Assign_Doc)lstDoc[k]; if (DAO.SelectedSpecialityID.Equals(DAODocInSession.SelectedSpecialityID) && DAO.SelectedId.Equals(DAODocInSession.SelectedId)) { ins = 1; } else { ins = 0; } } if (ins == 0) { lstDoc.Add(DAO); lstRemoved.Remove(DAO); hfselectedNode.Value = hfselectedNode.Value + list.Text + "~" + list.Value + ","; } break; } } if (flag == 0) { lstDoc.Add(DAO); hfselectedNode.Value = hfselectedNode.Value + list.Text + "~" + list.Value + ","; } } } Session["SelectedDocList"] = lstDoc; Session["RemovedDoc"] = lstRemoved; usrMessage.PutMessage("Documents Assigned Successfully!"); usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage); usrMessage.Show(); //Label3.Text = "Documents Assigned Successfully!"; } } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }
public void AddRange(ArrayList menuPermissions) { AddRange(menuPermissions.Cast <MenuPermissionInfo>().ToList()); }
protected void Page_Load(object sender, EventArgs e) { string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } try { tvwmenu.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)"); btnAssign.Attributes.Add("onclick", "order()"); txtCompanyID.Text = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID; if (!IsPostBack) { txtUserID.Text = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID; //load speciality in the dropdownlist. DataSet dsSpeciality = objSpeciality.GetSpecialityList(txtCompanyID.Text); ListItem list2 = new ListItem(); list2.Text = "---Select---"; list2.Value = "0"; ddlSpeciality.Items.Add(list2); for (int i = 0; i < dsSpeciality.Tables[0].Rows.Count; i++) { ListItem list = new ListItem(); list.Text = dsSpeciality.Tables[0].Rows[i][1].ToString(); list.Value = dsSpeciality.Tables[0].Rows[i][0].ToString(); ddlSpeciality.Items.Add(list); } hfselectedNodeinListbox.Value = ""; //Load All the documents in the session, which are available in the database. DataSet ds = new DataSet(); ds = objBillSysDocBO.GetAllSecialityDoc(txtCompanyID.Text); ArrayList lstDoc = new ArrayList(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DAO_Assign_Doc DAO = new DAO_Assign_Doc(); DAO.SelectedId = ds.Tables[0].Rows[i][0].ToString(); DAO.SelectedText = objBillSysDocBO.GetFullPathOfNode(ds.Tables[0].Rows[i][0].ToString()); DAO.SelectedSpeciality = objBillSysDocBO.GetSpecialityNameUsingId(ds.Tables[0].Rows[i][1].ToString()); DAO.SelectedSpecialityID = ds.Tables[0].Rows[i][1].ToString(); DAO.ORDER = Convert.ToInt32(ds.Tables[0].Rows[i][2]); DAO.REQUIRED_MULTIPLE = Convert.ToBoolean(ds.Tables[0].Rows[i][3]); lstDoc.Add(DAO); } Session["SelectedDocList"] = lstDoc; } //load Listbox on the Step 1 of the wizard. if selected speciality is not '---Select---' if (!ddlSpeciality.SelectedValue.Equals("0")) { tvwmenu.Visible = true; DAO_Assign_Doc DAO = new DAO_Assign_Doc(); ArrayList lstDoc = new ArrayList(); lstDoc = (ArrayList)Session["SelectedDocList"]; lbSelectedDocs.Items.Clear(); if (lstDoc != null) { for (int i = 0; i < lstDoc.Count; i++) { DAO = (DAO_Assign_Doc)lstDoc[i]; ListItem lst = new ListItem(); lst.Text = DAO.SelectedText; lst.Value = DAO.SelectedSpecialityID + "~" + DAO.SelectedId; if (DAO.SelectedSpecialityID.Equals(ddlSpeciality.SelectedValue)) { lbSelectedDocs.Items.Add(lst); } } } } else { //load treeview tvwmenu.Visible = true; tvwmenu.ExpandAll(); tvwmenu.ShowExpandCollapse = true; } // Label3.Text = ""; //lblmsg.Text = ""; //load treeview and listbox on the step 1 of the wizard if user clicks on 'Previous' button on the step 2 of the wizard. if (Wizard1.ActiveStepIndex == 1) { if (Session["SelectedDocList"] != null) { hfselectedNode.Value = ""; dsSpecialityDoc = objBillSysDocBO.GetSecialityDoc(txtCompanyID.Text, ddlSpeciality.SelectedValue); for (int i = 0; i < dsSpecialityDoc.Tables[0].Rows.Count; i++) { ListItem list = new ListItem(); list.Text = ""; list.Value = ""; lbSelectedDocs.Items.Add(list); } //tvwmenu.PopulateNodesFromClient = true; //tvwmenu.Nodes.RemoveAt(0); //TreeNode node = new TreeNode("Document Manager", "0"); //node.PopulateOnDemand = true; //tvwmenu.Nodes.Add(node); //tvwmenu.ExpandAll(); int count = lbSelectedDocs.Items.Count; for (int i = 0; i < count; i++) { if (lbSelectedDocs.Items[i].Value.Equals("")) { lbSelectedDocs.Items.RemoveAt(i); i--; count--; } else { } } } } DataSet dsDoc = new DataSet(); dsDoc = objBillSysDocBO.GetAllSecialityDoc(txtCompanyID.Text); lbAllAssignedDoc.Items.Clear(); for (int i = 0; i < dsDoc.Tables[0].Rows.Count; i++) { DAO_Assign_Doc DAO = new DAO_Assign_Doc(); DAO.SelectedId = dsDoc.Tables[0].Rows[i][0].ToString(); DAO.SelectedText = objBillSysDocBO.GetFullPathOfNode(dsDoc.Tables[0].Rows[i][0].ToString()); DAO.SelectedSpeciality = objBillSysDocBO.GetSpecialityNameUsingId(dsDoc.Tables[0].Rows[i][1].ToString()); DAO.SelectedSpecialityID = dsDoc.Tables[0].Rows[i][1].ToString(); DAO.ORDER = Convert.ToInt32(dsDoc.Tables[0].Rows[i][2]); DAO.REQUIRED_MULTIPLE = Convert.ToBoolean(dsDoc.Tables[0].Rows[i][3]); ListItem lst = new ListItem(); lst.Text = DAO.SelectedSpeciality.ToString() + DAO.SelectedText.ToString(); lst.Value = DAO.SelectedId.ToString(); lbAllAssignedDoc.Items.Add(lst); } } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } #region "check version readonly or not" string app_status = ((Bill_Sys_BillingCompanyObject)Session["APPSTATUS"]).SZ_READ_ONLY.ToString(); if (app_status.Equals("True")) { Bill_Sys_ChangeVersion cv = new Bill_Sys_ChangeVersion(this.Page); cv.MakeReadOnlyPage("Bill_Sys_DocumentType.aspx"); } #endregion //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e) { string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } try { DAO_Assign_Doc DAO = new DAO_Assign_Doc(); ArrayList lstDoc = new ArrayList(); ArrayList lstDoc1 = new ArrayList(); lstDoc = (ArrayList)Session["SelectedDocList"]; lbAllSelectedDocuments.Items.Clear(); int order = 0; string[] arrSpeciality = new string[1000]; string[] arrNode = new string[1000]; int count = 0; ArrayList lstRemoved = (ArrayList)Session["RemovedDoc"]; for (int i = 0; i < lstRemoved.Count; i++) { DAO_Assign_Doc dao = new DAO_Assign_Doc(); dao = (DAO_Assign_Doc)lstRemoved[i]; objBillSysDocBO.RemoveSpecialityDoc(dao.SelectedSpecialityID, txtCompanyID.Text, dao.SelectedId); } lstRemoved.Clear(); for (int i = 0; i < lstDoc.Count; i++) { int iflag = 0; DAO = (DAO_Assign_Doc)lstDoc[i]; string[] selectedNode = new string[500]; selectedNode = hfselectedNodeinListbox.Value.Split(','); for (int j = 0; j < selectedNode.Length - 1; j++) { if (!selectedNode[j].Equals("") && selectedNode[j].Split('~')[1].Equals(DAO.SelectedId) && selectedNode[j].Split('~')[0].Equals(DAO.SelectedSpecialityID)) { objBillSysDocBO.AssignDocToSpeciality(selectedNode[j].Split('~')[1], ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID, DAO.SelectedSpecialityID, txtCompanyID.Text, DAO.ORDER, true); iflag = 1; DAO.REQUIRED_MULTIPLE = true; arrSpeciality[i] = DAO.SelectedSpecialityID; arrNode[i] = selectedNode[j].Split('~')[1]; count++; } order = DAO.ORDER; } if (iflag == 0) { objBillSysDocBO.AssignDocToSpeciality(DAO.SelectedId, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID, DAO.SelectedSpecialityID, txtCompanyID.Text, DAO.ORDER, false); DAO.REQUIRED_MULTIPLE = false; arrSpeciality[i] = DAO.SelectedSpecialityID; arrNode[i] = DAO.SelectedId; count++; } lstDoc1.Add(DAO); } DataSet ds = new DataSet(); //ds = objBillSysDocBO.GetSecialityDoc(txtCompanyID.Text, arrSpeciality[0]); //for (int i = 0; i < ds.Tables[0].Rows.Count; i++) //{ // int flag = 0; // for (int j = 0; j < count; j++) // { // if ((Convert.ToInt32(ds.Tables[0].Rows[i][0]) == Convert.ToInt32(arrNode[j])) && ds.Tables[0].Rows[i][1].Equals(arrSpeciality[j])) // { // flag = 1; // } // } // if (flag == 0) // { // if (arrSpeciality[i] == null) // { // break; // } // else // { // objBillSysDocBO.RemoveSpecialityDoc(arrSpeciality[i], txtCompanyID.Text, arrNode[i]); // } // } // ds = objBillSysDocBO.GetSecialityDoc(txtCompanyID.Text, arrSpeciality[i]); //} Session["SelectedDocList"] = lstDoc1; //lblmsg.Text = "Documents Saved Successfully!"; lstDoc = (ArrayList)Session["SelectedDocList"]; lbAllSelectedDocuments.Items.Clear(); lbselect.Items.Clear(); if (lstDoc != null) { hfselectedNodeinListbox.Value = ""; for (int i = 0; i < lstDoc.Count; i++) { DAO = (DAO_Assign_Doc)lstDoc[i]; if (DAO.REQUIRED_MULTIPLE) { ListItem lst = new ListItem(); lst.Text = DAO.SelectedSpeciality + DAO.SelectedText; lst.Value = DAO.SelectedSpecialityID + "~" + DAO.SelectedId; hfselectedNodeinListbox.Value = hfselectedNodeinListbox.Value + lst.Value + ","; lbselect.Items.Add(lst); } else { ListItem lst = new ListItem(); lst.Text = DAO.SelectedSpeciality + DAO.SelectedText; lst.Value = DAO.SelectedSpecialityID + "~" + DAO.SelectedId; lbAllSelectedDocuments.Items.Add(lst); } } } ds = objBillSysDocBO.GetAllSecialityDoc(txtCompanyID.Text); lstDoc.Clear(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DAO_Assign_Doc DAONew = new DAO_Assign_Doc(); DAONew.SelectedId = ds.Tables[0].Rows[i][0].ToString(); DAONew.SelectedText = objBillSysDocBO.GetFullPathOfNode(ds.Tables[0].Rows[i][0].ToString()); DAONew.SelectedSpeciality = objBillSysDocBO.GetSpecialityNameUsingId(ds.Tables[0].Rows[i][1].ToString()); DAONew.SelectedSpecialityID = ds.Tables[0].Rows[i][1].ToString(); DAONew.ORDER = Convert.ToInt32(ds.Tables[0].Rows[i][2]); DAONew.REQUIRED_MULTIPLE = Convert.ToBoolean(ds.Tables[0].Rows[i][3]); lstDoc.Add(DAONew); } Session["SelectedDocList"] = lstDoc; lstRemoved.Clear(); Session["RemovedDoc"] = lstRemoved; MessageControl1.PutMessage("Documents Saved Successfully!"); MessageControl1.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage); MessageControl1.Show(); //Session["SelectedDocList"] = null; } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }
/// <summary> /// Returns an ordered list of nodes, based upon the preferred order of /// load balancing algorithm. /// </summary> /// <param name="memberInfo">collected information about all the server nodes</param> /// <returns>ordered list of server nodes</returns> NodeInfo IActivityDistributor.SelectNode(ClusterCacheStatistics clusterStats, object data) { ArrayList memberInfos = clusterStats.Nodes; string group = data as string; bool gpAfStrict = false; NodeInfo min = null; NodeInfo gMin = null; NodeInfo sMin = null; lock (memberInfos.SyncRoot) { if (group != null) { gpAfStrict = clusterStats.ClusterDataAffinity != null?clusterStats.ClusterDataAffinity.Contains(group) : false; } for (int i = 0; i < memberInfos.Count; i++) { NodeInfo curr = (NodeInfo)memberInfos[i]; if (curr.Status.IsAnyBitSet(NodeStatus.Coordinator | NodeStatus.SubCoordinator)) { if (curr.Statistics == null) { continue; } if (min == null || (curr.Statistics.Count < min.Statistics.Count)) { min = curr; } if (curr.DataAffinity != null) { if (curr.DataAffinity.IsExists(group)) { if (gMin == null || (curr.Statistics.Count < gMin.Statistics.Count)) { gMin = (NodeInfo)memberInfos[i]; } } else if (curr.DataAffinity.Strict == false) { sMin = min; } else { min = sMin; } } else { sMin = min; } } } } if (gpAfStrict && gMin == null) { if (NCacheLog.IsInfoEnabled) { NCacheLog.Info("CoordinatorBiasedObjectCountBalancer.SelectNode", "strict group affinity, no node found to accommodate " + group + " data"); } return(null); } return((gMin == null) ? sMin : gMin); }
void FillChildMenu(TreeNode node) { string MenuID = node.Value; DataSet ChildMenuTable = new DataSet(); ChildMenuTable = objBillSysDocBO.GetChildNodes(Convert.ToInt32(MenuID), txtCompanyID.Text); dsSpecialityDoc = objBillSysDocBO.GetSecialityDoc(txtCompanyID.Text, ddlSpeciality.SelectedValue); if (ChildMenuTable.Tables.Count > 0) { foreach (DataRow row in ChildMenuTable.Tables[0].Rows) { TreeNode newNode = new TreeNode(row["SZ_NODE_NAME"].ToString(), row["I_NODE_ID"].ToString()); newNode.PopulateOnDemand = false; newNode.SelectAction = TreeNodeSelectAction.Expand; newNode.ShowCheckBox = true; string str = ""; newNode.ToolTip = node.ToolTip + ">>" + row["SZ_NODE_NAME"].ToString() + "(" + row["I_NODE_ID"].ToString() + ")"; newNode.Value = row["I_NODE_ID"].ToString(); for (int i = 0; i < dsSpecialityDoc.Tables[0].Rows.Count; i++) { if (row["I_NODE_ID"].ToString().Equals(dsSpecialityDoc.Tables[0].Rows[i][0].ToString())) { newNode.Checked = true; string path = node.ToolTip; string[] nodeid = new string[10]; nodeid = node.ValuePath.Split('/'); for (int j = 0; j < nodeid.Length; j++) { path = path.Replace("(" + nodeid[j] + ")", ""); } hfselectedNode.Value = hfselectedNode.Value + path + ">>" + row["SZ_NODE_NAME"].ToString() + "~" + dsSpecialityDoc.Tables[0].Rows[i][1].ToString() + "~" + row["I_NODE_ID"].ToString() + ","; ListItem list1 = new ListItem(); list1.Text = path + ">>" + row["SZ_NODE_NAME"].ToString(); list1.Value = dsSpecialityDoc.Tables[0].Rows[i][1].ToString() + "~" + row["I_NODE_ID"].ToString(); lbSelectedDocs.Items.Insert(Convert.ToInt32(dsSpecialityDoc.Tables[0].Rows[i][2]), list1); lbSelectedDocs.Items.RemoveAt(Convert.ToInt32(dsSpecialityDoc.Tables[0].Rows[i][2]) + 1); hfOrder.Value = hfOrder.Value + row["I_NODE_ID"].ToString() + "~" + dsSpecialityDoc.Tables[0].Rows[i][2].ToString() + ","; DAO_Assign_Doc DAO = new DAO_Assign_Doc(); DAO.SelectedId = row["I_NODE_ID"].ToString(); DAO.SelectedText = path + ">>" + row["SZ_NODE_NAME"].ToString(); DAO.SelectedSpeciality = ddlSpeciality.SelectedItem.Text; DAO.SelectedSpecialityID = dsSpecialityDoc.Tables[0].Rows[i][1].ToString(); DAO.ORDER = Convert.ToInt32(dsSpecialityDoc.Tables[0].Rows[i][2]); DAO.REQUIRED_MULTIPLE = Convert.ToBoolean(dsSpecialityDoc.Tables[0].Rows[i][3]); ArrayList lstDoc = new ArrayList(); if (Session["SelectedDocList"] == null) { lstDoc.Add(DAO); Session["SelectedDocList"] = lstDoc; } else { lstDoc = (ArrayList)Session["SelectedDocList"]; Session["SelectedDocList"] = lstDoc; int flag = 0; for (int l = 0; l < lstDoc.Count; l++) { DAO_Assign_Doc DAO1 = new DAO_Assign_Doc(); DAO1 = (DAO_Assign_Doc)lstDoc[l]; if (DAO1.SelectedId.Equals(DAO.SelectedId) && DAO1.SelectedSpecialityID.Equals(DAO.SelectedSpecialityID)) { flag = 1; break; } } if (flag == 0) { lstDoc.Add(DAO); } } if (Session["SelectedDocList"] != null) { ArrayList lstDoc1 = new ArrayList(); lstDoc1 = (ArrayList)Session["SelectedDocList"]; for (int k = 0; k < lstDoc1.Count; k++) { DAO_Assign_Doc dao = new DAO_Assign_Doc(); dao = (DAO_Assign_Doc)lstDoc[k]; if (dao.SelectedId.Equals(row["I_NODE_ID"].ToString()) && dao.SelectedSpecialityID.Equals(ddlSpeciality.SelectedValue.ToString())) { newNode.Checked = true; } } } } else if (Session["SelectedDocList"] != null) { ArrayList lstDoc = new ArrayList(); lstDoc = (ArrayList)Session["SelectedDocList"]; for (int k = 0; k < lstDoc.Count; k++) { DAO_Assign_Doc dao = new DAO_Assign_Doc(); dao = (DAO_Assign_Doc)lstDoc[k]; if (dao.SelectedId.Equals(row["I_NODE_ID"].ToString()) && dao.SelectedSpecialityID.Equals(ddlSpeciality.SelectedValue.ToString())) { newNode.Checked = true; } } } } node.ChildNodes.Add(newNode); FillChildMenu(newNode); } } }
protected void Page_Load(object sender, EventArgs e) { string tempPath = System.IO.Path.GetTempPath(); string strFilePath = Request.Params["Path"]; if (strFilePath == null) return; string str1 = string.Format("http://{0}", Settings.CurrentSettings.BSTADDRESS); if (strFilePath.IndexOf(str1) == 0) { strFilePath = strFilePath.Replace(str1, @"//bst_master/public"); } str1 = string.Format("http://{0}", BSTStat.globalIPAddress); if (strFilePath.IndexOf(str1) == 0) { strFilePath = strFilePath.Replace(str1, @"//bst_master/public"); } str1 = Settings.CurrentSettings.COMPANYSITE; if (strFilePath.IndexOf(str1) == 0) { strFilePath = strFilePath.Replace(str1, @"//bst_master/public"); } string ext = Path.GetExtension(strFilePath).ToUpper(); if (ext != ".TXT") { ErrorMessage.Text = "Unsupported file format!"; ErrorMessage.Visible = true; return; } filetoshow.Text = strFilePath.Replace('/', '\\'); return; if (!System.IO.File.Exists(strFilePath)) { Response.Write("Sory, file <b>" + strFilePath + "</b> not exist."); return; } Response.ClearContent(); Response.ClearHeaders(); if (ext == "txt") { System.IO.StreamReader file = new System.IO.StreamReader(strFilePath); string line; ArrayList htmlbody = new ArrayList(); while ((line = file.ReadLine()) != null) { htmlbody.Add(line); } file.Close(); string html; html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n"; html += "<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n"; html += "<head>\r\n"; html += "<meta http-equiv=\"Content-Type\" content=\"text/html\" />\r\n"; html += "<style type=\"text/css\">\r\n"; html += "TABLE {border-collapse: collapse;}\r\n"; html += "TH, TD {border: 1px solid #CCC;}\r\n"; html += "table th {background-color: lightblue;} .hover_Row { background-color: yellow; } .clicked_Row { background-color: lightgreen; }\r\n"; html += "</style>\r\n"; html += "<script type=\"text/javascript\" src=\"GetFileAsExcel.js\"></script>"; html += "</head>\r\n"; html += "<body>\r\n"; int iTable = 0; bool NeedCloseTable = false; int LastNumberOfColumns = -1; foreach (string strTemp in htmlbody) { string[] lsColumn = strTemp.Split('\t'); // Close/Open Table if (lsColumn.Count() != LastNumberOfColumns) { LastNumberOfColumns = lsColumn.Count(); if (NeedCloseTable) { html += "</table>\r\n"; html += "<script type=\"text/javascript\">highlight_Table_Rows(\"color_table_" + iTable.ToString() + "\", \"hover_Row\", \"clicked_Row\");</script>\r\n"; iTable++; NeedCloseTable = false; } if (lsColumn.Count() > 1) { html += "<table id=\"color_table_" + iTable.ToString() + "\">\r\n"; NeedCloseTable = true; } } // Row body if (lsColumn.Count() == 1) { html += strTemp + "<br />\r\n"; } else { html += "<tr>\r\n"; for (int i = 0; i < lsColumn.Count(); i++) { html += "<td>" + ((lsColumn[i] != string.Empty) ? lsColumn[i] : " ") + "</td>\r\n"; } html += "</tr>\r\n"; } } if (NeedCloseTable) { html += "</table>\r\n"; html += "<script type=\"text/javascript\">highlight_Table_Rows(\"color_table_" + iTable.ToString() + "\", \"hover_Row\", \"clicked_Row\");</script>\r\n"; } html += "</body>"; html += "</html>"; Response.Write(html); } else { Response.Write("Sory, but file <b>" + strFilePath + "</b> is not text."); } Response.Flush(); Response.End(); }
private void DeleteMap(string name, bool isItMap) { string path = ""; string mapPath; string mapInfoPath = ""; string mapLayerPath = ""; string mapPathMetaPath = ""; string mapInfoMetaPath = ""; string mapLayerMetaPath = ""; if (isItMap) { mapInfoPath = uteGLOBAL3dMapEditor.getMapsDir() + name + "_info.txt"; mapInfoMetaPath = uteGLOBAL3dMapEditor.getMapsDir() + name + "_info.txt.meta"; mapPath = uteGLOBAL3dMapEditor.getMapsDir() + name + ".txt"; mapPathMetaPath = uteGLOBAL3dMapEditor.getMapsDir() + name + ".txt.meta"; mapLayerPath = uteGLOBAL3dMapEditor.getMapsDir() + name + "_layers.txt"; mapLayerMetaPath = uteGLOBAL3dMapEditor.getMapsDir() + name + "_layers.txt.meta"; } else { mapPath = uteGLOBAL3dMapEditor.getPatternsDir() + name + ".txt"; mapPathMetaPath = uteGLOBAL3dMapEditor.getMapsDir() + name + ".txt.meta"; } ArrayList arr = new ArrayList(); if (File.Exists(mapPathMetaPath)) { File.Delete(mapPathMetaPath); } if (File.Exists(mapPath)) { File.Delete(mapPath); } if (isItMap) { if (File.Exists(mapLayerPath)) { File.Delete(mapLayerPath); } if (File.Exists(mapLayerMetaPath)) { File.Delete(mapLayerMetaPath); } if (File.Exists(mapInfoPath)) { File.Delete(mapInfoPath); } if (File.Exists(mapInfoMetaPath)) { File.Delete(mapInfoMetaPath); } path = myMapsPath; ReadAllMaps(); arr = myMaps; } else { path = myPatternsPath; ReadAllPatterns(); arr = myPatterns; } string allnewpr = ""; for (int i = 0; i < arr.Count; i++) { if (!arr[i].ToString().Equals("") && !arr[i].ToString().Equals(name)) { allnewpr += arr[i].ToString() + ":"; } } StreamWriter sw = new StreamWriter(path); sw.Write(""); sw.Write(allnewpr); sw.Flush(); sw.Close(); if (isItMap) { ReadAllMaps(); } else { ReadAllPatterns(); } }