public override IValue GetPropValue(int propNum) { var prop = _props[propNum]; var dispId = prop.DispatchId; try { try { var result = DispatchUtility.Invoke(Instance, dispId, null); return(CreateIValue(result)); } catch (System.Reflection.TargetInvocationException e) { throw e.InnerException ?? e; } } catch (System.MissingMemberException) { throw RuntimeException.PropNotFoundException(prop.Name); } catch (System.MemberAccessException) { throw RuntimeException.PropIsNotReadableException(prop.Name); } }
public ValueTableColumn GetColumnByIIndex(IValue index) { if (index.DataType == DataType.String) { ValueTableColumn Column = FindColumnByName(index.AsString()); if (Column == null) { throw RuntimeException.PropNotFoundException(index.AsString()); } return(Column); } if (index.DataType == DataType.Number) { int i_index = Decimal.ToInt32(index.AsNumber()); if (i_index < 0 || i_index >= Count()) { throw RuntimeException.InvalidArgumentValue(); } ValueTableColumn Column = FindColumnByIndex(i_index); return(Column); } if (index is ValueTableColumn) { return(index as ValueTableColumn); } throw RuntimeException.InvalidArgumentType(); }
public override int FindProperty(string name) { int dispId; if (!_dispIdCache.TryGetValue(name, out dispId)) { if (DispatchUtility.TryGetDispId(_instance, name, out dispId)) { if (_dispatchedType != null) { var memberInfo = _dispatchedType.GetMember(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase); if (memberInfo.Length == 0 || !(memberInfo[0].MemberType == MemberTypes.Property)) { throw RuntimeException.PropNotFoundException(name); } else { _membersCache.Add(dispId, memberInfo[0]); _dispIdCache.Add(name, dispId); } } else { _dispIdCache.Add(name, dispId); } } else { throw RuntimeException.PropNotFoundException(name); } } return(dispId); }
private List <ValueTableColumn> GetProcessingColumnList(string ColumnNames, bool EmptyListInCaseOfNull = false) { List <ValueTableColumn> processing_list = new List <ValueTableColumn>(); if (ColumnNames != null) { if (ColumnNames.Trim().Length == 0) { // Передали пустую строку вместо списка колонок return(processing_list); } string[] column_names = ColumnNames.Split(','); foreach (string name in column_names) { ValueTableColumn Column = Columns.FindColumnByName(name.Trim()); if (Column == null) { throw RuntimeException.PropNotFoundException(name.Trim()); } processing_list.Add(Column); } } else if (!EmptyListInCaseOfNull) { foreach (ValueTableColumn Column in _columns) { processing_list.Add(Column); } } return(processing_list); }
public int GetColumnNumericIndex(IValue index) { if (index.DataType == DataType.String) { ValueTableColumn Column = FindColumnByName(index.AsString()); if (Column == null) { throw RuntimeException.PropNotFoundException(index.AsString()); } return(Column.ID); } if (index.DataType == DataType.Number) { int iIndex = Decimal.ToInt32(index.AsNumber()); if (iIndex < 0 || iIndex >= Count()) { throw RuntimeException.InvalidArgumentValue(); } return(iIndex); } var column = index.GetRawValue() as ValueTableColumn; if (column != null) { return(column.ID); } throw RuntimeException.InvalidArgumentType(); }
internal List <ValueTreeColumn> GetProcessingColumnList(string columnNamesString) { List <ValueTreeColumn> processingList = new List <ValueTreeColumn>(); if (columnNamesString != null) { if (columnNamesString.Trim().Length == 0) { // Передали пустую строку вместо списка колонок return(processingList); } string[] columnNames = columnNamesString.Split(','); foreach (string name in columnNames) { var column = FindColumnByName(name.Trim()); if (column == null) { throw RuntimeException.PropNotFoundException(name.Trim()); } processingList.Add(column); } } else { foreach (var column in _columns) { processingList.Add(column); } } return(processingList); }
private List <ValueTableSortRule> GetSortRules(string Columns) { string[] a_columns = Columns.Split(','); List <ValueTableSortRule> Rules = new List <ValueTableSortRule>(); foreach (string column in a_columns) { string[] description = column.Trim().Split(' '); if (description.Count() == 0) { throw RuntimeException.PropNotFoundException(""); // TODO: WrongColumnNameException } ValueTableSortRule Desc = new ValueTableSortRule(); Desc.Column = this.Columns.FindColumnByName(description[0]); if (description.Count() > 1) { if (String.Compare(description[1], "DESC", true) == 0 || String.Compare(description[1], "УБЫВ", true) == 0) { Desc.direction = -1; } } else { Desc.direction = 1; } Rules.Add(Desc); } return(Rules); }
public override int FindProperty(string name) { if (!TryFindProperty(name, out var md)) { throw RuntimeException.PropNotFoundException(name); } return(_props.IndexOf(md)); }
public int GetPropertyNumber(string name) { if (_propNumbers.TryGetValue(name, out var index)) { return(index); } throw RuntimeException.PropNotFoundException(name); }
public override int FindProperty(string name) { int idx = _columns.FindIndex(column => NamesComparer.Equals(name, column.Name)); if (idx == -1) { throw RuntimeException.PropNotFoundException(name); } return(idx); }
public override int FindProperty(string name) { var column = FindColumnByName(name); if (column == null) { throw RuntimeException.PropNotFoundException(name); } return(_columns.IndexOf(column)); }
public override int FindProperty(string name) { ValueTableColumn Column = FindColumnByName(name); if (Column == null) { throw RuntimeException.PropNotFoundException(name); } return(Column.ID); }
public int FindProperty(string name) { var propNumber = NativeApiProxy.FindProp(_object, name); if (propNumber < 0) { throw RuntimeException.PropNotFoundException(name); } return(propNumber); }
public int FindProperty(string name) { var idx = _properties.FindIndex(x => x.Name.ToLower() == name.ToLower() || x.Alias.ToLower() == name.ToLower()); if (idx < 0) { throw RuntimeException.PropNotFoundException(name); } return(idx); }
public int GetPropertyNumber(string name) { try { return(_propNumbers[name]); } catch (KeyNotFoundException) { throw RuntimeException.PropNotFoundException(name); } }
public override int FindProperty(string name) { var idx = FindMemberIndex(name); if (idx < 0) { throw RuntimeException.PropNotFoundException(name); } return(idx); }
public override int FindProperty(string name) { try { return(_propHolder.GetPropertyNumber(name)); } catch (KeyNotFoundException) { throw RuntimeException.PropNotFoundException(name); } }
public int FindProperty(string name) { var idx = GetPropertyIndex(name); if (idx < 0) { throw RuntimeException.PropNotFoundException(name); } return(idx); }
public int FindProperty(string name) { int id; if (!_thisPropIndexes.TryGetIdOfName(name, out id)) { throw RuntimeException.PropNotFoundException(name); } return(id); }
public int FindProperty(string name) { Init(); var idx = _properties.FindIndex(x => String.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase) || String.Equals(x.Alias, name, StringComparison.OrdinalIgnoreCase)); if (idx < 0) { throw RuntimeException.PropNotFoundException(name); } return(idx); }
public int FindAnyProperty(string name) { int index; if (_allPropertiesSearchCache.TryGetValue(name, out index)) { return(index); } else { throw RuntimeException.PropNotFoundException(name); } }
public override int FindProperty(string name) { if (_properties.ContainsProperty(name)) { return(_properties.FindProperty(name)); } var cols = Owner().Columns; var column = cols.FindColumnByName(name); if (column == null) { throw RuntimeException.PropNotFoundException(name); } return(GetColumnPropIndex(cols.IndexOf(column))); }
private bool CheckFilterCriteria(ValueTableRow Row, StructureImpl Filter) { foreach (KeyAndValueImpl kv in Filter) { ValueTableColumn Column = Columns.FindColumnByName(kv.Key.AsString()); if (Column == null) { throw RuntimeException.PropNotFoundException(kv.Key.AsString()); } IValue current = Row.Get(Column); if (!current.Equals(kv.Value)) { return(false); } } return(true); }
public override int FindProperty(string name) { int dispId; if (!_dispIdCache.TryGetValue(name, out dispId)) { if (DispatchUtility.TryGetDispId(_instance, name, out dispId)) { _dispIdCache.Add(name, dispId); } else { throw RuntimeException.PropNotFoundException(name); } } return(dispId); }
public override void SetPropValue(int propNum, IValue newVal) { var prop = _props[propNum]; var dispId = prop.DispatchId; try { try { object argToPass; if (newVal.DataType == Machine.DataType.Date) { var date = newVal.AsDate(); if (date == DateTime.MinValue) { argToPass = new DateTime(100, 1, 1); // Min OLEAuth Date } else { argToPass = MarshalIValue(newVal); } } else { argToPass = MarshalIValue(newVal); } DispatchUtility.InvokeSetProperty(Instance, dispId, argToPass); } catch (System.Reflection.TargetInvocationException e) { throw e.InnerException ?? e; } } catch (System.MissingMemberException) { throw RuntimeException.PropNotFoundException(prop.Name); } catch (System.MemberAccessException) { throw RuntimeException.PropIsNotWritableException(prop.Name); } }
public override int FindProperty(string name) { var idx = FindOwnProperty(name); if (idx >= 0) { return(idx); } else { int index; if (_propertySearchCache.TryGetValue(name, out index)) { return(index); } else { throw RuntimeException.PropNotFoundException(name); } } }
public override void SetPropValue(int propNum, IValue newVal) { try { try { object argToPass; if (newVal.DataType == Machine.DataType.Date) { var date = newVal.AsDate(); if (date == DateTime.MinValue) { argToPass = new DateTime(100, 1, 1); // Min OLEAuth Date } else { argToPass = MarshalIValue(newVal); } } else { argToPass = MarshalIValue(newVal); } DispatchUtility.InvokeSetProperty(_instance, propNum, argToPass); } catch (System.Reflection.TargetInvocationException e) { throw e.InnerException; } } catch (System.MissingMemberException) { throw RuntimeException.PropNotFoundException("dispid[" + propNum.ToString() + "]"); } catch (System.MemberAccessException) { throw RuntimeException.PropIsNotWritableException("dispid[" + propNum.ToString() + "]"); } }
public override int FindProperty(string name) { var idx = FindOwnProperty(name); if (idx >= 0) { return(idx); } else { var propsFound = _module.ExportedProperies.Where(x => String.Compare(x.SymbolicName, name, true) == 0) .Select(x => x.Index).ToArray(); if (propsFound.Length > 0) { return(propsFound[0]); } else { throw RuntimeException.PropNotFoundException(name); } } }
public override void SetPropValue(int propNum, IValue newVal) { try { try { DispatchUtility.InvokeSetProperty(_instance, propNum, MarshalIValue(newVal)); } catch (System.Reflection.TargetInvocationException e) { throw e.InnerException; } } catch (System.MissingMemberException) { throw RuntimeException.PropNotFoundException("dispid[" + propNum.ToString() + "]"); } catch (System.MemberAccessException) { throw RuntimeException.PropIsNotWritableException("dispid[" + propNum.ToString() + "]"); } }
public override IValue GetPropValue(int propNum) { try { try { var result = DispatchUtility.Invoke(_instance, propNum, null); return(CreateIValue(result)); } catch (System.Reflection.TargetInvocationException e) { throw e.InnerException; } } catch (System.MissingMemberException) { throw RuntimeException.PropNotFoundException("dispid[" + propNum.ToString() + "]"); } catch (System.MemberAccessException) { throw RuntimeException.PropIsNotReadableException("dispid[" + propNum.ToString() + "]"); } }