private static unsafe void ParseConfigurationPackages(NativeRuntime.IFabricCodePackageActivationContext nativeContext, ServiceManifest manifest) { IList <string> names = new List <string>(); NativeCommon.IFabricStringListResult nativeResult = nativeContext.GetConfigurationPackageNames(); uint count; IntPtr nativeNames = nativeResult.GetStrings(out count); for (int i = 0; i < count; i++) { NativeRuntime.IFabricConfigurationPackage configPackageResult = nativeContext.GetConfigurationPackage(Marshal.ReadIntPtr((IntPtr)(nativeNames + i))); NativeTypes.FABRIC_CONFIGURATION_PACKAGE_DESCRIPTION nativeDescription = *(((NativeTypes.FABRIC_CONFIGURATION_PACKAGE_DESCRIPTION *)configPackageResult.get_Description())); NativeRuntime.IFabricConfigurationPackage nativePackage = null; string packageName = NativeTypes.FromNativeString(nativeDescription.Name); using (var pin = new PinBlittable(packageName)) { nativePackage = nativeContext.GetConfigurationPackage(pin.AddrOfPinnedObject()); } manifest.ConfigurationPackages.Add(ConfigurationPackage.CreateFromNative(nativePackage)); GC.KeepAlive(configPackageResult); } GC.KeepAlive(nativeResult); }
internal static StringCollectionResult FromNative(NativeCommon.IFabricStringListResult innerCollection, bool mayContainDuplicates) { var result = new StringCollectionResult(mayContainDuplicates); if (innerCollection != null) { uint count; unsafe { var fabricStringArrayPointer = (char **)innerCollection.GetStrings(out count); for (int i = 0; i < count; i++) { var itemPtr = (IntPtr)(fabricStringArrayPointer + i); result.Add(NativeTypes.FromNativeStringPointer(itemPtr)); } } } GC.KeepAlive(innerCollection); return(result); }
internal static StringCollectionResult FromNative(NativeCommon.IFabricStringListResult innerCollection) { return(FromNative(innerCollection, false)); }