/// <summary> /// method returns the String /// </summary> public override string ToString() { // initial value string info = ""; // if Exclude if (Exclude) { // set the return value info = "Exclude: true "; } else { // set the return value info = "Exclude: false "; } // set the info info += " Table Id " + TableId.ToString(); // if Field if (ObjectType == ExcludeObjectTypeEnum.Field) { // set the info info += " Field Id " + FieldId.ToString(); } // return value return(info); }
/// <summary> /// Configures the specified property info. /// </summary> /// <param name="propertyInfo">The property info.</param> /// <param name="config">The config.</param> public void Configure(PropertyInfo propertyInfo, SitecoreFieldConfiguration config) { config.FieldName = this.FieldName; if (config.FieldName.IsNullOrEmpty()) { config.FieldName = propertyInfo.Name; } if (FieldId.HasValue()) { config.FieldId = new ID(this.FieldId); } config.Setting = this.Setting; config.MediaUrlOptions = MediaUrlOptions; config.UrlOptions = UrlOptions; //code first configuration var fieldFieldValues = propertyInfo.GetCustomAttributes(typeof(SitecoreFieldFieldValueAttribute), true).Cast <SitecoreFieldFieldValueAttribute>(); ////fix: fieldfieldvalues are not passed var interfaceFromProperty = propertyInfo.DeclaringType.GetInterfaces().FirstOrDefault(inter => inter.GetProperty(propertyInfo.Name) != null); if (interfaceFromProperty != null) { fieldFieldValues = interfaceFromProperty.GetProperty(propertyInfo.Name).GetCustomAttributes(typeof(SitecoreFieldFieldValueAttribute), true).Cast <SitecoreFieldFieldValueAttribute>();; } base.Configure(propertyInfo, config); }
public void TryGetDocumentationComments_gets_expected_docs_for_a_field() { // ARRANGE var cs = @" using System; public class Class1 { /// <summary> /// Summary /// </summary> /// <remarks>Remarks</remarks> /// <example>Example</example> /// <value>Value</value> /// <seealso cref=""Class2"">Some text</seealso> /// <seealso cref=""Interface1"" /> public string Field1; } public class Class2 { } public interface Interface1 { } "; using var assembly = Compile(cs, out var xmlDocs); var id = new FieldId(new SimpleTypeId(NamespaceId.GlobalNamespace, "Class1"), "Field1"); // ACT var sut = new XmlDocsProvider(assembly, xmlDocs, NullLogger.Instance); var docs = sut.TryGetDocumentationComments(id); // ASSERT Assert.NotNull(docs); Assert.NotNull(docs !.MemberId); Assert.IsAssignableFrom <FieldId>(docs.MemberId); Assert.NotNull(docs.Summary); Assert.NotNull(docs.Remarks); Assert.NotNull(docs.Example); Assert.NotNull(docs.Value); Assert.All(docs.SeeAlso, seeAlso => Assert.NotNull(seeAlso.MemberId)); Assert.Equal(2, docs.SeeAlso.Count); Assert.Contains( docs.SeeAlso, seeAlso => seeAlso.Text.Elements.Count == 1 && seeAlso.MemberId !.Equals(new SimpleTypeId(NamespaceId.GlobalNamespace, "Class2")) ); Assert.Contains( docs.SeeAlso, seeAlso => seeAlso.Text.Elements.Count == 0 && seeAlso.MemberId !.Equals(new SimpleTypeId(NamespaceId.GlobalNamespace, "Interface1")) ); }
public void Deserialize(IXunitSerializationInfo info) { FieldId = new FieldId( definingType: info.GetValue <XunitSerializableTypeId>(nameof(FieldId.DefiningType)), name: info.GetValue <string>(nameof(FieldId.Name)) ); }
/// <inheritdoc /> protected override string FieldToString(FieldId field, RowVersion version) { return(field switch { FieldId.ProvinceState when version == RowVersion.JHopkinsV1 || version == RowVersion.JHopkinsV2 => "Province/State", FieldId.ProvinceState => "Province_State", FieldId.CountryRegion when version == RowVersion.JHopkinsV1 || version == RowVersion.JHopkinsV2 => "Country/Region", FieldId.CountryRegion => "Country_Region", FieldId.LastUpdate when version == RowVersion.JHopkinsV1 || version == RowVersion.JHopkinsV2 => "Last Update", FieldId.LastUpdate => "Last_Update", FieldId.Latitude when version == RowVersion.JHopkinsV1 || version == RowVersion.JHopkinsV2 => field.ToString(), FieldId.Latitude => "Lat", FieldId.Longitude when version == RowVersion.JHopkinsV1 || version == RowVersion.JHopkinsV2 => field.ToString(), FieldId.Longitude => "Long_", FieldId.CombinedKey => "Combined_Key", FieldId.IncidenceRate when version == RowVersion.JHopkinsV4 => "Incidence_Rate", FieldId.IncidenceRate when version == RowVersion.JHopkinsV5 => "Incident_Rate", FieldId.CaseFatalityRatio when version == RowVersion.JHopkinsV4 => "Case-Fatality_Ratio", FieldId.CaseFatalityRatio when version == RowVersion.JHopkinsV5 => "Case_Fatality_Ratio", _ => field.ToString() });
/// <inheritdoc /> protected override string FieldToString(FieldId field, RowVersion version) { return(field switch { FieldId.Iso2 when version == RowVersion.StatsBase => "iso2", FieldId.Iso3 when version == RowVersion.StatsBase => "iso3", FieldId.Code3 when version == RowVersion.StatsBase => "code3", FieldId.CountryRegion when version == RowVersion.StatsBase => "Country_Region", FieldId.Iso2 when version == RowVersion.StatsEx => "Two_Letter_Country_Code", FieldId.Iso3 when version == RowVersion.StatsEx => "Three_Letter_Country_Code", FieldId.Code3 when version == RowVersion.StatsEx => "Country_Number", FieldId.CountryRegion when version == RowVersion.StatsEx => "Country_Name", FieldId.ProvinceState => "Province_State", FieldId.Latitude => "Lat", FieldId.Longitude => "Long_", FieldId.CombinedKey => "Combined_Key", FieldId.ContinentName => "Continent_Name", FieldId.ContinentCode => "Continent_Code", FieldId.English => "English_JHopkins", FieldId.Russian => "Russian_Yandex", _ => field.ToString() });
/// <summary> /// Returns the value of one or more static fields of the reference type. Each field must be member of the reference type or /// one of its superclasses, superinterfaces, or implemented interfaces. Access control is not enforced; for example, the values /// of private fields can be obtained. /// </summary> public Task<List<Value>> GetValuesAsync(ReferenceTypeId typeId, FieldId[] fields) { var conn = ConnectionOrError; var sizeInfo = conn.GetIdSizeInfo(); var t = conn.SendAsync(JdwpPacket.CreateCommand(conn, Nr, 6, typeId.Size + 4 + (sizeInfo.FieldIdSize * fields.Length), x => { var data = x.Data; typeId.WriteTo(data); data.SetInt(fields.Length); foreach (var fieldId in fields) { fieldId.WriteTo(data); } })); return t.ContinueWith(x => { x.ForwardException(); var result = x.Result; result.ThrowOnError(); var data = result.Data; var count = data.GetInt(); var list = new List<Value>(count); for (var i = 0; i < count; i++) { var value = new Value(data); list.Add(value); } return list; }); }
public void SendXmlAndTextMatch(bool matchAll) { XElement[] elementList = new XElement[2]; elementList[0] = DeltaXml; elementList[0].SetAttributeValue(Common.BypassAKProcessing, "1"); elementList[1] = new XElement(Common.Requests.MenuAction); if (matchAll) { elementList[1].SetAttributeValue(Common.MenuAction, Common.MENUACTION_TextMatchAll); } else { elementList[1].SetAttributeValue(Common.MenuAction, Common.MENUACTION_TextMatch); } if (this.FieldId.IndexOf(".") >= 0) { elementList[1].SetAttributeValue(Common.referenceObject, FieldId.Substring(0, FieldId.LastIndexOf("."))); } _controlHarness.SendXml(elementList); }
public static FieldId GetFieldId(string fieldNameOrId) { if (!String.IsNullOrWhiteSpace(fieldNameOrId)) { int val; if (int.TryParse(fieldNameOrId, out val)) { if ((val >= 0) && (val < (int)(FieldId.NullField))) { return((FieldId)val); } } else { FieldId id = FieldId.IndexField; fieldNameOrId = fieldNameOrId.ToLower(); foreach (string s in FieldNames) { if (s.StartsWith(fieldNameOrId)) { return(id); } ++id; } } } return(FieldId.NullField); }
public IDictionary <IField, IValue> GetValues(IEnumerable <IField> fields) { IField[] fieldsArray = fields.ToArray(); FieldId[] fieldIds = new FieldId[fieldsArray.Length]; // verify each field comes from this VM for (int i = 0; i < fieldsArray.Length; i++) { Field field = fieldsArray[i] as Field; if (field == null) { throw new VirtualMachineMismatchException(); } fieldIds[i] = field.FieldId; } Types.Value[] values; DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetReferenceTypeValues(out values, ReferenceTypeId, fieldIds)); Dictionary <IField, IValue> result = new Dictionary <IField, IValue>(); for (int i = 0; i < fieldIds.Length; i++) { result[fieldsArray[i]] = VirtualMachine.GetMirrorOf(values[i]); } return(result); }
public DeclaredFieldData(FieldId fieldId, string name, string signature, string genericSignature, AccessModifiers modifiers) { FieldId = fieldId; Name = name; Signature = signature; GenericSignature = genericSignature; Modifiers = modifiers; }
public void UpdateItem([NotNull] ItemUri itemUri, [NotNull] FieldId fieldId, [NotNull] string value) { Assert.ArgumentNotNull(itemUri, nameof(itemUri)); Assert.ArgumentNotNull(fieldId, nameof(fieldId)); Assert.ArgumentNotNull(value, nameof(value)); ItemModifier.Edit(itemUri, fieldId, value); }
public static String Get(FieldId id) { if (_dic.TryGetValue(id, out var name)) { return(name); } return($"Unknown field: {id}"); }
public override int GetHashCode() { unchecked { return((FieldId.GetHashCode() * 397) ^ (Language == null ? 0 : StringComparer.OrdinalIgnoreCase.GetHashCode(Language)) ^ Version.GetHashCode()); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"/>. /// </returns> /// <filterpriority>2</filterpriority> /// ------------------------------------------------------------------------------------ public override int GetHashCode() { unchecked { int result = (FieldId != null ? FieldId.GetHashCode() : 0); result = (result * 397) ^ (Type != null ? Type.GetHashCode() : 0); result = (result * 397) ^ (ValueAsString != null ? ValueAsString.GetHashCode() : 0); return(result); } }
public override void Execute(object parameter) { var context = parameter as IItemSelectionContext; if (context == null) { return; } var item = context.Items.FirstOrDefault() as ITemplatedItem; if (item == null) { return; } var parentUri = item.ItemUri; var templateUri = new ItemUri(item.ItemUri.DatabaseUri, IdManager.GetItemId("/sitecore/templates/System/Templates/Template")); var parameterTemplateUri = parentUri.Site.DataService.AddFromTemplate(parentUri, templateUri, item.Name + @"-Parameters"); if (parameterTemplateUri == ItemUri.Empty) { return; } AppHost.Server.UpdateItem(parameterTemplateUri, BaseTemplateFieldId, ControlBaseItemId.ToString()); var parameterTemplateFieldId = new FieldId(new Guid("{7D24E54F-5C16-4314-90C9-6051AA1A7DA1}")); var fields = new List <Tuple <FieldId, string> > { new Tuple <FieldId, string>(parameterTemplateFieldId, parameterTemplateUri.ItemId.ToString()), new Tuple <FieldId, string>(DataSourceLocation, "PageSettings"), new Tuple <FieldId, string>(DataSourceTemplate, parameterTemplateUri.ItemId.ToString()) }; AppHost.Server.UpdateItem(parentUri, fields); AppHost.Windows.OpenTemplateDesigner(parameterTemplateUri); Notifications.RaiseItemAdded(this, new ItemVersionUri(parameterTemplateUri, LanguageManager.CurrentLanguage, Data.Version.Latest), parentUri); var activeContentTree = ActiveContext.ActiveContentTree; if (item is ItemTreeViewItem && activeContentTree != null) { var treeViewItem = activeContentTree.ContentTreeView.ExpandTo(parameterTemplateUri); if (treeViewItem != null) { treeViewItem.IsSelected = true; } } }
/// <inheritdoc /> protected override string FieldToString(FieldId field, RowVersion version) { return(field switch { FieldId.LastUpdate => "Day", FieldId.CountryRegion => "Country", FieldId.ProvinceState => "Province", FieldId.Admin2 => "County", FieldId.ContinentName => "Continent", FieldId.Population => "Population", FieldId.CombinedKey => "StatsName", _ => field.ToString() });
/// <summary> /// Configures the specified property info. /// </summary> /// <param name="propertyInfo">The property info.</param> /// <param name="config">The config.</param> public void Configure(PropertyInfo propertyInfo, SitecoreFieldConfiguration config) { config.FieldName = this.FieldName; if (config.FieldName.IsNullOrEmpty()) { config.FieldName = propertyInfo.Name; } config.Setting = this.Setting; config.CodeFirst = this.CodeFirst; if (FieldId.IsNotNullOrEmpty()) { config.FieldId = new ID(this.FieldId); } config.FieldSource = this.FieldSource; config.FieldTitle = this.FieldTitle; config.FieldType = this.FieldType; config.CustomFieldType = this.CustomFieldType; config.IsShared = this.IsShared; config.IsUnversioned = this.IsUnversioned; config.SectionName = this.SectionName; config.Setting = this.Setting; config.FieldSortOrder = this.FieldSortOrder; config.SectionSortOrder = this.SectionSortOrder; config.ValidationErrorText = this.ValidationErrorText; config.ValidationRegularExpression = this.ValidationRegularExpression; config.IsRequired = this.IsRequired; config.UrlOptions = this.UrlOptions; //code first configuration var fieldFieldValues = propertyInfo.GetCustomAttributes(typeof(SitecoreFieldFieldValueAttribute), true).Cast <SitecoreFieldFieldValueAttribute>(); ////fix: fieldfieldvalues are not passed var interfaceFromProperty = propertyInfo.DeclaringType.GetInterfaces().FirstOrDefault(inter => inter.GetProperty(propertyInfo.Name) != null); if (interfaceFromProperty != null) { fieldFieldValues = interfaceFromProperty.GetProperty(propertyInfo.Name).GetCustomAttributes(typeof(SitecoreFieldFieldValueAttribute), true).Cast <SitecoreFieldFieldValueAttribute>();; } var ffvConfigs = fieldFieldValues.Select(x => x.Configure(propertyInfo, config)); config.FieldValueConfigs = ffvConfigs.ToList(); base.Configure(propertyInfo, config); }
/// <inheritdoc /> protected override string FieldToString(FieldId field, RowVersion version) { return(field switch { FieldId.Confirmed => "Заражений", FieldId.LastUpdate => "Дата", FieldId.ProvinceState => "Регион", FieldId.Recovered => "Выздоровлений", FieldId.Deaths => "Смертей", FieldId.DeathsByDay => "Смертей за день", FieldId.ConfirmedByDay => "Заражений за день", FieldId.RecoveredByDay => "Выздоровлений за день", _ => field.ToString() });
private static void SetAccessor(AbcCode code, IMethod accessor, FieldId fieldId, int varProp) { if (accessor == null) { return; } var abcMethod = accessor.AbcMethod(); if (abcMethod == null) { return; } int index = abcMethod.MethodInfoIndex; code.GetLocal(varProp); code.PushInt(index); code.SetField(fieldId); }
public Task <string> GetExceptionMessageAsync(TaggedObjectId exceptionObject) { if (_failedToFindThrowableDetailedMessageField) { return(null); } // TODO: this logic could be factored out into a "ReferenceTypeFieldValueRetriever" (find // a better name...) class, and could also be used to directly show List<T> as // array type in the watch window and similar fancy things. return(Task.Factory.StartNew(() => { if (_throwableDetailedMessageFieldId == null) { Process.ReferenceTypeManager.RefreshClassesWithSignatureAsync(ThrowableClassSignature) .Await(DalvikProcess.VmTimeout); var refType = Process.ReferenceTypeManager.FindBySignature(ThrowableClassSignature); if (refType == null) { _failedToFindThrowableDetailedMessageField = true; return null; } var fieldInfo = Debugger.ReferenceType.FieldsAsync(refType.Id).Await(DalvikProcess.VmTimeout) .FirstOrDefault(f => f.Name == ThrowableDetailMessageFieldName); if (fieldInfo == null) { _failedToFindThrowableDetailedMessageField = true; return null; } _throwableDetailedMessageFieldId = fieldInfo.Id; } var val = Debugger.ObjectReference.GetValuesAsync(exceptionObject.Object, new[] { _throwableDetailedMessageFieldId }) .Await(DalvikProcess.VmTimeout).First(); var objectId = (ObjectId)val.ValueObject; if (objectId.IsNull) { return null; } var ret = Debugger.StringReference.ValueAsync(objectId).Await(DalvikProcess.VmTimeout); return ret; })); }
public jvmtiError GetFieldName(jclass classHandle, FieldId fieldId, out string name, out string signature, out string genericSignature) { name = null; signature = null; genericSignature = null; IntPtr namePtr; IntPtr signaturePtr; IntPtr genericPtr; jvmtiError error = RawInterface.GetFieldName(this, classHandle, fieldId, out namePtr, out signaturePtr, out genericPtr); if (error != jvmtiError.None) { return(error); } try { unsafe { if (namePtr != IntPtr.Zero) { name = ModifiedUTF8Encoding.GetString((byte *)namePtr); } if (signaturePtr != IntPtr.Zero) { signature = ModifiedUTF8Encoding.GetString((byte *)signaturePtr); } if (genericPtr != IntPtr.Zero) { genericSignature = ModifiedUTF8Encoding.GetString((byte *)genericPtr); } } } finally { Deallocate(namePtr); Deallocate(signaturePtr); Deallocate(genericPtr); } return(jvmtiError.None); }
/// <summary> /// Configures the specified property info. /// </summary> /// <param name="propertyInfo">The property info.</param> /// <param name="config">The config.</param> public void Configure(PropertyInfo propertyInfo, SitecoreFieldConfiguration config) { config.FieldName = this.FieldName; if (config.FieldName.IsNullOrEmpty()) { config.FieldName = propertyInfo.Name; } config.Setting = this.Setting; config.CodeFirst = this.CodeFirst; if (FieldId.IsNotNullOrEmpty()) { config.FieldId = new ID(this.FieldId); } config.FieldSource = this.FieldSource; config.FieldTitle = this.FieldTitle; config.FieldType = this.FieldType; config.CustomFieldType = this.CustomFieldType; config.IsShared = this.IsShared; config.IsUnversioned = this.IsUnversioned; config.SectionName = this.SectionName; config.Setting = this.Setting; config.FieldSortOrder = this.FieldSortOrder; config.SectionSortOrder = this.SectionSortOrder; config.ValidationErrorText = this.ValidationErrorText; config.ValidationRegularExpression = this.ValidationRegularExpression; config.IsRequired = this.IsRequired; config.UrlOptions = this.UrlOptions; //code first configuration var fieldFieldValues = propertyInfo.GetCustomAttributes(typeof(SitecoreFieldFieldValueAttribute), true).Cast <SitecoreFieldFieldValueAttribute>(); var ffvConfigs = fieldFieldValues.Select(x => x.Configure(propertyInfo, config)); config.FieldValueConfigs = ffvConfigs.ToList(); base.Configure(propertyInfo, config); }
/// <summary> /// Default ctor /// </summary> protected BaseFieldEvent(JdwpPacket.DataReaderWriter reader) : base(reader) { refTypeTag = (DebuggerLib.Jdwp.TypeTag)reader.GetByte(); switch (refTypeTag) { case DebuggerLib.Jdwp.TypeTag.Class: typeId = new ClassId(reader); break; case DebuggerLib.Jdwp.TypeTag.Interface: typeId = new InterfaceId(reader); break; case DebuggerLib.Jdwp.TypeTag.Array: typeId = new ArrayTypeId(reader); break; default: throw new ArgumentException("Unknown type tag " + (int)refTypeTag); } fieldId = new FieldId(reader); objectId = new TaggedObjectId(reader); }
public void TryGetDocumentationComments_returns_null_for_field_without_documentation() { // ARRANGE var cs = @" using System; public class Class1 { public string Field1; } "; using var assembly = Compile(cs, out var xmlDocs); var id = new FieldId(new SimpleTypeId(NamespaceId.GlobalNamespace, "Class1"), "Field1"); // ACT var sut = new XmlDocsProvider(assembly, xmlDocs, NullLogger.Instance); var docs = sut.TryGetDocumentationComments(id); // ASSERT Assert.Null(docs); }
/// <summary> /// Returns information for each field in a reference type. Inherited fields are not included. The field list will include any synthetic /// fields created by the compiler. Fields are returned in the order they occur in the class file. /// </summary> public Task<List<FieldInfo>> FieldsAsync(ReferenceTypeId id) { var conn = ConnectionOrError; var sizeInfo = conn.GetIdSizeInfo(); var t = conn.SendAsync(JdwpPacket.CreateCommand(conn, Nr, 14, sizeInfo.ReferenceTypeIdSize, x => id.WriteTo(x.Data))); return t.ContinueWith(x => { x.ForwardException(); var result = x.Result; result.ThrowOnError(); var data = result.Data; var count = data.GetInt(); var list = new List<FieldInfo>(count); for (var i = 0; i < count; i++ ) { var fieldId = new FieldId(data); var name = data.GetString(); var signature = data.GetString(); var genericSignature = data.GetString(); var accessFlags = data.GetInt(); list.Add(new FieldInfo(fieldId, name, signature, genericSignature, accessFlags)); } return list; }); }
public jvmtiError GetClassFields(JniEnvironment nativeEnvironment, ReferenceTypeId declaringType, out FieldId[] fields) { fields = null; using (var @class = VirtualMachine.GetLocalReferenceForClass(nativeEnvironment, declaringType)) { if ([email protected]) return jvmtiError.InvalidClass; int fieldsCount; IntPtr fieldsPtr; jvmtiError error = RawInterface.GetClassFields(this, @class.Value, out fieldsCount, out fieldsPtr); if (error != jvmtiError.None) return error; try { List<FieldId> fieldList = new List<FieldId>(); unsafe { jfieldID* fieldHandles = (jfieldID*)fieldsPtr; for (int i = 0; i < fieldsCount; i++) { if (fieldHandles[i] == jfieldID.Null) continue; fieldList.Add(fieldHandles[i]); } } fields = fieldList.ToArray(); return jvmtiError.None; } finally { Deallocate(fieldsPtr); } } }
public jvmtiError GetFieldName(jclass classHandle, FieldId fieldId, out string name, out string signature, out string genericSignature) { name = null; signature = null; genericSignature = null; IntPtr namePtr; IntPtr signaturePtr; IntPtr genericPtr; jvmtiError error = RawInterface.GetFieldName(this, classHandle, fieldId, out namePtr, out signaturePtr, out genericPtr); if (error != jvmtiError.None) return error; try { unsafe { if (namePtr != IntPtr.Zero) name = ModifiedUTF8Encoding.GetString((byte*)namePtr); if (signaturePtr != IntPtr.Zero) signature = ModifiedUTF8Encoding.GetString((byte*)signaturePtr); if (genericPtr != IntPtr.Zero) genericSignature = ModifiedUTF8Encoding.GetString((byte*)genericPtr); } } finally { Deallocate(namePtr); Deallocate(signaturePtr); Deallocate(genericPtr); } return jvmtiError.None; }
public jvmtiError GetFieldModifiers(jclass classHandle, FieldId fieldId, out JvmAccessModifiers modifiers) { return RawInterface.GetFieldModifiers(this, classHandle, fieldId, out modifiers); }
public jvmtiError GetFieldDeclaringClass(JniEnvironment nativeEnvironment, jclass classHandle, FieldId fieldId, out TaggedReferenceTypeId declaringClass) { declaringClass = default(TaggedReferenceTypeId); jclass declaringClassHandle; jvmtiError error = RawInterface.GetFieldDeclaringClass(this, classHandle, fieldId, out declaringClassHandle); if (error != jvmtiError.None) return error; declaringClass = VirtualMachine.TrackLocalClassReference(declaringClassHandle, this, nativeEnvironment, true); return jvmtiError.None; }
public Error GetReferenceTypeValues(ReferenceTypeId referenceType, FieldId[] fields, out Value[] values) { values = null; try { JniEnvironment nativeEnvironment; JvmtiEnvironment environment; jvmtiError error = GetEnvironment(out environment, out nativeEnvironment); if (error != jvmtiError.None) return GetStandardError(error); using (LocalClassReferenceHolder classHandle = VirtualMachine.GetLocalReferenceForClass(nativeEnvironment, referenceType)) { if (!classHandle.IsAlive) return Error.InvalidClass; Value[] valuesArray = new Value[fields.Length]; for (int i = 0; i < valuesArray.Length; i++) { string name; string signature; string genericSignature; error = environment.GetFieldName(classHandle.Value, fields[i], out name, out signature, out genericSignature); if (error != jvmtiError.None) return GetStandardError(error); switch (signature[0]) { case 'Z': valuesArray[i] = nativeEnvironment.GetStaticBooleanField(classHandle.Value, fields[i]); break; case 'B': valuesArray[i] = nativeEnvironment.GetStaticByteField(classHandle.Value, fields[i]); break; case 'C': valuesArray[i] = nativeEnvironment.GetStaticCharField(classHandle.Value, fields[i]); break; case 'D': valuesArray[i] = nativeEnvironment.GetStaticDoubleField(classHandle.Value, fields[i]); break; case 'F': valuesArray[i] = nativeEnvironment.GetStaticFloatField(classHandle.Value, fields[i]); break; case 'I': valuesArray[i] = nativeEnvironment.GetStaticIntField(classHandle.Value, fields[i]); break; case 'J': valuesArray[i] = nativeEnvironment.GetStaticLongField(classHandle.Value, fields[i]); break; case 'S': valuesArray[i] = nativeEnvironment.GetStaticShortField(classHandle.Value, fields[i]); break; case 'V': return Error.InvalidFieldid; case '[': case 'L': jobject value = nativeEnvironment.GetStaticObjectField(classHandle.Value, fields[i]); valuesArray[i] = VirtualMachine.TrackLocalObjectReference(value, environment, nativeEnvironment, true); break; default: throw new FormatException(); } } values = valuesArray; return Error.None; } } catch (Exception) { return Error.Internal; } }
/// <summary> /// Default ctor /// </summary> public FieldOnlyModifier(ReferenceTypeId classId, FieldId fieldId) : base(9) { this.classId = classId; this.fieldId = fieldId; }
public override int GetHashCode() { int hash = 1; if (StoryQuestId != 0UL) { hash ^= StoryQuestId.GetHashCode(); } if (QuestNameId.Length != 0) { hash ^= QuestNameId.GetHashCode(); } if (FieldId != 0UL) { hash ^= FieldId.GetHashCode(); } if (RequiredConditionId != 0L) { hash ^= RequiredConditionId.GetHashCode(); } if (SortBy != 0UL) { hash ^= SortBy.GetHashCode(); } if (AreaSpotId != 0UL) { hash ^= AreaSpotId.GetHashCode(); } if (ItemSetId != 0UL) { hash ^= ItemSetId.GetHashCode(); } if (QuestGroupId != 0UL) { hash ^= QuestGroupId.GetHashCode(); } if (FieldType != 0) { hash ^= FieldType.GetHashCode(); } if (ScheduleId.Length != 0) { hash ^= ScheduleId.GetHashCode(); } if (PlayCountLimit != 0L) { hash ^= PlayCountLimit.GetHashCode(); } if (ChapterOpenAnimation != false) { hash ^= ChapterOpenAnimation.GetHashCode(); } if (Difficulty != 0) { hash ^= Difficulty.GetHashCode(); } if (WeekScheduleKeyword.Length != 0) { hash ^= WeekScheduleKeyword.GetHashCode(); } if (Debug != false) { hash ^= Debug.GetHashCode(); } if (DebugCategory != 0L) { hash ^= DebugCategory.GetHashCode(); } if (RewardType != 0) { hash ^= RewardType.GetHashCode(); } if (ShowcasedItemId != 0L) { hash ^= ShowcasedItemId.GetHashCode(); } if (CharaQuestListItemId != 0L) { hash ^= CharaQuestListItemId.GetHashCode(); } if (IsEvolutionQuest != false) { hash ^= IsEvolutionQuest.GetHashCode(); } if (QuestType != 0) { hash ^= QuestType.GetHashCode(); } if (IsSearchQuest != false) { hash ^= IsSearchQuest.GetHashCode(); } if (NextQuestId != 0UL) { hash ^= NextQuestId.GetHashCode(); } if (U24 != 0UL) { hash ^= U24.GetHashCode(); } if (U25 != 0UL) { hash ^= U25.GetHashCode(); } if (U26 != 0UL) { hash ^= U26.GetHashCode(); } if (U27 != 0UL) { hash ^= U27.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public void FieldModification(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId thread, Types.Location location, TypeTag typeTag, ReferenceTypeId typeId, FieldId field, TaggedObjectId @object, Types.Value newValue) { throw new NotImplementedException(); }
public LayoutFileItemHandler() { TemplateId = IdManager.GetItemId(IdManager.SitecoreTemplatesSystemLayoutLayout); FieldId = new FieldId(IdManager.GetItemId(IdManager.SitecoreTemplatesSystemLayoutLayoutDataPath).ToGuid()); }
/// <summary> /// Default ctor /// </summary> internal DalvikField(DalvikReferenceType declaringType, FieldInfo info) { Id = info.Id; this.declaringType = declaringType; this.info = info; }
public static EventRequestModifier FieldFilter(ReferenceTypeId declaringClass, FieldId field) { return new EventRequestModifier() { Kind = ModifierKind.FieldFilter, DeclaringClass = declaringClass, Field = field, }; }
public void GoTo(FieldId fieldId, Int32 walkmeshId) { // TODO: Field script Console.WriteLine($"NotImplemented: {nameof(FieldService)}.{nameof(GoTo)}({nameof(fieldId)}: {fieldId}, {nameof(walkmeshId)}: {walkmeshId})"); }
private void WriteFieldId(byte[] packet, int offset, FieldId fieldId) { if (!_fieldIdSize.HasValue) throw new InvalidOperationException(); switch (_fieldIdSize.Value) { case 2: WriteInt16(packet, offset, (short)fieldId.Handle); break; case 4: WriteInt32(packet, offset, (int)fieldId.Handle); break; case 8: WriteInt64(packet, offset, fieldId.Handle); break; default: throw new NotImplementedException(); } }
public Task<string> GetExceptionMessageAsync(TaggedObjectId exceptionObject) { if (_failedToFindThrowableDetailedMessageField) return null; // TODO: this logic could be factored out into a "ReferenceTypeFieldValueRetriever" (find // a better name...) class, and could also be used to directly show List<T> as // array type in the watch window and similar fancy things. return Task.Factory.StartNew(() => { if (_throwableDetailedMessageFieldId == null) { Process.ReferenceTypeManager.RefreshClassesWithSignatureAsync(ThrowableClassSignature) .Await(DalvikProcess.VmTimeout); var refType = Process.ReferenceTypeManager.FindBySignature(ThrowableClassSignature); if (refType == null) { _failedToFindThrowableDetailedMessageField = true; return null; } var fieldInfo = Debugger.ReferenceType.FieldsAsync(refType.Id).Await(DalvikProcess.VmTimeout) .FirstOrDefault(f => f.Name == ThrowableDetailMessageFieldName); if (fieldInfo == null) { _failedToFindThrowableDetailedMessageField = true; return null; } _throwableDetailedMessageFieldId = fieldInfo.Id; } var val = Debugger.ObjectReference.GetValuesAsync(exceptionObject.Object, new[] { _throwableDetailedMessageFieldId }) .Await(DalvikProcess.VmTimeout).First(); var objectId = (ObjectId)val.ValueObject; if(objectId.IsNull) return null; var ret = Debugger.StringReference.ValueAsync(objectId).Await(DalvikProcess.VmTimeout); return ret; }); }
public Error GetReferenceTypeValues(out Value[] values, ReferenceTypeId referenceType, FieldId[] fields) { byte[] packet = new byte[HeaderSize + ReferenceTypeIdSize + sizeof(int) + (fields.Length * FieldIdSize)]; int id = GetMessageId(); SerializeHeader(packet, id, ReferenceTypeCommand.GetValues); WriteReferenceTypeId(packet, HeaderSize, referenceType); WriteInt32(packet, HeaderSize + ReferenceTypeIdSize, fields.Length); for (int i = 0; i < fields.Length; i++) { WriteFieldId(packet, HeaderSize + ReferenceTypeIdSize + sizeof(int) + (i * FieldIdSize), fields[i]); } byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { values = null; return errorCode; } int offset = HeaderSize; int valueCount = ReadInt32(response, ref offset); values = new Value[valueCount]; for (int i = 0; i < valueCount; i++) { values[i] = ReadValue(response, ref offset); } return Error.None; }
internal Field(VirtualMachine virtualMachine, ReferenceType declaringType, string name, string signature, string genericSignature, AccessModifiers modifiers, FieldId fieldId) : base(virtualMachine, declaringType, name, signature, genericSignature, modifiers) { Contract.Requires(virtualMachine != null); _fieldId = fieldId; }
public CshtmlFileItemHandler() { TemplateId = new ItemId(new Guid("{99F8905D-4A87-4EB8-9F8B-A9BEBFB3ADD6}")); FieldId = new FieldId(new Guid("{51B435BC-F7B9-478A-9C51-52916AF96FF5}")); }
public IDictionary<IField, IValue> GetValues(IEnumerable<IField> fields) { IField[] fieldsArray = fields.ToArray(); FieldId[] fieldIds = new FieldId[fieldsArray.Length]; // verify each field comes from this VM for (int i = 0; i < fieldsArray.Length; i++) { Field field = fieldsArray[i] as Field; if (field == null) throw new VirtualMachineMismatchException(); fieldIds[i] = field.FieldId; } Types.Value[] values; DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetObjectValues(out values, ObjectId, fieldIds)); Dictionary<IField, IValue> result = new Dictionary<IField, IValue>(); for (int i = 0; i < fieldIds.Length; i++) result[fieldsArray[i]] = VirtualMachine.GetMirrorOf(values[i]); return result; }
public void PrepareGoTo(FieldId fieldId) { // TODO: Field script Console.WriteLine($"NotImplemented: {nameof(FieldService)}.{nameof(PrepareGoTo)}({nameof(fieldId)}: {fieldId})"); }
public Error SetClassValues(ClassId @class, FieldId[] fields, Value[] values) { throw new NotImplementedException(); }
public override int GetHashCode() { return(FieldId.GetHashCode()); }
public Error SetObjectValues(ObjectId @object, FieldId[] fields, Value[] values) { throw new NotImplementedException(); }