public override ClassDefinition GetClassDefinition(object instance) { Type type = instance.GetType(); BindingFlags bindingAttr = BindingFlags.Public | BindingFlags.Instance; PropertyInfo[] propertyInfos = type.GetProperties(bindingAttr); #if !(NET_1_1) List<ClassMember> classMemberList = new List<ClassMember>(); #else ArrayList classMemberList = new ArrayList(); #endif for (int i = 0; i < propertyInfos.Length; i++) { PropertyInfo propertyInfo = propertyInfos[i]; if (propertyInfo.Name != "HelpLink" && propertyInfo.Name != "TargetSite") { ClassMember classMember = new ClassMember(propertyInfo.Name, bindingAttr, propertyInfo.MemberType, null); classMemberList.Add(classMember); } } string customClassName = type.FullName; customClassName = FluorineConfiguration.Instance.GetCustomClass(customClassName); #if !(NET_1_1) ClassMember[] classMembers = classMemberList.ToArray(); #else ClassMember[] classMembers = classMemberList.ToArray(typeof(ClassMember)) as ClassMember[]; #endif ClassDefinition classDefinition = new ClassDefinition(customClassName, classMembers, GetIsExternalizable(instance), GetIsDynamic(instance)); return classDefinition; }
public virtual ParticulaDibujable[] GeneraDibujables(Particula[] particula,float[] color,bool aleat) { ArrayList result=new ArrayList(); for (int i = 0; i < particula.Length; i++) { if(particula[i]==null)return (ParticulaDibujable[])result.ToArray(Type.GetType("ParticulaDibujable")); try { if(tempInfo==null || tempInfo.Nombre!=particula[i].GetType().Name) { tempInfo=pinfo.GetInfoParticulas(particula[i].GetType().Name); } } catch (Exception ex) { throw new Exception("Error al Generar Particulas Dibujables"); } assem=GestorEnsamblados.GetAssemblyByName(tempInfo.EnsambladoDibujable,tempInfo.PathDibujable); if(aleat) { result.Add((ParticulaDibujable)assem.CreateInstance(tempInfo.NombreDibujable, true, BindingFlags.CreateInstance, null, new object[] {particula[i]}, null, null)); } else { result.Add((ParticulaDibujable)assem.CreateInstance(tempInfo.NombreDibujable, true, BindingFlags.CreateInstance, null, new object[] {particula[i], color}, null, null)); } } return (ParticulaDibujable[])result.ToArray(Type.GetType("ParticulaDibujable")); }
public SpawnerStruct(ArrayList _enemies, ArrayList _positions, int _occurences, float _spawnInterval) { this.enemies = _enemies.ToArray() as GameObject[]; this.positions = _positions.ToArray() as Transform[]; this.occurences = _occurences; this.spawnInterval = _spawnInterval; }
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)); }
public void DeleteNode(int i) { if (i < 0 || i >= nodes.Length) Debug.LogError("You are trying to DELETE a node which does not exist. Max node index : " + (nodes.Length - 1) + " . Index wanted : " + i); ArrayList n = new ArrayList(nodes); ArrayList ha = new ArrayList(handlesA); ArrayList hb = new ArrayList(handlesB); //ArrayList a = new ArrayList(A); //ArrayList b = new ArrayList(B); //ArrayList c = new ArrayList(C); n.RemoveAt(i); ha.RemoveAt(i); hb.RemoveAt(i); //a.RemoveAt(i); //b.RemoveAt(i); //c.RemoveAt(i); nodes = (Vector3 []) n.ToArray(typeof(Vector3)); handlesA = (Vector3 []) ha.ToArray(typeof(Vector3)); handlesB = (Vector3 []) hb.ToArray(typeof(Vector3)); //A = (Vector3 []) a.ToArray(typeof(Vector3)); //B = (Vector3 []) b.ToArray(typeof(Vector3)); //C = (Vector3 []) c.ToArray(typeof(Vector3)); }
/// <summary> /// Function to check for collision using a series of check points. /// </summary> /// <param name="pointList">List of points to send rays to.</param> /// <param name="direction">Direction to send the ray in.</param> /// <param name="distance">Optional. Usually distance from center of object to border in direction of collision check.</param> /// <returns>A list of sprite colliders of the other object.</returns> public object[] checkCollisionList(Vector3[] pointList, Vector3 direction, float distance = 0.0f) { RaycastHit hit; ArrayList colliders = new ArrayList(); for (int i = 0; i < pointList.Length; i++) { bool collide; if(distance != 0.0) { collide = Physics.Raycast(pointList[i], direction, out hit, distance); } else { collide = Physics.Raycast(pointList[i], direction, out hit); if(isPlayerHidden() && collide){ //Debug.Log("Player is hidden"); collide = false; } } if (collide) { colliders.Add(hit.collider.gameObject); } } return colliders.ToArray(); }
// enum types public static SkillEffect[] Add(SkillEffect n, SkillEffect[] list) { ArrayList tmp = new ArrayList(); foreach(SkillEffect str in list) tmp.Add(str); tmp.Add(n); return tmp.ToArray(typeof(SkillEffect)) as SkillEffect[]; }
public static Vector3[] Add(Vector3 n, Vector3[] list) { ArrayList tmp = new ArrayList(); foreach(Vector3 str in list) tmp.Add(str); tmp.Add(n); return tmp.ToArray(typeof(Vector3)) as Vector3[]; }
internal static void Execute(object msg, NetConnection conn) { Msg_CRC_StoryMessage _msg = msg as Msg_CRC_StoryMessage; if (null == _msg) return; try { string msgId = _msg.m_MsgId; ArrayList args = new ArrayList(); for (int i = 0; i < _msg.m_Args.Count; i++) { switch (_msg.m_Args[i].val_type) { case ArgType.NULL://null args.Add(null); break; case ArgType.INT://int args.Add(int.Parse(_msg.m_Args[i].str_val)); break; case ArgType.FLOAT://float args.Add(float.Parse(_msg.m_Args[i].str_val)); break; default://string args.Add(_msg.m_Args[i].str_val); break; } } object[] objArgs = args.ToArray(); GfxStorySystem.Instance.SendMessage(msgId, objArgs); } catch (Exception ex) { LogSystem.Error("Msg_CRC_StoryMessage throw exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
public static SimpleOperator[] Add(SimpleOperator n, SimpleOperator[] list) { ArrayList tmp = new ArrayList(); foreach(SimpleOperator str in list) tmp.Add(str); tmp.Add(n); return tmp.ToArray(typeof(SimpleOperator)) as SimpleOperator[]; }
public string formvals(string strPostData) { ArrayList _formvalArrayList = new ArrayList(32); string aFormLineRegExp = @"(?<line>[^&]*)(&|&)*"; string s = strPostData.ToString(); MatchCollection lineMatchCollection = Regex.Matches(s, aFormLineRegExp); foreach (Match myLineMatch in lineMatchCollection) { String sLine = myLineMatch.Groups ["line"].ToString(); string aFormEntryRegExp = @"(?<name>.*)=(?<value>.*)"; MatchCollection inputMatchCollection = Regex.Matches(sLine, aFormEntryRegExp); foreach (Match myMatch in inputMatchCollection) { _formvalArrayList.Add( String.Format("<input name =\"{0}\" value=\"{1}\"/>", myMatch.Groups ["name"], myMatch.Groups ["value"]) ); } } if (0 == _formvalArrayList.Count) return ""; else return String.Join("", (string [])_formvalArrayList.ToArray(typeof(string))); }
public UnityEngine.Object[] Evaluate(Type targetType) { InitSteps(targetType); UnityEngine.Object[] prevResults = new UnityEngine.Object[] { null }; foreach (InjectStep step in steps) { ArrayList results = new ArrayList(); foreach (UnityEngine.Object parent in prevResults) { if (parent == null || parent.GetType() == typeof(GameObject)) { UnityEngine.Object[] partResults = step.Evaluate(parent as GameObject); if(partResults != null && partResults.Length > 0) { foreach (UnityEngine.Object obj in partResults) results.Add(obj); } } else { throw new NotSupportedException("Selecting anything except for game objects must be the last step of the query"); } } if(results.Count == 0) { return null; } prevResults = (UnityEngine.Object[]) results.ToArray(results[0].GetType()); } return prevResults; }
static ResponseCurve[] GetCurvesFromSelection() { ArrayList curves = new ArrayList(); if (Selection.activeTransform == null) return new ResponseCurve[0]; foreach (MonoBehaviour behaviour in Selection.activeTransform.GetComponents(typeof(MonoBehaviour))) { FieldInfo[] myFieldInfo = behaviour.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); for(int i = 0; i < myFieldInfo.Length; i++) { if (myFieldInfo[i].FieldType == typeof(AnimationCurve)) { object curve = myFieldInfo[i].GetValue(behaviour); if (curve != null) { ResponseCurve r = new ResponseCurve (); r.field = myFieldInfo[i]; r.behaviour = behaviour; curves.Add(r); } } } } if (curves.Count != 0) return curves.ToArray(typeof(ResponseCurve)) as ResponseCurve[]; else return new ResponseCurve[0]; }
public static int[] Add(int n, int[] list) { ArrayList tmp = new ArrayList(); foreach(int str in list) tmp.Add(str); tmp.Add(n); return tmp.ToArray(typeof(int)) as int[]; }
public string[] arama(string prefixText, int count) { SqlConnection baglan = new SqlConnection(ConnectionString.Get); SqlCommand komutver = new SqlCommand(); komutver.Connection = baglan; komutver.CommandText = "siparis_Odeme_Autocomlet"; komutver.CommandType = CommandType.StoredProcedure; komutver.Parameters.Add("@data", SqlDbType.NVarChar); string car = ""; komutver.Parameters["@data"].Value = car + prefixText.ToString(); SqlDataReader dr; ArrayList PN = new ArrayList(); baglan.Open(); dr = komutver.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { PN.Add(dr[0].ToString()); } } baglan.Close(); baglan.Dispose(); return (string[])(PN.ToArray(typeof(string))); }
public void AddText( string pText, int pIndex ) { ArrayList list = new ArrayList(); list.AddRange( mContents); list.Insert( pIndex, new GUIContent( pText)); mContents = list.ToArray( typeof(GUIContent)) as GUIContent[]; }
public void RegisterSpawnPoint( SpawnPointController point ) { ArrayList arr = new ArrayList(spawnPoints); arr.Add(point); spawnPoints = (SpawnPointController[])arr.ToArray(typeof(SpawnPointController)); }
/* * Decompositon of cumulative. * * Inspired by the MiniZinc implementation: * http://www.g12.csse.unimelb.edu.au/wiki/doku.php?id=g12:zinc:lib:minizinc:std:cumulative.mzn&s[]=cumulative * The MiniZinc decomposition is discussed in the paper: * A. Schutt, T. Feydy, P.J. Stuckey, and M. G. Wallace. * "Why cumulative decomposition is not as bad as it sounds." * Download: * http://www.cs.mu.oz.au/%7Epjs/rcpsp/papers/cp09-cu.pdf * http://www.cs.mu.oz.au/%7Epjs/rcpsp/cumu_lazyfd.pdf * * * Parameters: * * s: start_times assumption: IntVar[] * d: durations assumption: int[] * r: resources assumption: int[] * b: resource limit assumption: IntVar or int * * */ static void MyCumulative(Solver solver, IntVar[] s, int[] d, int[] r, IntVar b) { int[] tasks = (from i in Enumerable.Range(0, s.Length) where r[i] > 0 && d[i] > 0 select i).ToArray(); int times_min = tasks.Min(i => (int)s[i].Min()); int d_max = d.Max(); int times_max = tasks.Max(i => (int)s[i].Max() + d_max); for(int t = times_min; t <= times_max; t++) { ArrayList bb = new ArrayList(); foreach(int i in tasks) { bb.Add(((s[i] <= t) * (s[i] + d[i]> t) * r[i]).Var()); } solver.Add((bb.ToArray(typeof(IntVar)) as IntVar[]).Sum() <= b); } // Somewhat experimental: // This constraint is needed to constrain the upper limit of b. if (b is IntVar) { solver.Add(b <= r.Sum()); } }
public void TestToArrayBasic() { ArrayList alst1; string strValue; object[] oArr; //[] Vanila test case - ToArray returns an array of this. We will not extensively test this method as // this is a thin wrapper on Array.Copy which is extensively tested alst1 = new ArrayList(); for (int i = 0; i < 10; i++) { strValue = "String_" + i; alst1.Add(strValue); } oArr = alst1.ToArray(); for (int i = 0; i < 10; i++) { strValue = "String_" + i; Assert.Equal(strValue, (string)oArr[i]); } //[]lets try an empty list alst1 = new ArrayList(); oArr = alst1.ToArray(); Assert.Equal(0, oArr.Length); }
public static Color[] Add(Color n, Color[] list) { ArrayList tmp = new ArrayList(); foreach(Color str in list) tmp.Add(str); tmp.Add(n); return tmp.ToArray(typeof(Color)) as Color[]; }
public string[] arama(string prefixText, int count) { using (SqlConnection baglan = new SqlConnection(ConnectionString.Get)) { ArrayList user = new ArrayList(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = baglan; cmd.Connection.Open(); cmd.CommandText = "kullanici_Autocomlet"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@data", SqlDbType.NVarChar); cmd.Parameters["@data"].Value = prefixText; using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr.HasRows) { while (dr.Read()) { user.Add(dr[0].ToString()); } } } return (string[])(user.ToArray(typeof(string))); } } }
public static float[] Add(float n, float[] list) { ArrayList tmp = new ArrayList(); foreach(float str in list) tmp.Add(str); tmp.Add(n); return tmp.ToArray(typeof(float)) as float[]; }
public GameObject[] selected_terrains(byte ops) { terrains = new ArrayList(); terrains.Clear (); if((ops & TERRAIN_1) == TERRAIN_1){ terrains.Add(terrain[0]); } if((ops & TERRAIN_2) == TERRAIN_2){ terrains.Add(terrain[1]); } if((ops & TERRAIN_3) == TERRAIN_3){ terrains.Add(terrain[2]); } if((ops & TERRAIN_4) == TERRAIN_4){ terrains.Add(terrain[3]); } if((ops & TERRAIN_5) == TERRAIN_5){ terrains.Add(terrain[4]); } if((ops & TERRAIN_6) == TERRAIN_6){ terrains.Add(terrain[5]); } if((ops & TERRAIN_7) == TERRAIN_7){ terrains.Add(terrain[6]); } if((ops & TERRAIN_8) == TERRAIN_8){ terrains.Add(terrain[7]); } return terrains.ToArray() as GameObject[]; }
public static bool[] Add(bool n, bool[] list) { ArrayList tmp = new ArrayList(); foreach(bool str in list) tmp.Add(str); tmp.Add(n); return tmp.ToArray(typeof(bool)) as bool[]; }
// base types public static string[] Add(string n, string[] list) { ArrayList tmp = new ArrayList(); foreach(string str in list) tmp.Add(str); tmp.Add(n); return tmp.ToArray(typeof(string)) as string[]; }
public bool runTest() { Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer); int iCountErrors = 0; int iCountTestcases = 0; String strLoc = "Loc_000oo"; ArrayList alst1; String strValue; Object[] oArr; Int32[] iArr; try { do { strLoc = "Loc_8345vdfv"; alst1 = new ArrayList(); for(int i=0; i<10; i++) { strValue = "String_" + i; alst1.Add(strValue); } oArr = alst1.ToArray(); iCountTestcases++; for(int i=0; i<10; i++) { strValue = "String_" + i; if(!strValue.Equals((String)oArr [i])) { iCountErrors++; Console.WriteLine("Err_561dvs_" + i + "! Expected value not returned, " + strValue); } } alst1 = new ArrayList(); oArr = alst1.ToArray(); iCountTestcases++; if(oArr.Length!=0) { iCountErrors++; Console.WriteLine("Err_5434gbfg! Expected value not returned, " + oArr.Length); } } while (false); } catch (Exception exc_general ) { ++iCountErrors; Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy! strLoc=="+ strLoc +", exc_general==\n"+exc_general.ToString()); } if ( iCountErrors == 0 ) { Console.WriteLine( "paSs. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases); return true; } else { Console.WriteLine("FAiL! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums ); return false; } }
/// <summary> /// 设置饼状图各项对应的颜色 /// </summary> /// <param name="pieChart"></param> /// <param name="colArray"></param> public static void SetPieChartControl_Colors(System.Drawing.PieChart.PieChartControl pieChart, Color[] colArray) { ArrayList colors = new ArrayList(); foreach (Color col in colArray) { colors.Add(Color.FromArgb(125, col)); } pieChart.Colors = (Color[])colors.ToArray(typeof(Color)); ; }
public void TestArrayListWrappers() { ArrayList alst1; string strValue; Array arr1; //[] Vanila test case - ToArray returns an array of this. We will not extensively test this method as // this is a thin wrapper on Array.Copy which is extensively tested elsewhere alst1 = new ArrayList(); for (int i = 0; i < 10; i++) { strValue = "String_" + i; alst1.Add(strValue); } ArrayList[] arrayListTypes = { alst1, ArrayList.Adapter(alst1), ArrayList.FixedSize(alst1), alst1.GetRange(0, alst1.Count), ArrayList.ReadOnly(alst1), ArrayList.Synchronized(alst1)}; foreach (ArrayList arrayListType in arrayListTypes) { alst1 = arrayListType; arr1 = alst1.ToArray(typeof(string)); for (int i = 0; i < 10; i++) { strValue = "String_" + i; Assert.Equal(strValue, (string)arr1.GetValue(i)); } //[] this should be covered in Array.Copy, but lets do it for Assert.Throws<InvalidCastException>(() => { arr1 = alst1.ToArray(typeof(int)); }); Assert.Throws<ArgumentNullException>(() => { arr1 = alst1.ToArray(null); }); } //[]lets try an empty list alst1.Clear(); arr1 = alst1.ToArray(typeof(Object)); Assert.Equal(0, arr1.Length); }
public object[] GetFieldValues(string field) { OleDbCommand cmd = new OleDbCommand("SELECT " + field + " FROM " + m_sTable, m_Connection); OleDbDataReader reader = cmd.ExecuteReader(); ArrayList ret = new ArrayList(); while (reader.Read()) ret.Add(reader.GetValue(reader.GetOrdinal(field))); reader.Close(); return ret.ToArray(); }
public GameServerStatus[] GetGameServerList() { ArrayList returnList = new ArrayList(); IList gameServerList = AdminServer.TheInstance.GameServerManager.Servers; foreach(GameServer server in gameServerList) { returnList.Add(new GameServerStatus(server.Name, server.GameServerState)); } return (GameServerStatus[])returnList.ToArray(typeof(GameServerStatus)); }
// Sets the value of the current object control protected void SetObjectValue() { ArrayList nodes = ObjectTreeNode.GetNodesOfType(_type); ComboBox cb = (ComboBox)_valueControl; // Get rid of the nodes that refer to duplicate or null // objects; for duplicates, choose the node with the // shortest path ArrayList objects = new ArrayList(); for (int i = 0; i < nodes.Count;) { ObjectTreeNode node = (ObjectTreeNode)nodes[i]; Object obj = node.ObjectInfo.Obj; if (obj == null) { // The remaining nodes move up, so we // don't increment the index nodes.Remove(node); continue; } ObjNode objNode = new ObjNode(obj, node); ObjNode objNodeFound = (ObjNode)Utils.FindHack(objects, objNode); if (objNodeFound == null) { objects.Add(objNode); i++; } else { // See if this node is better than the one // previously found, nodes move up in both // cases so don't increment index if (objNode._pathCount < objNodeFound._pathCount) { nodes.Remove(objNodeFound._node); objects.Remove(objNodeFound); objects.Add(objNode); } else { nodes.Remove(node); } } } // Now measure all of the remaining nodes to figure // out how big to make the combo box Graphics g = cb.CreateGraphics(); int maxWidth = 0; foreach (TreeNode node in nodes) { TraceUtil.WriteLineVerbose(null, "SetObjectValue looking node: " + ((BrowserTreeNode)node).GetName()); int width = (int)g.MeasureString(node.ToString(), cb.Font).Width; if (width > maxWidth) { maxWidth = width; } } g.Dispose(); // The first value is "null" to allow the object to // be set to null // Second is Missing.Value to allow it to be optional _values.Clear(); _values.Add(null); _values.Add(Missing.Value); _values.AddRange(nodes); if (maxWidth > cb.Width) { cb.DropDownWidth = maxWidth; } cb.Items.Clear(); cb.Items.Add("null"); cb.Items.Add("Missing.Value"); cb.Items.AddRange(nodes.ToArray()); if (_valueControl2 != null) { ((TextBox)_valueControl2).Text = ""; } // Select the object if it exists if (_value != null) { bool found = false; foreach (ObjectTreeNode node in nodes) { if (_value == node.ObjectInfo.Obj) { cb.SelectedItem = node; found = true; // Enable the combo box cb.Enabled = true; if (_valueControl2 != null) { _valueControl2.Enabled = false; } break; } } // Just set the text box to be the string value of whatever // this is if (!found) { if (_valueControl2 != null) { cb.Enabled = false; _valueControl2.Enabled = true; ((TextBox)_valueControl2).Text = _value.ToString(); } } } else { // Make the default for optional parameters missing // so nothing has to be done to specify them if (_optional) { cb.Enabled = true; if (_valueControl2 != null) { _valueControl2.Enabled = false; } cb.SelectedIndex = OBJECT_MISSING; } else { if (_valueControl2 != null) { // Enable text cb.Enabled = false; _valueControl2.Enabled = true; } cb.SelectedIndex = OBJECT_NULL; } } }
void Update() { Rect imgRect = new Rect(5 + 100, 5, baseTex.width * zoom, baseTex.height * zoom); Vector2 mouse = Input.mousePosition; mouse.y = Screen.height - mouse.y; if (Input.GetKeyDown("t")) { test(); } if (Input.GetKeyDown("mouse 0")) { if (imgRect.Contains(mouse)) { if (tool == Tool.Vector) { var m2 = mouse - new Vector2(imgRect.x, imgRect.y); m2.y = imgRect.height - m2.y; var bz = new ArrayList(BezierPoints); bz.Add(new Drawing.BezierPoint(m2, m2 - new Vector2(50, 10), m2 + new Vector2(50, 10))); BezierPoints = (Drawing.BezierPoint[])bz.ToArray(); Drawing.DrawBezier(BezierPoints, lineTool.width, col, baseTex); } dragStart = mouse - new Vector2(imgRect.x, imgRect.y); dragStart.y = imgRect.height - dragStart.y; dragStart.x = Mathf.Round(dragStart.x / zoom); dragStart.y = Mathf.Round(dragStart.y / zoom); dragEnd = mouse - new Vector2(imgRect.x, imgRect.y); dragEnd.x = Mathf.Clamp(dragEnd.x, 0, imgRect.width); dragEnd.y = imgRect.height - Mathf.Clamp(dragEnd.y, 0, imgRect.height); dragEnd.x = Mathf.Round(dragEnd.x / zoom); dragEnd.y = Mathf.Round(dragEnd.y / zoom); } else { dragStart = Vector3.zero; } } if (Input.GetKey("mouse 0")) { if (dragStart == Vector2.zero) { return; } dragEnd = mouse - new Vector2(imgRect.x, imgRect.y); dragEnd.x = Mathf.Clamp(dragEnd.x, 0, imgRect.width); dragEnd.y = imgRect.height - Mathf.Clamp(dragEnd.y, 0, imgRect.height); dragEnd.x = Mathf.Round(dragEnd.x / zoom); dragEnd.y = Mathf.Round(dragEnd.y / zoom); if (tool == Tool.Brush) { Brush(dragEnd, preDrag); } if (tool == Tool.Eraser) { Eraser(dragEnd, preDrag); } } if (Input.GetKeyUp("mouse 0") && dragStart != Vector2.zero) { if (tool == Tool.Line) { dragEnd = mouse - new Vector2(imgRect.x, imgRect.y); dragEnd.x = Mathf.Clamp(dragEnd.x, 0, imgRect.width); dragEnd.y = imgRect.height - Mathf.Clamp(dragEnd.y, 0, imgRect.height); dragEnd.x = Mathf.Round(dragEnd.x / zoom); dragEnd.y = Mathf.Round(dragEnd.y / zoom); Debug.Log("Draw Line"); Drawing.NumSamples = AntiAlias; if (stroke.enabled) { baseTex = Drawing.DrawLine(dragStart, dragEnd, lineTool.width, col, baseTex, true, col2, stroke.width); } else { baseTex = Drawing.DrawLine(dragStart, dragEnd, lineTool.width, col, baseTex); } } dragStart = Vector2.zero; dragEnd = Vector2.zero; } preDrag = dragEnd; }
private object[] GetErrorInfor(ICTData ictData) { string[] errorList = ictData.ERRORCODES.Split('|'); ArrayList ecg2ecList = new ArrayList(); for (int i = 0; i < errorList.Length; i++) { if (errorList[i].Trim() == string.Empty) { continue; } bool hasShort = false; //是否有短路不良 bool hasOpen = false; //是否有开路不良 string[] deError = errorList[i].Split(';'); if (deError != null && deError.Length > 0) { for (int j = 0; j < deError.Length; j++) { if (deError[j].Trim() == string.Empty) { continue; } string[] ldeErrorInfo = deError[j].Split(','); TSErrorCode2Location tsinfo = new TSErrorCode2Location(); object[] ecg2ec = this.QueryECG2ECByECode(ldeErrorInfo[0]); tsinfo.ErrorCode = ldeErrorInfo[0]; if (tsinfo.ErrorCode.IndexOf("PVIB") > -1) { //OPEN Error if (hasShort) { continue; } } else if (tsinfo.ErrorCode.IndexOf("PVIA") > -1) { //Short Error if (hasOpen) { continue; } } tsinfo.ErrorLocation = getErrorLocation(ldeErrorInfo[1]); tsinfo.AB = "A"; if (ecg2ec != null && ecg2ec.Length > 0) { tsinfo.ErrorCodeGroup = ((ErrorCodeGroup2ErrorCode)ecg2ec[0]).ErrorCodeGroup; } else { tsinfo.ErrorCodeGroup = ldeErrorInfo[0] + "GROUP"; //如果没有不良代码组,填入默认值 } ecg2ecList.Add(tsinfo); if (tsinfo.ErrorCode.IndexOf("PVIB") > -1) { //OPEN Error hasShort = true; } else if (tsinfo.ErrorCode.IndexOf("PVIA") > -1) { //Short Error hasOpen = true; } } } } return((TSErrorCode2Location[])ecg2ecList.ToArray(typeof(TSErrorCode2Location))); }
public PTag[] ExtractTags(string s, bool addDefault) { ArrayList result = new ArrayList(); DebugDK.Log("extracting tags from " + s); string currentTagName = ""; PTag currentTag; string argString = ""; bool inArguments = false; string[] tagArgs = { }; for (int i = 0; i < s.Length; i++) { char current = s[i]; { // argument checking if (current.Equals('(')) // entering { inArguments = true; } if (inArguments) // adding { argString += current; } if (current.Equals(')')) // extracting & reset { inArguments = false; tagArgs = ExtractArguments(argString, false); DebugDK.Log("found arguments : "); //Token.PrintStringArr(ref tagArgs); argString = ""; } } if (!inArguments) { if (!current.Equals(')') && !current.Equals(',')) { currentTagName += current; } if ((current.Equals(',') || i == s.Length - 1)) { DebugDK.Log("moving on to next tag, current name is " + currentTagName); currentTag.name = RemoveWhitespace(currentTagName); currentTag.arguments = tagArgs; result.Add(currentTag); { currentTagName = ""; string[] temp = { }; tagArgs = temp; } } } } return((PTag[])result.ToArray(typeof(PTag))); }
/** * Takes an Element subclass and returns an array of RtfBasicElement * subclasses, that contained the mapped RTF equivalent to the Element * passed in. * * @param element The Element to wrap * @return An array of RtfBasicElement wrapping the Element * @throws DocumentException */ public IRtfBasicElement[] MapElement(IElement element) { ArrayList rtfElements = new ArrayList(); if (element is IRtfBasicElement) { IRtfBasicElement rtfElement = (IRtfBasicElement) element; rtfElement.SetRtfDocument(this.rtfDoc); return new IRtfBasicElement[]{rtfElement}; } switch (element.Type) { case Element.CHUNK: Chunk chunk = (Chunk) element; if (chunk.HasAttributes()) { if (chunk.Attributes.ContainsKey(Chunk.IMAGE)) { rtfElements.Add(new RtfImage(rtfDoc, chunk.GetImage())); } else if (chunk.Attributes.ContainsKey(Chunk.NEWPAGE)) { rtfElements.Add(new RtfNewPage(rtfDoc)); } else if (chunk.Attributes.ContainsKey(Chunk.TAB)) { float tabPos = (float) ((Object[]) chunk.Attributes[Chunk.TAB])[1]; RtfTab tab = new RtfTab(tabPos, RtfTab.TAB_LEFT_ALIGN); tab.SetRtfDocument(rtfDoc); rtfElements.Add(tab); rtfElements.Add(new RtfChunk(rtfDoc, new Chunk("\t"))); } else { rtfElements.Add(new RtfChunk(rtfDoc, (Chunk) element)); } } else { rtfElements.Add(new RtfChunk(rtfDoc, (Chunk) element)); } break; case Element.PHRASE: rtfElements.Add(new RtfPhrase(rtfDoc, (Phrase) element)); break; case Element.PARAGRAPH: rtfElements.Add(new RtfParagraph(rtfDoc, (Paragraph) element)); break; case Element.ANCHOR: rtfElements.Add(new RtfAnchor(rtfDoc, (Anchor) element)); break; case Element.ANNOTATION: rtfElements.Add(new RtfAnnotation(rtfDoc, (Annotation) element)); break; case Element.IMGRAW: case Element.IMGTEMPLATE: case Element.JPEG: rtfElements.Add(new RtfImage(rtfDoc, (Image) element)); break; case Element.AUTHOR: case Element.SUBJECT: case Element.KEYWORDS: case Element.TITLE: case Element.PRODUCER: case Element.CREATIONDATE: rtfElements.Add(new RtfInfoElement(rtfDoc, (Meta) element)); break; case Element.LIST: rtfElements.Add(new RtfList(rtfDoc, (List) element)); break; case Element.LISTITEM: rtfElements.Add(new RtfListItem(rtfDoc, (ListItem) element)); break; case Element.SECTION: rtfElements.Add(new RtfSection(rtfDoc, (Section) element)); break; case Element.CHAPTER: rtfElements.Add(new RtfChapter(rtfDoc, (Chapter) element)); break; case Element.TABLE: try { rtfElements.Add(new RtfTable(rtfDoc, (Table) element)); } catch (InvalidCastException) { rtfElements.Add(new RtfTable(rtfDoc, ((SimpleTable) element).CreateTable())); } break; case Element.PTABLE: try { rtfElements.Add(new RtfTable(rtfDoc, (PdfPTable) element)); } catch(InvalidCastException) { rtfElements.Add(new RtfTable(rtfDoc, ((SimpleTable) element).CreateTable())); } break; } return (IRtfBasicElement[]) rtfElements.ToArray(typeof(IRtfBasicElement)); }
private ArrayList SubstractArray(ArrayList search_in, ArrayList search_for) { ArrayList res = new ArrayList(); string tosearch = Environment.NewLine + String.Join(Environment.NewLine, (string[])search_in.ToArray(typeof(string))) + Environment.NewLine; tosearch = tosearch.ToUpper(); foreach (string titem in search_for) { if (!tosearch.Contains(Environment.NewLine + titem.ToUpper() + Environment.NewLine)) { res.Add(titem); } } return(res); }
public static AttributeCollection GetAttributes(ArrayList attributes) { AttributeCollection collection = new AttributeCollection((Attribute[])attributes.ToArray(typeof(Attribute))); return(collection); }
public override void OnResponse(NetState sender, RelayInfo info) { int button = info.ButtonID; TextRelay[] textentries = info.TextEntries; switch (button) { // Delete case 2002: for (int i = 0; i < m_Vendor.ItemsForSale.Count; i++) { if (((TradeVendor.ItemInfo)m_Vendor.ItemsForSale[i]).ItemSerial == m_Item.Serial) { m_Vendor.ItemsForSale.RemoveAt(i); break; } } m_Player.Backpack.AddItem(m_Item); m_Player.SendMessage("The item has been removed from inventory."); break; // Cancel case -1: break; // Okay case 2001: if (!m_BuyMode) { #region Owner Setting Price TradeVendor.ItemInfo iteminfo = new TradeVendor.ItemInfo(); iteminfo.ItemSerial = m_Item.Serial; #region Gold & Silver iteminfo.GoldCost = GetTextEntry(textentries, 1030); iteminfo.SilverCost = GetTextEntry(textentries, 1031); #endregion #region Ingots & Ores iteminfo.IronIngotCost = GetTextEntry(textentries, 1000); iteminfo.DullCopperIngotCost = GetTextEntry(textentries, 1001); iteminfo.ShadowIronIngotCost = GetTextEntry(textentries, 1002); iteminfo.CopperIngotCost = GetTextEntry(textentries, 1003); iteminfo.BronzeIngotCost = GetTextEntry(textentries, 1004); iteminfo.GoldIngotCost = GetTextEntry(textentries, 1005); iteminfo.AgapiteIngotCost = GetTextEntry(textentries, 1006); iteminfo.VeriteIngotCost = GetTextEntry(textentries, 1007); iteminfo.ValoriteIngotCost = GetTextEntry(textentries, 1008); iteminfo.MithrilIngotCost = GetTextEntry(textentries, 1009); iteminfo.BloodrockIngotCost = GetTextEntry(textentries, 1010); iteminfo.SteelIngotCost = GetTextEntry(textentries, 1011); iteminfo.AdamantiteIngotCost = GetTextEntry(textentries, 1012); iteminfo.IthilmarIngotCost = GetTextEntry(textentries, 1013); iteminfo.IronOreCost = GetTextEntry(textentries, 1038); iteminfo.DullCopperOreCost = GetTextEntry(textentries, 1039); iteminfo.ShadowIronOreCost = GetTextEntry(textentries, 1040); iteminfo.CopperOreCost = GetTextEntry(textentries, 1041); iteminfo.BronzeOreCost = GetTextEntry(textentries, 1042); iteminfo.GoldOreCost = GetTextEntry(textentries, 1043); iteminfo.AgapiteOreCost = GetTextEntry(textentries, 1044); iteminfo.VeriteOreCost = GetTextEntry(textentries, 1045); iteminfo.ValoriteOreCost = GetTextEntry(textentries, 1032); iteminfo.MithrilOreCost = GetTextEntry(textentries, 1033); iteminfo.BloodrockOreCost = GetTextEntry(textentries, 1034); iteminfo.SteelOreCost = GetTextEntry(textentries, 1035); iteminfo.AdamantiteOreCost = GetTextEntry(textentries, 1036); iteminfo.IthilmarOreCost = GetTextEntry(textentries, 1037); #endregion #region Hides & Scales iteminfo.NormalHidesCost = GetTextEntry(textentries, 1046); iteminfo.SpinedHidesCost = GetTextEntry(textentries, 1047); iteminfo.HornedHidesCost = GetTextEntry(textentries, 1048); iteminfo.BarbedHidesCost = GetTextEntry(textentries, 1049); iteminfo.RedScalesCost = GetTextEntry(textentries, 1050); iteminfo.YellowScalesCost = GetTextEntry(textentries, 1051); iteminfo.BlackScalesCost = GetTextEntry(textentries, 1052); iteminfo.GreenScalesCost = GetTextEntry(textentries, 1053); iteminfo.WhiteScalesCost = GetTextEntry(textentries, 1054); iteminfo.BlueScalesCost = GetTextEntry(textentries, 1055); #endregion #region Logs & Boards iteminfo.OakLogCost = GetTextEntry(textentries, 1014); iteminfo.PineLogCost = GetTextEntry(textentries, 1015); iteminfo.RedwoodLogCost = GetTextEntry(textentries, 1016); iteminfo.WhitePineLogCost = GetTextEntry(textentries, 1017); iteminfo.AshwoodLogCost = GetTextEntry(textentries, 1018); iteminfo.SilverBirchLogCost = GetTextEntry(textentries, 1019); iteminfo.YewLogCost = GetTextEntry(textentries, 1020); iteminfo.BlackOakLogCost = GetTextEntry(textentries, 1021); iteminfo.OakBoardCost = GetTextEntry(textentries, 1022); iteminfo.PineBoardCost = GetTextEntry(textentries, 1023); iteminfo.RedwoodBoardCost = GetTextEntry(textentries, 1024); iteminfo.WhitePineBoardCost = GetTextEntry(textentries, 1025); iteminfo.AshwoodBoardCost = GetTextEntry(textentries, 1026); iteminfo.SilverBirchBoardCost = GetTextEntry(textentries, 1027); iteminfo.YewBoardCost = GetTextEntry(textentries, 1028); iteminfo.BlackOakBoardCost = GetTextEntry(textentries, 1029); #endregion #region Jewels // Not Yet #endregion TradeVendor.ItemInfo m_Info = TradeVendor.ItemInfo.GetItemInfo(m_Item, m_Vendor.ItemsForSale); if (m_Info != null) { m_Vendor.ItemsForSale.Remove(m_Info); } m_Vendor.ItemsForSale.Add(iteminfo); m_Vendor.Backpack.AddItem(m_Item); #endregion } else { #region Player Buying Item TradeVendor.ItemInfo m_Info = TradeVendor.ItemInfo.GetItemInfo(m_Item, m_Vendor.ItemsForSale); ArrayList m_ConsumeType = new ArrayList(); ArrayList m_ConsumeAmt = new ArrayList(); if (m_Info != null) { if (m_Info.AdamantiteIngotCost > 0) { m_ConsumeType.Add(typeof(AdamantiteIngot)); m_ConsumeAmt.Add(m_Info.AdamantiteIngotCost); } if (m_Info.AdamantiteOreCost > 0) { m_ConsumeType.Add(typeof(AdamantiteOre)); m_ConsumeAmt.Add(m_Info.AdamantiteOreCost); } if (m_Info.AgapiteIngotCost > 0) { m_ConsumeType.Add(typeof(AgapiteIngot)); m_ConsumeAmt.Add(m_Info.AgapiteIngotCost); } if (m_Info.AgapiteOreCost > 0) { m_ConsumeType.Add(typeof(AgapiteOre)); m_ConsumeAmt.Add(m_Info.AgapiteOreCost); } if (m_Info.AshwoodBoardCost > 0) { m_ConsumeType.Add(typeof(AshwoodBoard)); m_ConsumeAmt.Add(m_Info.AshwoodBoardCost); } if (m_Info.AshwoodLogCost > 0) { m_ConsumeType.Add(typeof(AshwoodLog)); m_ConsumeAmt.Add(m_Info.AshwoodLogCost); } if (m_Info.BarbedHidesCost > 0) { m_ConsumeType.Add(typeof(BarbedHides)); m_ConsumeAmt.Add(m_Info.BarbedHidesCost); } if (m_Info.BlackOakBoardCost > 0) { m_ConsumeType.Add(typeof(BlackOakBoard)); m_ConsumeAmt.Add(m_Info.BlackOakBoardCost); } if (m_Info.BlackOakLogCost > 0) { m_ConsumeType.Add(typeof(BlackOakLog)); m_ConsumeAmt.Add(m_Info.BlackOakLogCost); } if (m_Info.BlackScalesCost > 0) { m_ConsumeType.Add(typeof(BlackScales)); m_ConsumeAmt.Add(m_Info.BlackScalesCost); } if (m_Info.BloodrockIngotCost > 0) { m_ConsumeType.Add(typeof(BloodrockIngot)); m_ConsumeAmt.Add(m_Info.BloodrockIngotCost); } if (m_Info.BloodrockOreCost > 0) { m_ConsumeType.Add(typeof(BloodrockOre)); m_ConsumeAmt.Add(m_Info.BloodrockOreCost); } if (m_Info.BlueScalesCost > 0) { m_ConsumeType.Add(typeof(BlueScales)); m_ConsumeAmt.Add(m_Info.BlueScalesCost); } if (m_Info.BronzeIngotCost > 0) { m_ConsumeType.Add(typeof(BronzeIngot)); m_ConsumeAmt.Add(m_Info.BronzeIngotCost); } if (m_Info.BronzeOreCost > 0) { m_ConsumeType.Add(typeof(BronzeOre)); m_ConsumeAmt.Add(m_Info.BronzeOreCost); } if (m_Info.CopperIngotCost > 0) { m_ConsumeType.Add(typeof(CopperIngot)); m_ConsumeAmt.Add(m_Info.CopperIngotCost); } if (m_Info.CopperOreCost > 0) { m_ConsumeType.Add(typeof(CopperOre)); m_ConsumeAmt.Add(m_Info.CopperOreCost); } if (m_Info.DullCopperIngotCost > 0) { m_ConsumeType.Add(typeof(DullCopperIngot)); m_ConsumeAmt.Add(m_Info.DullCopperIngotCost); } if (m_Info.DullCopperOreCost > 0) { m_ConsumeType.Add(typeof(DullCopperOre)); m_ConsumeAmt.Add(m_Info.DullCopperOreCost); } if (m_Info.GoldCost > 0) { m_ConsumeType.Add(typeof(Gold)); m_ConsumeAmt.Add(m_Info.GoldCost); } if (m_Info.GoldIngotCost > 0) { m_ConsumeType.Add(typeof(GoldIngot)); m_ConsumeAmt.Add(m_Info.GoldIngotCost); } if (m_Info.GoldOreCost > 0) { m_ConsumeType.Add(typeof(GoldOre)); m_ConsumeAmt.Add(m_Info.GoldOreCost); } if (m_Info.GreenScalesCost > 0) { m_ConsumeType.Add(typeof(GreenScales)); m_ConsumeAmt.Add(m_Info.GreenScalesCost); } if (m_Info.HornedHidesCost > 0) { m_ConsumeType.Add(typeof(HornedHides)); m_ConsumeAmt.Add(m_Info.HornedHidesCost); } if (m_Info.IronIngotCost > 0) { m_ConsumeType.Add(typeof(IronIngot)); m_ConsumeAmt.Add(m_Info.IronIngotCost); } if (m_Info.IronOreCost > 0) { m_ConsumeType.Add(typeof(IronOre)); m_ConsumeAmt.Add(m_Info.IronOreCost); } if (m_Info.IthilmarIngotCost > 0) { m_ConsumeType.Add(typeof(IthilmarIngot)); m_ConsumeAmt.Add(m_Info.IthilmarIngotCost); } if (m_Info.IthilmarOreCost > 0) { m_ConsumeType.Add(typeof(IthilmarOre)); m_ConsumeAmt.Add(m_Info.IthilmarOreCost); } if (m_Info.MithrilIngotCost > 0) { m_ConsumeType.Add(typeof(MithrilIngot)); m_ConsumeAmt.Add(m_Info.MithrilIngotCost); } if (m_Info.MithrilOreCost > 0) { m_ConsumeType.Add(typeof(MithrilOre)); m_ConsumeAmt.Add(m_Info.MithrilOreCost); } if (m_Info.NormalHidesCost > 0) { m_ConsumeType.Add(typeof(Hides)); m_ConsumeAmt.Add(m_Info.NormalHidesCost); } if (m_Info.OakBoardCost > 0) { m_ConsumeType.Add(typeof(Board)); m_ConsumeAmt.Add(m_Info.OakBoardCost); } if (m_Info.OakLogCost > 0) { m_ConsumeType.Add(typeof(Log)); m_ConsumeAmt.Add(m_Info.OakLogCost); } if (m_Info.PineBoardCost > 0) { m_ConsumeType.Add(typeof(PineBoard)); m_ConsumeAmt.Add(m_Info.PineBoardCost); } if (m_Info.PineLogCost > 0) { m_ConsumeType.Add(typeof(PineLog)); m_ConsumeAmt.Add(m_Info.PineLogCost); } if (m_Info.RedScalesCost > 0) { m_ConsumeType.Add(typeof(RedScales)); m_ConsumeAmt.Add(m_Info.RedScalesCost); } if (m_Info.RedwoodBoardCost > 0) { m_ConsumeType.Add(typeof(RedwoodBoard)); m_ConsumeAmt.Add(m_Info.RedwoodBoardCost); } if (m_Info.RedwoodLogCost > 0) { m_ConsumeType.Add(typeof(RedwoodLog)); m_ConsumeAmt.Add(m_Info.RedwoodLogCost); } if (m_Info.ShadowIronIngotCost > 0) { m_ConsumeType.Add(typeof(ShadowIronIngot)); m_ConsumeAmt.Add(m_Info.ShadowIronIngotCost); } if (m_Info.ShadowIronOreCost > 0) { m_ConsumeType.Add(typeof(ShadowIronOre)); m_ConsumeAmt.Add(m_Info.ShadowIronOreCost); } if (m_Info.SilverBirchBoardCost > 0) { m_ConsumeType.Add(typeof(SilverBirchBoard)); m_ConsumeAmt.Add(m_Info.SilverBirchBoardCost); } if (m_Info.SilverBirchLogCost > 0) { m_ConsumeType.Add(typeof(SilverBirchLog)); m_ConsumeAmt.Add(m_Info.SilverBirchLogCost); } if (m_Info.SilverCost > 0) { m_ConsumeType.Add(typeof(Silver)); m_ConsumeAmt.Add(m_Info.SilverCost); } if (m_Info.SpinedHidesCost > 0) { m_ConsumeType.Add(typeof(SpinedHides)); m_ConsumeAmt.Add(m_Info.SpinedHidesCost); } if (m_Info.SteelIngotCost > 0) { m_ConsumeType.Add(typeof(SteelIngot)); m_ConsumeAmt.Add(m_Info.SteelIngotCost); } if (m_Info.SteelOreCost > 0) { m_ConsumeType.Add(typeof(SteelOre)); m_ConsumeAmt.Add(m_Info.SteelOreCost); } if (m_Info.ValoriteIngotCost > 0) { m_ConsumeType.Add(typeof(ValoriteIngot)); m_ConsumeAmt.Add(m_Info.ValoriteIngotCost); } if (m_Info.ValoriteOreCost > 0) { m_ConsumeType.Add(typeof(ValoriteOre)); m_ConsumeAmt.Add(m_Info.ValoriteOreCost); } if (m_Info.VeriteIngotCost > 0) { m_ConsumeType.Add(typeof(VeriteIngot)); m_ConsumeAmt.Add(m_Info.VeriteIngotCost); } if (m_Info.VeriteOreCost > 0) { m_ConsumeType.Add(typeof(VeriteOre)); m_ConsumeAmt.Add(m_Info.VeriteOreCost); } if (m_Info.WhitePineBoardCost > 0) { m_ConsumeType.Add(typeof(WhitePineBoard)); m_ConsumeAmt.Add(m_Info.WhitePineBoardCost); } if (m_Info.WhitePineLogCost > 0) { m_ConsumeType.Add(typeof(WhitePineLog)); m_ConsumeAmt.Add(m_Info.WhitePineLogCost); } if (m_Info.WhiteScalesCost > 0) { m_ConsumeType.Add(typeof(WhiteScales)); m_ConsumeAmt.Add(m_Info.WhiteScalesCost); } if (m_Info.YellowScalesCost > 0) { m_ConsumeType.Add(typeof(YellowScales)); m_ConsumeAmt.Add(m_Info.YellowScalesCost); } if (m_Info.YewBoardCost > 0) { m_ConsumeType.Add(typeof(YewBoard)); m_ConsumeAmt.Add(m_Info.YewBoardCost); } if (m_Info.YewLogCost > 0) { m_ConsumeType.Add(typeof(YewLog)); m_ConsumeAmt.Add(m_Info.YewLogCost); } Type[] types = ( Type[] )m_ConsumeType.ToArray(typeof(Type)); int[] amts = ( int[] )m_ConsumeAmt.ToArray(typeof(int)); if (m_Player.Backpack.ConsumeTotal(types, amts, true) == -1) { m_Player.Backpack.AddItem(m_Item); m_Vendor.ItemsForSale.Remove(m_Info); for (int i = 0; i < m_ConsumeType.Count; i++) { Item item = (Item)Activator.CreateInstance(( Type )m_ConsumeType[i]); item.Amount = ( int )m_ConsumeAmt[i]; m_Vendor.BankBox.AddItem(item); } m_Vendor.Say("Here you go!"); } else { m_Player.SendMessage("You don't have the required resources for this."); } } #endregion } break; // Help case 2000: m_Player.SendMessage("I wonder what this is supposed to do?"); break; } }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if (value is Keys || value is int) { bool flag1 = destinationType == typeof(string); bool flag2 = false; if (!flag1) { flag2 = destinationType == typeof(Enum[]); } if (flag1 || flag2) { var keys1 = (Keys)value; bool flag3 = false; var arrayList = new ArrayList(); Keys keys2 = keys1 & Keys.Modifiers; foreach (string str in DisplayOrder) { var keys3 = (Keys)keyNames[str]; if ((keys3 & keys2) != Keys.None) { if (flag1) { if (flag3) { arrayList.Add("+"); } arrayList.Add(str); } else { arrayList.Add(keys3); } flag3 = true; } } Keys keys4 = keys1 & Keys.KeyCode; bool flag4 = false; if (flag3 && flag1) { arrayList.Add("+"); } foreach (string str in DisplayOrder) { var keys3 = (Keys)keyNames[str]; if (keys3.Equals(keys4)) { if (flag1) { arrayList.Add(str); } else { arrayList.Add(keys3); } flag4 = true; break; } } if (!flag4 && Enum.IsDefined(typeof(Keys), keys4)) { if (flag1) { arrayList.Add(((object)keys4).ToString()); } else { arrayList.Add(keys4); } } if (!flag1) { return(arrayList.ToArray(typeof(Enum))); } var stringBuilder = new StringBuilder(32); foreach (string str in arrayList) { stringBuilder.Append(str); } return((stringBuilder).ToString()); } } return(base.ConvertTo(context, culture, value, destinationType)); }
private void bindStatic() { dsSeries = MDetails.Chart_Data("1"); if (dsSeries == null) { return; } foreach (DataRow dr in dsSeries.Tables[0].Rows) { hidXCategories11.Add((dr["stage_type_desc"])); } foreach (DataRow dr1 in dsSeries.Tables[0].Rows) { hidValues11.Add(Convert.ToInt64((DateTime.Parse(dr1["exp_start_date"].ToString()).Subtract(new DateTime(1970, 1, 1))).TotalMilliseconds)); //hidValues11.Add((dr1["exp_start_date"])); yValues = hidValues11.ToArray(typeof(string)) as object[]; //hidValues1 = hidValues1 + dr1["value"].ToString(); } foreach (DataRow dr2 in dsSeries.Tables[0].Rows) { hidValues12.Add((dr2["weighting"])); yValues2 = hidValues12.ToArray(typeof(object)) as object[]; //hidValues1 = hidValues1 + dr1["value"].ToString(); } //Title // CaseChart.Title = new Highchart.Core.Title("Consumo de energia"); //define Axis CaseChart.YAxis.Add(new YAxisItem { title = new Highchart.Core.Title("Matter#") }); CaseChart.XAxis.Add(new XAxisItem { categories = hidXCategories11.ToArray(typeof(string)) as string[] }); //Data var series = new Collection <Serie>(); series.Add(new Serie { name = "Matter Summary", data = yValues }); var series1 = new Collection <Serie>(); series1.Add(new Serie { name = "Matter Summary", data = yValues2 }); // series.Add(new Serie { name = "televis�o", data = new object[] { 4, 6, 7, 7, 8, 13, 11 } }); //Ploting action CaseChart.PlotOptions = new Highchart.Core.PlotOptions.PlotOptionsScatter { dataLabels = new Highchart.Core.PlotOptions.DataLabels { enabled = true } }; //Customize tooltip CaseChart.Tooltip = new ToolTip("this.x +': '+ this.y"); //Customize legend CaseChart.Legend = new Highchart.Core.Legend { layout = Layout.vertical, borderWidth = 3, align = Align.right, y = 20, x = -20, verticalAlign = Highchart.Core.VerticalAlign.top, shadow = true, backgroundColor = "#e3e6be" }; //bind datacontrol CaseChart.DataSource = series; CaseChart.DataBind(); CaseChart.DataSource = series1; CaseChart.DataBind(); }
internal bool matchParameters(IntPtr luaState, MethodBase method, ref MethodCache methodCache) { bool flag = true; ParameterInfo[] parameters = method.GetParameters(); int currentLuaParam = 1; int num2 = LuaDLL.lua_gettop(luaState); ArrayList list = new ArrayList(); List <int> list2 = new List <int>(); List <MethodArgs> list3 = new List <MethodArgs>(); foreach (ParameterInfo info in parameters) { if (!info.IsIn && info.IsOut) { list2.Add(list.Add(null)); } else { ExtractValue value2; if (currentLuaParam > num2) { if (info.IsOptional) { list.Add(info.DefaultValue); goto Label_01A4; } flag = false; break; } if (this._IsTypeCorrect(luaState, currentLuaParam, info, out value2)) { int item = list.Add(value2(luaState, currentLuaParam)); MethodArgs args = new MethodArgs { index = item, extractValue = value2 }; list3.Add(args); if (info.ParameterType.IsByRef) { list2.Add(item); } currentLuaParam++; } else if (this._IsParamsArray(luaState, currentLuaParam, info, out value2)) { object luaParamValue = value2(luaState, currentLuaParam); Type elementType = info.ParameterType.GetElementType(); Array array = this.TableToArray(luaParamValue, elementType); int num5 = list.Add(array); MethodArgs args2 = new MethodArgs { index = num5, extractValue = value2, isParamsArray = true, paramsArrayType = elementType }; list3.Add(args2); currentLuaParam++; } else if (info.IsOptional) { list.Add(info.DefaultValue); } else { flag = false; break; } Label_01A4 :; } } if (currentLuaParam != (num2 + 1)) { flag = false; } if (flag) { methodCache.args = list.ToArray(); methodCache.cachedMethod = method; methodCache.outList = list2.ToArray(); methodCache.argTypes = list3.ToArray(); } return(flag); }
public CustomTypeDescriptor(Type type, MemberInfo[] members, string[] names) { if (type == null) { throw new ArgumentNullException("type"); } if (members == null) { FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public); ArrayList arrayList = new ArrayList(fields.Length + properties.Length); arrayList.AddRange(fields); arrayList.AddRange(properties); for (int i = 0; i < arrayList.Count; i++) { MemberInfo memberInfo = (MemberInfo)arrayList[i]; if (memberInfo.IsDefined(typeof(JsonIgnoreAttribute), inherit: true)) { arrayList.RemoveAt(i--); } } members = (MemberInfo[])arrayList.ToArray(typeof(MemberInfo)); } PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(null); int num = 0; MemberInfo[] array = members; foreach (MemberInfo memberInfo2 in array) { FieldInfo fieldInfo = memberInfo2 as FieldInfo; string name = (names != null && num < names.Length) ? names[num] : null; if (fieldInfo != null) { if (fieldInfo.DeclaringType != type && fieldInfo.ReflectedType != type) { throw new ArgumentException("fields"); } if (!fieldInfo.IsInitOnly && !fieldInfo.IsLiteral) { propertyDescriptorCollection.Add(new TypeFieldDescriptor(fieldInfo, name)); } } else { PropertyInfo propertyInfo = memberInfo2 as PropertyInfo; if (propertyInfo == null) { throw new ArgumentException("members"); } if (propertyInfo.DeclaringType != type && propertyInfo.ReflectedType != type) { throw new ArgumentException("properties"); } if (propertyInfo.CanRead && propertyInfo.CanWrite) { propertyDescriptorCollection.Add(new TypePropertyDescriptor(propertyInfo, name)); } } num++; } _properties = propertyDescriptorCollection; }
public PatientArray(ArrayList lst) { setProps((Patient[])lst.ToArray(typeof(Patient))); }
protected static object getNativeValueForLuaValue(Type t, LuaValue luaValue) { object value = null; if (t == typeof(Int32) || t == typeof(Int64) || t == typeof(Int16) || t == typeof(UInt16) || t == typeof(UInt32) || t == typeof(UInt64)) { value = luaValue.toInteger(); } else if (t == typeof(double) || t == typeof(float)) { value = luaValue.toNumber(); } else if (t == typeof(bool)) { value = luaValue.toBoolean(); } else if (t == typeof(string)) { value = luaValue.toString(); } else if (t.IsArray || typeof(IList).IsAssignableFrom(t)) { //数组 if (t == typeof(byte[])) { //二进制数组 value = luaValue.toData(); } else if (t == typeof(Int32[])) { List <LuaValue> arr = luaValue.toArray(); if (arr != null) { List <Int32> intArr = new List <Int32> (); foreach (LuaValue item in arr) { intArr.Add(item.toInteger()); } value = intArr.ToArray(); } } else if (t == typeof(Int64[])) { List <LuaValue> arr = luaValue.toArray(); if (arr != null) { List <Int64> intArr = new List <Int64> (); foreach (LuaValue item in arr) { intArr.Add(item.toInteger()); } value = intArr.ToArray(); } } else if (t == typeof(Int16[])) { List <LuaValue> arr = luaValue.toArray(); if (arr != null) { List <Int16> intArr = new List <Int16> (); foreach (LuaValue item in arr) { intArr.Add(Convert.ToInt16(item.toInteger())); } value = intArr.ToArray(); } } else if (t == typeof(UInt32[])) { List <LuaValue> arr = luaValue.toArray(); if (arr != null) { List <UInt32> intArr = new List <UInt32> (); foreach (LuaValue item in arr) { intArr.Add(Convert.ToUInt32(item.toInteger())); } value = intArr.ToArray(); } } else if (t == typeof(UInt64[])) { List <LuaValue> arr = luaValue.toArray(); if (arr != null) { List <UInt64> intArr = new List <UInt64> (); foreach (LuaValue item in arr) { intArr.Add(Convert.ToUInt64(item.toInteger())); } value = intArr.ToArray(); } } else if (t == typeof(UInt16[])) { List <LuaValue> arr = luaValue.toArray(); if (arr != null) { List <UInt16> intArr = new List <UInt16> (); foreach (LuaValue item in arr) { intArr.Add(Convert.ToUInt16(item.toInteger())); } value = intArr.ToArray(); } } else if (t == typeof(bool[])) { List <LuaValue> arr = luaValue.toArray(); if (arr != null) { List <bool> boolArr = new List <bool> (); foreach (LuaValue item in arr) { boolArr.Add(Convert.ToBoolean(item.toInteger())); } value = boolArr.ToArray(); } } else if (t == typeof(double[])) { List <LuaValue> arr = luaValue.toArray(); if (arr != null) { List <double> doubleArr = new List <double> (); foreach (LuaValue item in arr) { doubleArr.Add(item.toNumber()); } value = doubleArr.ToArray(); } } else if (t == typeof(float[])) { List <LuaValue> arr = luaValue.toArray(); if (arr != null) { List <float> floatArr = new List <float> (); foreach (LuaValue item in arr) { floatArr.Add((float)item.toNumber()); } value = floatArr.ToArray(); } } else if (t == typeof(string[])) { List <LuaValue> arr = luaValue.toArray(); if (arr != null) { List <string> floatArr = new List <string> (); foreach (LuaValue item in arr) { floatArr.Add(item.toString()); } value = floatArr.ToArray(); } } else { List <LuaValue> arr = luaValue.toArray(); if (arr != null) { ArrayList objArr = new ArrayList(); foreach (LuaValue item in arr) { objArr.Add(item.toObject()); } value = objArr.ToArray(); } } } else if (typeof(IDictionary).IsAssignableFrom(t)) { //字典 Dictionary <string, LuaValue> map = luaValue.toMap(); if (map != null) { if (t.IsGenericType) { //为泛型 Type[] types = t.GetGenericArguments(); Type valueType = types [1]; IDictionary dict = Activator.CreateInstance(t) as IDictionary; foreach (KeyValuePair <string, LuaValue> kv in map) { dict.Add(kv.Key, getNativeValueForLuaValue(valueType, kv.Value)); } value = dict; } else if (typeof(Hashtable).IsAssignableFrom(t)) { Hashtable dict = new Hashtable(); foreach (KeyValuePair <string, LuaValue> kv in map) { dict.Add(kv.Key, kv.Value.toObject()); } value = dict; } } } else { value = luaValue.toObject(); } return(value); }
public virtual void GroupBy() { GroupBy((ColumnHeader[])HeaderGroup.ToArray(typeof(ColumnHeader))); }
private static IntPtr _instanceMethodHandler(int contextId, int classId, Int64 instancePtr, string methodName, IntPtr argumentsBuffer, int bufferSize) { if (instancePtr != 0 && _exportsInstanceMethods.ContainsKey(classId) && _exportsInstanceMethods[classId].ContainsKey(methodName)) { LuaContext context = LuaContext.getContext(contextId); LuaObjectReference objRef = LuaObjectReference.findObject(instancePtr); object instance = objRef.target; MethodInfo m = _exportsInstanceMethods[classId][methodName]; if (instance != null && m != null) { ArrayList argsArr = parseMethodParameters(m, getArgumentList(context, argumentsBuffer, bufferSize)); object ret = m.Invoke(instance, argsArr != null && argsArr.Count > 0 ? argsArr.ToArray() : null); LuaValue retValue = new LuaValue(ret); LuaObjectEncoder encoder = new LuaObjectEncoder(context); encoder.writeObject(retValue); byte[] bytes = encoder.bytes; IntPtr retPtr; retPtr = Marshal.AllocHGlobal(bytes.Length); Marshal.Copy(bytes, 0, retPtr, bytes.Length); return(retPtr); } } return(IntPtr.Zero); }
private static void UpdateAccount(NetState state, PacketReader pvSrc) { if (state.Account.AccessLevel < AccessLevel.Administrator) { state.Send(new MessageBoxMessage("You do not have permission to edit accounts.", "Account Access Exception")); return; } string username = pvSrc.ReadString(); string pass = pvSrc.ReadString(); Account a = Accounts.GetAccount(username) as Account; if (a != null && !CanAccessAccount(state.Account, a)) { state.Send(new MessageBoxMessage("You cannot edit an account with an access level greater than or equal to your own.", "Account Access Exception")); } else { bool CreatedAccount = false; bool UpdatedPass = false; bool oldbanned = a == null ? false : a.Banned; AccessLevel oldAcessLevel = a == null ? 0 : a.AccessLevel; if (a == null) { a = new Account(username, pass); CreatedAccount = true; } else if (pass != "(hidden)") { a.SetPassword(pass); UpdatedPass = true; } if (a != state.Account) { AccessLevel newAccessLevel = (AccessLevel)pvSrc.ReadByte(); if (a.AccessLevel != newAccessLevel) { if (newAccessLevel >= state.Account.AccessLevel) { state.Send(new MessageBoxMessage("Warning: You may not set an access level greater than or equal to your own.", "Account Access Level update denied.")); } else { a.AccessLevel = newAccessLevel; } } bool newBanned = pvSrc.ReadBoolean(); if (newBanned != a.Banned) { oldbanned = a.Banned; a.Banned = newBanned; a.Comments.Add(new AccountComment(state.Account.Username, newBanned ? "Banned via Remote Admin" : "Unbanned via Remote Admin")); } } else { pvSrc.ReadInt16(); //skip both state.Send(new MessageBoxMessage("Warning: When editing your own account, Account Status and Access Level cannot be changed.", "Editing Own Account")); } ArrayList list = new ArrayList(); ushort length = pvSrc.ReadUInt16(); bool invalid = false; for (int i = 0; i < length; i++) { string add = pvSrc.ReadString(); if (Utility.IsValidIP(add)) { list.Add(add); } else { invalid = true; } } if (list.Count > 0) { a.IPRestrictions = (string[])list.ToArray(typeof(string)); } else { a.IPRestrictions = new string[0]; } if (invalid) { state.Send(new MessageBoxMessage("Warning: one or more of the IP Restrictions you specified was not valid.", "Invalid IP Restriction")); } if (CreatedAccount) { RemoteAdminLogging.WriteLine(state, "Created account {0} with Access Level {1}", a.Username, a.AccessLevel); } else { string changes = string.Empty; if (UpdatedPass) { changes += " Password Changed."; } if (oldAcessLevel != a.AccessLevel) { changes = string.Format("{0} Access level changed from {1} to {2}.", changes, oldAcessLevel, a.AccessLevel); } if (oldbanned != a.Banned) { changes += a.Banned ? " Banned." : " Unbanned."; } RemoteAdminLogging.WriteLine(state, "Updated account {0}:{1}", a.Username, changes); } state.Send(new MessageBoxMessage("Account updated successfully.", "Account Updated")); } }
/// <summary> /// Parse bump parameters. /// </summary> /// <param name="param">list of paramers</param> /// <param name="mtlData">material data to be updated</param> /// <remarks>Only the bump map texture path is used here.</remarks> /// <seealso cref="https://github.com/hammmm/unity-obj-loader"/> private void ParseBumpParameters(string[] param, MaterialData mtlData) { Regex regexNumber = new Regex(@"^[-+]?[0-9]*\.?[0-9]+$"); var bumpParams = new Dictionary <string, BumpParamDef>(); bumpParams.Add("bm", new BumpParamDef("bm", "string", 1, 1)); bumpParams.Add("clamp", new BumpParamDef("clamp", "string", 1, 1)); bumpParams.Add("blendu", new BumpParamDef("blendu", "string", 1, 1)); bumpParams.Add("blendv", new BumpParamDef("blendv", "string", 1, 1)); bumpParams.Add("imfchan", new BumpParamDef("imfchan", "string", 1, 1)); bumpParams.Add("mm", new BumpParamDef("mm", "string", 1, 1)); bumpParams.Add("o", new BumpParamDef("o", "number", 1, 3)); bumpParams.Add("s", new BumpParamDef("s", "number", 1, 3)); bumpParams.Add("t", new BumpParamDef("t", "number", 1, 3)); bumpParams.Add("texres", new BumpParamDef("texres", "string", 1, 1)); int pos = 1; string filename = null; while (pos < param.Length) { if (!param[pos].StartsWith("-")) { filename = param[pos]; pos++; continue; } // option processing string optionName = param[pos].Substring(1); pos++; if (!bumpParams.ContainsKey(optionName)) { continue; } BumpParamDef def = bumpParams[optionName]; ArrayList args = new ArrayList(); int i = 0; bool isOptionNotEnough = false; for (; i < def.valueNumMin; i++, pos++) { if (pos >= param.Length) { isOptionNotEnough = true; break; } if (def.valueType == "number") { Match match = regexNumber.Match(param[pos]); if (!match.Success) { isOptionNotEnough = true; break; } } args.Add(param[pos]); } if (isOptionNotEnough) { Debug.Log("bump variable value not enough for option:" + optionName + " of material:" + mtlData.materialName); continue; } for (; i < def.valueNumMax && pos < param.Length; i++, pos++) { if (def.valueType == "number") { Match match = regexNumber.Match(param[pos]); if (!match.Success) { break; } } args.Add(param[pos]); } // TODO: some processing of options Debug.Log("found option: " + optionName + " of material: " + mtlData.materialName + " args: " + string.Concat(args.ToArray())); } // set the file name, if found // TODO: other parsed parameters are not used for now if (filename != null) { mtlData.bumpTexPath = filename; } }
public static string[] Find_WIN32_Com_2() { ArrayList comsmap = new ArrayList(); RegistryKey keyCommap = Registry.LocalMachine.OpenSubKey("Hardware\\DeviceMap\\SerialComm"); if (keyCommap != null) { string[] sSubKeys = keyCommap.GetValueNames(); for (int i = 0; i < sSubKeys.Length; i++) { comsmap.Add((string)keyCommap.GetValue(sSubKeys[i])); } } if (comsmap.Count == 0) { return(null); } string[] coms = null; ArrayList acoms = new ArrayList(); RegistryKey keyFTDIBUS = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Enum\\FTDIBUS"); if (keyFTDIBUS != null) { string[] FTDIBUS_SubKeys = keyFTDIBUS.GetSubKeyNames(); for (int i = 0; i < FTDIBUS_SubKeys.Length; i++) { RegistryKey keyVID = keyFTDIBUS.OpenSubKey(FTDIBUS_SubKeys[i]); string[] Sub0000_Keys = keyVID.GetSubKeyNames(); for (int j = 0; j < Sub0000_Keys.Length; j++) { RegistryKey keyCom = keyVID.OpenSubKey(Sub0000_Keys[j]); string[] keyComparms = keyCom.GetValueNames(); if (((string)keyCom.GetValue("FriendlyName")).IndexOf("Serial") != -1) { string[] sSubKeys = keyCom.GetSubKeyNames(); bool ishavecontrol = false; if (sSubKeys.Length == 3) { ishavecontrol = true; } if (ishavecontrol) { RegistryKey keycomname = keyCom.OpenSubKey("Device Parameters"); string[] ParamKey = keycomname.GetValueNames(); int k; bool ishaveportname = false; for (k = 0; k < ParamKey.Length; k++) { if (ParamKey[k] == "PortName") { ishaveportname = true; break;; } } if (ishaveportname) { string portname = (string)keycomname.GetValue(ParamKey[k]); if (portname.IndexOf("COM") != -1) { if (!acoms.Contains(portname) && comsmap.Contains(portname)) { acoms.Add(portname); } } } } } } } } RegistryKey keyUSB = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Enum\\USB"); if (keyUSB != null) { string[] USB_SubKeys = keyUSB.GetSubKeyNames(); for (int i = 0; i < USB_SubKeys.Length; i++) { if (USB_SubKeys[i].IndexOf("Vid") != -1) { RegistryKey keyVid = keyUSB.OpenSubKey(USB_SubKeys[i]); string[] Vid_SubKeys = keyVid.GetSubKeyNames(); for (int j = 0; j < Vid_SubKeys.Length; j++) { RegistryKey keyVid_sub = keyVid.OpenSubKey(Vid_SubKeys[j]); string[] keyComparms = keyVid_sub.GetValueNames(); if (((string)keyVid_sub.GetValue("DeviceDesc")).IndexOf("Serial") != -1) { string[] sSubKeys = keyVid_sub.GetSubKeyNames(); bool ishavecontrol = false; if (sSubKeys.Length == 3) { ishavecontrol = true; } if (ishavecontrol) { RegistryKey keycomname = keyVid_sub.OpenSubKey("Device Parameters"); string[] ParamKey = keycomname.GetValueNames(); int k; bool ishaveportname = false; for (k = 0; k < ParamKey.Length; k++) { if (ParamKey[k] == "PortName") { ishaveportname = true; break;; } } if (ishaveportname) { string portname = (string)keycomname.GetValue(ParamKey[k]); if (portname.IndexOf("COM") != -1) { if (!acoms.Contains(portname) && comsmap.Contains(portname)) { acoms.Add(portname); } } } } } } } } } coms = (string[])acoms.ToArray(typeof(string)); return(coms); }
/// <summary> /// Reads the data. /// </summary> /// <param name="stream">The stream.</param> /// <param name="eofChar">The EOF char.</param> /// <returns></returns> public static byte[] ReadData(Stream stream, int eofChar) { int characterCount = 0; byte b = (byte)0; ArrayList bytes = new ArrayList(); bool done = false; while (!done) { int count = stream.ReadByte(); char baseChar = 'a'; if (count == eofChar) { break; } switch (count) { case '#': ReadToEOL(stream); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': b <<= 4; b += (byte)(count - '0'); characterCount++; if (characterCount == 2) { bytes.Add((byte)b); characterCount = 0; b = (byte)0; } break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': baseChar = 'A'; b <<= 4; b += (byte)(count + 10 - baseChar); characterCount++; if (characterCount == 2) { bytes.Add((byte)b); characterCount = 0; b = (byte)0; } break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': b <<= 4; b += (byte)(count + 10 - baseChar); characterCount++; if (characterCount == 2) { bytes.Add((byte)b); characterCount = 0; b = (byte)0; } break; case -1: done = true; break; default: break; } } byte[] polished = (byte[])bytes.ToArray(typeof(byte)); //byte[] rval = new byte[polished.Length]; //for ( int j = 0; j < polished.Length; j++ ) //{ // rval[j] = polished[j]; //} return(polished); }
public ActionResult LaudoVistoriaFlorestal(EspecificidadeVME especificidade) { LaudoVistoriaFlorestalBus _busLaudo = new LaudoVistoriaFlorestalBus(); List <Protocolos> lstProcessosDocumentos = _busTitulo.ObterProcessosDocumentos(especificidade.ProtocoloId); List <AtividadeSolicitada> lstAtividades = new List <AtividadeSolicitada>(); List <PessoaLst> destinatarios = new List <PessoaLst>(); Titulo titulo = new Titulo(); TituloModelo modelo = _tituloModeloBus.Obter(especificidade.ModeloId ?? 0); LaudoVistoriaFlorestal laudo = new LaudoVistoriaFlorestal(); LaudoVistoriaFlorestalVM vm = null; string htmlEspecificidade = string.Empty; if (especificidade.TituloId > 0) { titulo = _busTitulo.ObterSimplificado(especificidade.TituloId); titulo.Anexos = _busTitulo.ObterAnexos(especificidade.TituloId); titulo.Atividades = _busTitulo.ObterAtividades(especificidade.TituloId); titulo.Condicionantes = _busTitulo.ObterCondicionantes(especificidade.TituloId); titulo.Exploracoes = _busTitulo.ObterExploracoes(especificidade.TituloId); laudo = _busLaudo.Obter(especificidade.TituloId) as LaudoVistoriaFlorestal; if (laudo != null) { especificidade.AtividadeProcDocReq = laudo.ProtocoloReq; laudo.Anexos = titulo.Anexos; } } if (especificidade.ProtocoloId > 0) { if (_busEspecificidade.ExisteProcDocFilhoQueFoiDesassociado(especificidade.TituloId)) { lstAtividades = new List <AtividadeSolicitada>(); titulo.Atividades = new List <Atividade>(); } else { lstAtividades = _busAtividade.ObterAtividadesLista(especificidade.AtividadeProcDocReq.ToProtocolo()); } if (titulo.Situacao.Id == (int)eTituloSituacao.Cadastrado) { destinatarios = _busTitulo.ObterDestinatarios(especificidade.ProtocoloId); } else { destinatarios.Add(new PessoaLst() { Id = laudo.Destinatario, Texto = laudo.DestinatarioNomeRazao, IsAtivo = true }); } if (!especificidade.IsVisualizar) { _busEspecificidade.PossuiAtividadeEmAndamento(especificidade.ProtocoloId); } } if (!Validacao.EhValido) { return(Json(new { Msg = Validacao.Erros, EhValido = Validacao.EhValido, @Html = string.Empty }, JsonRequestBehavior.AllowGet)); } var busExploracao = new ExploracaoFlorestalBus(); var exploracoesLst = busExploracao.ObterPorEmpreendimentoList(especificidade.EmpreendimentoId); var caracterizacaoLst = new List <CaracterizacaoLst>(); if (exploracoesLst.Count() > 0) { caracterizacaoLst = exploracoesLst.Select(x => new CaracterizacaoLst { Id = x.Id, Texto = x.CodigoExploracaoTexto ?? "", ParecerFavoravel = String.Join(", ", x.Exploracoes.Where(w => w.ParecerFavoravel == true).Select(y => y.Identificacao)?.ToList()), ParecerDesfavoravel = String.Join(", ", x.Exploracoes.Where(w => w.ParecerFavoravel == false).Select(y => y.Identificacao)?.ToList()), IsAtivo = true })?.ToList(); } vm = new LaudoVistoriaFlorestalVM( modelo.Codigo, laudo, lstProcessosDocumentos, lstAtividades, caracterizacaoLst, destinatarios, _protocoloBus.ObterResponsaveisTecnicosPorRequerimento(especificidade.AtividadeProcDocReq.RequerimentoId), _busLista.ObterEspecificidadeConclusoes, titulo.Condicionantes, especificidade.AtividadeProcDocReqKey, especificidade.IsVisualizar); if (especificidade.TituloId > 0) { vm.Atividades.Atividades = titulo.Atividades; vm.Exploracoes = titulo.Exploracoes; var parecerFavoravel = new ArrayList(); var parecerDesfavoravel = new ArrayList(); foreach (var exploracao in exploracoesLst) { if (exploracao.Exploracoes.Where(x => x.ParecerFavoravel == true)?.ToList().Count > 0) { parecerFavoravel.Add(String.Concat(exploracao.CodigoExploracaoTexto, " (", String.Join(", ", exploracao.Exploracoes.Where(x => x.ParecerFavoravel == true).Select(x => x.Identificacao)?.ToList()), ")")); } if (exploracao.Exploracoes.Where(x => x.ParecerFavoravel == false)?.ToList().Count > 0) { parecerDesfavoravel.Add(String.Concat(exploracao.CodigoExploracaoTexto, " (", String.Join(", ", exploracao.Exploracoes.Where(x => x.ParecerFavoravel == false).Select(x => x.Identificacao)?.ToList()), ")")); } } vm.ParecerFavoravelLabel = parecerFavoravel.Count > 0 ? String.Join(", ", parecerFavoravel?.ToArray()) : ""; vm.ParecerDesfavoravelLabel = parecerDesfavoravel.Count > 0 ? String.Join(", ", parecerDesfavoravel?.ToArray()) : ""; } vm.IsCondicionantes = modelo.Regra(eRegra.Condicionantes) || (titulo.Condicionantes != null && titulo.Condicionantes.Count > 0); htmlEspecificidade = ViewModelHelper.RenderPartialViewToString(ControllerContext, "~/Areas/Especificidades/Views/Laudo/LaudoVistoriaFlorestal.ascx", vm); return(Json(new { Msg = Validacao.Erros, EhValido = Validacao.EhValido, @Html = htmlEspecificidade }, JsonRequestBehavior.AllowGet)); }
protected FileItem[] GetChildFiles(MainDataSet.ArticleRow articleRow) { if (articleRow != null && articleRow.DepartmentGuid != Guid.Empty) { MetaDataSet.FileDataTable dtFiles = (new Micajah.FileService.Client.Dal.MetaDataSetTableAdapters.FileTableAdapter()).GetFiles( Micajah.Common.Bll.Providers.InstanceProvider.GetInstance(articleRow.DepartmentGuid).OrganizationId, articleRow.DepartmentGuid, "Article", articleRow.ArticleGuid.ToString("N"), false); ArrayList files = new ArrayList(); foreach (MetaDataSet.FileRow frow in dtFiles) { string path = string.Empty; string ext = Path.GetExtension(frow.Name); string mimeType = MimeType.GetMimeType(ext); switch (FileType) { case "Image": path = Access.GetThumbnailUrl(frow.FileUniqueId, frow.OrganizationId, frow.DepartmentId, 640, 0, 0); if (MimeType.IsImageType(mimeType)) { files.Add( new FileItem( frow.Name, ext, frow.SizeInBytes, string.Empty, path, string.Format("{0}/{1}/", articleRow.Subject, frow.Name), fullPermissions)); } break; case "Video": path = Access.GetFileUrl(frow.FileUniqueId, frow.OrganizationId, frow.DepartmentId); if (MimeType.IsVideoType(mimeType)) { files.Add(new FileItem( frow.Name, ext, frow.SizeInBytes, string.Empty, path, string.Format("{0}/{1}/", articleRow.Subject, frow.Name), fullPermissions)); } break; case "Flash": path = Access.GetFlashUrl(frow.FileUniqueId, frow.OrganizationId, frow.DepartmentId); if (MimeType.IsFlash(mimeType)) { files.Add(new FileItem( frow.Name, ext, frow.SizeInBytes, string.Empty, path, string.Format("{0}/{1}/", articleRow.Subject, frow.Name), fullPermissions)); } break; default: path = Access.GetFileUrl(frow.FileUniqueId, frow.OrganizationId, frow.DepartmentId); files.Add(new FileItem( frow.Name, ext, frow.SizeInBytes, string.Empty, path, string.Format("{0}/{1}/", articleRow.Subject, frow.Name), fullPermissions)); break; } } return((FileItem[])files.ToArray(typeof(FileItem))); } return(new FileItem[] { }); }
public bool RegisterGrowl() { _initialized = false; var dir = Application.StartupPath; var connectorPath = Path.Combine(dir, "Growl.Connector.dll"); var corePath = Path.Combine(dir, "Growl.CoreLibrary.dll"); try { if (!IsDllExists) { return(false); } _connector = Assembly.LoadFile(connectorPath); _core = Assembly.LoadFile(corePath); } catch (Exception) { return(false); } try { _targetConnector = _connector.CreateInstance("Growl.Connector.GrowlConnector"); _targetCore = _core.CreateInstance("Growl.CoreLibrary"); Type t = _connector.GetType("Growl.Connector.NotificationType"); _growlNTreply = t.InvokeMember(null, BindingFlags.CreateInstance, null, null, new object[] { "REPLY", "Reply" }); _growlNTdm = t.InvokeMember(null, BindingFlags.CreateInstance, null, null, new object[] { "DIRECT_MESSAGE", "DirectMessage" }); _growlNTnew = t.InvokeMember(null, BindingFlags.CreateInstance, null, null, new object[] { "NOTIFY", "新着通知" }); _growlNTusevent = t.InvokeMember(null, BindingFlags.CreateInstance, null, null, new object[] { "USERSTREAM_EVENT", "UserStream Event" }); object encryptType = _connector.GetType("Growl.Connector.Cryptography+SymmetricAlgorithmType").InvokeMember("PlainText", BindingFlags.GetField, null, null, null); _targetConnector.GetType().InvokeMember("EncryptionAlgorithm", BindingFlags.SetProperty, null, _targetConnector, new[] { encryptType }); _growlApp = _connector.CreateInstance("Growl.Connector.Application", false, BindingFlags.Default, null, new object[] { _appName }, null, null); if (File.Exists(Path.Combine(Application.StartupPath, "Icons\\Tween.png"))) { // Icons\Tween.pngを使用 ConstructorInfo ci = _core.GetType("Growl.CoreLibrary.Resource").GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { typeof(string) }, null); object data = ci.Invoke(new object[] { Path.Combine(Application.StartupPath, "Icons\\Tween.png") }); PropertyInfo pi = _growlApp.GetType().GetProperty("Icon"); pi.SetValue(_growlApp, data, null); } else if (File.Exists(Path.Combine(Application.StartupPath, "Icons\\MIcon.ico"))) { // アイコンセットにMIcon.icoが存在する場合それを使用 ConstructorInfo cibd = _core.GetType("Growl.CoreLibrary.BinaryData").GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, new[] { typeof(byte[]) }, null); object bdata = cibd.Invoke(new object[] { IconToByteArray(Path.Combine(Application.StartupPath, "Icons\\MIcon.ico")) }); ConstructorInfo cires = _core.GetType("Growl.CoreLibrary.Resource").GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { bdata.GetType() }, null); object data = cires.Invoke(new[] { bdata }); PropertyInfo pi = _growlApp.GetType().GetProperty("Icon"); pi.SetValue(_growlApp, data, null); } else { // 内蔵アイコンリソースを使用 ConstructorInfo cibd = _core.GetType("Growl.CoreLibrary.BinaryData").GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, new[] { typeof(byte[]) }, null); object bdata = cibd.Invoke(new object[] { IconToByteArray(R.MIcon) }); ConstructorInfo cires = _core.GetType("Growl.CoreLibrary.Resource").GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { bdata.GetType() }, null); object data = cires.Invoke(new[] { bdata }); PropertyInfo pi = _growlApp.GetType().GetProperty("Icon"); pi.SetValue(_growlApp, data, null); } MethodInfo mi = _targetConnector.GetType().GetMethod("Register", new[] { _growlApp.GetType(), _connector.GetType("Growl.Connector.NotificationType[]") }); t = _connector.GetType("Growl.Connector.NotificationType"); var arglist = new ArrayList { _growlNTreply, _growlNTdm, _growlNTnew, _growlNTusevent }; mi.Invoke(_targetConnector, new[] { _growlApp, arglist.ToArray(t) }); // コールバックメソッドの登録 Type growlConnectorType = _connector.GetType("Growl.Connector.GrowlConnector"); EventInfo notificationCallback = growlConnectorType.GetEvent("NotificationCallback"); Type delegateType = notificationCallback.EventHandlerType; MethodInfo handler = typeof(GrowlHelper).GetMethod("GrowlCallbackHandler", BindingFlags.NonPublic | BindingFlags.Instance); Delegate d = Delegate.CreateDelegate(delegateType, this, handler); MethodInfo methodAdd = notificationCallback.GetAddMethod(); object[] addHandlerArgs = { d }; methodAdd.Invoke(_targetConnector, addHandlerArgs); _initialized = true; } catch (Exception) { _initialized = false; return(false); } return(true); }
public string MakeInnerHtmlChart(ChartData[] cds, int Width, int Height) { //Check that we have some data if (cds == null) { return("An error occured, could not find any plots!"); } try { //Get paths, set in global.cs string RelativePath = (string)Application["RelativePath"] + "/"; string AbsolutePath = (string)Application["PhysicalPath"] + "/"; //Generate unique filename string filename = DateTime.Now.Ticks.ToString(); //Get hostinfo IPHostEntry ihe = Dns.GetHostByName(this.Server.MachineName); //Initialize variables string[] imgs = new string[cds.Length]; StringBuilder sr = new StringBuilder(); string[] datanames = new string[cds.Length]; string xmldata; string tabdata; ArrayList files = new ArrayList(); //Run through ChartData[] and create charts for (int i = 0; i < cds.Length; i++) { //Initialize chart ChartControl cc = new ChartControl(); cc.AddChartData(cds[i]); cc.BackColor = Color.White; //Check X and Y values if (cds[i].X == null || cds[i].Y == null) { continue; } //Check y values bool ok = false; foreach (double[] d in cds[i].Y) { if (d != null) { ok = true; } } if (!ok) { continue; } //Check if the current ChartData has Width and Height set try { if (cds[i].Width != 0) { cc.Width = cds[i].Width; } else { cc.Width = Width; } if (cds[i].Height != 0) { cc.Height = cds[i].Height; } else { cc.Height = Height; } } catch {} //Create Image Image img = cc.GetImage(); if (img == null) { continue; } //Save image to disk img.Save(AbsolutePath + filename + "_" + i + ".png", ImageFormat.Png); //Store relative path to image imgs[i] = RelativePath + filename + "_" + i + ".png"; //Save ChartData as XML try { xmldata = filename + "_" + i + ".xnc"; using (Stream s = File.OpenWrite(AbsolutePath + xmldata)) { cds[i].ToXML(s); } } catch { xmldata = null; } //Save ChartData as HTML try { tabdata = filename + "_" + i + ".html"; using (Stream s = File.OpenWrite(AbsolutePath + tabdata)) { cds[i].ToHtml(s); } } catch { tabdata = null; } //Create HTML to return to client sr.Append("<table cellpadding=0 cellspacing=2><tr><td >"); sr.Append("<img src='" + "http://" + ihe.HostName + imgs[i] + "'>\n"); if (xmldata != null) { sr.Append("<tr><td align=right><a href='http://" + ihe.HostName + RelativePath + xmldata + "'>Xml format</a> | "); } if (tabdata != null) { sr.Append("<a href='http://" + ihe.HostName + RelativePath + tabdata + "' target='htmldata'>Html format</a></table><br>"); } //Files to be deleted at the end of session files.Add(AbsolutePath + filename + "_" + i + ".png"); files.Add(AbsolutePath + xmldata); files.Add(AbsolutePath + tabdata); } //Add to session end delete AddToDelete((string[])files.ToArray(typeof(string))); //Return HTML return(sr.ToString()); } catch (Exception e) { return("An unknown error occured. Please send the following message to the administrator:<br>" + e.Message + "<br>" + e.StackTrace + "<br>" + cds.Length + ", " + Width + ", " + Height); } }
/* * Matches a method against its arguments in the Lua stack. Returns * if the match was succesful. It it was also returns the information * necessary to invoke the method. */ internal bool matchParameters(IntPtr luaState, MethodBase method, ref MethodCache methodCache) { ExtractValue extractValue; bool isMethod = true; ParameterInfo[] paramInfo = method.GetParameters(); int currentLuaParam = 1; int nLuaParams = LuaDLL.lua_gettop(luaState); ArrayList paramList = new ArrayList(); List <int> outList = new List <int>(); List <MethodArgs> argTypes = new List <MethodArgs>(); foreach (ParameterInfo currentNetParam in paramInfo) { if (!currentNetParam.IsIn && currentNetParam.IsOut) // Skips out params { outList.Add(paramList.Add(null)); } else if (currentLuaParam > nLuaParams) // Adds optional parameters { if (currentNetParam.IsOptional) { paramList.Add(currentNetParam.DefaultValue); } else { isMethod = false; break; } } else if (_IsTypeCorrect(luaState, currentLuaParam, currentNetParam, out extractValue)) // Type checking { int index = paramList.Add(extractValue(luaState, currentLuaParam)); MethodArgs methodArg = new MethodArgs(); methodArg.index = index; methodArg.extractValue = extractValue; argTypes.Add(methodArg); if (currentNetParam.ParameterType.IsByRef) { outList.Add(index); } currentLuaParam++; } // Type does not match, ignore if the parameter is optional else if (currentNetParam.IsOptional) { paramList.Add(currentNetParam.DefaultValue); } else // No match { isMethod = false; break; } } if (currentLuaParam != nLuaParams + 1) // Number of parameters does not match { isMethod = false; } if (isMethod) { methodCache.args = paramList.ToArray(); methodCache.cachedMethod = method; methodCache.outList = outList.ToArray(); methodCache.argTypes = argTypes.ToArray(); } return(isMethod); }
public object ObterDadosPdf(IEspecificidade especificidade, BancoDeDados banco) { try { Laudo laudo = _da.ObterDadosPDF(especificidade.Titulo.Id, banco); DataEmissaoPorExtenso(laudo.Titulo); #region Anexos laudo.AnexosPdfs = laudo.Anexos .Select(x => x.Arquivo) .Where(x => (!String.IsNullOrEmpty(x.Nome) && new FileInfo(x.Nome).Extension.ToLower().IndexOf("pdf") > -1)).ToList(); laudo.Anexos.RemoveAll(anexo => String.IsNullOrEmpty(anexo.Arquivo.Extensao) || !((new[] { ".jpg", ".gif", ".png", ".bmp" }).Any(x => anexo.Arquivo.Extensao.ToLower() == x))); if (laudo.Anexos != null && laudo.Anexos.Count > 0) { foreach (AnexoPDF anexo in laudo.Anexos) { anexo.Arquivo.Conteudo = AsposeImage.RedimensionarImagem( File.ReadAllBytes(anexo.Arquivo.Caminho), 11, eAsposeImageDimensao.Ambos); } } #endregion laudo.Dominialidade = new DominialidadePDF(new DominialidadeBus().ObterPorEmpreendimento(especificidade.Titulo.EmpreendimentoId.GetValueOrDefault())); if (laudo.CaracterizacaoTipo == (int)eCaracterizacao.ExploracaoFlorestal) { var exploracoes = new ExploracaoFlorestalBus().ObterExploracoes(especificidade.Titulo.Id, (int)eTituloModeloCodigo.LaudoVistoriaFlorestal); laudo.ExploracaoFlorestalList = exploracoes.Select(x => new ExploracaoFlorestalPDF(x)).ToList(); var parecerFavoravel = new ArrayList(); var parecerDesfavoravel = new ArrayList(); foreach (var exploracao in exploracoes) { if (exploracao.Exploracoes.Where(x => x.ParecerFavoravel == true)?.ToList().Count > 0) { parecerFavoravel.Add(String.Concat(exploracao.CodigoExploracaoTexto, " (", String.Join(", ", exploracao.Exploracoes.Where(x => x.ParecerFavoravel == true).Select(x => x.Identificacao)?.ToList()), ")")); } if (exploracao.Exploracoes.Where(x => x.ParecerFavoravel == false)?.ToList().Count > 0) { parecerDesfavoravel.Add(String.Concat(exploracao.CodigoExploracaoTexto, " (", String.Join(", ", exploracao.Exploracoes.Where(x => x.ParecerFavoravel == false).Select(x => x.Identificacao)?.ToList()), ")")); } } laudo.ParecerFavoravel = parecerFavoravel.Count > 0 ? String.Join(", ", parecerFavoravel?.ToArray()) : ""; laudo.ParecerDesfavoravel = parecerDesfavoravel.Count > 0 ? String.Join(", ", parecerDesfavoravel?.ToArray()) : ""; } else { laudo.ExploracaoFlorestal = new ExploracaoFlorestalPDF(new ExploracaoFlorestalBus().ObterPorEmpreendimento(especificidade.Titulo.EmpreendimentoId.GetValueOrDefault())); } laudo.QueimaControlada = new QueimaControladaPDF(new QueimaControladaBus().ObterPorEmpreendimento(especificidade.Titulo.EmpreendimentoId.GetValueOrDefault())); laudo.Silvicultura = new SilviculturaPDF(new SilviculturaBus().ObterPorEmpreendimento(especificidade.Titulo.EmpreendimentoId.GetValueOrDefault())); return(laudo); } catch (Exception exc) { Validacao.AddErro(exc); } return(null); }
public void Format() { mScreenBytes = FormatScreen((string[])mStrings.ToArray(typeof(string))); }
static void ExtractMethodInfo(Hashtable methods, MethodInfo mi, Type type) { XmlRpcMethodAttribute attr = (XmlRpcMethodAttribute) Attribute.GetCustomAttribute(mi, typeof(XmlRpcMethodAttribute)); if (attr == null) { return; } XmlRpcMethodInfo mthdInfo = new XmlRpcMethodInfo(); mthdInfo.MethodInfo = mi; mthdInfo.XmlRpcName = GetXmlRpcMethodName(mi); mthdInfo.MiName = mi.Name; mthdInfo.Doc = attr.Description; mthdInfo.IsHidden = attr.IntrospectionMethod | attr.Hidden; // extract parameters information ArrayList parmList = new ArrayList(); ParameterInfo[] parms = mi.GetParameters(); foreach (ParameterInfo parm in parms) { XmlRpcParameterInfo parmInfo = new XmlRpcParameterInfo(); parmInfo.Name = parm.Name; parmInfo.Type = parm.ParameterType; parmInfo.XmlRpcType = GetXmlRpcTypeString(parm.ParameterType); // retrieve optional attributed info parmInfo.Doc = ""; XmlRpcParameterAttribute pattr = (XmlRpcParameterAttribute) Attribute.GetCustomAttribute(parm, typeof(XmlRpcParameterAttribute)); if (pattr != null) { parmInfo.Doc = pattr.Description; parmInfo.XmlRpcName = pattr.Name; } parmInfo.IsParams = Attribute.IsDefined(parm, typeof(ParamArrayAttribute)); parmList.Add(parmInfo); } mthdInfo.Parameters = (XmlRpcParameterInfo[]) parmList.ToArray(typeof(XmlRpcParameterInfo)); // extract return type information mthdInfo.ReturnType = mi.ReturnType; mthdInfo.ReturnXmlRpcType = GetXmlRpcTypeString(mi.ReturnType); object[] orattrs = mi.ReturnTypeCustomAttributes.GetCustomAttributes( typeof(XmlRpcReturnValueAttribute), false); if (orattrs.Length > 0) { mthdInfo.ReturnDoc = ((XmlRpcReturnValueAttribute)orattrs[0]).Description; } if (methods[mthdInfo.XmlRpcName] != null) { throw new XmlRpcDupXmlRpcMethodNames(String.Format("Method " + "{0} in type {1} has duplicate XmlRpc method name {2}", mi.Name, type.Name, mthdInfo.XmlRpcName)); } else { methods.Add(mthdInfo.XmlRpcName, mthdInfo); } }
public void OOOOOOODCD(ArrayList arr, string[] DOODQOQO, string[] OODDQOQO) { bool flag = false; ODODOQQO = DOODQOQO; ODODQOOQ = OODDQOQO; ArrayList list = new ArrayList(); if (this.obj == null) { this.ODOCOQCCOC(base.transform, null, null, null); } IEnumerator enumerator = this.obj.GetEnumerator(); try { while (enumerator.MoveNext()) { Transform current = (Transform)enumerator.Current; if (current.name == "Markers") { IEnumerator enumerator2 = current.GetEnumerator(); try { while (enumerator2.MoveNext()) { MarkerScript component = ((Transform)enumerator2.Current).GetComponent <MarkerScript>(); component.OQODQQDO.Clear(); component.ODOQQQDO.Clear(); component.OQQODQQOO.Clear(); component.ODDOQQOO.Clear(); list.Add(component); } continue; } finally { IDisposable disposable = enumerator2 as IDisposable; if (disposable == null) { } disposable.Dispose(); } } } } finally { IDisposable disposable2 = enumerator as IDisposable; if (disposable2 == null) { } disposable2.Dispose(); } this.mSc = (MarkerScript[])list.ToArray(typeof(MarkerScript)); ArrayList list2 = new ArrayList(); int num = 0; int num2 = 0; if (this.ODQQQQQO != null) { if (arr.Count == 0) { return; } for (int k = 0; k < ODODOQQO.Length; k++) { ODODDQQO ododdqqo = (ODODDQQO)arr[k]; for (int m = 0; m < this.ODQQQQQO.Length; m++) { if (ODODOQQO[k] == this.ODQQQQQO[m]) { num++; if (this.ODODQQOD.Length > m) { list2.Add(this.ODODQQOD[m]); } else { list2.Add(false); } foreach (MarkerScript script2 in this.mSc) { int index = -1; for (int n = 0; n < script2.ODDOOQDO.Length; n++) { if (ododdqqo.id == script2.ODDOOQDO[n]) { index = n; break; } } if (index >= 0) { script2.OQODQQDO.Add(script2.ODDOOQDO[index]); script2.ODOQQQDO.Add(script2.ODDGDOOO[index]); script2.OQQODQQOO.Add(script2.ODDQOOO[index]); if ((ododdqqo.sidewaysDistanceUpdate == 0) || ((ododdqqo.sidewaysDistanceUpdate == 2) && (script2.ODDQOODO[index] != ododdqqo.oldSidwaysDistance))) { script2.ODDOQQOO.Add(script2.ODDQOODO[index]); } else { script2.ODDOQQOO.Add(ododdqqo.splinePosition); } } else { script2.OQODQQDO.Add(ododdqqo.id); script2.ODOQQQDO.Add(ododdqqo.markerActive); script2.OQQODQQOO.Add(true); script2.ODDOQQOO.Add(ododdqqo.splinePosition); } } } } if (ododdqqo.sidewaysDistanceUpdate != 0) { } flag = false; } } for (int i = 0; i < ODODOQQO.Length; i++) { ODODDQQO ododdqqo2 = (ODODDQQO)arr[i]; bool flag2 = false; for (int num9 = 0; num9 < this.ODQQQQQO.Length; num9++) { if (ODODOQQO[i] == this.ODQQQQQO[num9]) { flag2 = true; } } if (!flag2) { num2++; list2.Add(false); foreach (MarkerScript script3 in this.mSc) { script3.OQODQQDO.Add(ododdqqo2.id); script3.ODOQQQDO.Add(ododdqqo2.markerActive); script3.OQQODQQOO.Add(true); script3.ODDOQQOO.Add(ododdqqo2.splinePosition); } } } this.ODODQQOD = (bool[])list2.ToArray(typeof(bool)); this.ODQQQQQO = new string[ODODOQQO.Length]; ODODOQQO.CopyTo(this.ODQQQQQO, 0); ArrayList list3 = new ArrayList(); for (int j = 0; j < this.ODODQQOD.Length; j++) { if (this.ODODQQOD[j]) { list3.Add(j); } } this.OOQQQOQO = (int[])list3.ToArray(typeof(int)); foreach (MarkerScript script4 in this.mSc) { script4.ODDOOQDO = (string[])script4.OQODQQDO.ToArray(typeof(string)); script4.ODDGDOOO = (bool[])script4.ODOQQQDO.ToArray(typeof(bool)); script4.ODDQOOO = (bool[])script4.OQQODQQOO.ToArray(typeof(bool)); script4.ODDQOODO = (float[])script4.ODDOQQOO.ToArray(typeof(float)); } if (!flag) { } }
private System.Data.DataTable DataSource(string Name = null) { ArrayList ClassArray = new ArrayList(); ArrayList FeeArray = new ArrayList(); ArrayList TutionFeeArray = new ArrayList(); ArrayList ExamFeeArray = new ArrayList(); var classes = db.Randoms.Where(c => c.ID == 6).FirstOrDefault(); ClassArray.AddRange(classes.Text.Split(',')); var fee = db.Randoms.Where(c => c.ID == 8).FirstOrDefault(); var feearray = fee.Text.Split(';'); FeeArray.AddRange(feearray); for (int i = 0; i <= FeeArray.ToArray().Length - 1; i++) { var narray = FeeArray[i].ToString().Split(','); TutionFeeArray.Add(narray[0].ToString()); ExamFeeArray.Add(narray[1].ToString()); } System.Data.DataTable custTable = new System.Data.DataTable("FeesWithClass"); DataColumn dtColumn; DataRow myDataRow; DataSet dtSet; // Create id column dtColumn = new DataColumn(); dtColumn.DataType = typeof(string); dtColumn.ColumnName = "Class"; dtColumn.Caption = "Class"; dtColumn.AutoIncrement = false; dtColumn.ReadOnly = false; dtColumn.Unique = false; // Add column to the DataColumnCollection. custTable.Columns.Add(dtColumn); // Create Name column. dtColumn = new DataColumn(); dtColumn.DataType = typeof(String); dtColumn.ColumnName = "TutionFee"; dtColumn.Caption = "TutionFee"; dtColumn.AutoIncrement = false; dtColumn.ReadOnly = false; dtColumn.Unique = false; /// Add column to the DataColumnCollection. custTable.Columns.Add(dtColumn); // Create Address column. dtColumn = new DataColumn(); dtColumn.DataType = typeof(String); dtColumn.ColumnName = "ExamFee"; dtColumn.Caption = "ExamFee"; dtColumn.ReadOnly = false; dtColumn.Unique = false; // Add column to the DataColumnCollection. custTable.Columns.Add(dtColumn); // Create a new DataSet dtSet = new DataSet(); // Add custTable to the DataSet. dtSet.Tables.Add(custTable); for (int x = 0; x <= ClassArray.ToArray().Length - 1; x++) { myDataRow = custTable.NewRow(); myDataRow["Class"] = ClassArray[x].ToString(); myDataRow["TutionFee"] = "Rs. " + TutionFeeArray[x].ToString(); myDataRow["ExamFee"] = "Rs. " + ExamFeeArray[x].ToString(); custTable.Rows.Add(myDataRow); } return(custTable); }