public static void AccessMaster(string Action, string TableName, Hashtable hash) { using(NpgsqlConnection con = new NpgsqlConnection(CONNECTION_STRING)) { string query = string.Format(@"SELECT * FROM ""{0}""", TableName); using(NpgsqlCommand cmd = new NpgsqlCommand(@query, con)) { NpgsqlDataAdapter adapter = new NpgsqlDataAdapter(); adapter.SelectCommand = cmd; NpgsqlCommand actionCommand = null; if(Action == "Entry"){ actionCommand = (new NpgsqlCommandBuilder(adapter)).GetInsertCommand(); } else if(Action == "Modify"){ actionCommand = (new NpgsqlCommandBuilder(adapter)).GetUpdateCommand(); } else if(Action == "Remove"){ actionCommand = (new NpgsqlCommandBuilder(adapter)).GetDeleteCommand(); } try { foreach(NpgsqlParameter param in actionCommand.Parameters){ if(hash[param.SourceColumn] != null) param.Value = hash[param.SourceColumn]; } actionCommand.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(string.Format("{0}", ex.Message)); MessageBox.Show(string.Format("{0}", ex.StackTrace.ToString())); } } } }
protected override void initPartData() { partList = new Hashtable(); partList["MEDIUM_Arm_Back_Lower_01"] = MEDIUM_Arm_Back_Lower_01 ; partList["MEDIUM_Arm_Back_Upper_01"] = MEDIUM_Arm_Back_Upper_01 ; partList["MEDIUM_Arm_Top_Lower_01"] = MEDIUM_Arm_Top_Lower_01 ; partList["MEDIUM_Arm_Top_Lower_011"] = MEDIUM_Arm_Top_Lower_01 ; partList["MEDIUM_Arm_Top_Lower_012"] = MEDIUM_Arm_Top_Lower_01 ; partList["MEDIUM_Arm_Top_Lower_014"] = MEDIUM_Arm_Top_Lower_01 ; partList["MEDIUM_Arm_Top_Upper_01"] = MEDIUM_Arm_Top_Upper_01 ; partList["MEDIUM_Head_01"] = MEDIUM_Head_01 ; partList["MEDIUM_Head_02"] = MEDIUM_Head_02 ; partList["MEDIUM_Head_03"] = MEDIUM_Head_03 ; partList["MEDIUM_Head_06"] = MEDIUM_Head_06 ; partList["MEDIUM_Head_07"] = MEDIUM_Head_07 ; partList["MEDIUM_Leg_Back_Lower_01"] = MEDIUM_Leg_Back_Lower_01 ; partList["MEDIUM_Leg_Back_Upper_01"] = MEDIUM_Leg_Back_Upper_01 ; partList["MEDIUM_Leg_Top_Lower_01"] = MEDIUM_Leg_Top_Lower_01 ; partList["MEDIUM_Leg_Top_Upper_01"] = MEDIUM_Leg_Top_Upper_01 ; partList["MEDIUM_Punch_FX_02"] = MEDIUM_Punch_FX_02 ; partList["MEDIUM_Punch_FX_027"] = MEDIUM_Punch_FX_027 ; partList["MEDIUM_Torso_01"] = MEDIUM_Torso_01 ; partList["MEDIUM_Weapon_01"] = MEDIUM_Weapon_01 ; partList["MEDIUM_Weapon_015"] = MEDIUM_Weapon_01 ; partList["MEDIUM_Weapon_016"] = MEDIUM_Weapon_01 ; partList["drop_shadow"] = drop_shadow ; }
//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); }; }
protected override void initPartData() { partList = new Hashtable(); partList["armDownL"] = armDownL; partList["armDownR"] = armDownR; partList["armUpL"] = armUpL; partList["armUpR"] = armUpR; partList["bodyDown"] = body; partList["legL"] = legL; partList["legR"] = legR; partList["shadow"] = Shadow; partList["ADD_1"] = ADD_1; partList["ADD_2"] = ADD_2; partList["ADD_3"] = ADD_3; partList["E_ADD_1"] = E_ADD_1; partList["E_ADD_2"] = E_ADD_2; partList["E_ADD_3"] = E_ADD_3; partList["E_FLASH_1"] = E_FLASH_1; partList["E_FLASH_2"] = E_FLASH_2; partList["E_FLASH_3"] = E_FLASH_3; partList["E_FLASH_5"] = E_FLASH_5; partList["E_FLASH_6"] = E_FLASH_5; partList["E_FLASH_7"] = E_FLASH_5; partList["E_SMOKE_1"] = smoke; partList["E_SMOKE_2"] = smoke; //partList["weapon_eft"] = weapon_eft; }
//type = a:1/10, b:1/100, c:1/1000 public Test_GetGameContentCommand( 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.content.get"); command.Add ("time", TimeUtils.UnixTime); command.Add ("args", new Hashtable () { { "playerId", playerId }}); 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); }; }
protected void btnSubmit_Click(object sender, EventArgs e) { //上传文件 UploadFile(StringHelper.ReplaceBadChar(txtfolder.Text)); Hashtable hs = new Hashtable(); hs.Add("cname", StringHelper.ReplaceBadChar(txtcname.Text)); hs.Add("ename", StringHelper.ReplaceBadChar(txtename.Text)); hs.Add("remark", StringHelper.ReplaceBadChar(txtremark.Text)); hs.Add("folder", StringHelper.ReplaceBadChar(txtfolder.Text)); hs.Add("coverimg", txtCoverImg.Text); if (!StringHelper.isNum(Request.QueryString["id"]))//插入新纪录 { DataBaseHelper.instance.Insert(hs, "Template"); if (!Directory.Exists(Server.MapPath("~/templets/" + StringHelper.ReplaceBadChar(txtfolder.Text)))) { Directory.CreateDirectory(Server.MapPath("~/templets/" + StringHelper.ReplaceBadChar(txtfolder.Text))); } } else//更新纪录 { string id = Request.QueryString["id"]; DataBaseHelper.instance.Update(hs, "Template", "[ID]=" + id); } Common.MessageBox.ShowAndRedirect(this, "操作成功!", "list.aspx"); }
public static void ToHashtable(ref Hashtable ht, string key, float data, bool check) { if(check) { ht.Add(key, data.ToString()); } }
/// <summary> /// Used for player QA events /// </summary> /// <param name="businessID"> /// The event identifier. F.x. "FailedToLoadLevel" <see cref="System.String"/> /// </param> /// <param name="message"> /// A string detailing the event, F.x. the stack trace from an exception <see cref="System.String"/> /// </param> /// <param name="stack"> /// If true any identical messages in the queue will be merged/stacked as a single message, to save server load /// </param> private void CreateNewEvent(SeverityType severity, string message, float? x, float? y, float? z, bool stack) { Hashtable parameters = new Hashtable() { { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Severity], severity.ToString() }, { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Message], message }, { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Level], GA.SettingsGA.CustomArea.Equals(string.Empty)?Application.loadedLevelName:GA.SettingsGA.CustomArea } }; if (x.HasValue) { parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.X], (x*GA.SettingsGA.HeatmapGridSize.x).ToString()); } if (y.HasValue) { parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Y], (y*GA.SettingsGA.HeatmapGridSize.y).ToString()); } if (z.HasValue) { parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Z], (z*GA.SettingsGA.HeatmapGridSize.z).ToString()); } GA_Queue.AddItem(parameters, GA_Submit.CategoryType.GA_Error, stack); }
public void AddShopCart(DataListCommandEventArgs e) { /*If login*/ ST_check_Login(); Hashtable hashCar; if (Session["ShopCart"] == null) { //if no shopping cart hashCar = new Hashtable(); hashCar.Add(e.CommandArgument, 1); Session["ShopCart"] = hashCar; } else { //if has shopping cart hashCar = (Hashtable)Session["ShopCart"];//get hash table of cart if (hashCar.Contains(e.CommandArgument))//if this item in the cart, add 1 { int count = Convert.ToInt32(hashCar[e.CommandArgument].ToString());//get the number of items hashCar[e.CommandArgument] = (count + 1);//add 1 item } else hashCar.Add(e.CommandArgument, 1); } Response.Redirect("~/Pages/User/ShoppingCart.aspx"); }
/* ============================================================================ Hashtable functions ============================================================================ */ public static void FromHashtable(Hashtable ht, string key, ref float data) { if(ht.ContainsKey(key)) { data = float.Parse((string)ht[key]); } }
/// <summary> /// Returns properties hashtable. /// </summary> private Hashtable GetProperties() { Hashtable result = new Hashtable(); result[CountryInfo.OBJECT_TYPE + ".twolettercode"] = txtTwoLetterCode.Text; result[CountryInfo.OBJECT_TYPE + ".threelettercode"] = txtThreeLetterCode.Text; return result; }
/// <summary> /// Returns properties hashtable. /// </summary> private Hashtable GetProperties() { Hashtable result = new Hashtable(); result[InlineControlInfo.OBJECT_TYPE + ".filename"] = txtFileName.Text; result[InlineControlInfo.OBJECT_TYPE + ".files"] = chkFiles.Checked; return result; }
//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); }; }
static int Main () { X x = new X (); x [0] = 1; if (x.v1 != 1) return 1; if (x [0] != 1) return 2; B bb = new B (); if (bb.EmulateIndexer (10) != 10) return 3; // // This tests that we properly set the return type for the setter // use pattern in the following indexer (see bug 36156) Hashtable a = new Hashtable (); int b = (int) (a [0] = 1); if (b != 1) return 4; return new B ().M (); }
public override void gaxb_load(XmlReader reader, object _parent, Hashtable args) { base.gaxb_load(reader, _parent, args); if (nameExists && titleExists == false) { gameObject.name = name; } var prefab = Resources.Load (name); if (prefab == null) { UnityEngine.Debug.Log ("Unable to load prefab resource " + name); return; } GameObject clone = GameObject.Instantiate(prefab) as GameObject; if (clone == null) { UnityEngine.Debug.Log ("Unable to instantiate prefab resource " + name); return; } clone.transform.parent = gameObject.transform; clone.transform.localPosition = Vector3.zero; clone.transform.localRotation = Quaternion.identity; if (clone.renderer != null) { clone.gameObject.layer = PlanetUnityOverride.puCameraLayer; clone.renderer.material.renderQueue = scope ().getRenderQueue () + renderQueueOffset; } foreach (Transform t in clone.transform) { t.gameObject.layer = PlanetUnityOverride.puCameraLayer; if (t.renderer != null) { t.renderer.material.renderQueue = scope ().getRenderQueue () + renderQueueOffset; } } }
protected void Page_Load(object sender, EventArgs e) { string identifier = QueryHelper.GetString("params", null); parameters = (Hashtable)WindowHelper.GetItem(identifier); if (parameters != null) { // Initialize reporting control reportElem.ConfirmationText = HTMLHelper.HTMLEncode(ValidationHelper.GetString(parameters["confirmationtext"], string.Empty)); reportElem.ReportTitle = HTMLHelper.HTMLEncode(ValidationHelper.GetString(parameters["reporttitle"], string.Empty)); reportElem.ReportObjectID = ValidationHelper.GetInteger(parameters["reportobjectid"], 0); reportElem.ReportObjectType = ValidationHelper.GetString(parameters["reportobjecttype"], string.Empty); reportElem.ReportURL = ValidationHelper.GetString(parameters["reporturl"], string.Empty); reportElem.DisplayButtons = false; reportElem.BodyPanel.CssClass = "DialogAbuseBody"; reportElem.ReportButton = btnReport; // Initialize buttons btnReport.Click += btnReport_Click; // Set title string reportDialogTitle = HTMLHelper.HTMLEncode(ValidationHelper.GetString(parameters["reportdialogtitle"], string.Empty)); PageTitle.TitleText = reportDialogTitle; PageTitle.AlternateText = reportDialogTitle; } else { reportElem.Visible = false; } }
protected void ImageButtonGiant_Click(object sender, ImageClickEventArgs e) { Hashtable ht = new Hashtable(); string where = ""; foreach (GridViewRow row in GridView1.Rows) { ht.Clear(); ht.Add("HasDuty_UserManage", ((CheckBox)row.FindControl("chkUserManage")).Checked == true ? 1 : 0); ht.Add("HasDuty_RoleManage", ((CheckBox)row.FindControl("chkUserManage")).Checked == true ? 1 : 0); ht.Add("HasDuty_Role", ((CheckBox)row.FindControl("chkUserManage")).Checked == true ? 1 : 0); ht.Add("HasDuty_CourseManage", ((CheckBox)row.FindControl("chkCourseManage")).Checked == true ? 1 : 0); ht.Add("HasDuty_PaperSetup", ((CheckBox)row.FindControl("chkPaperSetup")).Checked == true ? 1 : 0); ht.Add("HasDuty_PaperLists", ((CheckBox)row.FindControl("chkPaperSetup")).Checked == true ? 1 : 0); ht.Add("HasDuty_UserPaperList", ((CheckBox)row.FindControl("chkUserPaperList")).Checked == true ? 1 : 0); ht.Add("HasDuty_UserScore", ((CheckBox)row.FindControl("chkUserPaperList")).Checked == true ? 1 : 0); ht.Add("HasDuty_SingleSelectManage", ((CheckBox)row.FindControl("chkTypeManage")).Checked == true ? 1 : 0); ht.Add("HasDuty_MultiSelectManage", ((CheckBox)row.FindControl("chkTypeManage")).Checked == true ? 1 : 0); ht.Add("HasDuty_FillBlankManage", ((CheckBox)row.FindControl("chkTypeManage")).Checked == true ? 1 : 0); ht.Add("HasDuty_JudgeManage", ((CheckBox)row.FindControl("chkTypeManage")).Checked == true ? 1 : 0); ht.Add("HasDuty_QuestionManage", ((CheckBox)row.FindControl("chkTypeManage")).Checked == true ? 1 : 0); where = " Where RoleId=" + row.Cells[0].Text; Role.Update(ht, where); } Page.RegisterStartupScript("", "<script>alert('授权成功!');</script>"); }
public static void SetCountriesName(string language) { Debug.Log("countries....." + language); TextAsset textAsset = (TextAsset) Resources.Load("countries"); var xml = new XmlDocument (); xml.LoadXml (textAsset.text); Countries = new Hashtable(); AppCountries = new SortedList(); try{ var element = xml.DocumentElement[language]; if (element != null) { var elemEnum = element.GetEnumerator(); while (elemEnum.MoveNext()) { var xmlItem = (XmlElement)elemEnum.Current; Countries.Add(xmlItem.GetAttribute("name"), xmlItem.InnerText); AppCountries.Add(xmlItem.GetAttribute("name"), xmlItem.InnerText); } } else { Debug.LogError("The specified language does not exist: " + language); } } catch (Exception ex) { Debug.Log("Language:SetCountryName()" + ex.ToString()); } }
protected void btnSubmit_Click(object sender, EventArgs e) { Hashtable hs = new Hashtable(); hs.Add("adno", StringHelper.ReplaceBadChar(adno.Text)); hs.Add("adtype", dropadtype.SelectedValue); hs.Add("cname", StringHelper.ReplaceBadChar(cname.Text)); hs.Add("title", title.Text.Trim()); hs.Add("link", link.Text.Trim()); hs.Add("litpic", file1.Value.Trim()); hs.Add("brief", brief.Text.Trim()); hs.Add("remark", ""); hs.Add("body", txtContent.Value.Trim()); hs.Add("config", config.Value.Trim()); hs.Add("px", px.Text.Trim()); hs.Add("addtime", txtPublishTime.Text.Trim()); hs.Add("isshow", chkIsShow.Checked == true ? 1 : 0); if (!StringHelper.isNum(Request.QueryString["id"]))//插入新纪录 { BLL.DataBaseHelper.instance.Insert(hs, "ad"); cname.Text = ""; title.Text = ""; txtContent.Value = ""; Common.MessageBox.Show(this, "操作成功"); } else//更新纪录 { int id = int.Parse(Request.QueryString["id"]); BLL.DataBaseHelper.instance.Update(hs, "ad", "[id]=" + id); Common.MessageBox.ShowAndRedirect(this, "修改成功!", "list.aspx"); } }
// test CopyTo on a empty HashTable public void TestHashTableCopyToEmpty () { Hashtable hashTable = new Hashtable (); AssertEquals ("count", 0, hashTable.Count); object[] array = new object [hashTable.Count]; hashTable.CopyTo (array, 0); }
protected void btninsert_Click(object sender, EventArgs e) { Hashtable data = new Hashtable(); data.Add("cmpname", txtcmpname.Text); data.Add("adrs", txtadrs.Text); data.Add("phoneno", txtphoneno.Text); data.Add("emailid", txtemailid.Text ); data.Add("servingarea", txtservingarea.Text); data.Add("p1name", txtname1.Text); data.Add("p1phoneno",txtp1.Text ); data.Add("p1desc",txtdesc1.Text); data.Add("p2name", txtname2.Text); if (txtname2.Text != "") { data.Add("p2phoneno", txtp2.Text); } data.Add("p2desc", txtdesc2.Text); data.Add("p3name", txtname3.Text); if (txtname3.Text != "") { data.Add("p3phoneno", txtp3 .Text); } data.Add("p3desc", txtdesc3.Text); int id; bll inscmd = new bll(); id=inscmd.ins3vendordet(data); lblretvendorid.Text = "Third Party Vendor Details Inserted & Vendor ID is" + id.ToString(); }
private void GetListing (System.IO.DirectoryInfo dirinfo, System.IO.FileInfo [] files, bool recurse) { System.Console.WriteLine ("Scanning {0}", dirinfo.FullName); Hashtable exiting_entries = new Hashtable (); foreach (Photo p in store.Query (dirinfo)) { foreach (uint id in p.VersionIds) { string name; if (id == Photo.OriginalVersionId) name = p.Name; else name = (new System.IO.FileInfo (p.GetVersionPath (id))).Name; exiting_entries [name] = p; } } foreach (System.IO.FileInfo f in files) { if (! exiting_entries.Contains (f.Name)) { AddPath (f.FullName); } } if (recurse) { foreach (System.IO.DirectoryInfo d in dirinfo.GetDirectories ()){ if (!d.Name.StartsWith (".")) GetListing (d); } } }
/// <summary> /// ・ユーザ パラメタ(文字列置換) /// ・パラメタ ライズド クエリのパラメタ /// を格納するハッシュ テーブルをクリアする。 /// </summary> public void ClearParametersFromHt() { // ユーザ パラメタ(文字列置換)用ハッシュ テーブルを初期化 this.HtUserParameter = new Hashtable(); // パラメタ ライズド クエリのパラメタ用ハッシュ テーブルを初期化 this.HtParameter = new Hashtable(); }
/// <summary>Called by PUN when new properties for the room were set (by any client in the room).</summary> public void OnPhotonCustomRoomPropertiesChanged(Hashtable propertiesThatChanged) { if (propertiesThatChanged.ContainsKey(StartTimeKey)) { StartTime = (double)propertiesThatChanged[StartTimeKey]; } }
/// <summary> /// Returns all parameters of the selected item as name – value collection. /// </summary> public override Hashtable GetItemProperties() { Hashtable retval = new Hashtable(); #region "Image general tab" if (tabImageGeneral.Visible) { string url = this.lblUrlText.Text.Trim(); retval[DialogParameters.IMG_URL] = URLHelper.ResolveUrl(url); retval[DialogParameters.IMG_EXT] = ValidationHelper.GetString(ViewState[DialogParameters.URL_EXT], ""); } #endregion #region "General items" retval[DialogParameters.URL_EXT] = ValidationHelper.GetString(ViewState[DialogParameters.URL_EXT], ""); retval[DialogParameters.URL_URL] = URLHelper.ResolveUrl(ValidationHelper.GetString(ViewState[DialogParameters.URL_URL], "")); retval[DialogParameters.EDITOR_CLIENTID] = this.EditorClientID; #endregion return retval; }
static PHPSerializer() { __ns = new Hashtable(); Assembly[] assem = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assem.Length; i++) { Module[] m = assem[i].GetModules(); for (int j = 0; j < m.Length; j++) { try { Type[] t = m[j].GetTypes(); for (int k = 0; k < t.Length; k++) { if (t[k].Namespace != null && !__ns.ContainsKey(t[k].Namespace)) { __ns[t[k].Namespace] = assem[i].FullName; } } } catch { } } } }
public static SceneData.SceneNodeData CreateNodeData( Hashtable attrTable ) { SceneData.SceneNodeData data = new SceneData.SceneNodeData(); data.name = attrTable["name"] as string; data.parentname = attrTable["parentname"] as string; ParamUtil.SetFloatAttr( out data.posX , "posX" , attrTable , 0f ); ParamUtil.SetFloatAttr( out data.posY , "posY" , attrTable , 0f ); ParamUtil.SetFloatAttr( out data.posZ , "posZ" , attrTable , 0f ); ParamUtil.SetFloatAttr( out data.rotX , "rotX" , attrTable , 0f ); ParamUtil.SetFloatAttr( out data.rotY , "rotY" , attrTable , 0f ); ParamUtil.SetFloatAttr( out data.rotZ , "rotZ" , attrTable , 0f ); ParamUtil.SetFloatAttr( out data.sclX , "sclX" , attrTable , 1f ); ParamUtil.SetFloatAttr( out data.sclY , "sclY" , attrTable , 1f ); ParamUtil.SetFloatAttr( out data.sclZ , "sclZ" , attrTable , 1f ); data.uiAtlasName = attrTable["uiAtlasName"] as string; data.texturePath = attrTable["texturePath"] as string; ParamUtil.SetFloatAttr( out data.alpha , "alpha" , attrTable , 1f ); if( attrTable.ContainsKey( "show") ){ data.show = ViNoStringExtensions.IsTrueOrYes( attrTable["show"] as string ); } if( attrTable.ContainsKey( "makePixelPerfect") ){ data.makePixelPerfect = ViNoStringExtensions.IsTrueOrYes( attrTable["makePixelPerfect"] as string ); } return data; }
public void Clear() { TraceId = Guid.NewGuid().ToString(); IsComplete = false; GameData = null; SummaryData = new Hashtable<string, string>(); }
public OrderedDictionary (int capacity, IEqualityComparer equalityComparer) { initialCapacity = (capacity < 0) ? 0 : capacity; list = new ArrayList (initialCapacity); hash = new Hashtable (initialCapacity, equalityComparer); comparer = equalityComparer; }
/* ============================================================================ 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> /// Tracking Database level Activities performed by user. /// </summary> /// <param name="strPageName">Activity tracking page name</param> /// <param name="strQuerry">Name of the query to track</param> /// <param name="htable">List of parameters passed to query</param> /// <param name="strUserID">Activity tracking user Id</param> public void TrackDBActivity(string strPageName, string strQuerry, string strUserID, Hashtable htable = null) { #region Declaration string strLogSrchParam = string.Empty; #endregion try { //check whether Track activity or not if (IsTrack) { if (htable != null) { IDictionaryEnumerator en = htable.GetEnumerator(); while (en.MoveNext()) { if (strLogSrchParam == "") { strLogSrchParam = en.Key.ToString() + ":" + en.Value.ToString(); } else { strLogSrchParam = strLogSrchParam + "," + en.Key.ToString() + ":" + en.Value.ToString(); } } } var htbl = new Hashtable(); htbl.Add("@AppID", ""); htbl.Add("@ModuleId", ""); htbl.Add("@PageName", strPageName); htbl.Add("@FunctionName", ""); htbl.Add("@QueryName", strQuerry); htbl.Add("@QueryParameters", strLogSrchParam); htbl.Add("@CreatedBy", strUserID); ActivityID = (string)Exec_Scaler("prc_InsActivity", htbl); //ActivityID = (string)Exec_Scaler("Prc_InsertLogSearchParam '" + strPageName + "','" + strQuerry + "','" + strLogSrchParam + "','" + strUserID + "'"); } } catch (Exception ex) { throw ex; } finally { } }
private static void ParseAddXmlElement(SecurityElement et, ArrayList listToAdd, string accessStr) { foreach (SecurityElement uriElem in et.Children) { if (uriElem.Tag.Equals("ENDPOINT")) { Hashtable attributes = uriElem.Attributes; string tmpStr; try { tmpStr = attributes["host"] as string; } catch { tmpStr = null; } if (tmpStr == null) { throw new ArgumentNullException(accessStr + "host"); } string host = tmpStr; try { tmpStr = attributes["transport"] as string; } catch { tmpStr = null; } if (tmpStr == null) { throw new ArgumentNullException(accessStr + "transport"); } TransportType transport; try { transport = (TransportType)Enum.Parse(typeof(TransportType), tmpStr, true); } catch (Exception exception) { if (exception is ThreadAbortException || exception is StackOverflowException || exception is OutOfMemoryException) { throw; } throw new ArgumentException(accessStr + "transport", exception); } try { tmpStr = attributes["port"] as string; } catch { tmpStr = null; } if (tmpStr == null) { throw new ArgumentNullException(accessStr + "port"); } if (string.Compare(tmpStr, "All", StringComparison.OrdinalIgnoreCase) == 0) { tmpStr = "-1"; } int port; try { port = Int32.Parse(tmpStr, NumberFormatInfo.InvariantInfo); } catch (Exception exception) { if (exception is ThreadAbortException || exception is StackOverflowException || exception is OutOfMemoryException) { throw; } throw new ArgumentException(SR.GetString(SR.net_perm_invalid_val, accessStr + "port", tmpStr), exception); } if (!ValidationHelper.ValidateTcpPort(port) && port != SocketPermission.AllPorts) { throw new ArgumentOutOfRangeException("port", port, SR.GetString(SR.net_perm_invalid_val, accessStr + "port", tmpStr)); } listToAdd.Add(new EndpointPermission(host, port, transport)); } else { // improper tag found, just ignore } } }
/// <summary> /// Set properties to a datalake gen2 Datalakegen2Item /// </summary> /// <param name="item">datalake gen2 Datalakegen2Item</param> /// <param name="BlobProperties">properties to set</param> /// <param name="setToServer">True will set to server, false only set to the local Datalakegen2Item object</param> protected static PathHttpHeaders SetDatalakegen2ItemProperties(DataLakePathClient item, Hashtable BlobProperties, bool setToServer = true) { if (BlobProperties != null) { // Valid Blob Dir properties foreach (DictionaryEntry entry in BlobProperties) { if (!validDatalakeGen2FileProperties.ContainsKey(entry.Key.ToString())) { throw new ArgumentException(String.Format("InvalidDataLakeFileProperties", entry.Key.ToString(), entry.Value.ToString())); } } PathHttpHeaders headers = new PathHttpHeaders(); foreach (DictionaryEntry entry in BlobProperties) { string key = entry.Key.ToString(); string value = entry.Value.ToString(); Action <PathHttpHeaders, string> action = validDatalakeGen2FileProperties[key]; if (action != null) { action(headers, value); } } if (setToServer && item != null) { item.SetHttpHeaders(headers); } return(headers); } else { return(null); } }
public static Dictionary <K, V> HashtableToDictionary <K, V>(Hashtable table) { return(table .Cast <DictionaryEntry>() .ToDictionary(kvp => (K)kvp.Key, kvp => (V)kvp.Value)); }
public static Dictionary <string, string> ToDictionary(this Hashtable hashTable) { return(hashTable.Cast <DictionaryEntry>().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString())); }
public ClientPlayerSkill(Hashtable info) { this.ParseInfo(info); }
public FixturesPrediction(Hashtable rates) { Rates = rates; }
/// <summary> /// Initialize all the properties that a script may need /// One thing to note here is that resources are wrapped in ResourceToDuck wrapper /// to enable easy use by the script /// </summary> /// <param name="myContext">My context.</param> /// <param name="myController">My controller.</param> /// <param name="controllerContext">The controller context.</param> private void InitProperties(IEngineContext myContext, IController myController, IControllerContext controllerContext) { properties = new Hashtable(StringComparer.InvariantCultureIgnoreCase) { { "Controller", myController } }; if (myContext != null) { properties.Add("request", myContext.Request); properties.Add("response", myContext.Response); properties.Add("session", myContext.Session); } if (controllerContext.Resources != null) { foreach (var key in controllerContext.Resources.Keys) { properties.Add(key, new ResourceToDuck(controllerContext.Resources[key])); } } if (myContext != null && myContext.Request.QueryString != null) { foreach (var key in myContext.Request.QueryString.AllKeys) { if (key == null) { continue; } properties[key] = myContext.Request.QueryString[key]; } } if (myContext != null && myContext.Request.Form != null) { foreach (var key in myContext.Request.Form.AllKeys) { if (key == null) { continue; } properties[key] = myContext.Request.Form[key]; } } if (myContext != null && myContext.Flash != null) { foreach (DictionaryEntry entry in myContext.Flash) { properties[entry.Key] = entry.Value; } } if (controllerContext.PropertyBag != null) { foreach (DictionaryEntry entry in controllerContext.PropertyBag) { properties[entry.Key] = entry.Value; } } if (controllerContext.CustomActionParameters != null) { foreach (var entry in controllerContext.CustomActionParameters) { properties[entry.Key] = entry.Value; } } if (controllerContext.Helpers != null) { foreach (DictionaryEntry entry in controllerContext.Helpers) { properties[entry.Key] = entry.Value; } } if (myContext != null) { properties["siteRoot"] = myContext.ApplicationPath; } if (parent != null) { foreach (DictionaryEntry entry in parent.Properties) { properties[entry.Key] = entry.Value; } } }
/// <summary> /// Called when custom player-properties are changed. Player and the changed properties are passed as object[]. /// </summary> /// <remarks> /// Changing properties must be done by Player.SetCustomProperties, which causes this callback locally, too. /// </remarks> /// /// <param name="targetPlayer">Contains Player that changed.</param> /// <param name="changedProps">Contains the properties that changed.</param> public virtual void OnPlayerPropertiesUpdate(Player target, Hashtable changedProps) { }
public string RenderView(Hashtable pModelResult) { StringBuilder output = new StringBuilder(); HTMLUtil.HR(ref output, ""); output.Append("<H3>ActiveLog</H3>\n"); string tmp = normalizeEndLines.Replace(pModelResult["loglines"].ToString(), "\n"); string[] result = Regex.Split(tmp, "\n"); string formatopen = ""; string formatclose = ""; for (int i = 0; i < result.Length; i++) { if (result[i].Length >= 30) { string logtype = result[i].Substring(24, 6); switch (logtype) { case "WARN ": formatopen = "<font color=\"#7D7C00\">"; formatclose = "</font>"; break; case "ERROR ": formatopen = "<font color=\"#FF0000\">"; formatclose = "</font>"; break; default: formatopen = ""; formatclose = ""; break; } } StringBuilder replaceStr = new StringBuilder(); //string titlecolorresults = string formatresult = Regex.Replace(TitleColor.Replace(result[i], "$1"), "[^ABCDEFabcdef0-9]", ""); if (formatresult.Length > 6) { formatresult = formatresult.Substring(0, 6); } for (int j = formatresult.Length; j <= 5; j++) { formatresult += "0"; } replaceStr.Append("$1 - [<font color=\"#"); replaceStr.Append(formatresult); replaceStr.Append("\">$3</font>] $4<br />"); string repstr = replaceStr.ToString(); output.Append(formatopen); output.Append(webFormat.Replace(result[i], repstr)); output.Append(formatclose); } return(output.ToString()); }
public ClassCoverageItem(CoverageItem parent) : base(parent) { methodsByMethod = new Hashtable(); }
//和客户端进行数据通信包括接收客户端的请求 //根据同的请求命令执行相应的操作并将操作结果返回给客户端 public void ClientService() { string[] acceptStr = null; //保存消息字符 byte[] buff = new byte[1024]; //缓冲区 bool keepConnected = true; NetworkStream stream = currentClient.GetStream(); //用循环不断地与客户端进行交互,直到其发出EXIT或者QUIT命令 //将keepConnected设置为false,退出循环关闭当前连接,中止当前线程 while (keepConnected && ServerForm.ServerFlag) { acceptStr = null; try { //if (currentSocket == null || currentSocket.Available < 1) if (currentClient == null || currentClient.Available < 1) { Thread.Sleep(300); continue; } //接收信息存入buff数组中 //int length = currentSocket.Receive(buff); int length = stream.Read(buff, 0, 1024); string Command = Encoding.Default.GetString(buff, 0, length); acceptStr = Command.Split(new char[] { '|' }); if (acceptStr == null) { Thread.Sleep(200); continue; } } catch (Exception ex) { server.UpdateMsg("程序发生异常,异常信息:" + ex.Message); } if (acceptStr[0] == "CONNECT") { this.name = acceptStr[1]; if (ServerForm.clients.Contains(this.name)) { SendToClient(this, "ERORR|User" + this.name + "已经存在"); } else { Hashtable synClients = Hashtable.Synchronized(ServerForm.clients); synClients.Add(this.name, this); server.AddUser(this.name); IEnumerator myIEnumerator = ServerForm.clients.Values.GetEnumerator(); while (myIEnumerator.MoveNext()) { ChatClient cClient = (ChatClient)myIEnumerator.Current; SendToClient(cClient, "JOIN|" + this.name + "|"); Thread.Sleep(100); } connState = "connected"; SendToClient(this, "OK"); string msgUsers = "LIST|" + server.GetUserList(); SendToClient(this, msgUsers); } } else if (acceptStr[0] == "LIST") { if (connState == "CONNECTED") { string msgUsers = "LIST|" + server.GetUserList(); SendToClient(this, msgUsers); } else { SendToClient(this, "ERROR|服务器未连接,请重新登录"); } } else if (acceptStr[0] == "CHAT") { if (connState == "connected") { IEnumerator myEnumerator = ServerForm.clients.Values.GetEnumerator(); while (myEnumerator.MoveNext()) { ChatClient client = (ChatClient)myEnumerator.Current; SendToClient(client, acceptStr[1]); } server.UpdateMsg(acceptStr[1]); } else { SendToClient(this, "ERROR|服务器未连接,请重新登录"); } } else if (acceptStr[0] == "PRIV") { if (connState == "connected") { string sender = acceptStr[1]; string receiver = acceptStr[2]; string content = acceptStr[3]; string message = sender + " ---> " + receiver + ": " + content; if (ServerForm.clients.Contains(sender)) { SendToClient( (ChatClient)ServerForm.clients[sender], message); } if (ServerForm.clients.Contains(receiver)) { SendToClient( (ChatClient)ServerForm.clients[receiver], message); } server.UpdateMsg(message); } else { SendToClient(this, "ERROR|服务器未连接,请重新登录"); } } else if (acceptStr[0] == "EXIT") { if (ServerForm.clients.Contains(acceptStr[1])) { ChatClient client = (ChatClient)ServerForm.clients[acceptStr[1]]; Hashtable syncClients = Hashtable.Synchronized( ServerForm.clients); syncClients.Remove(client.name); server.RemoveUser(client.name); string message = "QUIT|" + acceptStr[1]; System.Collections.IEnumerator myEnumerator = ServerForm.clients.Values.GetEnumerator(); while (myEnumerator.MoveNext()) { ChatClient newClient = (ChatClient)myEnumerator.Current; SendToClient(newClient, message); } server.UpdateMsg("QUIT"); } break; } Thread.Sleep(200); } }
private void Show() { Hashtable hashtable = (Hashtable)HttpContext.Current.Application["config_fenye"]; int pageSize = Convert.ToInt32(hashtable["fenye_commom"]); string text = "1=1"; string text2 = base.Request.QueryString["keywords"]; if (!string.IsNullOrEmpty(text2) && Utils.CheckSql(text2)) { text = string.Concat(new string[] { " (a.CRM_Name like '%", text2, "%' or b.ContactAim like '%", text2, "%') " }); } string cmdText = string.Concat(new string[] { "select a.id as crmid,a.CRM_Name as crm,b.id as contactid,b.ContactAim as ContactTitle,b.addtime as ContactTime from crm a,crm_contact b where a.id=b.cid and a.CreatorID=", this.Uid, " and ", text, " order by b.id desc" }); DataSet dataSet = MsSqlOperate.ExecuteDataset(CommandType.Text, cmdText, new SqlParameter[0]); int num = 0; try { if (!string.IsNullOrEmpty(base.Request.QueryString["page"])) { num = Convert.ToInt32(base.Request.QueryString["page"]); } } catch { } if (num == 0) { num = 1; } PagedDataSource pagedDataSource = new PagedDataSource(); pagedDataSource.DataSource = dataSet.Tables[0].DefaultView; pagedDataSource.AllowPaging = true; pagedDataSource.PageSize = pageSize; pagedDataSource.CurrentPageIndex = num - 1; this.rpt.DataSource = pagedDataSource; this.rpt.DataBind(); if (!string.IsNullOrEmpty(base.Request.QueryString["keywords"])) { this.Page1.sty("meneame", num, pagedDataSource.PageCount, "?keywords=" + base.Request.QueryString["keywords"] + "&page="); } else { this.Page1.sty("meneame", num, pagedDataSource.PageCount, "?page="); } this.rpt.DataSource = pagedDataSource; this.rpt.DataBind(); this.num.InnerHtml = "当前查询条件总计 - <span style='color:#ff0000; font-weight:bold;'>" + dataSet.Tables[0].Rows.Count + "</span> 条 记录数据"; dataSet.Dispose(); }
/// <summary> /// Called when a room's custom properties changed. The propertiesThatChanged contains all that was set via Room.SetCustomProperties. /// </summary> /// <remarks> /// Since v1.25 this method has one parameter: Hashtable propertiesThatChanged.<br/> /// Changing properties must be done by Room.SetCustomProperties, which causes this callback locally, too. /// </remarks> /// <param name="propertiesThatChanged"></param> public virtual void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged) { }
public Hashtable GetPDSTRowFromPipeNameCheckSize(string spoolname, string shipno) { string connstr = "dsn=mis-1;uid=tbdb01;pwd=tbdb01"; OdbcConnection conn = new OdbcConnection(connstr); OdbcDataAdapter da = new OdbcDataAdapter(); string query = string.Format(@"select A.*,B.MATERIAL from PDST_PIPE A , STD_PDST_COMP_REF_AM B where A.ship_no='{0}' AND A.MATL_SPEC=B.determine_args(+) ", shipno); OdbcCommand cmd = new OdbcCommand(query, conn); da.SelectCommand = cmd; result_dt = new DataTable(); da.Fill(result_dt); string[] namesplit = spoolname.Split('-'); string module = namesplit[0]; string line = namesplit[1]; string spoolno = namesplit[2]; string system = line.Substring(0, 2); int lineno = Convert.ToInt32(line.Substring(2)); List<DataRow> resultlist = new List<DataRow>(); Hashtable resultHs = new Hashtable(); foreach (DataRow row in result_dt.Rows) { try { string linestr = row["LINE_NO"].ToString(); linestr = linestr.Trim(); string[] splitarr = linestr.Split(new char[] { ' ' }, 2); string pdst_sys = splitarr[0]; string[] pdst_linenos = new string[] { }; //라인넘버 존재하지 않고 그냥 EB 이렇게 정의되는 경우 1-9999로 정의함. if (splitarr.Length == 1) { pdst_linenos = new string[] { "1-99999" }; } else { pdst_linenos = splitarr[1].Split(new char[] { ',' }); } if (pdst_sys == system) { int start_no = 0; int end_no = 0; bool includedLineNo = false; foreach (string pdst_lineno in pdst_linenos) { string[] pdst_linenoarr = pdst_lineno.Split(new string[] { "-" }, StringSplitOptions.None); if (pdst_linenoarr.Length == 1) { start_no = Convert.ToInt32(pdst_linenoarr[0]); end_no = Convert.ToInt32(pdst_linenoarr[0]); } else { start_no = Convert.ToInt32(pdst_linenoarr[0]); end_no = Convert.ToInt32(pdst_linenoarr[1]); } Console.WriteLine("22"); if (lineno >= start_no && lineno <= end_no) { includedLineNo = true; break; } } if (includedLineNo) { resultlist.Add(row); } } } catch (Exception ee) { Console.WriteLine("1"); } } //결과 List를 Hashtable로 변환해서 리턴시킴 for (int i = 1; i <= resultlist.Count; i++) { Hashtable resultsubHs = new Hashtable(); for (int j = 1; j <= result_dt.Columns.Count; j++) { resultsubHs.Add((double)j, resultlist[i - 1][j - 1].ToString()); } resultHs.Add((double)i, resultsubHs); } return resultHs; }
public LLSDParcelVoiceInfoResponse(string region, int localID, Hashtable creds) { region_name = region; parcel_local_id = localID; voice_credentials = creds; }
public Hashtable ExtractClashItems(Hashtable ClashItems) { Dictionary<string, List<string>> piecelist = new Dictionary<string, List<string>>(); Dictionary<string, List<string>> strulist = new Dictionary<string, List<string>>(); Dictionary<string, List<string>> equiplist = new Dictionary<string, List<string>>(); List<Hashtable> ClashItemList = new List<Hashtable>(); Hashtable clashHash = new Hashtable(); //var xx = ClashItems.OfType<Hashtable>().GroupBy(x => x[1.0]).Select(x=>x); foreach (var idx in ClashItems.Keys) { //clashHash.Add() Hashtable tmphash = (Hashtable)ClashItems[idx]; string key=tmphash[1.0].ToString(); List<string> tmplist=tmphash.Values.OfType<string>().ToList(); if( clashHash.ContainsKey(key)) { ((List<List<string>>)clashHash[key]).Add(tmplist); } else{ List<List<string>> values = new List<List<string>>(); values.Add(tmplist); clashHash.Add(key,values); } //List<string> values = new List<string>(); //ClashItemList.Add((Hashtable)ClashItems[idx]); } foreach (string key in clashHash.Keys) { foreach (var item in ((List<List<string>>)clashHash[key])) { try { if (DbElement.GetElement(item[0]).Owner.GetAsString(DbAttributeInstance.TYPE) == "BRAN") { string piecename = DbElement.GetElement(item[0]).GetAsString(DbAttributeInstance.PCRFA); if (piecelist.Keys.Contains(piecename)) { if (!piecelist[piecename].Contains(item[4])) piecelist[piecename].Add(item[4]); } else { List<string> values = new List<string>(); values.Add(item[4]); piecelist.Add(piecename, values); } } else if (DbElement.GetElement(item[0]).Owner.GetAsString(DbAttributeInstance.TYPE) == "FRMW") { string struname=DbElement.GetElement(item[0]).Owner.Owner.GetAsString(DbAttributeInstance.NAME); if (strulist.Keys.Contains(struname)) { if (!strulist[struname].Contains(item[4])) strulist[struname].Add(item[4]); } else { List<string> values = new List<string>(); values.Add(item[4]); strulist.Add(struname, values); } } //else if(DbElement.GetElement(item[0]).Owner.GetAsString(DbAttributeInstance.TYPE) == "EQUI") //{ // string equipname = DbElement.GetElement(item[0]).Owner.GetAsString(DbAttributeInstance.NAME); // if (equiplist.Keys.Contains(equipname)) // { // if (!equiplist[equipname].Contains(item[4])) // equiplist[equipname].Add(item[4]); // } // else // { // List<string> values = new List<string>(); // values.Add(item[4]); // equiplist.Add(equipname, values); // } //} }catch(Exception ee) { } } } Hashtable resultHs = new Hashtable(); //Datatable -> HashTable double i=1.0; foreach (string piecename in piecelist.Keys) { Hashtable resultsubHs = new Hashtable(); resultsubHs.Add(1.0, piecename); for (int j = 1; j <= piecelist[piecename].Count; j++) { resultsubHs.Add((double)j+1, piecelist[piecename][j - 1]); } resultHs.Add((double)i, resultsubHs); i= i+1; } foreach (string struname in strulist.Keys) { Hashtable resultsubHs = new Hashtable(); resultsubHs.Add(1.0, struname); for (int j = 1; j <= strulist[struname].Count; j++) { resultsubHs.Add((double)j + 1, strulist[struname][j - 1]); } resultHs.Add((double)i, resultsubHs); i = i + 1; } //foreach (string equiname in equiplist.Keys) //{ // Hashtable resultsubHs = new Hashtable(); // resultsubHs.Add(1.0, equiname); // for (int j = 1; j <= equiplist[equiname].Count; j++) // { // resultsubHs.Add((double)j + 1, equiplist[equiname][j - 1]); // } // resultHs.Add((double)i, resultsubHs); // i = i + 1; //} Console.WriteLine(resultHs); return resultHs; }
/// <summary> /// get company infor after web search /// </summary> /// <param name="nodes"></param> /// <param name="fileName"></param> private void getCompanyInfor3(HtmlAgilityPack.HtmlNodeCollection nodes, string fileName) { string name = Path.GetFileNameWithoutExtension(fileName); Uri uri1 = new Uri(txtWeb.Text); Hashtable urls = new Hashtable(); int count = 0; foreach (HtmlAgilityPack.HtmlNode node in nodes) { if (node.InnerHtml.IndexOf("企業") > -1 || node.InnerHtml.IndexOf("会社") > -1 || node.InnerHtml.IndexOf("概要") > -1 || node.InnerHtml.IndexOf("案内") > -1 || node.InnerHtml.IndexOf("COMPANY") > -1 || node.InnerHtml.IndexOf("ABOUTUS") > -1) { string url = System.Web.HttpUtility.HtmlDecode(node.GetAttributeValue("href", "")); if (url.StartsWith("http")) { if (url.Split('/').Length < 6 && url.IndexOf("?") < 0) { Uri uri2 = new Uri(url); if (url != txtWeb.Text && uri1.Host == uri2.Host && urls[url] == null) { urls[url] = url; count++; if (count == 20) { break; } } } } else { if (url.StartsWith("/")) { url = "http://" + uri1.Host + url; } else { url = "http://" + uri1.Host + "/" + url; } if (url.Split('/').Length < 6 && url.IndexOf("?") < 0) { Uri uri2 = new Uri(url); if (url != txtWeb.Text && urls[url] == null) { urls[url] = url; count++; if (count == 20) { break; } } } } } } if (count == 0) { foreach (HtmlAgilityPack.HtmlNode node in nodes) { string url = System.Web.HttpUtility.HtmlDecode(node.GetAttributeValue("href", "")); if (url.IndexOf("corporate") > -1 || url.IndexOf("about") > -1 || url.IndexOf("infor") > -1 || url.IndexOf("profile") > -1 || url.IndexOf("company") > -1) { if (url.StartsWith("http")) { if (url.Split('/').Length < 6 && url.IndexOf("?") < 0) { Uri uri2 = new Uri(url); if (url != txtWeb.Text && uri1.Host == uri2.Host && urls[url] == null) { urls[url] = url; count++; if (count == 20) { break; } } } } else { if (url.StartsWith("/")) { url = "http://" + uri1.Host + url; } else { url = "http://" + uri1.Host + "/" + url; } if (url.Split('/').Length < 6 && url.IndexOf("?") < 0) { Uri uri2 = new Uri(url); if (url != txtWeb.Text && urls[url] == null) { urls[url] = url; count++; if (count == 20) { break; } } } } } } } if (urls.Keys.Count > 0) { string[] urldata = new string[urls.Keys.Count]; urls.Keys.CopyTo(urldata, 0); for (int i = 0; i < urldata.Length; i++) { Uri uri3 = new Uri(urldata[i]); UriBuilder uri = new UriBuilder(uri3.AbsoluteUri); string path = fileName.Split('\\')[4]; path = @"C:\Temp\Spider\" + uri.Host + "\\"; string filename = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + "_" + i.ToString() + ".htm"); if (!path.EndsWith("\\")) { path += "\\"; } if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (!File.Exists(filename)) { using (WebClient client = new WebClient()) { client.DownloadFile(uri3, filename); System.Threading.Thread.Sleep(1000); Application.DoEvents(); } } } } }
public Hashtable ArraySort2by2(Hashtable sourcehash, double columnidx, Boolean mode) { //Hash Table의 크기에 맞춰 컬럼생성 DataTable dt = new DataTable(); Hashtable samplerow= ((Hashtable)sourcehash[1.0]); int columnsize = samplerow.Count; for (int i = 0; i < columnsize; i++) { Type columntype=samplerow[Convert.ToDouble(i+1)].GetType(); dt.Columns.Add("col" + (i + 1).ToString(),columntype); } //데이터 테이블로 넣는다. foreach (var key in sourcehash.Keys) { Hashtable hs2 = (Hashtable)sourcehash[key]; ArrayList ar = new ArrayList(); for (double i=1.0; i <= hs2.Keys.Count;i=i+1 ) { //ar[columnkey]=hs2[columnkey].ToString(); ar.Add(hs2[i]); } //foreach (var columnkey in hs2.Keys) //{ // //ar[columnkey]=hs2[columnkey].ToString(); // ar.Add(hs2[columnkey]); //} dt.Rows.Add(ar.ToArray()); //Hashtable hhs2=(Hashtable)hs[h1]; //foreach(int h2 in hhs2.Keys) //{ Console.WriteLine(dt); //} } int idx = Convert.ToInt32(columnidx); dt.DefaultView.Sort = "col"+idx.ToString() + " ASC"; dt = dt.DefaultView.ToTable(false); Hashtable resultHs = new Hashtable(); //Datatable -> HashTable for (int i = 1; i < dt.Rows.Count + 1; i++) { Hashtable resultsubHs = new Hashtable(); for (int j = 1; j < dt.Columns.Count + 1; j++) { resultsubHs.Add((double)j, dt.Rows[i-1][j - 1]); } resultHs.Add((double)i, resultsubHs); } Console.WriteLine(resultHs); return resultHs; }
public Hashtable GetTreatInfos(string module,string system,double bore,string treatment, string matl) { Hashtable resultHs=new Hashtable(); string [] treatinfo=new string[]{}; if (treatment=="-") treatment=""; treatment=treatment.Trim(); ///1단계적용 if (treatment == "GAL") { treatinfo = new string[] { "AG","AG", "---","---", "0" }; } if (treatment == "PE") { treatinfo = new string[] { "BC","BP", "---","6KP", "0" }; } if (treatment == "ALUMINIZED") { treatinfo = new string[] { "---","---", "---","---", "0" }; } if (matl == "SUS") { treatinfo = new string[] { "PA","PA", "---","---", "0" }; } if (treatment == "COPPER") { if (treatment == "INS") { treatinfo = new string[] { "NO","NO", "---","---", "1" }; } else { treatinfo = new string[] { "NO","NO", "---","---", "0" }; } } if(treatinfo.Length!=0 ) { if(treatinfo[3]=="6KP") { string munit= module.Substring(0,2); if(munit=="M1") { treatinfo=new string[]{treatinfo[0],treatinfo[1].Substring(0,4)+"6KH",treatinfo[2]}; }else if(munit=="M2" || munit=="M3" || munit=="MA" || munit=="2E" ) { treatinfo=new string[]{treatinfo[0],treatinfo[1].Substring(0,4)+"6KF",treatinfo[2]}; } } if(module.Substring(0,1)=="E" && module.Substring(module.Length-1,1)=="6") { if(bore>=125) treatinfo = new string[] { "BP","BP", "6KS","6KH", "0" }; else treatinfo = new string[] { "AG","AG", "---","---", "0" }; } //결과 List를 Hashtable로 변환해서 리턴시킴 for (int i = 1; i <= treatinfo.Length; i++) { resultHs.Add((double)i, treatinfo[i-1]); } return resultHs; } ///2 단계적용 string [] oilsys=new string []{"FA","FC","FG","FH","FI","FN","FS","FV","LK"}; string [] watersys = new string[] { "TA", "TB", "TE", "TH", "TR", "WE", "TU", "BP" }; string [] exhgassys = new string[] { "XS", "XL" }; if (oilsys.Contains(system)) { if (treatment == "INS & TRAC") { treatinfo = new string[] { "AA","AP", "---","6JY", "1" }; } if (treatment == "INS / INST & ELEC.TRAC." && system == "LK") { treatinfo = new string[] { "AA","AP", "---","6JY", "1" }; } } if (watersys.Contains(system)) { if (treatment == "INS" ) treatinfo = new string[] { "AH","AP", "---","6JY", "1" }; if (system == "TU" && treatment == "") treatinfo = new string[] { "AH","AP", "---","6JY", "0" }; if (system=="BP" && treatment=="INS. & TRAC. GAL") treatinfo = new string[] { "AG","GP", "---","6KV", "1" }; } if(exhgassys.Contains(system) && treatment=="INS") { treatinfo = new string[] { "AH","BP", "---","6JB", "1" }; } if(treatinfo.Length!=0 ) { if(treatinfo[3]=="6KP") { string munit= module.Substring(0,2); if(munit=="M1") { treatinfo=new string[]{treatinfo[0],treatinfo[1].Substring(0,4)+"6KH",treatinfo[2]}; }else if(munit=="M2" || munit=="M3" || munit=="MA" || munit=="2E" ) { treatinfo=new string[]{treatinfo[0],treatinfo[1].Substring(0,4)+"6KF",treatinfo[2]}; } } if(module.Substring(0,1)=="E" && module.Substring(module.Length-1,1)=="6") { if(bore>=125) treatinfo = new string[] { "BP","BP", "6KS","6KH", "0" }; else treatinfo = new string[] { "AG","AG", "---","---", "0" }; } //결과 List를 Hashtable로 변환해서 리턴시킴 for (int i = 1; i <= treatinfo.Length; i++) { resultHs.Add((double)i, treatinfo[i-1]); } return resultHs; } /// 3단계적용 string initsys=system.Substring(0,1); if(initsys=="L" || initsys=="F" || initsys=="H") treatinfo = new string[] { "AA","AP", "---","6KP", "0" }; if (initsys == "T" || initsys == "W" || initsys == "D" || initsys == "B") treatinfo = new string[] { "AH","AP", "---","6KP", "0" }; if(initsys=="V" || initsys=="A" || initsys=="I" || initsys=="X") treatinfo = new string[] { "AH","AP", "---","6KP", "0" }; if(treatinfo.Length!=0 ) { if(treatinfo[3]=="6KP") { string munit= module.Substring(0,2); if(munit=="M1") { treatinfo=new string[]{treatinfo[0],treatinfo[1],treatinfo[2],"6KH",treatinfo[4]}; }else if(munit=="M2" || munit=="M3" || munit=="MA" || munit=="2E" ) { treatinfo = new string[] { treatinfo[0], treatinfo[1], treatinfo[2], "6KF", treatinfo[4] }; } } if(module.Substring(0,1)=="E" && module.Substring(module.Length-1,1)=="6") { if(bore>=125) treatinfo = new string[] { "BP","BP", "6KS","6KH", "0" }; else treatinfo = new string[] { "AG","AG", "---","---", "0" }; } //결과 List를 Hashtable로 변환해서 리턴시킴 for (int i = 1; i <= treatinfo.Length; i++) { resultHs.Add((double)i, treatinfo[i-1]); } return resultHs; } return resultHs; }
public void GetSpflImportTree(List<Tb_Khfl_Import> list, List<Tb_Khfl> khflList, List<Tb_Khfl_Import> fiallist, string id_user, string id_masteruser) { if (list.Any()) { Hashtable ht = new Hashtable(); ht.Add("id_masteruser", id_masteruser); ht.Add("id_farther", "0"); ht.Add("flag_delete", (int)Enums.FlagDelete.NoDelete); var dbList = DAL.QueryList<Tb_Khfl>(typeof(Tb_Khfl), ht); var firstList = list.Where(l => string.IsNullOrWhiteSpace(l.father)).ToList(); firstList.ForEach(fl => { var res = CheckImportInfo(fl, dbList.ToList()); if (!res.Success) { fl.bz = res.Message[0] ?? "数据不合要求!"; fiallist.Add(fl); } else { if (firstList.Where(d => d.mc == fl.mc).Count() > 1) { fl.bz = "操作失败 导入数据存在同名分类!"; fiallist.Add(fl); } else { Tb_Khfl st = new Tb_Khfl(); st.bm = fl.bm; st.mc = fl.mc; st.id = Guid.NewGuid().ToString(); st.path = "/0/" + st.id; st.id_farther = "0"; st.flag_delete = (byte)Enums.FlagDelete.NoDelete; st.rq_edit = st.rq_create = DateTime.Now; st.id_edit = st.id_create = id_user; st.id_masteruser = id_masteruser; CreatSubTree(st, list, khflList, fiallist, id_user, id_masteruser, dbList.ToList()); var model = khflList.FirstOrDefault(sl => sl.mc == st.mc); if (model != null && model.id_farther == st.id_farther) { fl.bz = "同一级中已有同名分类"; fiallist.Add(fl); } else { khflList.Add(st); } } } }); foreach (var item in list.Where(d => !(from s in khflList select s.mc).Contains(d.mc) && string.IsNullOrEmpty(d.bz))) { item.bz = "导入文件中无此 上级名称 的根目录数据 或上级名称 根目录不符合要求"; fiallist.Add(item); } } }
public Hashtable SubGroupingbyColumn(Hashtable sourcehash, double keyColIdx) { //Hash Table의 크기에 맞춰 컬럼생성 DataTable dt = new DataTable(); Hashtable samplerow = ((Hashtable)sourcehash[1.0]); int columnsize = samplerow.Count; for (int i = 0; i < columnsize; i++) { Type columntype = samplerow[Convert.ToDouble(i + 1)].GetType(); dt.Columns.Add("col" + (i + 1).ToString(), columntype); } //데이터 테이블로 넣는다. foreach (double key in sourcehash.Keys.Cast<double>().OrderBy(T=>T)) { Hashtable hs2 = (Hashtable)sourcehash[key]; ArrayList ar = new ArrayList(); foreach (var columnkey in hs2.Keys.Cast<double>().OrderBy(T => T)) { //ar[columnkey]=hs2[columnkey].ToString(); ar.Add(hs2[columnkey]); } dt.Rows.Add(ar.ToArray()); Console.WriteLine(dt); } //int idx = Convert.ToInt32(columnidx); //dt.DefaultView.Sort = "col" + idx.ToString() + " ASC"; dt = dt.DefaultView.ToTable(false); var groupset=dt.AsEnumerable().GroupBy(r => r[Convert.ToInt32(keyColIdx)]).Select(g => g); Hashtable resultHs = new Hashtable(); //Datatable -> HashTable var resultlist=groupset.ToList(); for (int i = 1; i <= resultlist.Count ; i++) { Hashtable resultsubHs = new Hashtable(); resultsubHs.Add(1.0,resultlist[i-1].Key); var resultlist2 = resultlist[i - 1].ToArray(); for (int j =1; j <= resultlist2.Count() ; j++) { Hashtable resultsub2Hs = new Hashtable(); for (int k = 1; k < resultlist2[j-1].ItemArray.Count()+1; k++) { resultsub2Hs.Add((double)k, resultlist2[j-1][k-1]); } resultsubHs.Add((double)j+1, resultsub2Hs); } resultHs.Add((double)i, resultsubHs); } Console.WriteLine(resultHs); return resultHs; }
/// <summary> /// 检查同级分类名称 /// </summary> /// <param name="ht">id_cyuser:当前用户ID id_farther所属父节点ID flag_delete:未删除标识 mc:分类名称</param> /// <returns></returns> private bool CheckMC(Hashtable ht) { return DAL.GetCount(typeof(Tb_Khfl), ht) > 0; }
public Hashtable GetPaintCode(string shipno,string itemtype, string area,string system,string lineno,string matl) { Hashtable hs = new Hashtable(); result_dt = new DataTable(); string connstr = "dsn=mis-1;uid=tbdb01;pwd=tbdb01"; OdbcConnection conn = new OdbcConnection(connstr); OdbcDataAdapter da = new OdbcDataAdapter(); string query = string.Format(@"select * from AM_PAINT_REF WHERE SHIP_NO='{0}'", shipno); OdbcCommand cmd = new OdbcCommand(query, conn); da.SelectCommand = cmd; da.Fill(result_dt); DataRow resultrow = null; if (itemtype == "PIPE") { var matchresult = result_dt.Rows.Cast<DataRow>().Where(r => r["AREA"].ToString() == area && r["MATERIAL"].ToString() == matl && r["SYSTEM"].ToString() == system).ToArray(); var matchAreaMatl = result_dt.Rows.Cast<DataRow>().Where(r => r["AREA"].ToString() == area && r["MATERIAL"].ToString() == matl).ToArray(); if (matchresult.Count() > 0) //구역,재질, 시스템이 일치하는 경우 { bool haslineno = false; foreach (DataRow row in matchresult) { string paint_lineno = row["LINE_NO"].ToString(); if (paint_lineno != "-") { string[] splitLineNo = paint_lineno.Split(new char[] { ',' }); foreach (string eachlineno in splitLineNo) { int startno = 0; int endno = 0; string[] eachlinesnos = eachlineno.Trim().Split(new char[] { '-' }); if (eachlinesnos.Length == 1) { startno = Convert.ToInt32(eachlinesnos[0]); endno = Convert.ToInt32(eachlinesnos[0]); } else { startno = Convert.ToInt32(eachlinesnos[0]); endno = Convert.ToInt32(eachlinesnos[1]); } if (Convert.ToInt32(lineno) >= startno && Convert.ToInt32(lineno) <= endno) { haslineno = true; resultrow = row; break; } } if (haslineno) break; } } if (haslineno == false) { var matchresult2 = matchresult.Where(r => r["LINE_NO"].ToString() == "-"); if (matchresult2.Count() > 0) resultrow = matchresult2.First(); else return hs; } } else if (matchresult.Length == 0 && matchAreaMatl.Length > 0)//구역,재질만 일치하는 경우 { try { resultrow = result_dt.Rows.Cast<DataRow>().Where(r => r["AREA"].ToString() == area && r["MATERIAL"].ToString() == matl && r["SYSTEM"].ToString() == "ALL").First(); } catch (Exception ee) { return hs; } } else { try { resultrow = result_dt.Rows.Cast<DataRow>().Where(r => r["AREA"].ToString() == area && r["MATERIAL"].ToString() == matl).First(); } catch (Exception ee) { return hs; } } }else if(itemtype=="SUPPORT") { var matchresult = result_dt.Rows.Cast<DataRow>().Where(r => r["AREA"].ToString() == area && r["ITEM_TYPE"].ToString()==itemtype && r["SYSTEM"].ToString() == system).ToArray(); if (matchresult.Length > 0) resultrow = matchresult[0]; else return hs; }else if(itemtype=="OUTFITTING") { var matchresult = result_dt.Rows.Cast<DataRow>().Where(r => r["AREA"].ToString() == area && r["ITEM_TYPE"].ToString() == itemtype && r["SYSTEM"].ToString() == system).ToArray(); if (matchresult.Length > 0) resultrow = matchresult[0]; else { var matchresult2 = result_dt.Rows.Cast<DataRow>().Where(r => r["AREA"].ToString() == area && r["ITEM_TYPE"].ToString() == itemtype && r["SYSTEM"].ToString() == "ALL").ToArray(); if (matchresult2.Length > 0) resultrow = matchresult[0]; else return hs; } } //결과 List를 Hashtable로 변환해서 리턴시킴 Console.WriteLine("1"); for (int i = 1; i <= resultrow.ItemArray.Length; i++) { hs.Add((double)i, resultrow[i - 1].ToString()); } return hs; }
public static void ShowAsyn() { Hashtable hash = new Hashtable(); GameCore.Instance.UIManager.ShowUI("SystemUI/UILogin", hash); }
public BaseResult MoveNode(Hashtable param) { BaseResult result = new BaseResult() { Success = true }; if (param == null || param.Keys.Count <= 0) { result.Success = false; result.Message.Add("参数有误!"); return result; } var id = param["id"].ToString(); var id_cyuser = param["id_cyuser"].ToString(); var id_farther = param["id_farther"].ToString(); if (string.IsNullOrWhiteSpace(id) || string.IsNullOrWhiteSpace(id_cyuser) || string.IsNullOrWhiteSpace(id_farther)) { result.Success = false; result.Message.Add("参数有误!"); return result; } Hashtable ht = new Hashtable(); ht.Add("id", id); ht.Add("id_cyuser", id_cyuser); ht.Add("flag_delete", (int)Enums.FlagDelete.NoDelete); try { var nodeModel = DAL.GetItem<Tb_Khfl>(typeof(Tb_Khfl), ht); if (nodeModel != null) { ht["id"] = id_farther; Hashtable checkMc = new Hashtable(); checkMc.Add("id_masteruser", nodeModel.id_masteruser); checkMc.Add("id_farther", id_farther); checkMc.Add("flag_delete", (int)Enums.FlagDelete.NoDelete); checkMc.Add("mc", nodeModel.mc); if (CheckMC(checkMc)) { result.Success = false; result.Message.Add("同级中有相同商品分类名称,不能移动!"); return result; } var oldSubList = Tb_KhflDAL.QuerySubListByPath(id_cyuser, nodeModel.path); var newFartherNode = DAL.GetItem<Tb_Khfl>(typeof(Tb_Khfl), ht); var oldNodeModelPath = nodeModel.path; var nd = DateTime.Now; if (id_farther == "0") { nodeModel.path = nodeModel.id; ChangeNodePath(oldSubList, nodeModel, oldNodeModelPath); } else { if (newFartherNode != null) { nodeModel.path = newFartherNode.path + "/" + nodeModel.id; ChangeNodePath(oldSubList, nodeModel, oldNodeModelPath); } } Hashtable nodeHt = new Hashtable(); nodeHt.Add("id", nodeModel.id); nodeHt.Add("id_masteruser", nodeModel.id_masteruser); nodeHt.Add("new_path", nodeModel.path); nodeHt.Add("new_id_edit", nodeModel.id_edit); nodeHt.Add("new_rq_edit", nd); nodeHt.Add("new_id_farther", id_farther); DAL.UpdatePart(typeof(Tb_Khfl), nodeHt); } } catch (Exception ex) { result.Success = false; result.Message.Add("称动节点异常"); } return result; }
/// <summary> /// Saves the broadcast stream as a file. /// </summary> /// <param name="name">The path of the file relative to the scope.</param> /// <param name="isAppend">Whether to append to the end of file.</param> public void SaveAs(string name, bool isAppend) { try { IScope scope = this.Scope; IStreamFilenameGenerator generator = ScopeUtils.GetScopeService(scope, typeof(IStreamFilenameGenerator)) as IStreamFilenameGenerator; string filename = generator.GenerateFilename(scope, name, ".flv", GenerationType.RECORD); // Get file for that filename FileInfo file; if (generator.ResolvesToAbsolutePath) file = new FileInfo(filename); else file = scope.Context.GetResource(filename).File; if (!isAppend) { if (file.Exists) { // Per livedoc of FCS/FMS: // When "live" or "record" is used, // any previously recorded stream with the same stream URI is deleted. file.Delete(); } } else { if (!file.Exists) { // Per livedoc of FCS/FMS: // If a recorded stream at the same URI does not already exist, // "append" creates the stream as though "record" was passed. isAppend = false; } } if (!file.Exists) { // Make sure the destination directory exists string directory = Path.GetDirectoryName(file.FullName); if (!Directory.Exists(directory)) Directory.CreateDirectory(directory); } if (!file.Exists) { using (FileStream fs = file.Create()) { } } FileConsumer fc = new FileConsumer(scope, file); #if !(NET_1_1) Dictionary<string, object> parameterMap = new Dictionary<string, object>(); #else Hashtable parameterMap = new Hashtable(); #endif if (isAppend) { parameterMap.Add("mode", "append"); } else { parameterMap.Add("mode", "record"); } if (null == _recordPipe) { _recordPipe = new InMemoryPushPushPipe(); } _recordPipe.Subscribe(fc, parameterMap); _recordingFilename = filename; } catch (IOException ex) { log.Error("Save as exception", ex); } }
public override void Show(Hashtable hash) { base.Show(hash); _LoadSceneOperation = LogicManager.Instance.StartLoadLogic(); }
public static void SetScore(this PhotonPlayer player, int newScore) { Hashtable hashtable = new Hashtable(); hashtable["score"] = newScore; player.SetCustomProperties(hashtable); }
public Row(Hashtable entries) { this._entries = entries; }