Пример #1
0
        public static unsafe NSBundle GetNSBundle(this XRReferenceImageLibrary library)
        {
            // If no data exists in the XRReferenceImageLibrary, then try to look it up in the main bundle
            if (!library.dataStore.TryGetValue(ARKitPackageInfo.identifier, out var assetCatalogData))
            {
                var mainBundle = NSBundle.mainBundle;
                NSObject.Retain(mainBundle);
                return(mainBundle);
            }

            fixed(void *data = assetCatalogData)
            {
                using var mainBundleIdentifier = NSBundle.mainBundle.bundleIdentifier;
                using var bundleIdentifier     = new NSMutableString(mainBundleIdentifier);
                using var uuid = library.guid.ToNSString();

                bundleIdentifier.Append(uuid);

                return(new NSBundle(bundleIdentifier, new NativeView
                {
                    data = data,
                    count = assetCatalogData.Length
                }));
            }
        }
        public static NSString GetARResourceGroupName(this XRReferenceImageLibrary library)
        {
            if (library.dataStore.TryGetValue(ARKitPackageInfo.identifier, out var data))
            {
                return(new NSString(ARKitImageDatabase.resourceGroupName));
            }

            // Otherwise, construct the name based on the library's name + guid
            var name = new NSMutableString(library.name);

            name.Append(NSString.underscore);
            using (var uuid = library.guid.ToNSString())
            {
                name.Append(uuid);
            }

            return(name);
        }