static public int Reverse(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 1) { System.Collections.Generic.List <WWWRequest> self = (System.Collections.Generic.List <WWWRequest>)checkSelf(l); self.Reverse(); pushValue(l, true); return(1); } else if (argc == 3) { System.Collections.Generic.List <WWWRequest> self = (System.Collections.Generic.List <WWWRequest>)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); self.Reverse(a1, a2); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function Reverse to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
private static BigInteger convertIPtoBigInt(string ipv6) { System.Net.IPAddress address; BigInteger ipnum = 0; //BigInteger 可用來處理超大整數 if (System.Net.IPAddress.TryParse(ipv6, out address)) { byte[] addrBytes = address.GetAddressBytes(); if (System.BitConverter.IsLittleEndian) { System.Collections.Generic.List <byte> byteList = new System.Collections.Generic.List <byte>(addrBytes); byteList.Reverse(); addrBytes = byteList.ToArray(); } if (addrBytes.Length > 8) { //IPv6 ipnum = System.BitConverter.ToUInt64(addrBytes, 8); ipnum <<= 64; ipnum += System.BitConverter.ToUInt64(addrBytes, 0); } else { //IPv4 ipnum = System.BitConverter.ToUInt32(addrBytes, 0); } return(ipnum); } return(ipnum); }
public ulong Dot(string dottedip) { string strIP = dottedip; System.Net.IPAddress address; UInt64 ipnum = 0; if (System.Net.IPAddress.TryParse(strIP, out address)) { byte[] addrBytes = address.GetAddressBytes(); if (System.BitConverter.IsLittleEndian) { System.Collections.Generic.List <byte> byteList = new System.Collections.Generic.List <byte>(addrBytes); byteList.Reverse(); addrBytes = byteList.ToArray(); } if (addrBytes.Length > 8) { //IPv6 ipnum = System.BitConverter.ToUInt64(addrBytes, 8); ipnum <<= 64; ipnum += System.BitConverter.ToUInt64(addrBytes, 0); } else { //IPv4 ipnum = System.BitConverter.ToUInt32(addrBytes, 0); } } return(ipnum); }
protected void btnDelete_Click(object sender, System.EventArgs e) { try { PTPrjInfoService pTPrjInfoService = new PTPrjInfoService(); System.Collections.Generic.List <string> listFromJson = JsonHelper.GetListFromJson(this.hfldCheckedIds.Value); listFromJson.Reverse(); foreach (string current in listFromJson) { if (pTPrjInfoService.GetCountProject(current) > 0) { base.RegisterScript("top.ui.show('请删除子项目');"); return; } SelfEventAction.SuperDelete(current, "PT_PrjInfo_ZTB_Detail", "SetUpFlowState"); } ProjectInfo.Del(listFromJson); this.BindGv(); base.RegisterScript("top.ui.show('删除成功');"); } catch { base.RegisterScript("top.ui.show('删除失败');"); } }
public ulong ConvertIpAdressToNumber(string strIP) { ulong ipNum = 0; System.Net.IPAddress address; if (System.Net.IPAddress.TryParse(strIP, out address)) { byte[] addrBytes = address.GetAddressBytes(); if (System.BitConverter.IsLittleEndian) { System.Collections.Generic.List <byte> byteList = new System.Collections.Generic.List <byte>(addrBytes); byteList.Reverse(); addrBytes = byteList.ToArray(); } if (addrBytes.Length > 8) { this.IsV6 = true; ipNum = System.BitConverter.ToUInt64(addrBytes, 8); ipNum <<= 64; ipNum += System.BitConverter.ToUInt64(addrBytes, 0); } else { this.IsV6 = false; ipNum = System.BitConverter.ToUInt32(addrBytes, 0); } } return(ipNum); }
static void Main(string[] args) { string strIP = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"; // IPV6 Format //string strIP = "39.52.19.96"; // IPV4 Format System.Net.IPAddress address; System.Numerics.BigInteger ipnum; if (System.Net.IPAddress.TryParse(strIP, out address)) { byte[] addrBytes = address.GetAddressBytes(); if (System.BitConverter.IsLittleEndian) { List <byte> byteList = new System.Collections.Generic.List <byte>(addrBytes); byteList.Reverse(); addrBytes = byteList.ToArray(); } if (addrBytes.Length > 8) { //IPv6 ipnum = System.BitConverter.ToUInt64(addrBytes, 8); ipnum <<= 64; ipnum += System.BitConverter.ToUInt64(addrBytes, 0); Console.WriteLine("IPV6 to IP Number : {0} ", ipnum); } else { //IPv4 ipnum = System.BitConverter.ToUInt32(addrBytes, 0); Console.WriteLine("IPV4 to IP Number: {0}", ipnum); } } }
public static string ToBase36String(byte[] bytes, bool bigEndian = false) { // Estimate the result's length so we don't waste time realloc'ing int result_length = (int) Math.Ceiling(bytes.Length * kByteBitCount / kBase36CharsLengthDivisor); // We use a List so we don't have to CopyTo a StringBuilder's characters // to a char[], only to then Array.Reverse it later var result = new System.Collections.Generic.List <char>(result_length); var dividend = new BigInteger(bytes); // IsZero's computation is less complex than evaluating "dividend > 0" // which invokes BigInteger.CompareTo(BigInteger) while (!dividend.IsZero) { BigInteger remainder; dividend = BigInteger.DivRem(dividend, kBigInt36, out remainder); int digit_index = Math.Abs((int)remainder); result.Add(kBase36Digits[digit_index]); } // orientate the characters in big-endian ordering if (!bigEndian) { result.Reverse(); } // ToArray will also trim the excess chars used in length prediction return(new string(result.ToArray())); }
protected void btnDel_Click(object sender, System.EventArgs e) { CheckBox checkBox = this.gvBudget.HeaderRow.Cells[0].FindControl("cbAllBox") as CheckBox; if (checkBox != null && checkBox.Checked) { BudTemplateItem.Delete(this.tvBudget.SelectedValue); this.strJS.Append(string.Concat(new string[] { "location='BudTemplateList.aspx?tempId=", this.tvBudget.SelectedValue, "&tempType=", this.ddlType.SelectedValue, "';" })); base.RegisterScript(this.strJS.ToString()); return; } System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>(); if (this.hfldCheckedIds.Value.Contains("[")) { list = JsonHelper.GetListFromJson(this.hfldCheckedIds.Value); } else { list.Add(this.hfldCheckedIds.Value); } bool flag = false; System.Collections.Generic.List <string> orderNumberById = BudTemplateItem.GetOrderNumberById(list); if (orderNumberById.Count > 1) { flag = BudTask.IsStructured(orderNumberById); } try { if (flag) { list.Reverse(); } BudTemplateItem.Delete(list); this.strJS.Append("alert('系统提示:\\n删除成功!');"); this.strJS.Append(string.Concat(new string[] { "location='BudTemplateList.aspx?tempId=", this.tvBudget.SelectedValue, "&tempType=", this.ddlType.SelectedValue, "';" })); } catch { this.strJS.Append("alert('系统提示:\\n请先删除子项!')"); } base.RegisterScript(this.strJS.ToString()); }
static int _m_Reverse(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Generic.List <string> gen_to_be_invoked = (System.Collections.Generic.List <string>)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 1) { gen_to_be_invoked.Reverse( ); return(0); } if (gen_param_count == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { int _index = LuaAPI.xlua_tointeger(L, 2); int _count = LuaAPI.xlua_tointeger(L, 3); gen_to_be_invoked.Reverse( _index, _count); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to System.Collections.Generic.List<string>.Reverse!")); }
protected void BuildRoute(int WavesCount) { Point CurrentBacktrace = new Point(xFinish, yFinish); int CurrentWave = WavesCount; //adding backtrace points into path do { CurrentBacktrace = Backtrace(CurrentBacktrace); Path.Add(CurrentBacktrace); CurrentWave--; }while (CurrentWave > 2); //reversing path so it starts from start, not end Path.Reverse(); }
public static System.Collections.Generic.List <int> splitbits(int value, params int[] values) { System.Collections.Generic.List <int> list = new System.Collections.Generic.List <int>(); int num_args = values.Length; int b0 = 0; for (int i = num_args; i > 1; i = i - 1) { int b = values[i - 1]; list.Add(bits(value, b0, b)); b0 = b0 + b; } list.Reverse(); return(list); }
public string GetMostSimilarTypeName(string name) { string[] namespaceHierarchy = name.Split('.'); int nshLen = namespaceHierarchy.Length; string suggestion = null; if (nshLen > 1) { INamespace ns = null; INamespace prevNs = null; for (int i = 1; i < nshLen; i++) { string currentNsName = string.Join(".", namespaceHierarchy, 0, i); ns = ResolveQualifiedName(currentNsName) as INamespace; if (null == ns) { namespaceHierarchy[i - 1] = GetMostSimilarMemberName(prevNs, namespaceHierarchy[i - 1], EntityType.Namespace); if (null == namespaceHierarchy[i - 1]) { break; } i--; continue; //reloop to resolve step } prevNs = ns; } suggestion = GetMostSimilarMemberName(ns, namespaceHierarchy[nshLen - 1], EntityType.Type); if (null != suggestion) { namespaceHierarchy[nshLen - 1] = suggestion; return(string.Join(".", namespaceHierarchy)); } } System.Collections.Generic.List <INamespace> nsList = new System.Collections.Generic.List <INamespace>(); FlattenChildNamespaces(nsList, GetGlobalNamespace()); nsList.Reverse(); //most recently added namespaces first foreach (INamespace nse in nsList) { suggestion = GetMostSimilarMemberName(nse, namespaceHierarchy[nshLen - 1], EntityType.Type); if (null != suggestion) { return(nse.ToString() + "." + suggestion); } } return(GetMostSimilarMemberName(GetGlobalNamespace(), namespaceHierarchy[nshLen - 1], EntityType.Type)); }
private static BigInteger IpV6ToNumber(IPAddress originalIpV6) { var addrBytes = originalIpV6.GetAddressBytes(); System.Numerics.BigInteger result; if (System.BitConverter.IsLittleEndian) { System.Collections.Generic.List <byte> byteList = new System.Collections.Generic.List <byte>(addrBytes); byteList.Reverse(); addrBytes = byteList.ToArray(); } if (addrBytes.Length > 8) { result = System.BitConverter.ToUInt64(addrBytes, 8); result <<= 64; result += System.BitConverter.ToUInt64(addrBytes, 0); } return(result); }
public void refrechDataGrid(System.Collections.Generic.List <Commande> commandes) { dataGridView1.Rows.Clear(); int i = 0; commandes.Reverse(); var db = new dbContext(); int nbprod = 0; decimal montant = 0; foreach (var item in commandes) { var pcommandes = db.Produit_commande.Where(c => c.NCommande == item.NCommande).ToList <Produit_commande>(); montant = pcommandes.Sum(s => s.quantite * db.Produits.Find(s.codeProduit).prixAchat); nbprod = pcommandes.Sum(s => s.quantite); if (i < commandes.Count - 1) { dataGridView1.Rows.Add(); } dataGridView1.Rows[i].Cells[0].Value = item.NCommande; dataGridView1.Rows[i].Cells[1].Value = item.dateDemande.ToShortDateString(); dataGridView1.Rows[i].Cells[2].Value = item.dateArriveSouhaite.ToShortDateString(); dataGridView1.Rows[i].Cells[3].Value = nbprod + " produits..."; dataGridView1.Rows[i].Cells[4].Value = montant + " dh"; dataGridView1.Rows[i].Cells[6].Value = ((System.Drawing.Image)(Properties.Resources.clear)); if (item.statut == true) { dataGridView1.Rows[i].Cells[5].Style.BackColor = Color.Green; dataGridView1.Rows[i].Cells[5].Value = "Arrivé"; } else { dataGridView1.Rows[i].Cells[5].Style.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(169)))), ((int)(((byte)(0))))); dataGridView1.Rows[i].Cells[5].Value = "Valider"; } i++; } }
static string reverseParentheses(string s) { List <int> lp = new System.Collections.Generic.List <int>(); List <int> rp = new System.Collections.Generic.List <int>(); for (int i = 0; i < s.Length; i++) { if (s[i].Equals('(')) { lp.Add(i); } if (s[i].Equals(')')) { rp.Add(i); } } lp.Reverse(); for (int i = 0; i < lp.Count; i++) { s = flip(s, lp[i], rp[i]); } return(s.Replace("(", "").Replace(")", "")); }
public void ReisenReverse() { dieReisen.Reverse(); }
public void __Reverse() { _list.Reverse(); }
/// <summary> /// Reverse the stack /// </summary> public void Reverse() { list.Reverse(); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { bool bHavePreselectedObjects = false; const ObjectType geometryFilter = ObjectType.MeshFace; OptionDouble minEdgeLengthOption = new OptionDouble(minEdgeLength, 0.001, 200); OptionDouble maxEdgeLengthOption = new OptionDouble(maxEdgeLength, 0.001, 200); OptionDouble constriantAngleOption = new OptionDouble(constriantAngle, 0.001, 360); OptionInteger smoothStepsOptions = new OptionInteger(smoothSteps, 0, 100); OptionDouble smoothSpeedOption = new OptionDouble(smoothSpeed, 0.01, 1.0); OptionDouble projectAmountOption = new OptionDouble(projectedAmount, 0.01, 1.0); OptionDouble projectedDistanceOption = new OptionDouble(projectedDistance, 0.01, 100000.0); GetObject go = new GetObject(); go.SetCommandPrompt("Select mesh faces to project onto another mesh"); go.GeometryFilter = geometryFilter; go.AddOptionDouble("ConstraintAngle", ref constriantAngleOption); go.AddOptionDouble("MinEdge", ref minEdgeLengthOption); go.AddOptionDouble("MaxEdge", ref maxEdgeLengthOption); go.AddOptionInteger("SmoothSteps", ref smoothStepsOptions); go.AddOptionDouble("SmoothSpeed", ref smoothSpeedOption); go.GroupSelect = true; go.SubObjectSelect = true; for (; ;) { GetResult faceres = go.GetMultiple(1, 0); if (faceres == GetResult.Option) { go.EnablePreSelect(false, true); continue; } else if (go.CommandResult() != Result.Success) { return(go.CommandResult()); } if (go.ObjectsWerePreselected) { bHavePreselectedObjects = true; go.EnablePreSelect(false, true); continue; } break; } minEdgeLength = minEdgeLengthOption.CurrentValue; maxEdgeLength = maxEdgeLengthOption.CurrentValue; constriantAngle = constriantAngleOption.CurrentValue; smoothSteps = smoothStepsOptions.CurrentValue; smoothSpeed = smoothSpeedOption.CurrentValue; //System.Collections.Generic.List<System.Guid> meshes = new System.Collections.Generic.List<System.Guid>(); System.Guid rhinoMesh = System.Guid.Empty; System.Collections.Generic.List <int> removeFaces = new System.Collections.Generic.List <int>(); g3.DMesh3 projectFaces = new g3.DMesh3(true, false, false, false); Rhino.Geometry.Mesh rhinoInputMesh = new Rhino.Geometry.Mesh(); for (int i = 0; i < go.ObjectCount; i++) { ObjRef obj = go.Object(i); if (rhinoMesh == System.Guid.Empty) { rhinoMesh = obj.ObjectId; rhinoInputMesh = obj.Mesh(); for (int j = 0; j < rhinoInputMesh.Vertices.Count; j++) { var vertex = new g3.NewVertexInfo(); vertex.n = new g3.Vector3f(rhinoInputMesh.Normals[j].X, rhinoInputMesh.Normals[j].Y, rhinoInputMesh.Normals[j].Z); vertex.v = new g3.Vector3d(rhinoInputMesh.Vertices[j].X, rhinoInputMesh.Vertices[j].Y, rhinoInputMesh.Vertices[j].Z); projectFaces.AppendVertex(vertex); } } var m = rhinoInputMesh; if (rhinoMesh != obj.ObjectId) { continue; } removeFaces.Add(obj.GeometryComponentIndex.Index); var mf = rhinoInputMesh.Faces[obj.GeometryComponentIndex.Index]; if (mf.IsQuad) { double dist1 = m.Vertices[mf.A].DistanceTo(m.Vertices[mf.C]); double dist2 = m.Vertices[mf.B].DistanceTo(m.Vertices[mf.D]); if (dist1 > dist2) { projectFaces.AppendTriangle(mf.A, mf.B, mf.D); projectFaces.AppendTriangle(mf.B, mf.C, mf.D); } else { projectFaces.AppendTriangle(mf.A, mf.B, mf.C); projectFaces.AppendTriangle(mf.A, mf.C, mf.D); } } else { projectFaces.AppendTriangle(mf.A, mf.B, mf.C); } } if (rhinoInputMesh == null) { return(Result.Failure); } removeFaces.Sort(); removeFaces.Reverse(); foreach (var removeFace in removeFaces) { rhinoInputMesh.Faces.RemoveAt(removeFace); } rhinoInputMesh.Compact(); GetObject goProjected = new GetObject(); goProjected.EnablePreSelect(false, true); goProjected.SetCommandPrompt("Select mesh to project to"); goProjected.GeometryFilter = ObjectType.Mesh; goProjected.AddOptionDouble("ConstraintAngle", ref constriantAngleOption); goProjected.AddOptionDouble("MinEdge", ref minEdgeLengthOption); goProjected.AddOptionDouble("MaxEdge", ref maxEdgeLengthOption); goProjected.AddOptionInteger("SmoothSteps", ref smoothStepsOptions); goProjected.AddOptionDouble("SmoothSpeed", ref smoothSpeedOption); goProjected.AddOptionDouble("ProjectAmount", ref projectAmountOption); goProjected.AddOptionDouble("ProjectDistance", ref projectedDistanceOption); goProjected.GroupSelect = true; goProjected.SubObjectSelect = false; goProjected.EnableClearObjectsOnEntry(false); goProjected.EnableUnselectObjectsOnExit(false); for (; ;) { GetResult resProject = goProjected.Get(); if (resProject == GetResult.Option) { continue; } else if (goProjected.CommandResult() != Result.Success) { return(goProjected.CommandResult()); } break; } minEdgeLength = minEdgeLengthOption.CurrentValue; maxEdgeLength = maxEdgeLengthOption.CurrentValue; constriantAngle = constriantAngleOption.CurrentValue; smoothSteps = smoothStepsOptions.CurrentValue; smoothSpeed = smoothSpeedOption.CurrentValue; projectedAmount = projectAmountOption.CurrentValue; projectedDistance = projectedDistanceOption.CurrentValue; if (bHavePreselectedObjects) { // Normally, pre-selected objects will remain selected, when a // command finishes, and post-selected objects will be unselected. // This this way of picking, it is possible to have a combination // of pre-selected and post-selected. So, to make sure everything // "looks the same", lets unselect everything before finishing // the command. for (int i = 0; i < go.ObjectCount; i++) { RhinoObject rhinoObject = go.Object(i).Object(); if (null != rhinoObject) { rhinoObject.Select(false); } } doc.Views.Redraw(); } bool result = false; if (goProjected.ObjectCount < 1) { return(Result.Failure); } var rhinoMeshProject = goProjected.Object(0).Mesh(); if (rhinoMeshProject == null || !rhinoMeshProject.IsValid) { return(Result.Failure); } var meshProjected = GopherUtil.ConvertToD3Mesh(rhinoMeshProject); var res = GopherUtil.RemeshMesh(projectFaces, (float)minEdgeLength, (float)maxEdgeLength, (float)constriantAngle, (float)smoothSpeed, smoothSteps, meshProjected, (float)projectedAmount, (float)projectedDistance); var newRhinoMesh = GopherUtil.ConvertToRhinoMesh(res); if (newRhinoMesh != null && newRhinoMesh.IsValid) { newRhinoMesh.Append(rhinoInputMesh); result |= doc.Objects.Replace(rhinoMesh, newRhinoMesh); } doc.Views.Redraw(); return(Result.Success); }