public apLinkedMatrix SetMatrixWrap(apMatrix matrixWrap, CALCULATE_TYPE calculateType, float lerpIfInterpolation = 1.0f) { _valueType = VALUE_TYPE.MatrixWrap; if (_matrixWrap == null) { _matrixWrap = new apMatrix(matrixWrap); } else { _matrixWrap.SetMatrix(matrixWrap); } _calculateType = calculateType; if (_calculateType == CALCULATE_TYPE.Interpolation) { _lerp = lerpIfInterpolation; } _weight = 1.0f; _isWeight = false; _weightCalAdded = 1.0f; _isWeightCalAdded = false; return(this); }
private void btn_saveVal_Click(object sender, EventArgs e) {//Aplica el nuevo valor a la configuración if (dgv_values.SelectedRows.Count < 1) { return; } DataGridViewRow dRowLoc = dgv_values.SelectedRows[0]; string RootKey = dRowLoc.Cells["txt_KeyRoot"].Value.ToString(); ROOT_KEY RootKeyR = MyReg.cad(RootKey); string SubKey = dRowLoc.Cells["txt_SubKey"].Value.ToString(); string KeyName = dRowLoc.Cells["txt_Name"].Value.ToString(); string Type = dRowLoc.Cells["txt_Type"].Value.ToString(); VALUE_TYPE TypeR = MyReg.tip(Type); string currentVal = txt_valueVal.Text.Trim(); bool ModuleReg = MyReg.exist(RootKeyR, SubKey, ""); if (ModuleReg == false) { ModuleReg = MyReg.newKey(RootKeyR, SubKey); } object objIn = new object(); objIn = currentVal; ModuleReg = MyReg.setValue(RootKeyR, SubKey, KeyName, ref objIn, TypeR); if (ModuleReg) { dRowLoc.Cells["txt_Data"].Value = currentVal; } }
public apLinkedMatrix SetVertPosition(List <apModifiedVertex> modVerts, CALCULATE_TYPE calculateType, float lerpIfInterpolation = 1.0f) { _valueType = VALUE_TYPE.VertPos; _nVerts = modVerts.Count; if (_vertPos == null || _vertPos.Length != _nVerts) { _vertPos = new Vector2[_nVerts]; } for (int i = 0; i < _nVerts; i++) { _vertPos[i] = modVerts[i]._deltaPos; } _calculateType = calculateType; if (_calculateType == CALCULATE_TYPE.Interpolation) { _lerp = lerpIfInterpolation; } _weight = 1.0f; _isWeight = false; _weightCalAdded = 1.0f; _isWeightCalAdded = false; return(this); }
public apLinkedMatrix SetPassAndMerge(VALUE_TYPE valueType) { _valueType = valueType; //값이 별도로 존재하지 않는다. _calculateType = CALCULATE_TYPE.PassAndMerge; _weight = 1.0f; _isWeight = false; _weightCalAdded = 1.0f; _isWeightCalAdded = false; return(this); }
public apLinkedMatrix SetMatrix3x3(apMatrix3x3 matrix4x4, CALCULATE_TYPE calculateType, float lerpIfInterpolation = 1.0f) { _valueType = VALUE_TYPE.Matrix3x3; _matrix4x4 = matrix4x4; _calculateType = calculateType; if (_calculateType == CALCULATE_TYPE.Interpolation) { _lerp = lerpIfInterpolation; } _weight = 1.0f; _isWeight = false; _weightCalAdded = 1.0f; _isWeightCalAdded = false; return(this); }
private string ConvertValues(string hex, VALUE_TYPE type) { string result = ""; string input = hex.Replace(" ", ""); Int64 intermediate = Convert.ToInt64(input, 16); if (type == VALUE_TYPE.INT32_INT64) { result = intermediate.ToString(); } else { result = BitConverter.Int64BitsToDouble(intermediate).ToString("F8", CultureInfo.InvariantCulture); } return(result); }
public static extern uint ValueBinaryDataSet(ref JsonValue pval, IntPtr pBytes, int nBytes, VALUE_TYPE type, int units);
public void setNull() { type_ = VALUE_TYPE.NULL; value_ = null; }
/// <summary> /// returns the numberic of supported .Net type. If type is not supported function will throw /// the exception <exception cref="DrOpen.Exceptions.DDTypeIncorrectException" /// </summary> /// <param name="t">.Net type</param> /// <returns></returns> public static int GetNumericType(Type type) { VALUE_TYPE ans = VALUE_TYPE.UNKNOW; Type t; if (type.IsArray) { t = type.GetElementType(); } else { t = type; } if (t == typeof(string)) { ans = VALUE_TYPE.STRING; } else if (t == typeof(DateTime)) { ans = VALUE_TYPE.DATE_TIME; } else if (t == typeof(char)) { ans = VALUE_TYPE.CHAR; } else if (t == typeof(bool)) { ans = VALUE_TYPE.BOOL; } else if (t == typeof(byte)) { ans = VALUE_TYPE.BYTE; } else if (t == typeof(Guid)) { ans = VALUE_TYPE.GUID; } else if (t == typeof(float)) { ans = VALUE_TYPE.FLOAT; } else if (t == typeof(double)) { ans = VALUE_TYPE.DOUBLE; } else if (t == typeof(decimal)) { ans = VALUE_TYPE.DECEMAL; } else if (t == typeof(int)) { ans = VALUE_TYPE.INT; } else if (t == typeof(uint)) { ans = VALUE_TYPE.U_INT; } else if (t == typeof(short)) { ans = VALUE_TYPE.SHORT; } else if (t == typeof(ushort)) { ans = VALUE_TYPE.U_SHORT; } else if (t == typeof(long)) { ans = VALUE_TYPE.LONG; } else if (t == typeof(ulong)) { ans = VALUE_TYPE.U_LONG; } //if ((t.IsArray) && (t != typeof(byte[]))) ans |= ARRAY_BIT; if (ans == 0) { throw new DDTypeIncorrectException(t.ToString()); } if (type.IsArray) { ans |= VALUE_TYPE.ARRAY; } return((int)ans); }
/// <summary> /// </summary> /// <param name="regEx"></param> private Node BuildRegExTree(List <int> regEx) { if (regEx == null || regEx.Count <= 0) { return(null); } List <Node> nodeList = new List <Node>(); for (int i = 0; i < regEx.Count; i++) { Node nodeI = new Node(regEx[i]); if (nodeI.GetValueType().Equals(VALUE_TYPE.VALUE_TYPE_UNDEFINE)) { return(null); } nodeList.Add(nodeI); } Stack <Node> oprStack = new Stack <Node>(); //操作符栈 Stack <Node> opdStack = new Stack <Node>(); //操作数栈 //将运算优先级最低的符号入栈 oprStack.Push(new Node(-1)); for (int i = 0; i < nodeList.Count; i++) { Node node = nodeList[i]; VALUE_TYPE nodeIType = nodeList[i].GetValueType(); if (nodeIType.Equals(VALUE_TYPE.VALUE_TYPE_ASCII)) { opdStack.Push(node); } else if (nodeIType.Equals(VALUE_TYPE.VALUE_TYPE_OPERATOR) || nodeIType.Equals(VALUE_TYPE.VALUE_TYPE_BRACKET)) { //结束符 if (node.GetValueTypeConcrete().Equals(VALUE_TYPE_CONCRETE.VALUE_TYPE_CONCRETE_MINPOR)) { while (oprStack.Peek() != null) { Node oprTop = oprStack.Pop(); if ( oprTop.GetValueTypeConcrete().Equals(VALUE_TYPE_CONCRETE.VALUE_TYPE_CONCRETE_HUO) || oprTop.GetValueTypeConcrete().Equals(VALUE_TYPE_CONCRETE.VALUE_TYPE_CONCRETE_LIANJIE) ) { Node opdTop = opdStack.Pop(); Node opdSec = opdStack.Pop(); Node n = new Node(oprTop.value, opdTop, opdSec); opdStack.Push(n); } else { break; } } Node result = opdStack.Pop(); return(result); } else if (node.GetValueTypeConcrete().Equals(VALUE_TYPE_CONCRETE.VALUE_TYPE_CONCRETE_BIBAO)) { //结束字符 Node topOneOpd = opdStack.Pop(); Node parentNode = new Node(node.value, topOneOpd, null); opdStack.Push(parentNode); } else if (node.GetValueTypeConcrete().Equals(VALUE_TYPE_CONCRETE.VALUE_TYPE_CONCRETE_LEFTBRACET)) { oprStack.Push(node); } else if (node.GetValueTypeConcrete().Equals(VALUE_TYPE_CONCRETE.VALUE_TYPE_CONCRETE_RIGHTBRACET)) { //右括号 while (oprStack.Peek() != null) { Node oprTop = oprStack.Pop(); if ( oprTop.GetValueTypeConcrete().Equals(VALUE_TYPE_CONCRETE.VALUE_TYPE_CONCRETE_HUO) || oprTop.GetValueTypeConcrete().Equals(VALUE_TYPE_CONCRETE.VALUE_TYPE_CONCRETE_LIANJIE) ) { Node opdTop = opdStack.Pop(); Node opdSec = opdStack.Pop(); Node n = new Node(oprTop.value, opdTop, opdSec); opdStack.Push(n); } else { break; } } } else { Node top = oprStack.Peek(); if (top != null) { int priResult = Node.ComparePri(top, node); if (priResult == -2) { Console.WriteLine("比较优先级出现错误"); return(null); //比较优先级发生错误 } else if (priResult == -1) { oprStack.Push(node); } else if (priResult == 1) { //符号栈顶元素优先级大于当前符号优先级,那么要进行运算 Node topOneOpd = opdStack.Pop(); Node topTwoOpd = opdStack.Pop(); Node topOneOpr = oprStack.Pop(); Node parentNode = new Node(topOneOpr.value, topOneOpd, topTwoOpd); opdStack.Push(parentNode); oprStack.Push(node); } else if (priResult == 0) { Console.WriteLine("---------------------"); return(opdStack.Pop()); } } } } } return(null); }
public static extern uint ValueFloatDataSet(ref JsonValue pval, double data, VALUE_TYPE type, int units);
static extern int RegQueryValueEx(UIntPtr hKey, [MarshalAs(UnmanagedType.LPWStr)] string lpValueName, int lpReserved, ref VALUE_TYPE lpType, [Optional] ref long lpData, ref uint lpcbData);
private static extern int RegSetValueEx(UIntPtr hKey, [MarshalAs(UnmanagedType.LPWStr)] string lpValueName, int Reserved, VALUE_TYPE dwType, ref byte lpData, int cbData);
public static extern uint ValueType(ref JsonValue pval, out VALUE_TYPE pType, out int pUnits);
/// <summary> /// Esta funcion obtiene el tipo de un registro. /// </summary> /// <param name="RootKey"> /// Llave principal o raiz. /// Ejemplo: HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE</param> /// <param name="SubKey"> /// Ruta de las llaves. /// Ejemplo: "SYSTEM\\CurrentControlSet\\Control"</param> /// <param name="Name"> /// Nombre del registro. /// Ejemplo: "WaitToKillServiceTimeout"</param> /// <param name="Type"> /// Nombre del registro. /// Ejemplo: REG_DWORD, REG_SZ</param> /// <returns>bool</returns> public static bool getType(ROOT_KEY RootKey, string SubKey, string Name, VALUE_TYPE Type) { object Value = new object(); return(getValue(RootKey, SubKey, Name, ref Value, ref Type)); }
static extern int RegQueryValueEx(UIntPtr hKey, [MarshalAs(UnmanagedType.LPWStr)] string lpValueName, int lpReserved, out VALUE_TYPE lpType, [Optional] System.Text.StringBuilder lpData, ref uint lpcbData);
/// <summary> /// Esta funcion establece el valor y tipo de un registro. /// </summary> /// <param name="RootKey"> /// Llave principal o raiz. /// Ejemplo: HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE</param> /// <param name="SubKey"> /// Ruta de las llaves. /// Ejemplo: "SYSTEM\\CurrentControlSet\\Control"</param> /// <param name="Name"> /// Nombre del registro. /// Ejemplo: "WaitToKillServiceTimeout"</param> /// <param name="Value"> /// Valor del registro. Deuvuelve el contenido del registro.</param> /// <param name="Type"> /// Nombre del registro. /// Ejemplo: REG_DWORD, REG_SZ</param> /// <returns>bool</returns> public static bool setValue(ROOT_KEY RootKey, string SubKey, string Name, ref object Value, VALUE_TYPE Type) { /*__________________________________________________________________ * Descripcion: Esta funcion define el valor y tipo de un registro. * Parameteros: * RootKey - HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, etc.. * SubKey - La direccion ó ruta de las sub llaves. * Name - El nombre del registro. * Value - Valor del registro. * Type - Tipo de registro. * Syntaxis: * object obj = "87600"; * bool result = MyReg.setValue(ROOT_KEY.HKEY_LOCAL_MACHINE, * "SOFTWARE\\Microsoft\\Internet Explorer", "Build", * ref obj, VALUE_TYPE.REG_SZ); * Regresa: * bool - Determina si la funcion termino sin errores. *__________________________________________________________________ */ UIntPtr hkeyResult = UIntPtr.Zero; int returnValue = RegOpenKeyEx(RootKey, SubKey, 0, KEY_ACCESS.KEY_ALL_ACCESS, ref hkeyResult); //32 Bits //Si todo sale bien entonces devuelve 'ERROR_SUCCESS' if (returnValue != ERROR_SUCCESS) {//En caso de que no exista el key if (hkeyResult != UIntPtr.Zero) { RegCloseKey(hkeyResult); } return(false); } //Debemos tener el nombre if (Name.Trim() == "") { return(false); } //Defino el valor del registro if (Type == VALUE_TYPE.REG_DWORD || Type == VALUE_TYPE.REG_DWORD_LITTLE_ENDIAN || Type == VALUE_TYPE.REG_DWORD_BIG_ENDIAN) { int pvDataDWORD = Convert.ToInt32(Value); returnValue = RegSetValueEx(hkeyResult, Name, 0, Type, ref pvDataDWORD, 4); } if (Type == VALUE_TYPE.REG_QWORD || Type == VALUE_TYPE.REG_QWORD_LITTLE_ENDIAN) { //long pvDataQWORD = (long)Value; long pvDataQWORD = Convert.ToInt64(Value); returnValue = RegSetValueEx(hkeyResult, Name, 0, Type, ref pvDataQWORD, 8); } if (Type == VALUE_TYPE.REG_SZ || Type == VALUE_TYPE.REG_EXPAND_SZ || Type == VALUE_TYPE.REG_MULTI_SZ) { string Data = (string)Value; IntPtr pStr = Marshal.StringToHGlobalAuto(Data); int pvSize = (Data.Length + 1) * Marshal.SystemDefaultCharSize; returnValue = RegSetValueEx(hkeyResult, Name, 0, Type, pStr, pvSize); } if (Type == VALUE_TYPE.REG_BINARY) { byte[] bBuffer = (byte[])Value; int pvSize = (bBuffer.GetUpperBound(0) + 1); returnValue = RegSetValueEx(hkeyResult, Name, 0, Type, ref bBuffer[0], pvSize); } if (Type == VALUE_TYPE.REG_LINK || Type == VALUE_TYPE.REG_FULL_RESOURCE_DESCRIPTOR || Type == VALUE_TYPE.REG_RESOURCE_LIST || Type == VALUE_TYPE.REG_RESOURCE_REQUIREMENTS_LIST) { byte[] bBuffer = (byte[])Value; int pvSize = (bBuffer.GetUpperBound(0) + 1); returnValue = RegSetValueEx(hkeyResult, Name, 0, Type, ref bBuffer[0], pvSize); } if (hkeyResult != UIntPtr.Zero) { RegCloseKey(hkeyResult); } return(returnValue == 0); }
/// <summary> /// Esta funcion obtiene el valor y tipo de un registro. /// </summary> /// <param name="RootKey"> /// Llave principal o raiz. /// Ejemplo: HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE</param> /// <param name="SubKey"> /// Ruta de las llaves. /// Ejemplo: "SYSTEM\\CurrentControlSet\\Control"</param> /// <param name="Name"> /// Nombre del registro. /// Ejemplo: "WaitToKillServiceTimeout"</param> /// <param name="Value"> /// Valor del registro. Deuvuelve el contenido del registro.</param> /// <param name="Type"> /// Nombre del registro. /// Ejemplo: REG_DWORD, REG_SZ</param> /// <returns>bool</returns> public static bool getValue(ROOT_KEY RootKey, string SubKey, string Name, ref object Value, ref VALUE_TYPE Tipo) { /*__________________________________________________________________ * Descripcion: Esta funcion obtiene el valor y tipo de un registro. * Parameteros: * RootKey - HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, etc.. * SubKey - La direccion ó ruta de las sub llaves. * Name - El nombre del registro. * Value - Valor del registro. * Tipo - Tipo de registro. * Syntaxis: * object obj = new object(); * VALUE_TYPE tipo = VALUE_TYPE.REG_DWORD; * bool result = MyReg.getValue(ROOT_KEY.HKEY_LOCAL_MACHINE, * "SOFTWARE\\Microsoft\\Internet Explorer", "Build", * ref obj, ref tipo); * Regresa: * bool - Determina si la funcion termino sin errores. *__________________________________________________________________ */ Value = null; UIntPtr hkeyResult = UIntPtr.Zero; int returnValue = RegOpenKeyEx(RootKey, SubKey, 0, KEY_ACCESS.KEY_READ, ref hkeyResult); //32 Bits //Si todo sale bien entonces devuelve 'ERROR_SUCCESS' if (returnValue != ERROR_SUCCESS) {//En caso de que no exista el key if (hkeyResult != UIntPtr.Zero) { RegCloseKey(hkeyResult); } return(false); } if (Name.Trim() == "") { return(true); } //Obtengo el valor del registro int pvDataDWORD = 0; uint pvSize = 4; Tipo = VALUE_TYPE.REG_DWORD; returnValue = RegQueryValueEx(hkeyResult, Name, 0, ref Tipo, ref pvDataDWORD, ref pvSize); if (returnValue == ERROR_FILE_NOT_FOUND) {//No existe el registro if (hkeyResult != UIntPtr.Zero) { RegCloseKey(hkeyResult); } return(false); } if (Tipo == VALUE_TYPE.REG_DWORD || Tipo == VALUE_TYPE.REG_DWORD_LITTLE_ENDIAN || Tipo == VALUE_TYPE.REG_DWORD_BIG_ENDIAN) {//Si fuese correcto el valor buscado Value = pvDataDWORD; } //Si el valor es diferente al buscado if (Tipo == VALUE_TYPE.REG_QWORD || Tipo == VALUE_TYPE.REG_QWORD_LITTLE_ENDIAN) { long pvDataQDWORD = 0; //Tipo = 8 returnValue = RegQueryValueEx(hkeyResult, Name, 0, ref Tipo, ref pvDataQDWORD, ref pvSize); Value = pvDataQDWORD; } if (Tipo == VALUE_TYPE.REG_SZ || Tipo == VALUE_TYPE.REG_EXPAND_SZ || Tipo == VALUE_TYPE.REG_MULTI_SZ) { System.Text.StringBuilder pvData = new System.Text.StringBuilder(0); pvData = new System.Text.StringBuilder((int)(pvSize / 2)); RegQueryValueEx(hkeyResult, Name, 0, out Tipo, pvData, ref pvSize); Value = pvData; } if (Tipo == VALUE_TYPE.REG_BINARY) { byte[] bBuffer = new byte[1024]; RegQueryValueEx(hkeyResult, Name, 0, ref Tipo, ref bBuffer[0], ref pvSize); string sRet = String.Empty; for (int i = 0; i < (pvSize); i++) { sRet += bBuffer[i].ToString(); } //byte[] bRet = new byte[pvSize]; //for (int i = 0; i < (pvSize); i++) bRet[i] = (byte)bBuffer[i]; Value = sRet; } if (Tipo == VALUE_TYPE.REG_LINK || Tipo == VALUE_TYPE.REG_FULL_RESOURCE_DESCRIPTOR || Tipo == VALUE_TYPE.REG_RESOURCE_LIST || Tipo == VALUE_TYPE.REG_RESOURCE_REQUIREMENTS_LIST) { byte[] bBuffer = new byte[1024]; RegQueryValueEx(hkeyResult, Name, 0, ref Tipo, ref bBuffer[0], ref pvSize); string sRet = String.Empty; for (int i = 0; i < (pvSize); i++) { sRet += bBuffer[i].ToString(); } //byte[] bRet = new byte[pvSize]; //for (int i = 0; i < (pvSize); i++) bRet[i] = (byte)bBuffer[i]; Value = sRet; } if (hkeyResult != UIntPtr.Zero) { RegCloseKey(hkeyResult); } return(Value != null); }
/// <summary> /// Esta funcion obtiene el valor de un registro. /// </summary> /// <param name="RootKey"> /// Llave principal o raiz. /// Ejemplo: HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE</param> /// <param name="SubKey"> /// Ruta de las llaves. /// Ejemplo: "SYSTEM\\CurrentControlSet\\Control"</param> /// <param name="Name"> /// Nombre del registro. /// Ejemplo: "WaitToKillServiceTimeout"</param> /// <param name="Value"> /// Valor del registro. Deuvuelve el contenido del registro.</param> /// <returns>bool</returns> public static bool getValue(ROOT_KEY RootKey, string SubKey, string Name, ref object Value) { VALUE_TYPE Tipo = VALUE_TYPE.REG_DWORD; return(getValue(RootKey, SubKey, Name, ref Value, ref Tipo)); }
public static extern uint ValueIntDataSet(ref JsonValue pval, int data, VALUE_TYPE type, int units);
public static extern uint ValueInt64DataSet(ref JsonValue pval, long data, VALUE_TYPE type, int units);
/// <summary> /// Returns the .Net type by numeric type. If type doesn't support the function will throw /// the exception <exception cref="DrOpen.Exceptions.DDTypeIncorrectException" /// </summary> /// <param name="type"></param> /// <returns></returns> public static Type GetTypeByNumeric(int type) { VALUE_TYPE t = ((VALUE_TYPE)type) & ~VALUE_TYPE.ARRAY; Type result = null; if (t == VALUE_TYPE.STRING) { result = typeof(string); } else if (t == VALUE_TYPE.DATE_TIME) { result = typeof(DateTime); } else if (t == VALUE_TYPE.CHAR) { result = typeof(char); } else if (t == VALUE_TYPE.BOOL) { result = typeof(bool); } else if (t == VALUE_TYPE.BYTE) { result = typeof(byte); } else if (t == VALUE_TYPE.GUID) { result = typeof(Guid); } else if (t == VALUE_TYPE.FLOAT) { result = typeof(float); } else if (t == VALUE_TYPE.DOUBLE) { result = typeof(double); } else if (t == VALUE_TYPE.DECEMAL) { result = typeof(decimal); } else if (t == VALUE_TYPE.INT) { result = typeof(int); } else if (t == VALUE_TYPE.U_INT) { result = typeof(uint); } else if (t == VALUE_TYPE.SHORT) { result = typeof(short); } else if (t == VALUE_TYPE.U_SHORT) { result = typeof(ushort); } else if (t == VALUE_TYPE.LONG) { result = typeof(long); } else if (t == VALUE_TYPE.U_LONG) { result = typeof(ulong); } if (result == null) { throw new DDTypeIncorrectException(t.ToString()); } if ((((VALUE_TYPE)type) & VALUE_TYPE.ARRAY) == VALUE_TYPE.ARRAY) { result = result.MakeArrayType(); } return(result); }
private void tView_reg_AfterSelect(object sender, TreeViewEventArgs e) {//Al seleccionar un nodo/key string[] fullPath = e.Node.FullPath.Split('\\'); if (fullPath.Length <= 1) { return; } //Escribo la ruta del nodo int removeLen = fullPath[0].Length + 1; txt_addr.Text = e.Node.FullPath.Substring(removeLen); if (fullPath.Length <= 2) { return; } //Enumero los valores removeLen += fullPath[1].Length + 1; ROOT_KEY root = MyReg.cad(fullPath[1]); string iPath = e.Node.FullPath.Substring(removeLen); System.Collections.ArrayList arrayL = new System.Collections.ArrayList(); bool ModuleReg = MyReg.EnumRegs(root, iPath, ref arrayL); dtNavVal.Rows.Clear(); object obj = new object(); foreach (string item in arrayL) { if (item == "") { continue; } VALUE_TYPE type = VALUE_TYPE.REG_DWORD; MyReg.getValue(root, iPath, item, ref obj, ref type); DataTable dtDesc = new DataTable(); String querySelect = "SELECT * FROM Valores " + " WHERE RootKey='" + fullPath[1] + "' AND SubKey='" + iPath + "' AND Name='" + item + "'"; dbConexionAccess.Open(); OleDbCommand sCommand = new OleDbCommand(querySelect, dbConexionAccess); OleDbDataAdapter sAdapter = new OleDbDataAdapter(sCommand); sAdapter.Fill(dtDesc); dbConexionAccess.Close(); DataRow dRow = dtNavVal.NewRow(); dRow["RootKey"] = fullPath[1]; dRow["SubKey"] = iPath; dRow["Name"] = item; dRow["Type"] = type.ToString(); dRow["Value"] = (obj == null) ? "" : obj.ToString(); if (dtDesc.Rows.Count > 0) { dRow["Value Optimal"] = dtDesc.Rows[0]["Value Optimal"].ToString(); dRow["Kind"] = dtDesc.Rows[0]["Kind"].ToString(); dRow["Description"] = dtDesc.Rows[0]["Description"].ToString(); dRow["Version"] = dtDesc.Rows[0]["Version"].ToString(); dRow["dangerous"] = dtDesc.Rows[0]["dangerous"].ToString(); dRow["registry"] = dtDesc.Rows[0]["registry"].ToString(); } dtNavVal.Rows.Add(dRow); DataGridViewRow sRow = dgv_values.Rows[dgv_values.Rows.Count - 1]; sRow.Cells[0].Value = (type == VALUE_TYPE.REG_SZ || type == VALUE_TYPE.REG_MULTI_SZ || type == VALUE_TYPE.REG_EXPAND_SZ) ? imgL.Images[2]:imgL.Images[3]; if (dtDesc.Rows.Count > 0) { sRow.DefaultCellStyle.ForeColor = System.Drawing.Color.FromArgb(0, 5, 5, 210); } } }