Merge remote-tracking branch 'origin/main' into net7.0
This commit is contained in:
Коммит
db91c70f41
|
@ -31,7 +31,7 @@ tests/bcl-test/Mac\ OS\ X\ BCL\ \tests*.csproj
|
|||
tests/bcl-test/mscorlib*.csproj
|
||||
tests/bcl-test/SystemCoreXunit*.csproj
|
||||
tests/bcl-test/SystemXunit.csproj
|
||||
global6.json
|
||||
global.json
|
||||
.idea
|
||||
device-tests-provisioning.csx
|
||||
build-provisioning.csx
|
||||
|
|
15
Make.config
15
Make.config
|
@ -538,7 +538,7 @@ MAC_PACKAGE_DMG_DIRNAME="$(MAC_PACKAGE_TITLE)"
|
|||
MAC_PACKAGE_UTI=com.$(MAC_PACKAGE_NAME_LOWER).pkg
|
||||
MAC_PACKAGE_INSTALL_LOCATION=$(MAC_FRAMEWORK_VERSIONED_DIR)
|
||||
|
||||
TT = $(SYSTEM_DOTNET) t4
|
||||
TT = $(DOTNET) t4
|
||||
|
||||
PRODUCT_KEY_PATH?=$(TOP)/product.snk
|
||||
|
||||
|
@ -593,22 +593,11 @@ endif
|
|||
|
||||
-include $(TOP)/dotnet.config
|
||||
$(TOP)/dotnet.config: $(TOP)/eng/Versions.props
|
||||
$(Q) grep -A1 \"sdk\": $(TOP)/global.json | sed -e '1d' -e 's/[ \t]*"version": /SYSTEM_DOTNET_VERSION=/' -e 's/"//g' > $@.tmp
|
||||
$(Q) grep MicrosoftDotnetSdkInternalPackageVersion $(TOP)/eng/Versions.props | sed -e 's/<*\/*MicrosoftDotnetSdkInternalPackageVersion>//g' -e 's/[ \t]*/DOTNET_VERSION=/' >> $@.tmp
|
||||
$(Q) grep MicrosoftNETCoreAppRefPackageVersion $(TOP)/eng/Versions.props | sed -e 's/<*\/*MicrosoftNETCoreAppRefPackageVersion>//g' -e 's/[ \t]*/BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION=/' >> $@.tmp
|
||||
$(Q) grep MicrosoftNETWorkloadEmscriptenManifest70100PackageVersion $(TOP)/eng/Versions.props | sed -e 's/<*\/*MicrosoftNETWorkloadEmscriptenManifest70100PackageVersion>//g' -e 's/[ \t]*/EMSCRIPTEN_MANIFEST_PACKAGE_VERSION=/' >> $@.tmp
|
||||
$(Q) mv $@.tmp $@
|
||||
|
||||
ifneq ("$(wildcard /usr/local/share/dotnet/dotnet)","")
|
||||
SYSTEM_DOTNET=/usr/local/share/dotnet/dotnet
|
||||
else
|
||||
ifneq ("$(wildcard /usr/local/share/dotnet/x64/dotnet)","")
|
||||
SYSTEM_DOTNET=/usr/local/share/dotnet/x64/dotnet
|
||||
else
|
||||
SYSTEM_DOTNET=/must/install/dotnet
|
||||
endif
|
||||
endif
|
||||
|
||||
DOTNET_DESTDIR ?= $(TOP)/_build
|
||||
DOTNET_NUPKG_DIR ?= $(DOTNET_DESTDIR)/nupkgs
|
||||
DOTNET_PKG_DIR ?= $(DOTNET_DESTDIR)/pkgs
|
||||
|
@ -635,7 +624,7 @@ DOTNET_TARBALL=https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$(DOTNET_VERSI
|
|||
DOTNET_TARBALL_NAME=$(notdir $(DOTNET_TARBALL))
|
||||
DOTNET_DIR=$(abspath $(TOP)/builds/downloads/$(basename $(basename $(DOTNET_TARBALL_NAME))))
|
||||
DOTNET=$(DOTNET_DIR)/dotnet
|
||||
DOTNET_BCL_DIR:=$(abspath $(TOP)/builds/downloads/microsoft.netcore.app.ref/$(DOTNET_BCL_VERSION)/ref/$(DOTNET_TFM))
|
||||
DOTNET_BCL_DIR:=$(abspath $(TOP)/packages/microsoft.netcore.app.ref/$(DOTNET_BCL_VERSION)/ref/$(DOTNET_TFM))
|
||||
|
||||
# The sdk version band has the last two digits set to 0: https://github.com/dotnet/sdk/blob/22c4860dcb2cf6b123dd641cc4a87a50380759d5/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/SdkDirectoryWorkloadManifestProvider.cs#L52-L53
|
||||
DOTNET_MANIFEST_VERSION_BAND=$(shell echo $(DOTNET_VERSION_BAND) | sed 's/..$$/00/')
|
||||
|
|
12
Makefile
12
Makefile
|
@ -58,10 +58,10 @@ ifdef INCLUDE_IOS
|
|||
@echo Validated file permissions for Xamarin.iOS.
|
||||
endif
|
||||
|
||||
all-local:: global6.json
|
||||
all-local:: global.json
|
||||
|
||||
# This tells NuGet to use the exact same dotnet version we've configured in Make.config
|
||||
global6.json: $(TOP)/Make.config.inc Makefile $(TOP)/.git/HEAD $(TOP)/.git/index
|
||||
global.json: $(TOP)/Make.config.inc Makefile $(TOP)/.git/HEAD $(TOP)/.git/index
|
||||
$(Q_GEN) \
|
||||
printf "{\n" > $@; \
|
||||
printf "\t\"sdk\": { \"version\": \"$(DOTNET_VERSION)\" }\n" >> $@; \
|
||||
|
@ -149,6 +149,14 @@ fix-xcode-select:
|
|||
fix-xcode-first-run:
|
||||
$(XCODE_DEVELOPER_ROOT)/usr/bin/xcodebuild -runFirstLaunch
|
||||
|
||||
install-dotnet:
|
||||
@echo "Figuring out package link..."
|
||||
@export PKG=$$(make -C builds print-dotnet-pkg-urls); \
|
||||
echo "Downloading $$(basename $$PKG)..."; \
|
||||
curl -LO "$$PKG"; \
|
||||
echo "Installing $$(basename $$PKG)..."; \
|
||||
time sudo installer -pkg "$$(basename $$PKG)" -target / -verbose -dumplog
|
||||
|
||||
git-clean-all:
|
||||
@echo "$(COLOR_RED)Cleaning and resetting all dependencies. This is a destructive operation.$(COLOR_CLEAR)"
|
||||
@echo "$(COLOR_RED)You have 5 seconds to cancel (Ctrl-C) if you wish.$(COLOR_CLEAR)"
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<!-- use a local package folder because we produce nuget packages which may end up having to be cleaned,
|
||||
and it's much easier to clean a local repository than the global nuget cache (in particular on bots) -->
|
||||
<add key="repositorypath" value="packages" />
|
||||
<add key="globalPackagesFolder" value="packages" />
|
||||
</config>
|
||||
<packageSources>
|
||||
<clear />
|
||||
|
@ -20,6 +23,7 @@
|
|||
<add key="dotnet7" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />
|
||||
<add key="macios-dependencies" value="https://pkgs.dev.azure.com/xamarin/public/_packaging/macios-dependencies/nuget/v3/index.json" />
|
||||
<add key="xamarin-impl" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" />
|
||||
<add key="local-tests-feed" value="tests/.nuget/packages" />
|
||||
</packageSources>
|
||||
<disabledPackageSources>
|
||||
<clear />
|
||||
|
|
|
@ -28,3 +28,5 @@ mono-ios-sdk-destdir
|
|||
*.dylib
|
||||
*.o
|
||||
x86-64-slice*
|
||||
*.pkg
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ DOWNLOAD_DOTNET_VERSION=$(BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION)
|
|||
endif
|
||||
endif
|
||||
|
||||
.stamp-download-dotnet-packages: $(TOP)/Make.config downloads/$(basename $(basename $(DOTNET_TARBALL_NAME))) package-download/global.json package-download/NuGet.config
|
||||
.stamp-download-dotnet-packages: $(TOP)/Make.config downloads/$(basename $(basename $(DOTNET_TARBALL_NAME)))
|
||||
$(Q_GEN) cd package-download && $(DOTNET) \
|
||||
build \
|
||||
download-packages.proj \
|
||||
|
@ -140,29 +140,16 @@ endif
|
|||
/bl \
|
||||
$(DOTNET_BUILD_VERBOSITY)
|
||||
# looks like the below isn't needed anymore?
|
||||
#$(Q) $(CP) ./downloads/microsoft.net.workload.mono.toolchain.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(DOWNLOAD_DOTNET_VERSION)/data/WorkloadManifest.* ./downloads/dotnet-sdk-$(DOTNET_VERSION)-osx-x64/sdk-manifests/$(DOTNET_MANIFEST_VERSION_WITH_PRERELEASE_COMPONENT)/microsoft.net.workload.mono.toolchain/
|
||||
#$(Q) $(CP) ./downloads/microsoft.net.workload.emscripten.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(EMSCRIPTEN_MANIFEST_PACKAGE_VERSION)/data/WorkloadManifest.* ./downloads/dotnet-sdk-$(DOTNET_VERSION)-osx-x64/sdk-manifests/$(DOTNET_MANIFEST_VERSION_WITH_PRERELEASE_COMPONENT)/microsoft.net.workload.emscripten/
|
||||
#$(Q) $(CP) $(TOP)/packages/microsoft.net.workload.mono.toolchain.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(DOWNLOAD_DOTNET_VERSION)/data/WorkloadManifest.* ./downloads/dotnet-sdk-$(DOTNET_VERSION)-osx-x64/sdk-manifests/$(DOTNET_MANIFEST_VERSION_WITH_PRERELEASE_COMPONENT)/microsoft.net.workload.mono.toolchain/
|
||||
#$(Q) $(CP) $(TOP)/packages/microsoft.net.workload.emscripten.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(EMSCRIPTEN_MANIFEST_PACKAGE_VERSION)/data/WorkloadManifest.* ./downloads/dotnet-sdk-$(DOTNET_VERSION)-osx-x64/sdk-manifests/$(DOTNET_MANIFEST_VERSION_WITH_PRERELEASE_COMPONENT)/microsoft.net.workload.emscripten/
|
||||
$(Q) touch $@
|
||||
|
||||
.stamp-install-t4: $(TOP)/.config/dotnet-tools.json
|
||||
$(SYSTEM_DOTNET) tool restore
|
||||
.stamp-install-t4: $(TOP)/.config/dotnet-tools.json .stamp-download-dotnet-packages
|
||||
$(DOTNET) tool restore
|
||||
$(Q) touch $@
|
||||
|
||||
BundledNETCorePlatformsPackageVersion.txt: .stamp-download-dotnet-packages
|
||||
|
||||
package-download/global.json: $(TOP)/global6.json Makefile
|
||||
$(Q) $(CP) $< $@
|
||||
|
||||
# put any downloaded packages in our own directory, not in ~
|
||||
package-download/NuGet.config: $(TOP)/NuGet.config Makefile
|
||||
$(Q) $(CP) $< $@
|
||||
$(Q) $(CP) $< $@.tmp
|
||||
$(Q) nuget config -Set globalPackagesFolder=$(abspath $(CURDIR)/downloads) -Config $@.tmp
|
||||
ifdef CUSTOM_DOTNET
|
||||
$(Q) nuget sources add -Name dev-runtime-feed -Source $(abspath $(DOTNET_RUNTIME_PATH)/artifacts/packages/Release/Shipping) -ConfigFile $@.tmp
|
||||
endif
|
||||
$(Q) mv $@.tmp $@
|
||||
|
||||
DOTNET_DOWNLOADS = \
|
||||
downloads/$(basename $(basename $(DOTNET_TARBALL_NAME))) \
|
||||
.stamp-download-dotnet-packages \
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
NuGet.config
|
||||
global.json
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
global.json
|
||||
tmpdir
|
||||
Workloads/Microsoft.NET.Sdk.*/LICENSE
|
||||
WorkloadManifest.json
|
||||
|
|
|
@ -168,14 +168,14 @@ $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call NupkgDefinition,$(platform)
|
|||
|
||||
# Create the nuget in a temporary directory (nupkgs/)
|
||||
define CreateNuGetTemplate
|
||||
nupkgs/$(1)$(4).$(2).nupkg: $(TEMPLATED_FILES) $(WORKLOAD_TARGETS) $(3) package/$(1)/package.csproj $(wildcard package/*.csproj) $(wildcard $(DOTNET_DESTDIR)/$(1)/* $(DOTNET_DESTDIR)/$(1)/*/* $(DOTNET_DESTDIR)/$(1)/*/*/* $(DOTNET_DESTDIR)/$(1)/*/*/*/*) global.json .stamp-workaround-for-maccore-issue-2427
|
||||
nupkgs/$(1)$(4).$(2).nupkg: $(TEMPLATED_FILES) $(WORKLOAD_TARGETS) $(3) package/$(1)/package.csproj $(wildcard package/*.csproj) $(wildcard $(DOTNET_DESTDIR)/$(1)/* $(DOTNET_DESTDIR)/$(1)/*/* $(DOTNET_DESTDIR)/$(1)/*/*/* $(DOTNET_DESTDIR)/$(1)/*/*/*/*) .stamp-workaround-for-maccore-issue-2427
|
||||
@# Delete any versions of the nuget we're building
|
||||
$$(Q) rm -f nupkgs/$(1).*.nupkg
|
||||
$$(Q_PACK) $(DOTNET) pack package/$(1)/package.csproj -p:VersionBand=$(5) --output "$$(dir $$@)" $(DOTNET_PACK_VERBOSITY) "/bl:$$@.binlog"
|
||||
endef
|
||||
|
||||
define CreateWindowsNuGetTemplate
|
||||
nupkgs/$(1).$(2).nupkg: $(3) $(WORKLOAD_TARGETS) package/$(1)/package.csproj $(wildcard package/*.csproj) $(wildcard $(DOTNET_DESTDIR)/$(1)/* $(DOTNET_DESTDIR)/$(1)/*/* $(DOTNET_DESTDIR)/$(1)/*/*/* $(DOTNET_DESTDIR)/$(1)/*/*/*/*) global.json .stamp-workaround-for-maccore-issue-2427
|
||||
nupkgs/$(1).$(2).nupkg: $(3) $(WORKLOAD_TARGETS) package/$(1)/package.csproj $(wildcard package/*.csproj) $(wildcard $(DOTNET_DESTDIR)/$(1)/* $(DOTNET_DESTDIR)/$(1)/*/* $(DOTNET_DESTDIR)/$(1)/*/*/* $(DOTNET_DESTDIR)/$(1)/*/*/*/*) .stamp-workaround-for-maccore-issue-2427
|
||||
@# Delete any versions of the nuget we're building
|
||||
$$(Q) rm -f nupkgs/$(1).*.nupkg
|
||||
$$(Q_PACK) $(DOTNET) pack package/$(1)/package.csproj --output "$$(dir $$@)" $(DOTNET_PACK_VERBOSITY) "/bl:$$@.binlog"
|
||||
|
@ -395,18 +395,11 @@ ifdef ENABLE_DOTNET
|
|||
all-local:: $(TARGETS)
|
||||
endif
|
||||
|
||||
# This tells NuGet to use the exact same dotnet version we've configured in Make.config
|
||||
global.json: $(TOP)/global6.json
|
||||
$(CP) $< $@
|
||||
|
||||
$(TOP)/tests/dotnet/NuGet.config:
|
||||
$(Q) $(MAKE) -C $(TOP)/tests/dotnet NuGet.config
|
||||
|
||||
clean-local::
|
||||
$(Q) rm -Rf $(DOTNET_NUPKG_DIR)
|
||||
$(Q) git clean -xfdq
|
||||
|
||||
.stamp-workaround-for-maccore-issue-2427: global.json $(TOP)/eng/Versions.props $(LOCAL_WORKLOAD_TARGETS)
|
||||
.stamp-workaround-for-maccore-issue-2427: $(TOP)/eng/Versions.props $(LOCAL_WORKLOAD_TARGETS)
|
||||
$(Q) $(DOTNET) restore package/workaround-for-maccore-issue-2427/restore.csproj /bl:package/workaround-for-maccore-issue-2427/restore.binlog $(MSBUILD_VERBOSITY)
|
||||
$(Q) touch $@
|
||||
|
||||
|
|
|
@ -17,70 +17,53 @@
|
|||
|
||||
-->
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Condition="'$(EnableDefault@PLATFORM@Items)' == 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0'))">
|
||||
<!-- Default plist file inclusion -->
|
||||
<ItemGroup Condition="'$(EnableDefault@PLATFORM@Items)' == 'true'">
|
||||
<None Include="*.plist">
|
||||
<Link>$([MSBuild]::MakeRelative ('$(MSBuildProjectDirectory)', '%(Identity)'))</Link>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Default SceneKit assets inclusion -->
|
||||
<ItemGroup Condition="'$(EnableDefault@PLATFORM@Items)' == 'true'">
|
||||
<SceneKitAsset Include="**\*.scnassets\*" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" >
|
||||
<IsDefaultItem>true</IsDefaultItem>
|
||||
</SceneKitAsset>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Default Asset Catalog file inclusion -->
|
||||
<ItemGroup Condition="'$(EnableDefault@PLATFORM@Items)' == 'true'">
|
||||
<ImageAsset Include="**\*.xcassets\**\*.*" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);**\*.xcassets\**\*.DS_Store">
|
||||
<Link>$([MSBuild]::MakeRelative ('$(MSBuildProjectDirectory)', '%(Identity)'))</Link>
|
||||
<Visible>false</Visible>
|
||||
<IsDefaultItem>true</IsDefaultItem>
|
||||
</ImageAsset>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Default Storyboard file inclusion -->
|
||||
<ItemGroup Condition="'$(EnableDefault@PLATFORM@Items)' == 'true'">
|
||||
<InterfaceDefinition Include="**\*.storyboard;**\*.xib" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" >
|
||||
<Link>$([MSBuild]::MakeRelative ('$(MSBuildProjectDirectory)', '%(Identity)'))</Link>
|
||||
<IsDefaultItem>true</IsDefaultItem>
|
||||
</InterfaceDefinition>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Default Atlas Texture file inclusion -->
|
||||
<ItemGroup Condition="'$(EnableDefault@PLATFORM@Items)' == 'true'">
|
||||
<AtlasTexture Include="**\*.atlas\*.png" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" >
|
||||
<Link>$([MSBuild]::MakeRelative ('$(MSBuildProjectDirectory)', '%(Identity)'))</Link>
|
||||
<IsDefaultItem>true</IsDefaultItem>
|
||||
</AtlasTexture>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Default CoreMLModel inclusion -->
|
||||
<ItemGroup Condition="'$(EnableDefault@PLATFORM@Items)' == 'true'">
|
||||
<CoreMLModel Include="**\*.mlmodel" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" >
|
||||
<Link>$([MSBuild]::MakeRelative ('$(MSBuildProjectDirectory)', '%(Identity)'))</Link>
|
||||
<IsDefaultItem>true</IsDefaultItem>
|
||||
</CoreMLModel>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Default Metal inclusion -->
|
||||
<ItemGroup Condition="'$(EnableDefault@PLATFORM@Items)' == 'true'">
|
||||
<Metal Include="**\*.metal" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" >
|
||||
<Link>$([MSBuild]::MakeRelative ('$(MSBuildProjectDirectory)', '%(Identity)'))</Link>
|
||||
<IsDefaultItem>true</IsDefaultItem>
|
||||
</Metal>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Default SceneKit assets inclusion -->
|
||||
<ItemGroup Condition="'$(EnableDefault@PLATFORM@Items)' == 'true'">
|
||||
<SceneKitAsset Include="**\*.scnassets\*" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" >
|
||||
<IsDefaultItem>true</IsDefaultItem>
|
||||
</SceneKitAsset>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Default font files inclusion -->
|
||||
<ItemGroup Condition="'$(EnableDefault@PLATFORM@Items)' == 'true'">
|
||||
<!-- Include everything in the project's Resources folder (as represented by the _ResourcePrefix property, which is set from the IPhoneResourcePrefix/XamMacResourcePrefix properties),
|
||||
except for files that are already in any of the other resource type item groups -->
|
||||
<BundleResource Include="$(_ResourcePrefix)\**\*" Exclude="
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit cac05a2445b478afb3ff5d19333a229256b0a75f
|
||||
Subproject commit be3a8d0855b8291848d02c9c9d99748cb41c56c2
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "6.0.201"
|
||||
}
|
||||
}
|
|
@ -17,14 +17,16 @@ namespace Xamarin.Messaging.Build {
|
|||
{
|
||||
this.serializer = serializer;
|
||||
|
||||
var dotnetPath = Path.Combine (MessagingContext.GetXmaPath (), "SDKs", "dotnet", "dotnet");
|
||||
var sdkRootPath = Path.Combine (MessagingContext.GetXmaPath (), "SDKs");
|
||||
var dotnetPath = Path.Combine (sdkRootPath, "dotnet", "dotnet");
|
||||
|
||||
if (File.Exists (dotnetPath)) {
|
||||
Environment.SetEnvironmentVariable ("HOME", Path.Combine (sdkRootPath, ".home"));
|
||||
} else {
|
||||
//In case the XMA dotnet has not been installed yet
|
||||
if (!File.Exists (dotnetPath)) {
|
||||
dotnetPath = "/usr/local/share/dotnet/dotnet";
|
||||
}
|
||||
|
||||
// TODO: Needed by the ILLinkTask, we need to add support for doing this from Windows
|
||||
Environment.SetEnvironmentVariable ("DOTNET_HOST_PATH", dotnetPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1 @@
|
|||
*.zip
|
||||
NuGet.config
|
||||
global.json
|
||||
|
||||
|
|
|
@ -9,18 +9,10 @@ Xamarin.PreBuilt.iOS.app.zip: .build-stamp
|
|||
$(Q) rm -rf $@
|
||||
$(Q_GEN) cd $(APP_DIR) && zip -9r $(abspath $@) .
|
||||
|
||||
NuGet.config: $(TOP)/tests/dotnet/NuGet.config $(TOP)/NuGet.config
|
||||
$(Q) $(MAKE) $@ -C $(dir $<)
|
||||
$(Q) $(CP) $< $@
|
||||
|
||||
global.json: $(TOP)/tests/dotnet/global.json $(TOP)/global6.json
|
||||
$(Q) $(MAKE) $@ -C $(dir $<)
|
||||
$(Q) $(CP) $< $@
|
||||
|
||||
$(TOP)/tests/dotnet/%:
|
||||
$(Q) $(MAKE) -C $(dir $@) $*
|
||||
|
||||
.build-stamp: $(wildcard Xamarin.PreBuilt.iOS/*) Makefile NuGet.config global.json
|
||||
.build-stamp: $(wildcard Xamarin.PreBuilt.iOS/*) Makefile
|
||||
$(Q_GEN) $(DOTNET) build Xamarin.PreBuilt.iOS/Xamarin.PreBuilt.iOS.csproj "/bl:$(abspath ./msbuild.binlog)" $(MSBUILD_VERBOSITY)
|
||||
$(Q) touch $@
|
||||
|
||||
|
|
|
@ -164,7 +164,6 @@ namespace Xamarin.MacDev.Tasks
|
|||
var bundleResources = new List<ITaskItem> ();
|
||||
var modified = new HashSet<string> ();
|
||||
var items = new List<ITaskItem> ();
|
||||
string metadata;
|
||||
|
||||
foreach (var asset in SceneKitAssets) {
|
||||
if (!File.Exists (asset.ItemSpec))
|
||||
|
@ -178,9 +177,7 @@ namespace Xamarin.MacDev.Tasks
|
|||
if (scnassets.Length == 0)
|
||||
continue;
|
||||
|
||||
metadata = asset.GetMetadata ("LogicalName");
|
||||
if (!string.IsNullOrEmpty (metadata))
|
||||
asset.SetMetadata ("LogicalName", string.Empty);
|
||||
asset.RemoveMetadata ("LogicalName");
|
||||
|
||||
var bundleName = BundleResource.GetLogicalName (ProjectDir, prefixes, asset, !string.IsNullOrEmpty(SessionId));
|
||||
var output = new TaskItem (Path.Combine (intermediate, bundleName));
|
||||
|
@ -195,6 +192,17 @@ namespace Xamarin.MacDev.Tasks
|
|||
// .. and remove the @OriginalItemSpec which is for @asset
|
||||
scnassetsItem.RemoveMetadata ("OriginalItemSpec");
|
||||
|
||||
// The Link metadata is for the asset, but 'scnassetsItem' is the containing *.scnasset directory,
|
||||
// so we need to update the Link metadata accordingly (if it exists).
|
||||
var link = scnassetsItem.GetMetadata ("Link");
|
||||
if (!string.IsNullOrEmpty (link)) {
|
||||
var newLinkLength = link.Length - (asset.ItemSpec.Length - scnassets.Length);
|
||||
if (newLinkLength > 0 && newLinkLength < link.Length) {
|
||||
link = link.Substring (0, newLinkLength);
|
||||
scnassetsItem.SetMetadata ("Link", link);
|
||||
}
|
||||
}
|
||||
|
||||
var assetMetadata = asset.GetMetadata ("DefiningProjectFullPath");
|
||||
if (assetMetadata != scnassetsItem.GetMetadata ("DefiningProjectFullPath")) {
|
||||
// xbuild doesn't set this, so we'll do it
|
||||
|
|
|
@ -664,7 +664,7 @@ $(foreach platform,$(DOTNET_PLATFORMS),$(foreach rid,$(DOTNET_$(platform)_RUNTIM
|
|||
|
||||
define DotNetLibXamarinTemplate
|
||||
|
||||
DOTNET$(6)_$(2)_LIBDIR ?= $$(TOP)/builds/downloads/microsoft.netcore.app.runtime$(7).$(2)/$(BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION)/runtimes/$(2)/native
|
||||
DOTNET$(6)_$(2)_LIBDIR ?= $$(TOP)/packages/microsoft.netcore.app.runtime$(7).$(2)/$(BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION)/runtimes/$(2)/native
|
||||
DOTNET$(6)_$(2)_DYLIB_FLAGS = $(DOTNET_$(1)_DYLIB_FLAGS) -Wl,-install_name,libxamarin$(5).dylib -framework Foundation -framework CFNetwork -lz -L$(abspath $(DOTNET$(6)_$(2)_LIBDIR))
|
||||
|
||||
DOTNET_$(2)_$(3)$(4)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(5).$(3).o, $(MONOTOUCH_SOURCE_STEMS)) $$(patsubst %,.libs/$(1)/%$(5).$(3).o, $(MONOTOUCH_$(shell echo $(3) | tr a-z A-Z)_SOURCE_STEMS))
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
global.json
|
||||
build
|
||||
MonoTouch.NUnitLite.csproj
|
||||
MonoTouch.NUnitLite.tvos.csproj
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using ObjCRuntime;
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace CoreFoundation {
|
|||
static IntPtr Create (NSUrl bundleUrl)
|
||||
{
|
||||
if (bundleUrl is null)
|
||||
throw new ArgumentNullException (nameof (bundleUrl));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (bundleUrl));
|
||||
|
||||
return CFBundleCreate (IntPtr.Zero, bundleUrl.Handle);
|
||||
|
||||
|
@ -71,7 +71,7 @@ namespace CoreFoundation {
|
|||
public static CFBundle[]? GetBundlesFromDirectory (NSUrl directoryUrl, string bundleType)
|
||||
{
|
||||
if (directoryUrl is null) // NSUrl cannot be "" by definition
|
||||
throw new ArgumentNullException (nameof (directoryUrl));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (directoryUrl));
|
||||
if (String.IsNullOrEmpty (bundleType))
|
||||
throw new ArgumentException (nameof (bundleType));
|
||||
var bundleTypeHandle = CFString.CreateNative (bundleType);
|
||||
|
@ -289,7 +289,7 @@ namespace CoreFoundation {
|
|||
public static NSUrl? GetResourceUrl (NSUrl bundleUrl, string resourceName, string resourceType, string subDirName)
|
||||
{
|
||||
if (bundleUrl is null)
|
||||
throw new ArgumentNullException (nameof (bundleUrl));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (bundleUrl));
|
||||
|
||||
if (String.IsNullOrEmpty (resourceName))
|
||||
throw new ArgumentException (nameof (resourceName));
|
||||
|
@ -336,7 +336,7 @@ namespace CoreFoundation {
|
|||
public static NSUrl?[]? GetResourceUrls (NSUrl bundleUrl, string resourceType, string subDirName)
|
||||
{
|
||||
if (bundleUrl is null)
|
||||
throw new ArgumentNullException (nameof (bundleUrl));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (bundleUrl));
|
||||
|
||||
if (String.IsNullOrEmpty (resourceType))
|
||||
throw new ArgumentException (nameof (resourceType));
|
||||
|
@ -441,9 +441,9 @@ namespace CoreFoundation {
|
|||
public static string?[]? GetLocalizationsForPreferences (string[] locArray, string[] prefArray)
|
||||
{
|
||||
if (locArray is null)
|
||||
throw new ArgumentNullException (nameof (locArray));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (locArray));
|
||||
if (prefArray is null)
|
||||
throw new ArgumentNullException (nameof (prefArray));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (prefArray));
|
||||
|
||||
var cfLocalArrayHandle = IntPtr.Zero;
|
||||
var cfPrefArrayHandle = IntPtr.Zero;
|
||||
|
@ -467,7 +467,7 @@ namespace CoreFoundation {
|
|||
public static string?[]? GetLocalizations (NSUrl bundle)
|
||||
{
|
||||
if (bundle is null)
|
||||
throw new ArgumentNullException (nameof (bundle));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (bundle));
|
||||
var rv = CFBundleCopyLocalizationsForURL (bundle.Handle);
|
||||
return CFArray.StringArrayFromHandle (rv, true);
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ namespace CoreFoundation {
|
|||
public static string?[]? GetPreferredLocalizations (string[] locArray)
|
||||
{
|
||||
if (locArray is null)
|
||||
throw new ArgumentNullException (nameof (locArray));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (locArray));
|
||||
|
||||
var cfString = new CFString [locArray.Length];
|
||||
for (int index = 0; index < locArray.Length; index++) {
|
||||
|
@ -543,7 +543,7 @@ namespace CoreFoundation {
|
|||
public static NSDictionary? GetInfoDictionary (NSUrl url)
|
||||
{
|
||||
if (url is null)
|
||||
throw new ArgumentNullException (nameof (url));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
|
||||
// follow the create rule, no need to retain
|
||||
return Runtime.GetNSObject<NSDictionary> (CFBundleCopyInfoDictionaryForURL (url.Handle));
|
||||
}
|
||||
|
@ -607,7 +607,7 @@ namespace CoreFoundation {
|
|||
public static bool IsExecutableLoadable (CFBundle bundle)
|
||||
{
|
||||
if (bundle is null)
|
||||
throw new ArgumentNullException (nameof (bundle));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (bundle));
|
||||
|
||||
return CFBundleIsExecutableLoadable (bundle.GetCheckedHandle ());
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ namespace CoreFoundation {
|
|||
public static bool IsExecutableLoadable (NSUrl url)
|
||||
{
|
||||
if (url is null)
|
||||
throw new ArgumentNullException (nameof (url));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
|
||||
|
||||
return CFBundleIsExecutableLoadableForURL (url.Handle);
|
||||
}
|
||||
|
|
|
@ -26,15 +26,19 @@
|
|||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using CoreFoundation;
|
||||
using ObjCRuntime;
|
||||
|
||||
namespace CoreFoundation {
|
||||
|
||||
class CFDataBuffer : IDisposable {
|
||||
byte[] buffer;
|
||||
CFData data;
|
||||
CFData? data;
|
||||
|
||||
public unsafe CFDataBuffer (byte[] buffer)
|
||||
{
|
||||
|
@ -65,7 +69,7 @@ namespace CoreFoundation {
|
|||
}
|
||||
|
||||
public IntPtr Handle {
|
||||
get { return data.Handle; }
|
||||
get { return data.GetHandle (); }
|
||||
}
|
||||
|
||||
public byte[] Data {
|
||||
|
@ -78,7 +82,7 @@ namespace CoreFoundation {
|
|||
|
||||
protected virtual void Dispose (bool disposing)
|
||||
{
|
||||
if (data != null) {
|
||||
if (data is not null) {
|
||||
data.Dispose ();
|
||||
data = null;
|
||||
}
|
||||
|
|
|
@ -69,10 +69,10 @@ namespace CoreFoundation {
|
|||
public static CFDictionary FromObjectsAndKeys (INativeObject[] objects, INativeObject[] keys)
|
||||
{
|
||||
if (objects is null)
|
||||
throw new ArgumentNullException (nameof (objects));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (objects));
|
||||
|
||||
if (keys is null)
|
||||
throw new ArgumentNullException (nameof (keys));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (keys));
|
||||
|
||||
if (objects.Length != keys.Length)
|
||||
throw new ArgumentException ("The length of both arrays must be the same");
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -42,10 +45,10 @@ namespace CoreFoundation {
|
|||
#endif
|
||||
public static class CFErrorDomain {
|
||||
|
||||
public static readonly NSString Cocoa;
|
||||
public static readonly NSString Mach;
|
||||
public static readonly NSString OSStatus;
|
||||
public static readonly NSString Posix;
|
||||
public static readonly NSString? Cocoa;
|
||||
public static readonly NSString? Mach;
|
||||
public static readonly NSString? OSStatus;
|
||||
public static readonly NSString? Posix;
|
||||
|
||||
static CFErrorDomain ()
|
||||
{
|
||||
|
@ -65,11 +68,11 @@ namespace CoreFoundation {
|
|||
#endif
|
||||
public static class CFExceptionDataKey {
|
||||
|
||||
public static readonly NSString Description;
|
||||
public static readonly NSString LocalizedDescription;
|
||||
public static readonly NSString LocalizedFailureReason;
|
||||
public static readonly NSString LocalizedRecoverySuggestion;
|
||||
public static readonly NSString UnderlyingError;
|
||||
public static readonly NSString? Description;
|
||||
public static readonly NSString? LocalizedDescription;
|
||||
public static readonly NSString? LocalizedFailureReason;
|
||||
public static readonly NSString? LocalizedRecoverySuggestion;
|
||||
public static readonly NSString? UnderlyingError;
|
||||
|
||||
static CFExceptionDataKey ()
|
||||
{
|
||||
|
@ -90,7 +93,7 @@ namespace CoreFoundation {
|
|||
#endif
|
||||
public class CFException : Exception {
|
||||
|
||||
public CFException (string description, NSString domain, nint code, string failureReason, string recoverySuggestion)
|
||||
public CFException (string? description, NSString? domain, nint code, string? failureReason, string? recoverySuggestion)
|
||||
: base (description)
|
||||
{
|
||||
Code = code;
|
||||
|
@ -107,11 +110,11 @@ namespace CoreFoundation {
|
|||
public static CFException FromCFError (IntPtr cfErrorHandle, bool release)
|
||||
{
|
||||
if (cfErrorHandle == IntPtr.Zero)
|
||||
throw new ArgumentNullException (nameof (cfErrorHandle));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (cfErrorHandle));
|
||||
|
||||
var e = new CFException (
|
||||
CFString.FromHandle (CFErrorCopyDescription (cfErrorHandle), releaseHandle: true),
|
||||
(NSString) Runtime.GetNSObject (CFErrorGetDomain (cfErrorHandle)),
|
||||
Runtime.GetNSObject (CFErrorGetDomain (cfErrorHandle)) as NSString,
|
||||
CFErrorGetCode (cfErrorHandle),
|
||||
CFString.FromHandle (CFErrorCopyFailureReason (cfErrorHandle), releaseHandle: true),
|
||||
CFString.FromHandle (CFErrorCopyRecoverySuggestion (cfErrorHandle), releaseHandle: true));
|
||||
|
@ -119,8 +122,10 @@ namespace CoreFoundation {
|
|||
var cfUserInfo = CFErrorCopyUserInfo (cfErrorHandle);
|
||||
if (cfUserInfo != IntPtr.Zero) {
|
||||
using (var userInfo = new NSDictionary (cfUserInfo)) {
|
||||
foreach (var i in userInfo)
|
||||
e.Data.Add (i.Key?.ToString (), i.Value?.ToString ());
|
||||
foreach (var i in userInfo) {
|
||||
if (i.Key is not null)
|
||||
e.Data.Add (i.Key.ToString (), i.Value?.ToString ());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (release)
|
||||
|
@ -129,9 +134,9 @@ namespace CoreFoundation {
|
|||
}
|
||||
|
||||
public nint Code {get; private set;}
|
||||
public NSString Domain {get; private set;}
|
||||
public string FailureReason {get; private set;}
|
||||
public string RecoverySuggestion {get; private set;}
|
||||
public NSString? Domain {get; private set;}
|
||||
public string? FailureReason {get; private set;}
|
||||
public string? RecoverySuggestion {get; private set;}
|
||||
|
||||
[DllImport (Constants.CoreFoundationLibrary)]
|
||||
static extern IntPtr CFErrorCopyDescription (IntPtr err);
|
||||
|
|
|
@ -216,7 +216,7 @@ namespace CoreFoundation {
|
|||
public static CFMessagePort? CreateLocalPort (string? name, CFMessagePortCallBack callback, CFAllocator? allocator = null)
|
||||
{
|
||||
if (callback is null)
|
||||
throw new ArgumentNullException (nameof (callback));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (callback));
|
||||
|
||||
return CreateLocalPort (allocator, name, callback, context: null);
|
||||
}
|
||||
|
@ -348,14 +348,14 @@ namespace CoreFoundation {
|
|||
lock (invalidationHandles)
|
||||
invalidationHandles.TryGetValue (messagePort, out callback);
|
||||
|
||||
if (callback != null)
|
||||
if (callback is not null)
|
||||
callback.Invoke ();
|
||||
}
|
||||
|
||||
public static CFMessagePort? CreateRemotePort (CFAllocator? allocator, string name)
|
||||
{
|
||||
if (name is null)
|
||||
throw new ArgumentNullException (nameof (name));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (name));
|
||||
|
||||
var n = CFString.CreateNative (name);
|
||||
try {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Copyright 2019 Microsoft Corporation
|
||||
|
||||
#nullable enable
|
||||
|
||||
#if !COREBUILD
|
||||
|
||||
using System;
|
||||
|
@ -46,13 +48,13 @@ namespace CoreFoundation {
|
|||
public CFMutableString (string @string = "", nint maxLength = default (nint))
|
||||
{
|
||||
// not really needed - but it's consistant with other .ctor
|
||||
if (@string == null)
|
||||
throw new ArgumentNullException (nameof (@string));
|
||||
if (@string is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (@string));
|
||||
// NSMallocException Out of memory. We suggest restarting the application. If you have an unsaved document, create a backup copy in Finder, then try to save.
|
||||
if (maxLength < 0)
|
||||
throw new ArgumentException (nameof (maxLength));
|
||||
Handle = CFStringCreateMutable (IntPtr.Zero, maxLength);
|
||||
if (@string != null)
|
||||
if (@string is not null)
|
||||
CFStringAppendCharacters (Handle, @string, @string.Length);
|
||||
}
|
||||
|
||||
|
@ -61,8 +63,8 @@ namespace CoreFoundation {
|
|||
|
||||
public CFMutableString (CFString theString, nint maxLength = default (nint))
|
||||
{
|
||||
if (theString == null)
|
||||
throw new ArgumentNullException (nameof (theString));
|
||||
if (theString is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (theString));
|
||||
// NSMallocException Out of memory. We suggest restarting the application. If you have an unsaved document, create a backup copy in Finder, then try to save.
|
||||
if (maxLength < 0)
|
||||
throw new ArgumentException (nameof (maxLength));
|
||||
|
@ -74,8 +76,8 @@ namespace CoreFoundation {
|
|||
|
||||
public void Append (string @string)
|
||||
{
|
||||
if (@string == null)
|
||||
throw new ArgumentNullException (nameof (@string));
|
||||
if (@string is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (@string));
|
||||
str = null; // destroy any cached value
|
||||
CFStringAppendCharacters (Handle, @string, @string.Length);
|
||||
}
|
||||
|
@ -102,7 +104,7 @@ namespace CoreFoundation {
|
|||
|
||||
public bool Transform (ref CFRange range, string transform, bool reverse)
|
||||
{
|
||||
var t = NSString.CreateNative (transform);
|
||||
var t = CreateNative (transform);
|
||||
try {
|
||||
return Transform (ref range, t, reverse);
|
||||
} finally {
|
||||
|
@ -113,7 +115,7 @@ namespace CoreFoundation {
|
|||
bool Transform (ref CFRange range, IntPtr transform, bool reverse)
|
||||
{
|
||||
if (transform == IntPtr.Zero)
|
||||
throw new ArgumentNullException (nameof (transform));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (transform));
|
||||
str = null; // destroy any cached value
|
||||
return CFStringTransform (Handle, ref range, transform, reverse);
|
||||
}
|
||||
|
@ -140,7 +142,7 @@ namespace CoreFoundation {
|
|||
|
||||
public bool Transform (string transform, bool reverse)
|
||||
{
|
||||
var t = NSString.CreateNative (transform);
|
||||
var t = CreateNative (transform);
|
||||
try {
|
||||
return Transform (t, reverse);
|
||||
} finally {
|
||||
|
@ -151,7 +153,7 @@ namespace CoreFoundation {
|
|||
bool Transform (IntPtr transform, bool reverse)
|
||||
{
|
||||
if (transform == IntPtr.Zero)
|
||||
throw new ArgumentNullException (nameof (transform));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (transform));
|
||||
str = null; // destroy any cached value
|
||||
return CFStringTransform (Handle, IntPtr.Zero, transform, reverse);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Copyright 2015 Xamarin Inc. All rights reserved.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
|
||||
namespace CoreFoundation {
|
||||
|
|
|
@ -103,9 +103,8 @@ namespace CoreFoundation {
|
|||
public CFNotificationObserverToken AddObserver (string name, INativeObject objectToObserve, Action<string,NSDictionary?> notificationHandler,
|
||||
CFNotificationSuspensionBehavior suspensionBehavior = CFNotificationSuspensionBehavior.DeliverImmediately)
|
||||
{
|
||||
if (darwinnc is not null && darwinnc.Handle == Handle){
|
||||
if (name is null)
|
||||
throw new ArgumentNullException (nameof (name), "When using the Darwin Notification Center, the value passed must not be null");
|
||||
if (darwinnc is not null && darwinnc.Handle == Handle && name is null){
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (name), "When using the Darwin Notification Center, the value passed must not be null");
|
||||
}
|
||||
|
||||
var strHandle = CFString.CreateNative (name);
|
||||
|
@ -189,7 +188,7 @@ namespace CoreFoundation {
|
|||
{
|
||||
// The name of the notification to post.This value must not be NULL.
|
||||
if (notification is null)
|
||||
throw new ArgumentNullException (nameof (notification));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (notification));
|
||||
|
||||
var strHandle = CFString.CreateNative (notification);
|
||||
CFNotificationCenterPostNotificationWithOptions (
|
||||
|
@ -204,7 +203,7 @@ namespace CoreFoundation {
|
|||
public void RemoveObserver (CFNotificationObserverToken token)
|
||||
{
|
||||
if (token is null)
|
||||
throw new ArgumentNullException (nameof (token));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (token));
|
||||
if (token.nameHandle == IntPtr.Zero && token.stringName != NullNotificationName)
|
||||
throw new ObjectDisposedException (nameof (token));
|
||||
if (token.centerHandle != Handle)
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
//
|
||||
// Note: currently only the "high level" API is bound
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -30,7 +32,7 @@ namespace CoreFoundation
|
|||
[DllImport (Constants.CoreFoundationLibrary)]
|
||||
static extern IntPtr CFPreferencesCopyAppValue (IntPtr key, IntPtr applicationId);
|
||||
|
||||
public static readonly NSString CurrentApplication;
|
||||
public static readonly NSString? CurrentApplication;
|
||||
|
||||
/*public static readonly NSString AnyApplication;
|
||||
public static readonly NSString CurrentHost;
|
||||
|
@ -50,15 +52,17 @@ namespace CoreFoundation
|
|||
AnyUser = Dlfcn.GetStringConstant (handle, "kCFPreferencesAnyUser");*/
|
||||
}
|
||||
|
||||
public static object GetAppValue (string key)
|
||||
public static object? GetAppValue (string key)
|
||||
{
|
||||
if (CurrentApplication is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (CurrentApplication));
|
||||
return GetAppValue (key, CurrentApplication);
|
||||
}
|
||||
|
||||
public static object GetAppValue (string key, string applicationId)
|
||||
public static object? GetAppValue (string key, string applicationId)
|
||||
{
|
||||
if (applicationId == null) {
|
||||
throw new ArgumentNullException ("applicationId");
|
||||
if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
using (var nsApplicationId = new NSString (applicationId)) {
|
||||
|
@ -66,12 +70,12 @@ namespace CoreFoundation
|
|||
}
|
||||
}
|
||||
|
||||
public static object GetAppValue (string key, NSString applicationId)
|
||||
public static object? GetAppValue (string key, NSString applicationId)
|
||||
{
|
||||
if (key == null) {
|
||||
throw new ArgumentNullException ("key");
|
||||
} else if (applicationId == null) {
|
||||
throw new ArgumentNullException ("applicationId");
|
||||
if (key is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (key));
|
||||
} else if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
IntPtr valuePtr;
|
||||
|
@ -94,13 +98,15 @@ namespace CoreFoundation
|
|||
|
||||
public static void SetAppValue (string key, object value)
|
||||
{
|
||||
if (CurrentApplication is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (CurrentApplication));
|
||||
SetAppValue (key, value, CurrentApplication);
|
||||
}
|
||||
|
||||
public static void SetAppValue (string key, object value, string applicationId)
|
||||
public static void SetAppValue (string key, object? value, string applicationId)
|
||||
{
|
||||
if (applicationId == null) {
|
||||
throw new ArgumentNullException ("applicationId");
|
||||
if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
using (var nsApplicationId = new NSString (applicationId)) {
|
||||
|
@ -108,17 +114,18 @@ namespace CoreFoundation
|
|||
}
|
||||
}
|
||||
|
||||
public static void SetAppValue (string key, object value, NSString applicationId)
|
||||
public static void SetAppValue (string key, object? value, NSString applicationId)
|
||||
{
|
||||
if (key == null) {
|
||||
throw new ArgumentNullException ("key");
|
||||
} else if (applicationId == null) {
|
||||
throw new ArgumentNullException ("applicationId");
|
||||
if (key is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (key));
|
||||
} else if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
using (var cfKey = new CFString (key)) {
|
||||
if (value == null) {
|
||||
if (value is null) {
|
||||
CFPreferencesSetAppValue (cfKey.Handle, IntPtr.Zero, applicationId.Handle);
|
||||
return;
|
||||
} else if (value is string) {
|
||||
using (var valueStr = new CFString ((string)value)) {
|
||||
CFPreferencesSetAppValue (cfKey.Handle, valueStr.Handle, applicationId.Handle);
|
||||
|
@ -135,7 +142,7 @@ namespace CoreFoundation
|
|||
}
|
||||
|
||||
var nsnumber = NSNumber.FromObject (value);
|
||||
if (nsnumber != null) {
|
||||
if (nsnumber is not null) {
|
||||
using (nsnumber) {
|
||||
CFPreferencesSetAppValue (cfKey.Handle, nsnumber.Handle, applicationId.Handle);
|
||||
}
|
||||
|
@ -148,6 +155,8 @@ namespace CoreFoundation
|
|||
|
||||
public static void RemoveAppValue (string key)
|
||||
{
|
||||
if (CurrentApplication is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (CurrentApplication));
|
||||
SetAppValue (key, null, CurrentApplication);
|
||||
}
|
||||
|
||||
|
@ -168,13 +177,15 @@ namespace CoreFoundation
|
|||
|
||||
public static bool GetAppBooleanValue (string key)
|
||||
{
|
||||
if (CurrentApplication is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (CurrentApplication));
|
||||
return GetAppBooleanValue (key, CurrentApplication);
|
||||
}
|
||||
|
||||
public static bool GetAppBooleanValue (string key, string applicationId)
|
||||
{
|
||||
if (applicationId == null) {
|
||||
throw new ArgumentNullException ("applicationId");
|
||||
if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
using (var nsApplicationId = new NSString (applicationId)) {
|
||||
|
@ -184,10 +195,10 @@ namespace CoreFoundation
|
|||
|
||||
public static bool GetAppBooleanValue (string key, NSString applicationId)
|
||||
{
|
||||
if (key == null) {
|
||||
throw new ArgumentNullException ("key");
|
||||
} else if (applicationId == null) {
|
||||
throw new ArgumentNullException ("applicationId");
|
||||
if (key is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (key));
|
||||
} else if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
using (var cfKey = new CFString (key)) {
|
||||
|
@ -201,13 +212,15 @@ namespace CoreFoundation
|
|||
|
||||
public static nint GetAppIntegerValue (string key)
|
||||
{
|
||||
if (CurrentApplication is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (CurrentApplication));
|
||||
return GetAppIntegerValue (key, CurrentApplication);
|
||||
}
|
||||
|
||||
public static nint GetAppIntegerValue (string key, string applicationId)
|
||||
{
|
||||
if (applicationId == null) {
|
||||
throw new ArgumentNullException ("applicationId");
|
||||
if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
using (var nsApplicationId = new NSString (applicationId)) {
|
||||
|
@ -217,10 +230,10 @@ namespace CoreFoundation
|
|||
|
||||
public static nint GetAppIntegerValue (string key, NSString applicationId)
|
||||
{
|
||||
if (key == null) {
|
||||
throw new ArgumentNullException ("key");
|
||||
} else if (applicationId == null) {
|
||||
throw new ArgumentNullException ("applicationId");
|
||||
if (key is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (key));
|
||||
} else if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
using (var cfKey = new CFString (key)) {
|
||||
|
@ -233,13 +246,15 @@ namespace CoreFoundation
|
|||
|
||||
public static void AddSuitePreferencesToApp (string suiteId)
|
||||
{
|
||||
if (CurrentApplication is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (CurrentApplication));
|
||||
AddSuitePreferencesToApp (CurrentApplication, suiteId);
|
||||
}
|
||||
|
||||
public static void AddSuitePreferencesToApp (string applicationId, string suiteId)
|
||||
{
|
||||
if (applicationId == null) {
|
||||
throw new ArgumentNullException (applicationId);
|
||||
if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
using (var nsApplicationId = new NSString (applicationId)) {
|
||||
|
@ -249,10 +264,10 @@ namespace CoreFoundation
|
|||
|
||||
public static void AddSuitePreferencesToApp (NSString applicationId, string suiteId)
|
||||
{
|
||||
if (applicationId == null) {
|
||||
throw new ArgumentNullException ("applicationId");
|
||||
} else if (suiteId == null) {
|
||||
throw new ArgumentNullException ("suiteId");
|
||||
if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
} else if (suiteId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (suiteId));
|
||||
}
|
||||
|
||||
using (var cfSuiteId = new CFString (suiteId)) {
|
||||
|
@ -265,13 +280,15 @@ namespace CoreFoundation
|
|||
|
||||
public static void RemoveSuitePreferencesFromApp (string suiteId)
|
||||
{
|
||||
if (CurrentApplication is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (CurrentApplication));
|
||||
RemoveSuitePreferencesFromApp (CurrentApplication, suiteId);
|
||||
}
|
||||
|
||||
public static void RemoveSuitePreferencesFromApp (string applicationId, string suiteId)
|
||||
{
|
||||
if (applicationId == null) {
|
||||
throw new ArgumentNullException (applicationId);
|
||||
if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
using (var nsApplicationId = new NSString (applicationId)) {
|
||||
|
@ -281,10 +298,10 @@ namespace CoreFoundation
|
|||
|
||||
public static void RemoveSuitePreferencesFromApp (NSString applicationId, string suiteId)
|
||||
{
|
||||
if (applicationId == null) {
|
||||
throw new ArgumentNullException ("applicationId");
|
||||
} else if (suiteId == null) {
|
||||
throw new ArgumentNullException ("suiteId");
|
||||
if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
} else if (suiteId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (suiteId));
|
||||
}
|
||||
|
||||
using (var cfSuiteId = new CFString (suiteId)) {
|
||||
|
@ -298,13 +315,15 @@ namespace CoreFoundation
|
|||
|
||||
public static bool AppSynchronize ()
|
||||
{
|
||||
if (CurrentApplication is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (CurrentApplication));
|
||||
return AppSynchronize (CurrentApplication);
|
||||
}
|
||||
|
||||
public static bool AppSynchronize (string applicationId)
|
||||
{
|
||||
if (applicationId == null) {
|
||||
throw new ArgumentNullException (applicationId);
|
||||
if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
using (var nsApplicationId = new NSString (applicationId)) {
|
||||
|
@ -314,8 +333,8 @@ namespace CoreFoundation
|
|||
|
||||
public static bool AppSynchronize (NSString applicationId)
|
||||
{
|
||||
if (applicationId == null) {
|
||||
throw new ArgumentNullException ("applicationId");
|
||||
if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
return CFPreferencesAppSynchronize (applicationId.Handle);
|
||||
|
@ -327,13 +346,15 @@ namespace CoreFoundation
|
|||
|
||||
public static bool AppValueIsForced (string key)
|
||||
{
|
||||
if (CurrentApplication is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (CurrentApplication));
|
||||
return AppValueIsForced (key, CurrentApplication);
|
||||
}
|
||||
|
||||
public static bool AppValueIsForced (string key, string applicationId)
|
||||
{
|
||||
if (applicationId == null) {
|
||||
throw new ArgumentNullException (applicationId);
|
||||
if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
using (var nsApplicationId = new NSString (applicationId)) {
|
||||
|
@ -343,10 +364,10 @@ namespace CoreFoundation
|
|||
|
||||
public static bool AppValueIsForced (string key, NSString applicationId)
|
||||
{
|
||||
if (key == null) {
|
||||
throw new ArgumentNullException ("key");
|
||||
} else if (applicationId == null) {
|
||||
throw new ArgumentNullException ("applicationId");
|
||||
if (key is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (key));
|
||||
} else if (applicationId is null) {
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (applicationId));
|
||||
}
|
||||
|
||||
using (var cfKey = new CFString (key)) {
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace CoreFoundation
|
|||
FromData (NSData data, CFPropertyListMutabilityOptions options = CFPropertyListMutabilityOptions.Immutable)
|
||||
{
|
||||
if (data is null)
|
||||
throw new ArgumentNullException (nameof (data));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (data));
|
||||
if (data.Handle == IntPtr.Zero)
|
||||
throw new ObjectDisposedException (nameof (data));
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
#if !WATCH
|
||||
|
||||
using System;
|
||||
|
@ -68,10 +70,10 @@ namespace CoreFoundation {
|
|||
#region Property Keys
|
||||
|
||||
#if !MONOMAC
|
||||
static NSString kCFProxyAutoConfigurationHTTPResponseKey;
|
||||
static NSString AutoConfigurationHTTPResponseKey {
|
||||
static NSString? kCFProxyAutoConfigurationHTTPResponseKey;
|
||||
static NSString? AutoConfigurationHTTPResponseKey {
|
||||
get {
|
||||
if (kCFProxyAutoConfigurationHTTPResponseKey == null)
|
||||
if (kCFProxyAutoConfigurationHTTPResponseKey is null)
|
||||
kCFProxyAutoConfigurationHTTPResponseKey = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyAutoConfigurationHTTPResponseKey");
|
||||
|
||||
return kCFProxyAutoConfigurationHTTPResponseKey;
|
||||
|
@ -79,70 +81,70 @@ namespace CoreFoundation {
|
|||
}
|
||||
#endif
|
||||
|
||||
static NSString kCFProxyAutoConfigurationJavaScriptKey;
|
||||
static NSString AutoConfigurationJavaScriptKey {
|
||||
static NSString? kCFProxyAutoConfigurationJavaScriptKey;
|
||||
static NSString? AutoConfigurationJavaScriptKey {
|
||||
get {
|
||||
if (kCFProxyAutoConfigurationJavaScriptKey == null)
|
||||
if (kCFProxyAutoConfigurationJavaScriptKey is null)
|
||||
kCFProxyAutoConfigurationJavaScriptKey = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyAutoConfigurationJavaScriptKey");
|
||||
|
||||
return kCFProxyAutoConfigurationJavaScriptKey;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFProxyAutoConfigurationURLKey;
|
||||
static NSString AutoConfigurationURLKey {
|
||||
static NSString? kCFProxyAutoConfigurationURLKey;
|
||||
static NSString? AutoConfigurationURLKey {
|
||||
get {
|
||||
if (kCFProxyAutoConfigurationURLKey == null)
|
||||
if (kCFProxyAutoConfigurationURLKey is null)
|
||||
kCFProxyAutoConfigurationURLKey = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyAutoConfigurationURLKey");
|
||||
|
||||
return kCFProxyAutoConfigurationURLKey;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFProxyHostNameKey;
|
||||
static NSString HostNameKey {
|
||||
static NSString? kCFProxyHostNameKey;
|
||||
static NSString? HostNameKey {
|
||||
get {
|
||||
if (kCFProxyHostNameKey == null)
|
||||
if (kCFProxyHostNameKey is null)
|
||||
kCFProxyHostNameKey = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyHostNameKey");
|
||||
|
||||
return kCFProxyHostNameKey;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFProxyPasswordKey;
|
||||
static NSString PasswordKey {
|
||||
static NSString? kCFProxyPasswordKey;
|
||||
static NSString? PasswordKey {
|
||||
get {
|
||||
if (kCFProxyPasswordKey == null)
|
||||
if (kCFProxyPasswordKey is null)
|
||||
kCFProxyPasswordKey = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyPasswordKey");
|
||||
|
||||
return kCFProxyPasswordKey;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFProxyPortNumberKey;
|
||||
static NSString PortNumberKey {
|
||||
static NSString? kCFProxyPortNumberKey;
|
||||
static NSString? PortNumberKey {
|
||||
get {
|
||||
if (kCFProxyPortNumberKey == null)
|
||||
if (kCFProxyPortNumberKey is null)
|
||||
kCFProxyPortNumberKey = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyPortNumberKey");
|
||||
|
||||
return kCFProxyPortNumberKey;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFProxyTypeKey;
|
||||
static NSString ProxyTypeKey {
|
||||
static NSString? kCFProxyTypeKey;
|
||||
static NSString? ProxyTypeKey {
|
||||
get {
|
||||
if (kCFProxyTypeKey == null)
|
||||
if (kCFProxyTypeKey is null)
|
||||
kCFProxyTypeKey = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyTypeKey");
|
||||
|
||||
return kCFProxyTypeKey;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFProxyUsernameKey;
|
||||
static NSString UsernameKey {
|
||||
static NSString? kCFProxyUsernameKey;
|
||||
static NSString? UsernameKey {
|
||||
get {
|
||||
if (kCFProxyUsernameKey == null)
|
||||
if (kCFProxyUsernameKey is null)
|
||||
kCFProxyUsernameKey = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyUsernameKey");
|
||||
|
||||
return kCFProxyUsernameKey;
|
||||
|
@ -151,70 +153,70 @@ namespace CoreFoundation {
|
|||
#endregion Property Keys
|
||||
|
||||
#region Proxy Types
|
||||
static NSString kCFProxyTypeNone;
|
||||
static NSString CFProxyTypeNone {
|
||||
static NSString? kCFProxyTypeNone;
|
||||
static NSString? CFProxyTypeNone {
|
||||
get {
|
||||
if (kCFProxyTypeNone == null)
|
||||
if (kCFProxyTypeNone is null)
|
||||
kCFProxyTypeNone = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyTypeNone");
|
||||
|
||||
return kCFProxyTypeNone;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFProxyTypeAutoConfigurationURL;
|
||||
static NSString CFProxyTypeAutoConfigurationURL {
|
||||
static NSString? kCFProxyTypeAutoConfigurationURL;
|
||||
static NSString? CFProxyTypeAutoConfigurationURL {
|
||||
get {
|
||||
if (kCFProxyTypeAutoConfigurationURL == null)
|
||||
if (kCFProxyTypeAutoConfigurationURL is null)
|
||||
kCFProxyTypeAutoConfigurationURL = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyTypeAutoConfigurationURL");
|
||||
|
||||
return kCFProxyTypeAutoConfigurationURL;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFProxyTypeAutoConfigurationJavaScript;
|
||||
static NSString CFProxyTypeAutoConfigurationJavaScript {
|
||||
static NSString? kCFProxyTypeAutoConfigurationJavaScript;
|
||||
static NSString? CFProxyTypeAutoConfigurationJavaScript {
|
||||
get {
|
||||
if (kCFProxyTypeAutoConfigurationJavaScript == null)
|
||||
if (kCFProxyTypeAutoConfigurationJavaScript is null)
|
||||
kCFProxyTypeAutoConfigurationJavaScript = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyTypeAutoConfigurationJavaScript");
|
||||
|
||||
return kCFProxyTypeAutoConfigurationJavaScript;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFProxyTypeFTP;
|
||||
static NSString CFProxyTypeFTP {
|
||||
static NSString? kCFProxyTypeFTP;
|
||||
static NSString? CFProxyTypeFTP {
|
||||
get {
|
||||
if (kCFProxyTypeFTP == null)
|
||||
if (kCFProxyTypeFTP is null)
|
||||
kCFProxyTypeFTP = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyTypeFTP");
|
||||
|
||||
return kCFProxyTypeFTP;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFProxyTypeHTTP;
|
||||
static NSString CFProxyTypeHTTP {
|
||||
static NSString? kCFProxyTypeHTTP;
|
||||
static NSString? CFProxyTypeHTTP {
|
||||
get {
|
||||
if (kCFProxyTypeHTTP == null)
|
||||
if (kCFProxyTypeHTTP is null)
|
||||
kCFProxyTypeHTTP = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyTypeHTTP");
|
||||
|
||||
return kCFProxyTypeHTTP;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFProxyTypeHTTPS;
|
||||
static NSString CFProxyTypeHTTPS {
|
||||
static NSString? kCFProxyTypeHTTPS;
|
||||
static NSString? CFProxyTypeHTTPS {
|
||||
get {
|
||||
if (kCFProxyTypeHTTPS == null)
|
||||
if (kCFProxyTypeHTTPS is null)
|
||||
kCFProxyTypeHTTPS = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyTypeHTTPS");
|
||||
|
||||
return kCFProxyTypeHTTPS;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFProxyTypeSOCKS;
|
||||
static NSString CFProxyTypeSOCKS {
|
||||
static NSString? kCFProxyTypeSOCKS;
|
||||
static NSString? CFProxyTypeSOCKS {
|
||||
get {
|
||||
if (kCFProxyTypeSOCKS == null)
|
||||
if (kCFProxyTypeSOCKS is null)
|
||||
kCFProxyTypeSOCKS = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFProxyTypeSOCKS");
|
||||
|
||||
return kCFProxyTypeSOCKS;
|
||||
|
@ -224,32 +226,32 @@ namespace CoreFoundation {
|
|||
|
||||
static CFProxyType CFProxyTypeToEnum (NSString type)
|
||||
{
|
||||
if (CFProxyTypeAutoConfigurationJavaScript != null) {
|
||||
if (CFProxyTypeAutoConfigurationJavaScript is not null) {
|
||||
if (type.Handle == CFProxyTypeAutoConfigurationJavaScript.Handle)
|
||||
return CFProxyType.AutoConfigurationJavaScript;
|
||||
}
|
||||
|
||||
if (CFProxyTypeAutoConfigurationURL != null) {
|
||||
if (CFProxyTypeAutoConfigurationURL is not null) {
|
||||
if (type.Handle == CFProxyTypeAutoConfigurationURL.Handle)
|
||||
return CFProxyType.AutoConfigurationUrl;
|
||||
}
|
||||
|
||||
if (CFProxyTypeFTP != null) {
|
||||
if (CFProxyTypeFTP is not null) {
|
||||
if (type.Handle == CFProxyTypeFTP.Handle)
|
||||
return CFProxyType.FTP;
|
||||
}
|
||||
|
||||
if (CFProxyTypeHTTP != null) {
|
||||
if (CFProxyTypeHTTP is not null) {
|
||||
if (type.Handle == CFProxyTypeHTTP.Handle)
|
||||
return CFProxyType.HTTP;
|
||||
}
|
||||
|
||||
if (CFProxyTypeHTTP != null) {
|
||||
if (CFProxyTypeHTTPS is not null) {
|
||||
if (type.Handle == CFProxyTypeHTTPS.Handle)
|
||||
return CFProxyType.HTTPS;
|
||||
}
|
||||
|
||||
if (CFProxyTypeSOCKS != null) {
|
||||
if (CFProxyTypeSOCKS is not null) {
|
||||
if (type.Handle == CFProxyTypeSOCKS.Handle)
|
||||
return CFProxyType.SOCKS;
|
||||
}
|
||||
|
@ -266,74 +268,74 @@ namespace CoreFoundation {
|
|||
}
|
||||
#endif
|
||||
|
||||
public NSString AutoConfigurationJavaScript {
|
||||
public NSString? AutoConfigurationJavaScript {
|
||||
get {
|
||||
if (AutoConfigurationJavaScriptKey == null)
|
||||
if (AutoConfigurationJavaScriptKey is null)
|
||||
return null;
|
||||
|
||||
return (NSString) settings[AutoConfigurationJavaScriptKey];
|
||||
}
|
||||
}
|
||||
|
||||
public NSUrl AutoConfigurationUrl {
|
||||
public NSUrl? AutoConfigurationUrl {
|
||||
get {
|
||||
if (AutoConfigurationURLKey == null)
|
||||
if (AutoConfigurationURLKey is null)
|
||||
return null;
|
||||
|
||||
return (NSUrl) settings[AutoConfigurationURLKey];
|
||||
}
|
||||
}
|
||||
|
||||
public string HostName {
|
||||
public string? HostName {
|
||||
get {
|
||||
if (HostNameKey == null)
|
||||
if (HostNameKey is null)
|
||||
return null;
|
||||
|
||||
NSString v = (NSString) settings[HostNameKey];
|
||||
|
||||
return v != null ? v.ToString () : null;
|
||||
return v?.ToString ();
|
||||
}
|
||||
}
|
||||
|
||||
public string Password {
|
||||
public string? Password {
|
||||
get {
|
||||
if (PasswordKey == null)
|
||||
if (PasswordKey is null)
|
||||
return null;
|
||||
|
||||
NSString v = (NSString) settings[PasswordKey];
|
||||
|
||||
return v != null ? v.ToString () : null;
|
||||
return v?.ToString ();
|
||||
}
|
||||
}
|
||||
|
||||
public int Port {
|
||||
get {
|
||||
if (PortNumberKey == null)
|
||||
if (PortNumberKey is null)
|
||||
return 0;
|
||||
|
||||
NSNumber v = (NSNumber) settings[PortNumberKey];
|
||||
|
||||
return v != null ? v.Int32Value : 0;
|
||||
return v?.Int32Value ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
public CFProxyType ProxyType {
|
||||
get {
|
||||
if (ProxyTypeKey == null)
|
||||
if (ProxyTypeKey is null)
|
||||
return CFProxyType.None;
|
||||
|
||||
return CFProxyTypeToEnum ((NSString) settings[ProxyTypeKey]);
|
||||
}
|
||||
}
|
||||
|
||||
public string Username {
|
||||
public string? Username {
|
||||
get {
|
||||
if (UsernameKey == null)
|
||||
if (UsernameKey is null)
|
||||
return null;
|
||||
|
||||
NSString v = (NSString) settings[UsernameKey];
|
||||
|
||||
return v != null ? v.ToString () : null;
|
||||
return v?.ToString ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -357,40 +359,40 @@ namespace CoreFoundation {
|
|||
}
|
||||
|
||||
#region Global Proxy Setting Constants
|
||||
static NSString kCFNetworkProxiesHTTPEnable;
|
||||
static NSString CFNetworkProxiesHTTPEnable {
|
||||
static NSString? kCFNetworkProxiesHTTPEnable;
|
||||
static NSString? CFNetworkProxiesHTTPEnable {
|
||||
get {
|
||||
if (kCFNetworkProxiesHTTPEnable == null)
|
||||
if (kCFNetworkProxiesHTTPEnable is null)
|
||||
kCFNetworkProxiesHTTPEnable = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFNetworkProxiesHTTPEnable");
|
||||
|
||||
return kCFNetworkProxiesHTTPEnable;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFNetworkProxiesHTTPPort;
|
||||
static NSString CFNetworkProxiesHTTPPort {
|
||||
static NSString? kCFNetworkProxiesHTTPPort;
|
||||
static NSString? CFNetworkProxiesHTTPPort {
|
||||
get {
|
||||
if (kCFNetworkProxiesHTTPPort == null)
|
||||
if (kCFNetworkProxiesHTTPPort is null)
|
||||
kCFNetworkProxiesHTTPPort = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFNetworkProxiesHTTPPort");
|
||||
|
||||
return kCFNetworkProxiesHTTPPort;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFNetworkProxiesHTTPProxy;
|
||||
static NSString CFNetworkProxiesHTTPProxy {
|
||||
static NSString? kCFNetworkProxiesHTTPProxy;
|
||||
static NSString? CFNetworkProxiesHTTPProxy {
|
||||
get {
|
||||
if (kCFNetworkProxiesHTTPProxy == null)
|
||||
if (kCFNetworkProxiesHTTPProxy is null)
|
||||
kCFNetworkProxiesHTTPProxy = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFNetworkProxiesHTTPProxy");
|
||||
|
||||
return kCFNetworkProxiesHTTPProxy;
|
||||
}
|
||||
}
|
||||
|
||||
static NSString kCFNetworkProxiesProxyAutoConfigEnable;
|
||||
static NSString CFNetworkProxiesProxyAutoConfigEnable {
|
||||
static NSString? kCFNetworkProxiesProxyAutoConfigEnable;
|
||||
static NSString? CFNetworkProxiesProxyAutoConfigEnable {
|
||||
get {
|
||||
if (kCFNetworkProxiesProxyAutoConfigEnable == null)
|
||||
if (kCFNetworkProxiesProxyAutoConfigEnable is null)
|
||||
kCFNetworkProxiesProxyAutoConfigEnable = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFNetworkProxiesProxyAutoConfigEnable");
|
||||
|
||||
return kCFNetworkProxiesProxyAutoConfigEnable;
|
||||
|
@ -398,10 +400,10 @@ namespace CoreFoundation {
|
|||
}
|
||||
|
||||
#if !MONOMAC
|
||||
static NSString kCFNetworkProxiesProxyAutoConfigJavaScript;
|
||||
static NSString CFNetworkProxiesProxyAutoConfigJavaScript {
|
||||
static NSString? kCFNetworkProxiesProxyAutoConfigJavaScript;
|
||||
static NSString? CFNetworkProxiesProxyAutoConfigJavaScript {
|
||||
get {
|
||||
if (kCFNetworkProxiesProxyAutoConfigJavaScript == null)
|
||||
if (kCFNetworkProxiesProxyAutoConfigJavaScript is null)
|
||||
kCFNetworkProxiesProxyAutoConfigJavaScript = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFNetworkProxiesProxyAutoConfigJavaScript");
|
||||
|
||||
return kCFNetworkProxiesProxyAutoConfigJavaScript;
|
||||
|
@ -409,10 +411,10 @@ namespace CoreFoundation {
|
|||
}
|
||||
#endif
|
||||
|
||||
static NSString kCFNetworkProxiesProxyAutoConfigURLString;
|
||||
static NSString CFNetworkProxiesProxyAutoConfigURLString {
|
||||
static NSString? kCFNetworkProxiesProxyAutoConfigURLString;
|
||||
static NSString? CFNetworkProxiesProxyAutoConfigURLString {
|
||||
get {
|
||||
if (kCFNetworkProxiesProxyAutoConfigURLString == null)
|
||||
if (kCFNetworkProxiesProxyAutoConfigURLString is null)
|
||||
kCFNetworkProxiesProxyAutoConfigURLString = Dlfcn.GetStringConstant (Libraries.CFNetwork.Handle, "kCFNetworkProxiesProxyAutoConfigURLString");
|
||||
|
||||
return kCFNetworkProxiesProxyAutoConfigURLString;
|
||||
|
@ -422,69 +424,69 @@ namespace CoreFoundation {
|
|||
|
||||
public bool HTTPEnable {
|
||||
get {
|
||||
if (CFNetworkProxiesHTTPEnable == null)
|
||||
if (CFNetworkProxiesHTTPEnable is null)
|
||||
return false;
|
||||
|
||||
NSNumber v = (NSNumber) settings[CFNetworkProxiesHTTPEnable];
|
||||
|
||||
return v != null ? v.BoolValue : false;
|
||||
return v?.BoolValue ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
public int HTTPPort {
|
||||
get {
|
||||
if (CFNetworkProxiesHTTPPort == null)
|
||||
if (CFNetworkProxiesHTTPPort is null)
|
||||
return 0;
|
||||
|
||||
NSNumber v = (NSNumber) settings[CFNetworkProxiesHTTPPort];
|
||||
|
||||
return v != null ? v.Int32Value : 0;
|
||||
return v?.Int32Value ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
public string HTTPProxy {
|
||||
public string? HTTPProxy {
|
||||
get {
|
||||
if (CFNetworkProxiesHTTPProxy == null)
|
||||
if (CFNetworkProxiesHTTPProxy is null)
|
||||
return null;
|
||||
|
||||
NSString v = (NSString) settings[CFNetworkProxiesHTTPProxy];
|
||||
|
||||
return v != null ? v.ToString () : null;
|
||||
return v?.ToString ();
|
||||
}
|
||||
}
|
||||
|
||||
public bool ProxyAutoConfigEnable {
|
||||
get {
|
||||
if (CFNetworkProxiesProxyAutoConfigEnable == null)
|
||||
if (CFNetworkProxiesProxyAutoConfigEnable is null)
|
||||
return false;
|
||||
|
||||
NSNumber v = (NSNumber) settings[CFNetworkProxiesProxyAutoConfigEnable];
|
||||
|
||||
return v != null ? v.BoolValue : false;
|
||||
return v?.BoolValue ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
#if !MONOMAC
|
||||
public string ProxyAutoConfigJavaScript {
|
||||
public string? ProxyAutoConfigJavaScript {
|
||||
get {
|
||||
if (CFNetworkProxiesProxyAutoConfigJavaScript == null)
|
||||
if (CFNetworkProxiesProxyAutoConfigJavaScript is null)
|
||||
return null;
|
||||
|
||||
NSString v = (NSString) settings[CFNetworkProxiesProxyAutoConfigJavaScript];
|
||||
|
||||
return v != null ? v.ToString () : null;
|
||||
return v?.ToString ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public string ProxyAutoConfigURLString {
|
||||
public string? ProxyAutoConfigURLString {
|
||||
get {
|
||||
if (CFNetworkProxiesProxyAutoConfigURLString == null)
|
||||
if (CFNetworkProxiesProxyAutoConfigURLString is null)
|
||||
return null;
|
||||
|
||||
NSString v = (NSString) settings[CFNetworkProxiesProxyAutoConfigURLString];
|
||||
|
||||
return v != null ? v.ToString () : null;
|
||||
return v?.ToString ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -501,27 +503,27 @@ namespace CoreFoundation {
|
|||
/* CFStringRef __nonnull */ IntPtr proxyAutoConfigurationScript,
|
||||
/* CFURLRef __nonnull */ IntPtr targetURL, /* CFErrorRef __nullable * __nullable */ out IntPtr error);
|
||||
|
||||
static NSArray CopyProxiesForAutoConfigurationScript (NSString proxyAutoConfigurationScript, NSUrl targetURL)
|
||||
static NSArray? CopyProxiesForAutoConfigurationScript (NSString proxyAutoConfigurationScript, NSUrl targetURL)
|
||||
{
|
||||
IntPtr err;
|
||||
IntPtr native = CFNetworkCopyProxiesForAutoConfigurationScript (proxyAutoConfigurationScript.Handle, targetURL.Handle, out err);
|
||||
return native == IntPtr.Zero ? null : new NSArray (native);
|
||||
}
|
||||
|
||||
public static CFProxy[] GetProxiesForAutoConfigurationScript (NSString proxyAutoConfigurationScript, NSUrl targetURL)
|
||||
public static CFProxy[]? GetProxiesForAutoConfigurationScript (NSString proxyAutoConfigurationScript, NSUrl targetURL)
|
||||
{
|
||||
if (proxyAutoConfigurationScript == null)
|
||||
throw new ArgumentNullException ("proxyAutoConfigurationScript");
|
||||
if (proxyAutoConfigurationScript is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (proxyAutoConfigurationScript));
|
||||
|
||||
if (targetURL == null)
|
||||
throw new ArgumentNullException ("targetURL");
|
||||
if (targetURL is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (targetURL));
|
||||
|
||||
using (var array = CopyProxiesForAutoConfigurationScript (proxyAutoConfigurationScript, targetURL)) {
|
||||
if (array == null)
|
||||
if (array is null)
|
||||
return null;
|
||||
|
||||
NSDictionary[] dictionaries = NSArray.ArrayFromHandle<NSDictionary> (array.Handle);
|
||||
if (dictionaries == null)
|
||||
if (dictionaries is null)
|
||||
return null;
|
||||
|
||||
CFProxy[] proxies = new CFProxy [dictionaries.Length];
|
||||
|
@ -532,15 +534,18 @@ namespace CoreFoundation {
|
|||
}
|
||||
}
|
||||
|
||||
public static CFProxy[] GetProxiesForAutoConfigurationScript (NSString proxyAutoConfigurationScript, Uri targetUri)
|
||||
public static CFProxy[]? GetProxiesForAutoConfigurationScript (NSString proxyAutoConfigurationScript, Uri targetUri)
|
||||
{
|
||||
// proxyAutoConfigurationScript checked later
|
||||
if (targetUri == null)
|
||||
throw new ArgumentNullException ("targetUri");
|
||||
if (targetUri is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (targetUri));
|
||||
|
||||
using (var targetURL = NSUrl.FromString (targetUri.AbsoluteUri))
|
||||
using (var targetURL = NSUrl.FromString (targetUri.AbsoluteUri)) {
|
||||
if (targetURL is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (targetURL));
|
||||
return GetProxiesForAutoConfigurationScript (proxyAutoConfigurationScript, targetURL);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport (Constants.CFNetworkLibrary)]
|
||||
// CFArrayRef CFNetworkCopyProxiesForURL (CFURLRef url, CFDictionaryRef proxySettings);
|
||||
|
@ -548,26 +553,29 @@ namespace CoreFoundation {
|
|||
/* CFURLRef __nonnull */ IntPtr url,
|
||||
/* CFDictionaryRef __nonnull */ IntPtr proxySettings);
|
||||
|
||||
static NSArray CopyProxiesForURL (NSUrl url, NSDictionary proxySettings)
|
||||
static NSArray? CopyProxiesForURL (NSUrl url, NSDictionary proxySettings)
|
||||
{
|
||||
IntPtr native = CFNetworkCopyProxiesForURL (url.Handle, proxySettings.Handle);
|
||||
return native == IntPtr.Zero ? null : new NSArray (native);
|
||||
}
|
||||
|
||||
public static CFProxy[] GetProxiesForURL (NSUrl url, CFProxySettings proxySettings)
|
||||
public static CFProxy[]? GetProxiesForURL (NSUrl url, CFProxySettings? proxySettings)
|
||||
{
|
||||
if (url == null)
|
||||
throw new ArgumentNullException ("url");
|
||||
if (url is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
|
||||
|
||||
if (proxySettings == null)
|
||||
if (proxySettings is null)
|
||||
proxySettings = GetSystemProxySettings ();
|
||||
|
||||
using (NSArray array = CopyProxiesForURL (url, proxySettings.Dictionary)) {
|
||||
if (array == null)
|
||||
if (proxySettings is null)
|
||||
return null;
|
||||
|
||||
using (NSArray? array = CopyProxiesForURL (url, proxySettings.Dictionary)) {
|
||||
if (array is null)
|
||||
return null;
|
||||
|
||||
NSDictionary[] dictionaries = NSArray.ArrayFromHandle<NSDictionary> (array.Handle);
|
||||
if (dictionaries == null)
|
||||
if (dictionaries is null)
|
||||
return null;
|
||||
|
||||
CFProxy[] proxies = new CFProxy [dictionaries.Length];
|
||||
|
@ -578,19 +586,22 @@ namespace CoreFoundation {
|
|||
}
|
||||
}
|
||||
|
||||
public static CFProxy[] GetProxiesForUri (Uri uri, CFProxySettings proxySettings)
|
||||
public static CFProxy[]? GetProxiesForUri (Uri uri, CFProxySettings? proxySettings)
|
||||
{
|
||||
if (uri == null)
|
||||
throw new ArgumentNullException ("uri");
|
||||
if (uri is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (uri));
|
||||
|
||||
using (NSUrl url = NSUrl.FromString (uri.AbsoluteUri))
|
||||
using (NSUrl? url = NSUrl.FromString (uri.AbsoluteUri)) {
|
||||
if (url is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
|
||||
return GetProxiesForURL (url, proxySettings);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport (Constants.CFNetworkLibrary)]
|
||||
extern static /* CFDictionaryRef __nullable */ IntPtr CFNetworkCopySystemProxySettings ();
|
||||
|
||||
public static CFProxySettings GetSystemProxySettings ()
|
||||
public static CFProxySettings? GetSystemProxySettings ()
|
||||
{
|
||||
IntPtr native = CFNetworkCopySystemProxySettings ();
|
||||
|
||||
|
@ -608,16 +619,16 @@ namespace CoreFoundation {
|
|||
// helper delegate to reuse code
|
||||
delegate IntPtr CreatePACCFRunLoopSource (CFProxyAutoConfigurationResultCallbackInternal cb, ref CFStreamClientContext context);
|
||||
|
||||
static CFProxy[] ParseProxies (IntPtr proxyList)
|
||||
static CFProxy[]? ParseProxies (IntPtr proxyList)
|
||||
{
|
||||
CFProxy[] proxies = null;
|
||||
CFProxy[]? proxies = null;
|
||||
if (proxyList != IntPtr.Zero) {
|
||||
// it was retained in the cbs.
|
||||
using (var array = new CFArray (proxyList, false)) {
|
||||
proxies = new CFProxy [array.Count];
|
||||
for (int i = 0; i < proxies.Length; i++) {
|
||||
var dict = Runtime.GetNSObject<NSDictionary> (array.GetValue (i));
|
||||
proxies[i] = new CFProxy (dict);
|
||||
proxies[i] = new CFProxy (dict!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -631,7 +642,7 @@ namespace CoreFoundation {
|
|||
public IntPtr ErrorPtr; // Pointer to the Error
|
||||
public IntPtr CFRunLoopPtr; // Pointer to the runloop, needed to be stopped
|
||||
|
||||
public CFProxy [] ProxyList {
|
||||
public CFProxy []? ProxyList {
|
||||
get {
|
||||
if (ProxyListPtr != IntPtr.Zero)
|
||||
return ParseProxies (ProxyListPtr);
|
||||
|
@ -639,7 +650,7 @@ namespace CoreFoundation {
|
|||
}
|
||||
}
|
||||
|
||||
public NSError Error {
|
||||
public NSError? Error {
|
||||
get {
|
||||
if (ErrorPtr != IntPtr.Zero)
|
||||
return Runtime.GetNSObject<NSError> (ErrorPtr);
|
||||
|
@ -658,7 +669,7 @@ namespace CoreFoundation {
|
|||
// CFNetworkExecuteProxyAutoConfigurationScript or CFNetworkExecuteProxyAutoConfigurationURL call
|
||||
// that triggered this callback.
|
||||
// Well, that is NOT TRUE, the client passed is the client.Info pointer not the client.
|
||||
var pacCbData = (PACProxyCallbackData) Marshal.PtrToStructure (client, typeof (PACProxyCallbackData));
|
||||
var pacCbData = (PACProxyCallbackData) Marshal.PtrToStructure (client, typeof (PACProxyCallbackData))!;
|
||||
// make sure is not released, will be released by the parsing method.
|
||||
if (proxyList != IntPtr.Zero) {
|
||||
CFObject.CFRetain (proxyList);
|
||||
|
@ -674,10 +685,10 @@ namespace CoreFoundation {
|
|||
runLoop.Stop ();
|
||||
}
|
||||
|
||||
static async Task<(CFProxy[] proxies, NSError error)> ExecutePacCFRunLoopSourceAsync (CreatePACCFRunLoopSource factory, CancellationToken cancellationToken)
|
||||
static async Task<(CFProxy[]? proxies, NSError? error)> ExecutePacCFRunLoopSourceAsync (CreatePACCFRunLoopSource factory, CancellationToken cancellationToken)
|
||||
{
|
||||
CFProxy[] proxies = null;
|
||||
NSError outError = null;
|
||||
CFProxy[]? proxies = null;
|
||||
NSError? outError = null;
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
throw new OperationCanceledException ("Operation was cancelled.");
|
||||
|
||||
|
@ -717,7 +728,7 @@ namespace CoreFoundation {
|
|||
if (cancellationToken.IsCancellationRequested)
|
||||
throw new OperationCanceledException ("Operation was cancelled.");
|
||||
|
||||
pacCbData = (PACProxyCallbackData) Marshal.PtrToStructure (pacDataPtr, typeof (PACProxyCallbackData));
|
||||
pacCbData = (PACProxyCallbackData) Marshal.PtrToStructure (pacDataPtr, typeof (PACProxyCallbackData))!;
|
||||
// get data from the struct
|
||||
proxies = pacCbData.ProxyList;
|
||||
outError = pacCbData.Error;
|
||||
|
@ -736,7 +747,7 @@ namespace CoreFoundation {
|
|||
return (proxies: proxies, error: outError);
|
||||
}
|
||||
|
||||
static CFProxy[] ExecutePacCFRunLoopSourceBlocking (CreatePACCFRunLoopSource factory, out NSError outError)
|
||||
static CFProxy[]? ExecutePacCFRunLoopSourceBlocking (CreatePACCFRunLoopSource factory, out NSError? outError)
|
||||
{
|
||||
var runLoop = CFRunLoop.Current;
|
||||
outError = null;
|
||||
|
@ -757,7 +768,7 @@ namespace CoreFoundation {
|
|||
runLoop.RunInMode (mode, double.MaxValue, false);
|
||||
runLoop.RemoveSource (loopSource, mode);
|
||||
}
|
||||
pacCbData = (PACProxyCallbackData) Marshal.PtrToStructure (pacDataPtr, typeof (PACProxyCallbackData));
|
||||
pacCbData = (PACProxyCallbackData) Marshal.PtrToStructure (pacDataPtr, typeof (PACProxyCallbackData))!;
|
||||
// get data from the struct
|
||||
outError = pacCbData.Error;
|
||||
return pacCbData.ProxyList;
|
||||
|
@ -777,14 +788,14 @@ namespace CoreFoundation {
|
|||
/* CFProxyAutoConfigurationResultCallback __nonnull */ CFProxyAutoConfigurationResultCallbackInternal cb,
|
||||
/* CFStreamClientContext * __nonnull */ ref CFStreamClientContext clientContext);
|
||||
|
||||
public static CFProxy[] ExecuteProxyAutoConfigurationScript (string proxyAutoConfigurationScript, Uri targetUrl, out NSError outError)
|
||||
public static CFProxy[]? ExecuteProxyAutoConfigurationScript (string proxyAutoConfigurationScript, Uri targetUrl, out NSError? outError)
|
||||
{
|
||||
outError = null;
|
||||
if (proxyAutoConfigurationScript == null)
|
||||
throw new ArgumentNullException (nameof (proxyAutoConfigurationScript));
|
||||
if (proxyAutoConfigurationScript is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (proxyAutoConfigurationScript));
|
||||
|
||||
if (targetUrl == null)
|
||||
throw new ArgumentNullException (nameof (targetUrl));
|
||||
if (targetUrl is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (targetUrl));
|
||||
|
||||
using (var pacScript = new NSString (proxyAutoConfigurationScript))
|
||||
using (var url = new NSUrl (targetUrl.AbsoluteUri)) {
|
||||
|
@ -795,13 +806,13 @@ namespace CoreFoundation {
|
|||
}
|
||||
}
|
||||
|
||||
public static async Task<(CFProxy[] proxies, NSError error)> ExecuteProxyAutoConfigurationScriptAsync (string proxyAutoConfigurationScript, Uri targetUrl, CancellationToken cancellationToken)
|
||||
public static async Task<(CFProxy[]? proxies, NSError? error)> ExecuteProxyAutoConfigurationScriptAsync (string proxyAutoConfigurationScript, Uri targetUrl, CancellationToken cancellationToken)
|
||||
{
|
||||
if (proxyAutoConfigurationScript == null)
|
||||
throw new ArgumentNullException (nameof (proxyAutoConfigurationScript));
|
||||
if (proxyAutoConfigurationScript is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (proxyAutoConfigurationScript));
|
||||
|
||||
if (targetUrl == null)
|
||||
throw new ArgumentNullException (nameof (targetUrl));
|
||||
if (targetUrl is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (targetUrl));
|
||||
|
||||
using (var pacScript = new NSString (proxyAutoConfigurationScript))
|
||||
using (var url = new NSUrl (targetUrl.AbsoluteUri)) {
|
||||
|
@ -820,14 +831,14 @@ namespace CoreFoundation {
|
|||
/* CFProxyAutoConfigurationResultCallback __nonnull */ CFProxyAutoConfigurationResultCallbackInternal cb,
|
||||
/* CFStreamClientContext * __nonnull */ ref CFStreamClientContext clientContext);
|
||||
|
||||
public static CFProxy[] ExecuteProxyAutoConfigurationUrl (Uri proxyAutoConfigurationUrl, Uri targetUrl, out NSError outError)
|
||||
public static CFProxy[]? ExecuteProxyAutoConfigurationUrl (Uri proxyAutoConfigurationUrl, Uri targetUrl, out NSError? outError)
|
||||
{
|
||||
outError = null;
|
||||
if (proxyAutoConfigurationUrl == null)
|
||||
throw new ArgumentNullException (nameof (proxyAutoConfigurationUrl));
|
||||
if (proxyAutoConfigurationUrl is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (proxyAutoConfigurationUrl));
|
||||
|
||||
if (targetUrl == null)
|
||||
throw new ArgumentNullException (nameof (targetUrl));
|
||||
if (targetUrl is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (targetUrl));
|
||||
|
||||
using (var pacUrl = new NSUrl (proxyAutoConfigurationUrl.AbsoluteUri)) // toll free bridge to CFUrl
|
||||
using (var url = new NSUrl (targetUrl.AbsoluteUri)) {
|
||||
|
@ -838,14 +849,14 @@ namespace CoreFoundation {
|
|||
}
|
||||
}
|
||||
|
||||
public static async Task<(CFProxy[] proxies, NSError error)> ExecuteProxyAutoConfigurationUrlAsync (Uri proxyAutoConfigurationUrl, Uri targetUrl, CancellationToken cancellationToken)
|
||||
public static async Task<(CFProxy[]? proxies, NSError? error)> ExecuteProxyAutoConfigurationUrlAsync (Uri proxyAutoConfigurationUrl, Uri targetUrl, CancellationToken cancellationToken)
|
||||
{
|
||||
// similar to the sync method, but we will spawn a thread and wait in an async manner to an autoreset event to be fired
|
||||
if (proxyAutoConfigurationUrl == null)
|
||||
throw new ArgumentNullException (nameof (proxyAutoConfigurationUrl));
|
||||
if (proxyAutoConfigurationUrl is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (proxyAutoConfigurationUrl));
|
||||
|
||||
if (targetUrl == null)
|
||||
throw new ArgumentNullException (nameof (targetUrl));
|
||||
if (targetUrl is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (targetUrl));
|
||||
|
||||
using (var pacUrl = new NSUrl (proxyAutoConfigurationUrl.AbsoluteUri)) // toll free bridge to CFUrl
|
||||
using (var url = new NSUrl (targetUrl.AbsoluteUri)) {
|
||||
|
@ -858,14 +869,14 @@ namespace CoreFoundation {
|
|||
}
|
||||
|
||||
class CFWebProxy : IWebProxy {
|
||||
ICredentials credentials;
|
||||
ICredentials? credentials;
|
||||
bool userSpecified;
|
||||
|
||||
public CFWebProxy ()
|
||||
{
|
||||
}
|
||||
|
||||
public ICredentials Credentials {
|
||||
public ICredentials? Credentials {
|
||||
get { return credentials; }
|
||||
set {
|
||||
userSpecified = true;
|
||||
|
@ -873,7 +884,7 @@ namespace CoreFoundation {
|
|||
}
|
||||
}
|
||||
|
||||
static Uri GetProxyUri (CFProxy proxy, out NetworkCredential credentials)
|
||||
static Uri? GetProxyUri (CFProxy proxy, out NetworkCredential? credentials)
|
||||
{
|
||||
string protocol;
|
||||
|
||||
|
@ -890,13 +901,13 @@ namespace CoreFoundation {
|
|||
return null;
|
||||
}
|
||||
|
||||
string username = proxy.Username;
|
||||
string password = proxy.Password;
|
||||
string hostname = proxy.HostName;
|
||||
int port = proxy.Port;
|
||||
var username = proxy?.Username;
|
||||
var password = proxy?.Password;
|
||||
var hostname = proxy?.HostName;
|
||||
var port = proxy?.Port;
|
||||
string uri;
|
||||
|
||||
if (username != null)
|
||||
if (username is not null)
|
||||
credentials = new NetworkCredential (username, password);
|
||||
else
|
||||
credentials = null;
|
||||
|
@ -906,11 +917,11 @@ namespace CoreFoundation {
|
|||
return new Uri (uri, UriKind.Absolute);
|
||||
}
|
||||
|
||||
static Uri GetProxyUriFromScript (NSString script, Uri targetUri, out NetworkCredential credentials)
|
||||
static Uri? GetProxyUriFromScript (NSString script, Uri targetUri, out NetworkCredential? credentials)
|
||||
{
|
||||
CFProxy[] proxies = CFNetwork.GetProxiesForAutoConfigurationScript (script, targetUri);
|
||||
CFProxy[]? proxies = CFNetwork.GetProxiesForAutoConfigurationScript (script, targetUri);
|
||||
|
||||
if (proxies == null) {
|
||||
if (proxies is null) {
|
||||
credentials = null;
|
||||
return targetUri;
|
||||
}
|
||||
|
@ -940,21 +951,21 @@ namespace CoreFoundation {
|
|||
|
||||
public Uri GetProxy (Uri targetUri)
|
||||
{
|
||||
NetworkCredential credentials = null;
|
||||
Uri proxy = null;
|
||||
NetworkCredential? credentials = null;
|
||||
Uri? proxy = null;
|
||||
|
||||
if (targetUri == null)
|
||||
throw new ArgumentNullException ("targetUri");
|
||||
if (targetUri is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (targetUri));
|
||||
|
||||
try {
|
||||
CFProxySettings settings = CFNetwork.GetSystemProxySettings ();
|
||||
CFProxy[] proxies = CFNetwork.GetProxiesForUri (targetUri, settings);
|
||||
CFProxySettings? settings = CFNetwork.GetSystemProxySettings ();
|
||||
CFProxy[]? proxies = CFNetwork.GetProxiesForUri (targetUri, settings);
|
||||
|
||||
if (proxies != null) {
|
||||
for (int i = 0; i < proxies.Length && proxy == null; i++) {
|
||||
if (proxies is not null) {
|
||||
for (int i = 0; i < proxies.Length && proxy is null; i++) {
|
||||
switch (proxies[i].ProxyType) {
|
||||
case CFProxyType.AutoConfigurationJavaScript:
|
||||
proxy = GetProxyUriFromScript (proxies[i].AutoConfigurationJavaScript, targetUri, out credentials);
|
||||
proxy = GetProxyUriFromScript (proxies[i].AutoConfigurationJavaScript!, targetUri, out credentials);
|
||||
break;
|
||||
case CFProxyType.AutoConfigurationUrl:
|
||||
// unsupported proxy type (requires fetching script from remote url)
|
||||
|
@ -975,7 +986,7 @@ namespace CoreFoundation {
|
|||
}
|
||||
}
|
||||
|
||||
if (proxy == null) {
|
||||
if (proxy is null) {
|
||||
// no supported proxies for this Uri, fall back to trying to connect to targetUri directly
|
||||
proxy = targetUri;
|
||||
}
|
||||
|
@ -995,8 +1006,8 @@ namespace CoreFoundation {
|
|||
|
||||
public bool IsBypassed (Uri targetUri)
|
||||
{
|
||||
if (targetUri == null)
|
||||
throw new ArgumentNullException ("targetUri");
|
||||
if (targetUri is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (targetUri));
|
||||
|
||||
return GetProxy (targetUri) == targetUri;
|
||||
}
|
||||
|
|
|
@ -121,9 +121,9 @@ namespace CoreFoundation {
|
|||
protected override void ScheduleWithRunLoop (CFRunLoop loop, NSString? mode)
|
||||
{
|
||||
if (loop is null)
|
||||
throw new ArgumentNullException (nameof (loop));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (loop));
|
||||
if (mode is null)
|
||||
throw new ArgumentNullException (nameof (mode));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (mode));
|
||||
CFReadStreamScheduleWithRunLoop (Handle, loop.Handle, mode.Handle);
|
||||
}
|
||||
|
||||
|
@ -133,9 +133,9 @@ namespace CoreFoundation {
|
|||
protected override void UnscheduleFromRunLoop (CFRunLoop loop, NSString? mode)
|
||||
{
|
||||
if (loop is null)
|
||||
throw new ArgumentNullException (nameof (loop));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (loop));
|
||||
if (mode is null)
|
||||
throw new ArgumentNullException (nameof (mode));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (mode));
|
||||
CFReadStreamUnscheduleFromRunLoop (Handle, loop.Handle, mode.Handle);
|
||||
}
|
||||
|
||||
|
@ -156,14 +156,14 @@ namespace CoreFoundation {
|
|||
public nint Read (byte[] buffer)
|
||||
{
|
||||
if (buffer is null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (buffer));
|
||||
return Read (buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
public unsafe nint Read (byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer is null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (buffer));
|
||||
GetCheckedHandle ();
|
||||
if (offset < 0)
|
||||
throw new ArgumentException ();
|
||||
|
@ -181,7 +181,7 @@ namespace CoreFoundation {
|
|||
protected override IntPtr DoGetProperty (NSString name)
|
||||
{
|
||||
if (name is null)
|
||||
throw new ArgumentNullException (nameof (name));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (name));
|
||||
return CFReadStreamCopyProperty (Handle, name.Handle);
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ namespace CoreFoundation {
|
|||
protected override bool DoSetProperty (NSString name, INativeObject? value)
|
||||
{
|
||||
if (name is null)
|
||||
throw new ArgumentNullException (nameof (name));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (name));
|
||||
return CFReadStreamSetProperty (Handle, name.Handle, value.GetHandle ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -285,7 +285,7 @@ namespace CoreFoundation {
|
|||
public CFRunLoopExitReason RunInMode (NSString mode, double seconds, bool returnAfterSourceHandled)
|
||||
{
|
||||
if (mode is null)
|
||||
throw new ArgumentNullException (nameof (mode));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (mode));
|
||||
|
||||
return CFRunLoopRunInMode (mode.Handle, seconds, returnAfterSourceHandled);
|
||||
}
|
||||
|
@ -296,9 +296,9 @@ namespace CoreFoundation {
|
|||
public void AddSource (CFRunLoopSource source, NSString mode)
|
||||
{
|
||||
if (source is null)
|
||||
throw new ArgumentNullException (nameof (source));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (source));
|
||||
if (mode is null)
|
||||
throw new ArgumentNullException (nameof (mode));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (mode));
|
||||
|
||||
CFRunLoopAddSource (Handle, source.Handle, mode.Handle);
|
||||
}
|
||||
|
@ -310,9 +310,9 @@ namespace CoreFoundation {
|
|||
public bool ContainsSource (CFRunLoopSource source, NSString mode)
|
||||
{
|
||||
if (source is null)
|
||||
throw new ArgumentNullException (nameof (source));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (source));
|
||||
if (mode is null)
|
||||
throw new ArgumentNullException (nameof (mode));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (mode));
|
||||
|
||||
return CFRunLoopContainsSource (Handle, source.Handle, mode.Handle);
|
||||
}
|
||||
|
@ -323,9 +323,9 @@ namespace CoreFoundation {
|
|||
public void RemoveSource (CFRunLoopSource source, NSString mode)
|
||||
{
|
||||
if (source is null)
|
||||
throw new ArgumentNullException (nameof (source));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (source));
|
||||
if (mode is null)
|
||||
throw new ArgumentNullException (nameof (mode));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (mode));
|
||||
|
||||
CFRunLoopRemoveSource (Handle, source.Handle, mode.Handle);
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ namespace CoreFoundation {
|
|||
static byte[] CreateData (IPEndPoint endpoint)
|
||||
{
|
||||
if (endpoint is null)
|
||||
throw new ArgumentNullException (nameof (endpoint));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (endpoint));
|
||||
|
||||
if (endpoint.AddressFamily == AddressFamily.InterNetwork) {
|
||||
var buffer = new byte [16];
|
||||
|
|
|
@ -237,7 +237,7 @@ namespace CoreFoundation {
|
|||
out CFWriteStream writeStream)
|
||||
{
|
||||
if (socket is null)
|
||||
throw new ArgumentNullException (nameof (socket));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (socket));
|
||||
|
||||
IntPtr read, write;
|
||||
CFStreamCreatePairWithSocket (IntPtr.Zero, socket.GetNative (), out read, out write);
|
||||
|
@ -496,7 +496,7 @@ namespace CoreFoundation {
|
|||
public static CFHTTPStream CreateForHTTPRequest (CFHTTPMessage request)
|
||||
{
|
||||
if (request is null)
|
||||
throw new ArgumentNullException (nameof (request));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (request));
|
||||
|
||||
var handle = CFReadStreamCreateForHTTPRequest (IntPtr.Zero, request.Handle);
|
||||
return new CFHTTPStream (handle, true);
|
||||
|
@ -543,9 +543,9 @@ namespace CoreFoundation {
|
|||
public static CFHTTPStream CreateForStreamedHTTPRequest (CFHTTPMessage request, CFReadStream body)
|
||||
{
|
||||
if (request is null)
|
||||
throw new ArgumentNullException (nameof (request));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (request));
|
||||
if (body is null)
|
||||
throw new ArgumentNullException (nameof (body));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (body));
|
||||
|
||||
var handle = CFReadStreamCreateForStreamedHTTPRequest (IntPtr.Zero, request.Handle, body.Handle);
|
||||
return new CFHTTPStream (handle, true);
|
||||
|
@ -554,9 +554,9 @@ namespace CoreFoundation {
|
|||
public static CFHTTPStream CreateForStreamedHTTPRequest (CFHTTPMessage request, NSInputStream body)
|
||||
{
|
||||
if (request is null)
|
||||
throw new ArgumentNullException (nameof (request));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (request));
|
||||
if (body is null)
|
||||
throw new ArgumentNullException (nameof (body));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (body));
|
||||
|
||||
var handle = CFReadStreamCreateForStreamedHTTPRequest (IntPtr.Zero, request.Handle, body.Handle);
|
||||
return new CFHTTPStream (handle, true);
|
||||
|
@ -585,7 +585,7 @@ namespace CoreFoundation {
|
|||
protected void CheckError ()
|
||||
{
|
||||
var exc = GetError ();
|
||||
if (exc != null)
|
||||
if (exc is not null)
|
||||
throw exc;
|
||||
}
|
||||
|
||||
|
@ -688,35 +688,35 @@ namespace CoreFoundation {
|
|||
protected virtual void OnOpenCompleted (StreamEventArgs args)
|
||||
{
|
||||
var e = OpenCompletedEvent;
|
||||
if (e != null)
|
||||
if (e is not null)
|
||||
e (this, args);
|
||||
}
|
||||
|
||||
protected virtual void OnHasBytesAvailableEvent (StreamEventArgs args)
|
||||
{
|
||||
var e = HasBytesAvailableEvent;
|
||||
if (e != null)
|
||||
if (e is not null)
|
||||
e (this, args);
|
||||
}
|
||||
|
||||
protected virtual void OnCanAcceptBytesEvent (StreamEventArgs args)
|
||||
{
|
||||
var e = CanAcceptBytesEvent;
|
||||
if (e != null)
|
||||
if (e is not null)
|
||||
e (this, args);
|
||||
}
|
||||
|
||||
protected virtual void OnErrorEvent (StreamEventArgs args)
|
||||
{
|
||||
var e = ErrorEvent;
|
||||
if (e != null)
|
||||
if (e is not null)
|
||||
e (this, args);
|
||||
}
|
||||
|
||||
protected virtual void OnClosedEvent (StreamEventArgs args)
|
||||
{
|
||||
var e = ClosedEvent;
|
||||
if (e != null)
|
||||
if (e is not null)
|
||||
e (this, args);
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ namespace CoreFoundation {
|
|||
unsafe {
|
||||
// this returns non-null only if the string can be represented as unicode
|
||||
char* u = CFStringGetCharactersPtr (handle);
|
||||
if (u == null) {
|
||||
if (u is null) {
|
||||
// alloc short string on the stack, otherwise use the heap
|
||||
allocate_memory = l > 128;
|
||||
// var m = allocate_memory ? (char*) Marshal.AllocHGlobal (l * 2) : stackalloc char [l];
|
||||
|
@ -235,7 +235,7 @@ namespace CoreFoundation {
|
|||
if (x is null)
|
||||
return null;
|
||||
|
||||
if (x.str == null)
|
||||
if (x.str is null)
|
||||
x.str = FromHandle (x.Handle);
|
||||
|
||||
return x.str;
|
||||
|
@ -252,7 +252,7 @@ namespace CoreFoundation {
|
|||
|
||||
public int Length {
|
||||
get {
|
||||
if (str != null)
|
||||
if (str is not null)
|
||||
return str.Length;
|
||||
else
|
||||
return (int)CFStringGetLength (Handle);
|
||||
|
@ -265,7 +265,7 @@ namespace CoreFoundation {
|
|||
|
||||
public char this [nint p] {
|
||||
get {
|
||||
if (str != null)
|
||||
if (str is not null)
|
||||
return str [(int) p];
|
||||
else
|
||||
return CFStringGetCharacterAtIndex (Handle, p);
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace CoreFoundation {
|
|||
public string? GetDescription (IntPtr handle)
|
||||
{
|
||||
if (handle == IntPtr.Zero)
|
||||
throw new ArgumentNullException (nameof (handle));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handle));
|
||||
|
||||
return CFString.FromHandle (CFCopyDescription (handle));
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace CoreFoundation {
|
|||
static public CFUrl? FromFile (string filename)
|
||||
{
|
||||
if (filename is null)
|
||||
throw new ArgumentNullException (nameof (filename));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (filename));
|
||||
var strHandle = CFString.CreateNative (filename);
|
||||
try {
|
||||
var handle = CFURLCreateWithFileSystemPath (IntPtr.Zero, strHandle, (nint)(long)CFUrlPathStyle.POSIX, false);
|
||||
|
@ -95,7 +95,7 @@ namespace CoreFoundation {
|
|||
static public CFUrl? FromUrlString (string url, CFUrl? baseurl)
|
||||
{
|
||||
if (url is null)
|
||||
throw new ArgumentNullException (nameof (url));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
|
||||
var strHandle = CFString.CreateNative (url);
|
||||
try {
|
||||
return FromStringHandle (strHandle, baseurl);
|
||||
|
|
|
@ -112,14 +112,14 @@ namespace CoreFoundation {
|
|||
public int Write (byte[] buffer)
|
||||
{
|
||||
if (buffer is null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (buffer));
|
||||
return Write (buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
public unsafe int Write (byte[] buffer, nint offset, nint count)
|
||||
{
|
||||
if (buffer is null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (buffer));
|
||||
GetCheckedHandle ();
|
||||
if (offset < 0)
|
||||
throw new ArgumentException ();
|
||||
|
@ -148,9 +148,9 @@ namespace CoreFoundation {
|
|||
protected override void ScheduleWithRunLoop (CFRunLoop loop, NSString? mode)
|
||||
{
|
||||
if (loop is null)
|
||||
throw new ArgumentNullException (nameof (loop));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (loop));
|
||||
if (mode is null)
|
||||
throw new ArgumentNullException (nameof (mode));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (mode));
|
||||
CFWriteStreamScheduleWithRunLoop (Handle, loop.Handle, mode.Handle);
|
||||
}
|
||||
|
||||
|
@ -160,9 +160,9 @@ namespace CoreFoundation {
|
|||
protected override void UnscheduleFromRunLoop (CFRunLoop loop, NSString? mode)
|
||||
{
|
||||
if (loop is null)
|
||||
throw new ArgumentNullException (nameof (loop));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (loop));
|
||||
if (mode is null)
|
||||
throw new ArgumentNullException (nameof (mode));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (mode));
|
||||
CFWriteStreamUnscheduleFromRunLoop (Handle, loop.Handle, mode.Handle);
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ namespace CoreFoundation {
|
|||
protected override IntPtr DoGetProperty (NSString name)
|
||||
{
|
||||
if (name is null)
|
||||
throw new ArgumentNullException (nameof (name));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (name));
|
||||
return CFWriteStreamSetProperty (Handle, name.Handle);
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ namespace CoreFoundation {
|
|||
protected override bool DoSetProperty (NSString name, INativeObject? value)
|
||||
{
|
||||
if (name is null)
|
||||
throw new ArgumentNullException (nameof (name));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (name));
|
||||
return CFWriteStreamSetProperty (Handle, name.Handle, value.GetHandle ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -126,7 +129,7 @@ namespace CoreFoundation {
|
|||
public override bool Equals (object other)
|
||||
{
|
||||
var od = other as DispatchQueue;
|
||||
if (od == null)
|
||||
if (od is null)
|
||||
return false;
|
||||
return od.Handle == Handle;
|
||||
}
|
||||
|
@ -152,7 +155,7 @@ namespace CoreFoundation {
|
|||
public void SetTargetQueue (DispatchQueue queue)
|
||||
{
|
||||
// note: null is allowed because DISPATCH_TARGET_QUEUE_DEFAULT is defined as NULL (dispatch/queue.h)
|
||||
IntPtr q = queue == null ? IntPtr.Zero : queue.Handle;
|
||||
IntPtr q = queue.GetHandle ();
|
||||
dispatch_set_target_queue (Handle, q);
|
||||
}
|
||||
|
||||
|
@ -247,7 +250,7 @@ namespace CoreFoundation {
|
|||
[TV (10,0)]
|
||||
[Watch (3,0)]
|
||||
#endif
|
||||
public DispatchQueue (string label, Attributes attributes, DispatchQueue target = null)
|
||||
public DispatchQueue (string label, Attributes attributes, DispatchQueue? target = null)
|
||||
: base (dispatch_queue_create_with_target (label, attributes?.Create () ?? IntPtr.Zero, target.GetHandle ()), true)
|
||||
{
|
||||
}
|
||||
|
@ -256,7 +259,7 @@ namespace CoreFoundation {
|
|||
// Properties and methods
|
||||
//
|
||||
|
||||
public string Label {
|
||||
public string? Label {
|
||||
get {
|
||||
return Marshal.PtrToStringAnsi (dispatch_queue_get_label (GetCheckedHandle ()));
|
||||
}
|
||||
|
@ -270,7 +273,7 @@ namespace CoreFoundation {
|
|||
#else
|
||||
[iOS (7,0)]
|
||||
#endif
|
||||
public static string CurrentQueueLabel {
|
||||
public static string? CurrentQueueLabel {
|
||||
get {
|
||||
return Marshal.PtrToStringAnsi (dispatch_queue_get_label (IntPtr.Zero));
|
||||
}
|
||||
|
@ -371,7 +374,7 @@ namespace CoreFoundation {
|
|||
GCHandle gch = GCHandle.FromIntPtr (context);
|
||||
var obj = gch.Target as Tuple<Action, DispatchQueue>;
|
||||
gch.Free ();
|
||||
if (obj != null) {
|
||||
if (obj is not null) {
|
||||
var sc = SynchronizationContext.Current;
|
||||
|
||||
// Set GCD synchronization context. Mainly used when await executes inside GCD to continue
|
||||
|
@ -380,13 +383,13 @@ namespace CoreFoundation {
|
|||
//
|
||||
// This assumes that only 1 queue can run on thread at the same time
|
||||
//
|
||||
if (sc == null)
|
||||
if (sc is null)
|
||||
SynchronizationContext.SetSynchronizationContext (new DispatchQueueSynchronizationContext (obj.Item2));
|
||||
|
||||
try {
|
||||
obj.Item1 ();
|
||||
} finally {
|
||||
if (sc == null)
|
||||
if (sc is null)
|
||||
SynchronizationContext.SetSynchronizationContext (null);
|
||||
}
|
||||
}
|
||||
|
@ -399,7 +402,7 @@ namespace CoreFoundation {
|
|||
GCHandle gch = GCHandle.FromIntPtr (context);
|
||||
var obj = gch.Target as Tuple<Action<long>, DispatchQueue>;
|
||||
gch.Free ();
|
||||
if (obj != null) {
|
||||
if (obj is not null) {
|
||||
var sc = SynchronizationContext.Current;
|
||||
|
||||
// Set GCD synchronization context. Mainly used when await executes inside GCD to continue
|
||||
|
@ -408,13 +411,13 @@ namespace CoreFoundation {
|
|||
//
|
||||
// This assumes that only 1 queue can run on thread at the same time
|
||||
//
|
||||
if (sc == null)
|
||||
if (sc is null)
|
||||
SynchronizationContext.SetSynchronizationContext (new DispatchQueueSynchronizationContext (obj.Item2));
|
||||
|
||||
try {
|
||||
obj.Item1 ((long) count);
|
||||
} finally {
|
||||
if (sc == null)
|
||||
if (sc is null)
|
||||
SynchronizationContext.SetSynchronizationContext (null);
|
||||
}
|
||||
}
|
||||
|
@ -431,88 +434,88 @@ namespace CoreFoundation {
|
|||
|
||||
public void DispatchAsync (Action action)
|
||||
{
|
||||
if (action == null)
|
||||
throw new ArgumentNullException ("action");
|
||||
if (action is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (action));
|
||||
|
||||
dispatch_async_f (Handle, (IntPtr) GCHandle.Alloc (Tuple.Create (action, this)), static_dispatch);
|
||||
}
|
||||
|
||||
public void DispatchAsync (DispatchBlock block)
|
||||
{
|
||||
if (block == null)
|
||||
throw new ArgumentNullException (nameof (block));
|
||||
if (block is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (block));
|
||||
|
||||
dispatch_async (GetCheckedHandle (), block.GetCheckedHandle ());
|
||||
}
|
||||
|
||||
public void DispatchSync (Action action)
|
||||
{
|
||||
if (action == null)
|
||||
throw new ArgumentNullException ("action");
|
||||
if (action is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (action));
|
||||
|
||||
dispatch_sync_f (Handle, (IntPtr) GCHandle.Alloc (Tuple.Create (action, this)), static_dispatch);
|
||||
}
|
||||
|
||||
public void DispatchSync (DispatchBlock block)
|
||||
{
|
||||
if (block == null)
|
||||
throw new ArgumentNullException (nameof (block));
|
||||
if (block is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (block));
|
||||
|
||||
dispatch_sync (GetCheckedHandle (), block.GetCheckedHandle ());
|
||||
}
|
||||
|
||||
public void DispatchBarrierAsync (Action action)
|
||||
{
|
||||
if (action == null)
|
||||
throw new ArgumentNullException ("action");
|
||||
if (action is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (action));
|
||||
|
||||
dispatch_barrier_async_f (Handle, (IntPtr) GCHandle.Alloc (Tuple.Create (action, this)), static_dispatch);
|
||||
}
|
||||
|
||||
public void DispatchBarrierAsync (DispatchBlock block)
|
||||
{
|
||||
if (block == null)
|
||||
throw new ArgumentNullException (nameof (block));
|
||||
if (block is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (block));
|
||||
|
||||
dispatch_barrier_async (GetCheckedHandle (), block.GetCheckedHandle ());
|
||||
}
|
||||
|
||||
public void DispatchBarrierSync (Action action)
|
||||
{
|
||||
if (action == null)
|
||||
throw new ArgumentNullException (nameof (action));
|
||||
if (action is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (action));
|
||||
|
||||
dispatch_barrier_sync_f (Handle, (IntPtr) GCHandle.Alloc (Tuple.Create (action, this)), static_dispatch);
|
||||
}
|
||||
|
||||
public void DispatchBarrierSync (DispatchBlock block)
|
||||
{
|
||||
if (block == null)
|
||||
throw new ArgumentNullException (nameof (block));
|
||||
if (block is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (block));
|
||||
|
||||
dispatch_barrier_sync (GetCheckedHandle (), block.GetCheckedHandle ());
|
||||
}
|
||||
|
||||
public void DispatchAfter (DispatchTime when, Action action)
|
||||
{
|
||||
if (action == null)
|
||||
throw new ArgumentNullException ("action");
|
||||
if (action is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (action));
|
||||
|
||||
dispatch_after_f (when.Nanoseconds, Handle, (IntPtr) GCHandle.Alloc (Tuple.Create (action, this)), static_dispatch);
|
||||
}
|
||||
|
||||
public void DispatchAfter (DispatchTime when, DispatchBlock block)
|
||||
{
|
||||
if (block == null)
|
||||
throw new ArgumentNullException (nameof (block));
|
||||
if (block is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (block));
|
||||
|
||||
dispatch_after (when.Nanoseconds, GetCheckedHandle (), block.GetCheckedHandle ());
|
||||
}
|
||||
|
||||
public void Submit (Action<int> action, long times)
|
||||
{
|
||||
if (action == null)
|
||||
throw new ArgumentNullException ("action");
|
||||
if (action is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (action));
|
||||
dispatch_apply_f ((IntPtr) times, Handle, (IntPtr) GCHandle.Alloc (Tuple.Create (action, this)), static_dispatch_iterations);
|
||||
}
|
||||
|
||||
|
@ -521,7 +524,7 @@ namespace CoreFoundation {
|
|||
dispatch_queue_set_specific (GetCheckedHandle (), key, (IntPtr) GCHandle.Alloc (context), free_gchandle);
|
||||
}
|
||||
|
||||
public object GetSpecific (IntPtr key)
|
||||
public object? GetSpecific (IntPtr key)
|
||||
{
|
||||
GCHandle gchandle = (GCHandle) dispatch_queue_get_specific (GetCheckedHandle (), key);
|
||||
return gchandle.Target;
|
||||
|
@ -661,25 +664,24 @@ namespace CoreFoundation {
|
|||
// `Equals` and `GetHashCode` based on the Handle property.
|
||||
public override bool Equals (object other)
|
||||
{
|
||||
DispatchQueue o = other as DispatchQueue;
|
||||
if (o == null)
|
||||
return false;
|
||||
if (other is DispatchQueue o)
|
||||
return (o.Handle == Handle);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !NET
|
||||
public static bool operator == (DispatchQueue left, DispatchQueue right)
|
||||
{
|
||||
if ((object) left == null)
|
||||
return (object) right == null;
|
||||
if (left is null)
|
||||
return right is null;
|
||||
return left.Equals (right);
|
||||
}
|
||||
|
||||
public static bool operator != (DispatchQueue left, DispatchQueue right)
|
||||
{
|
||||
if ((object) left == null)
|
||||
return (object) right != null;
|
||||
if (left is null)
|
||||
return right is not null;
|
||||
return !left.Equals (right);
|
||||
}
|
||||
|
||||
|
@ -902,7 +904,7 @@ namespace CoreFoundation {
|
|||
{
|
||||
}
|
||||
|
||||
public static DispatchGroup Create ()
|
||||
public static DispatchGroup? Create ()
|
||||
{
|
||||
var ptr = dispatch_group_create ();
|
||||
if (ptr == IntPtr.Zero)
|
||||
|
@ -913,29 +915,29 @@ namespace CoreFoundation {
|
|||
|
||||
public void DispatchAsync (DispatchQueue queue, Action action)
|
||||
{
|
||||
if (queue == null)
|
||||
throw new ArgumentNullException ("queue");
|
||||
if (action == null)
|
||||
throw new ArgumentNullException ("action");
|
||||
if (queue is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (queue));
|
||||
if (action is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (action));
|
||||
|
||||
dispatch_group_async_f (GetCheckedHandle (), queue.Handle, (IntPtr) GCHandle.Alloc (Tuple.Create (action, queue)), DispatchQueue.static_dispatch);
|
||||
}
|
||||
|
||||
public void Notify (DispatchQueue queue, DispatchBlock block)
|
||||
{
|
||||
if (queue == null)
|
||||
throw new ArgumentNullException (nameof (queue));
|
||||
if (block == null)
|
||||
throw new ArgumentNullException (nameof (block));
|
||||
if (queue is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (queue));
|
||||
if (block is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (block));
|
||||
dispatch_group_notify (GetCheckedHandle (), queue.Handle, block.GetCheckedHandle ());
|
||||
}
|
||||
|
||||
public void Notify (DispatchQueue queue, Action action)
|
||||
{
|
||||
if (queue == null)
|
||||
throw new ArgumentNullException ("queue");
|
||||
if (action == null)
|
||||
throw new ArgumentNullException ("action");
|
||||
if (queue is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (queue));
|
||||
if (action is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (action));
|
||||
|
||||
dispatch_group_notify_f (GetCheckedHandle (), queue.Handle, (IntPtr) GCHandle.Alloc (Tuple.Create (action, queue)), DispatchQueue.static_dispatch);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
// Copyright 2019 Microsoft Corp.
|
||||
//
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
@ -53,22 +56,22 @@ namespace CoreFoundation {
|
|||
|
||||
public static DispatchBlock Create (Action action, DispatchBlockFlags flags = DispatchBlockFlags.None)
|
||||
{
|
||||
if (action == null)
|
||||
throw new ArgumentNullException (nameof (action));
|
||||
if (action is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (action));
|
||||
return new DispatchBlock (action, flags);
|
||||
}
|
||||
|
||||
public static DispatchBlock Create (Action action, DispatchBlockFlags flags, DispatchQualityOfService qosClass, int relative_priority)
|
||||
{
|
||||
if (action == null)
|
||||
throw new ArgumentNullException (nameof (action));
|
||||
if (action is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (action));
|
||||
return new DispatchBlock (action, flags, qosClass, relative_priority);
|
||||
}
|
||||
|
||||
public static DispatchBlock Create (DispatchBlock block, DispatchBlockFlags flags, DispatchQualityOfService qosClass, int relative_priority)
|
||||
{
|
||||
if (block == null)
|
||||
throw new ArgumentNullException (nameof (block));
|
||||
if (block is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (block));
|
||||
return block.Create (flags, qosClass, relative_priority);
|
||||
}
|
||||
|
||||
|
@ -94,8 +97,8 @@ namespace CoreFoundation {
|
|||
[BindingImpl (BindingImplOptions.Optimizable)]
|
||||
static IntPtr create (Action action, DispatchBlockFlags flags)
|
||||
{
|
||||
if (action == null)
|
||||
throw new ArgumentNullException (nameof (action));
|
||||
if (action is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (action));
|
||||
|
||||
BlockLiteral block_handler = new BlockLiteral ();
|
||||
try {
|
||||
|
@ -116,8 +119,8 @@ namespace CoreFoundation {
|
|||
[BindingImpl (BindingImplOptions.Optimizable)]
|
||||
static IntPtr create (DispatchBlockFlags flags, DispatchQualityOfService qosClass, int relative_priority, Action action)
|
||||
{
|
||||
if (action == null)
|
||||
throw new ArgumentNullException (nameof (action));
|
||||
if (action is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (action));
|
||||
|
||||
BlockLiteral block_handler = new BlockLiteral ();
|
||||
try {
|
||||
|
@ -141,18 +144,18 @@ namespace CoreFoundation {
|
|||
|
||||
public void Notify (DispatchQueue queue, Action notification)
|
||||
{
|
||||
if (notification == null)
|
||||
throw new ArgumentNullException (nameof (notification));
|
||||
if (notification is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (notification));
|
||||
using (var block = new DispatchBlock (notification))
|
||||
Notify (queue, block);
|
||||
}
|
||||
|
||||
public void Notify (DispatchQueue queue, DispatchBlock notification)
|
||||
{
|
||||
if (queue == null)
|
||||
throw new ArgumentNullException (nameof (queue));
|
||||
if (notification == null)
|
||||
throw new ArgumentNullException (nameof (notification));
|
||||
if (queue is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (queue));
|
||||
if (notification is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (notification));
|
||||
dispatch_block_notify (GetCheckedHandle (), queue.GetCheckedHandle (), notification.GetCheckedHandle ());
|
||||
}
|
||||
|
||||
|
@ -184,9 +187,9 @@ namespace CoreFoundation {
|
|||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||
delegate void DispatchBlockCallback (IntPtr block);
|
||||
|
||||
public static explicit operator Action (DispatchBlock block)
|
||||
public static explicit operator Action? (DispatchBlock block)
|
||||
{
|
||||
if (block == null)
|
||||
if (block is null)
|
||||
return null;
|
||||
|
||||
unsafe {
|
||||
|
@ -198,7 +201,7 @@ namespace CoreFoundation {
|
|||
|
||||
public void Invoke ()
|
||||
{
|
||||
((Action) this) ();
|
||||
((Action) this!) ();
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
@ -63,8 +66,8 @@ namespace CoreFoundation {
|
|||
//
|
||||
public static DispatchData FromByteBuffer (byte [] buffer)
|
||||
{
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
if (buffer is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (buffer));
|
||||
var b = Marshal.AllocHGlobal (buffer.Length);
|
||||
Marshal.Copy (buffer, 0, b, buffer.Length);
|
||||
var dd = dispatch_data_create (b, (nuint) buffer.Length, IntPtr.Zero, destructor: free);
|
||||
|
@ -73,8 +76,8 @@ namespace CoreFoundation {
|
|||
|
||||
public static DispatchData FromByteBuffer (byte [] buffer, int start, int length)
|
||||
{
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
if (buffer is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (buffer));
|
||||
if (start < 0 || start >= buffer.Length)
|
||||
throw new ArgumentException (nameof (start));
|
||||
if (length < 0)
|
||||
|
@ -94,7 +97,7 @@ namespace CoreFoundation {
|
|||
public static DispatchData FromBuffer (IntPtr buffer, nuint size)
|
||||
{
|
||||
if (buffer == IntPtr.Zero)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (buffer));
|
||||
var dd = dispatch_data_create (buffer, (nuint) size, IntPtr.Zero, destructor: IntPtr.Zero);
|
||||
return new DispatchData (dd, owns: true);
|
||||
}
|
||||
|
@ -132,10 +135,10 @@ namespace CoreFoundation {
|
|||
|
||||
public static DispatchData Concat (DispatchData data1, DispatchData data2)
|
||||
{
|
||||
if (data1 == null)
|
||||
throw new ArgumentNullException (nameof (data1));
|
||||
if (data2 == null)
|
||||
throw new ArgumentNullException (nameof (data2));
|
||||
if (data1 is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (data1));
|
||||
if (data2 is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (data2));
|
||||
|
||||
return new DispatchData (dispatch_data_create_concat (data1.Handle, data2.Handle), owns: true);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
@ -43,7 +46,7 @@ using NativeHandle = System.IntPtr;
|
|||
|
||||
namespace CoreFoundation {
|
||||
|
||||
public delegate void DispatchIOHandler (DispatchData data, int error);
|
||||
public delegate void DispatchIOHandler (DispatchData? data, int error);
|
||||
|
||||
#if NET
|
||||
[SupportedOSPlatform ("ios")]
|
||||
|
@ -71,7 +74,7 @@ namespace CoreFoundation {
|
|||
static void Trampoline_DispatchReadWriteHandler (IntPtr block, IntPtr dispatchData, int error)
|
||||
{
|
||||
var del = BlockLiteral.GetTarget<DispatchIOHandler> (block);
|
||||
if (del != null) {
|
||||
if (del is not null) {
|
||||
var dd = dispatchData == IntPtr.Zero ? null : new DispatchData (dispatchData, owns: false);
|
||||
del (dd, error);
|
||||
}
|
||||
|
@ -86,10 +89,10 @@ namespace CoreFoundation {
|
|||
[BindingImpl (BindingImplOptions.Optimizable)]
|
||||
public static void Read (int fd, nuint size, DispatchQueue dispatchQueue, DispatchIOHandler handler)
|
||||
{
|
||||
if (handler == null)
|
||||
throw new ArgumentNullException (nameof (handler));
|
||||
if (dispatchQueue == null)
|
||||
throw new ArgumentNullException (nameof (dispatchQueue));
|
||||
if (handler is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handler));
|
||||
if (dispatchQueue is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (dispatchQueue));
|
||||
|
||||
BlockLiteral block_handler = new BlockLiteral ();
|
||||
block_handler.SetupBlockUnsafe (static_DispatchReadWriteHandler, handler);
|
||||
|
@ -103,12 +106,12 @@ namespace CoreFoundation {
|
|||
[BindingImpl (BindingImplOptions.Optimizable)]
|
||||
public static void Write (int fd, DispatchData dispatchData, DispatchQueue dispatchQueue, DispatchIOHandler handler)
|
||||
{
|
||||
if (dispatchData == null)
|
||||
throw new ArgumentNullException (nameof (dispatchData));
|
||||
if (handler == null)
|
||||
throw new ArgumentNullException (nameof (handler));
|
||||
if (dispatchQueue == null)
|
||||
throw new ArgumentNullException (nameof (dispatchQueue));
|
||||
if (dispatchData is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (dispatchData));
|
||||
if (handler is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handler));
|
||||
if (dispatchQueue is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (dispatchQueue));
|
||||
|
||||
BlockLiteral block_handler = new BlockLiteral ();
|
||||
block_handler.SetupBlockUnsafe (static_DispatchReadWriteHandler, handler);
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
|
@ -38,8 +41,8 @@ namespace CoreFoundation {
|
|||
|
||||
public DispatchQueueSynchronizationContext (DispatchQueue dispatchQueue)
|
||||
{
|
||||
if (dispatchQueue == null)
|
||||
throw new ArgumentNullException ("dispatchQueue");
|
||||
if (dispatchQueue is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (dispatchQueue));
|
||||
this.queue = dispatchQueue;
|
||||
}
|
||||
|
||||
|
@ -48,12 +51,12 @@ namespace CoreFoundation {
|
|||
return new DispatchQueueSynchronizationContext (queue);
|
||||
}
|
||||
|
||||
public override void Post (SendOrPostCallback d, object state)
|
||||
public override void Post (SendOrPostCallback d, object? state)
|
||||
{
|
||||
queue.DispatchAsync (() => d (state));
|
||||
}
|
||||
|
||||
public override void Send (SendOrPostCallback d, object state)
|
||||
public override void Send (SendOrPostCallback d, object? state)
|
||||
{
|
||||
queue.DispatchSync (() => d (state));
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
//
|
||||
// Copyright 2015 Xamarin Inc
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
@ -55,7 +58,7 @@ namespace CoreFoundation {
|
|||
[SupportedOSPlatform ("tvos")]
|
||||
#endif
|
||||
public class DispatchSource : DispatchObject {
|
||||
DispatchQueue queue;
|
||||
DispatchQueue? queue;
|
||||
|
||||
// constructors for use in bindings
|
||||
[Preserve (Conditional = true)]
|
||||
|
@ -110,7 +113,7 @@ namespace CoreFoundation {
|
|||
|
||||
public void SetEventHandler (Action handler)
|
||||
{
|
||||
if (handler == null){
|
||||
if (handler is null){
|
||||
dispatch_source_set_event_handler_f (GetCheckedHandle (), IntPtr.Zero);
|
||||
return;
|
||||
}
|
||||
|
@ -118,12 +121,15 @@ namespace CoreFoundation {
|
|||
DispatchBlock.Invoke (
|
||||
delegate {
|
||||
var sc = SynchronizationContext.Current;
|
||||
if (sc == null)
|
||||
if (sc is null) {
|
||||
if (queue is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (queue));
|
||||
SynchronizationContext.SetSynchronizationContext (new DispatchQueueSynchronizationContext (queue));
|
||||
}
|
||||
try {
|
||||
handler ();
|
||||
} finally {
|
||||
if (sc == null)
|
||||
if (sc is null)
|
||||
SynchronizationContext.SetSynchronizationContext (null);
|
||||
}
|
||||
}, block=> dispatch_source_set_event_handler (GetCheckedHandle (), block));
|
||||
|
@ -141,18 +147,21 @@ namespace CoreFoundation {
|
|||
|
||||
public void SetRegistrationHandler (Action handler)
|
||||
{
|
||||
if (handler == null)
|
||||
throw new ArgumentNullException ("handler");
|
||||
if (handler is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handler));
|
||||
|
||||
DispatchBlock.Invoke (
|
||||
delegate {
|
||||
var sc = SynchronizationContext.Current;
|
||||
if (sc == null)
|
||||
if (sc is null) {
|
||||
if (queue is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (queue));
|
||||
SynchronizationContext.SetSynchronizationContext (new DispatchQueueSynchronizationContext (queue));
|
||||
}
|
||||
try {
|
||||
handler ();
|
||||
} finally {
|
||||
if (sc == null)
|
||||
if (sc is null)
|
||||
SynchronizationContext.SetSynchronizationContext (null);
|
||||
}
|
||||
}, block => dispatch_source_set_registration_handler (GetCheckedHandle (), block));
|
||||
|
@ -160,18 +169,21 @@ namespace CoreFoundation {
|
|||
|
||||
public void SetCancelHandler (Action handler)
|
||||
{
|
||||
if (handler == null)
|
||||
throw new ArgumentNullException ("handler");
|
||||
if (handler is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handler));
|
||||
|
||||
DispatchBlock.Invoke (
|
||||
delegate {
|
||||
var sc = SynchronizationContext.Current;
|
||||
if (sc == null)
|
||||
if (sc is null) {
|
||||
if (queue is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (queue));
|
||||
SynchronizationContext.SetSynchronizationContext (new DispatchQueueSynchronizationContext (queue));
|
||||
}
|
||||
try {
|
||||
handler ();
|
||||
} finally {
|
||||
if (sc == null)
|
||||
if (sc is null)
|
||||
SynchronizationContext.SetSynchronizationContext (null);
|
||||
}
|
||||
}, block => dispatch_source_set_cancel_handler (GetCheckedHandle (), block));
|
||||
|
@ -230,7 +242,7 @@ namespace CoreFoundation {
|
|||
public DataAdd (IntPtr handle, bool owns) : base (handle, owns) { }
|
||||
public DataAdd (IntPtr handle) : base (handle, false) { }
|
||||
|
||||
public DataAdd (DispatchQueue queue = null)
|
||||
public DataAdd (DispatchQueue? queue = null)
|
||||
{
|
||||
if (type_data_add == IntPtr.Zero)
|
||||
type_data_add = Dlfcn.dlsym (Libraries.System.Handle, "_dispatch_source_type_data_add");
|
||||
|
@ -239,7 +251,7 @@ namespace CoreFoundation {
|
|||
var handle = dispatch_source_create (type_data_add,
|
||||
handle: IntPtr.Zero,
|
||||
mask: IntPtr.Zero,
|
||||
queue: queue == null ? IntPtr.Zero : queue.Handle);
|
||||
queue: queue.GetHandle ());
|
||||
if (handle != IntPtr.Zero)
|
||||
InitializeHandle (handle);
|
||||
}
|
||||
|
@ -257,7 +269,7 @@ namespace CoreFoundation {
|
|||
public DataOr (IntPtr handle, bool owns) : base (handle, owns) { }
|
||||
public DataOr (IntPtr handle) : base (handle, false) { }
|
||||
|
||||
public DataOr (DispatchQueue queue = null)
|
||||
public DataOr (DispatchQueue? queue = null)
|
||||
{
|
||||
if (type_data_or == IntPtr.Zero)
|
||||
type_data_or = Dlfcn.dlsym (Libraries.System.Handle, "_dispatch_source_type_data_or");
|
||||
|
@ -265,7 +277,7 @@ namespace CoreFoundation {
|
|||
var handle = dispatch_source_create (type_data_or,
|
||||
handle: IntPtr.Zero,
|
||||
mask: IntPtr.Zero,
|
||||
queue: queue == null ? IntPtr.Zero : queue.Handle);
|
||||
queue: queue.GetHandle ());
|
||||
if (handle != IntPtr.Zero)
|
||||
InitializeHandle (handle);
|
||||
}
|
||||
|
@ -302,7 +314,7 @@ namespace CoreFoundation {
|
|||
public MachSend (IntPtr handle, bool owns) : base (handle, owns) { }
|
||||
public MachSend (IntPtr handle) : base (handle, false) { }
|
||||
|
||||
public MachSend (int machPort, bool sendDead = false, DispatchQueue queue = null)
|
||||
public MachSend (int machPort, bool sendDead = false, DispatchQueue? queue = null)
|
||||
{
|
||||
if (type_mach_send == IntPtr.Zero)
|
||||
type_mach_send = Dlfcn.dlsym (Libraries.System.Handle, "_dispatch_source_type_mach_send");
|
||||
|
@ -310,7 +322,7 @@ namespace CoreFoundation {
|
|||
var handle = dispatch_source_create (type_mach_send,
|
||||
handle: (IntPtr) machPort,
|
||||
mask: (IntPtr) (sendDead ? 1 : 0),
|
||||
queue: queue == null ? IntPtr.Zero : queue.Handle);
|
||||
queue: queue.GetHandle ());
|
||||
if (handle != IntPtr.Zero)
|
||||
InitializeHandle (handle);
|
||||
}
|
||||
|
@ -333,7 +345,7 @@ namespace CoreFoundation {
|
|||
public MachReceive (IntPtr handle, bool owns) : base (handle, owns) { }
|
||||
public MachReceive (IntPtr handle) : base (handle, false) { }
|
||||
|
||||
public MachReceive (int machPort, DispatchQueue queue = null)
|
||||
public MachReceive (int machPort, DispatchQueue? queue = null)
|
||||
{
|
||||
if (type_mach_recv == IntPtr.Zero)
|
||||
type_mach_recv = Dlfcn.dlsym (Libraries.System.Handle, "_dispatch_source_type_mach_recv");
|
||||
|
@ -341,7 +353,7 @@ namespace CoreFoundation {
|
|||
var handle = dispatch_source_create (type_mach_recv,
|
||||
handle: (IntPtr) machPort,
|
||||
mask: IntPtr.Zero,
|
||||
queue: queue == null ? IntPtr.Zero : queue.Handle);
|
||||
queue: queue.GetHandle ());
|
||||
if (handle != IntPtr.Zero)
|
||||
InitializeHandle (handle);
|
||||
}
|
||||
|
@ -359,7 +371,7 @@ namespace CoreFoundation {
|
|||
public MemoryPressure (IntPtr handle, bool owns) : base (handle, owns){}
|
||||
public MemoryPressure (IntPtr handle) : base (handle, false){}
|
||||
|
||||
public MemoryPressure (MemoryPressureFlags monitorFlags = MemoryPressureFlags.Normal | MemoryPressureFlags.Warn, DispatchQueue queue = null)
|
||||
public MemoryPressure (MemoryPressureFlags monitorFlags = MemoryPressureFlags.Normal | MemoryPressureFlags.Warn, DispatchQueue? queue = null)
|
||||
{
|
||||
if (type_memorypressure == IntPtr.Zero)
|
||||
type_memorypressure = Dlfcn.dlsym (Libraries.System.Handle, "_dispatch_source_type_memorypressure");
|
||||
|
@ -367,7 +379,7 @@ namespace CoreFoundation {
|
|||
var handle = dispatch_source_create (type_memorypressure,
|
||||
handle: IntPtr.Zero,
|
||||
mask: (IntPtr) monitorFlags,
|
||||
queue: queue == null ? IntPtr.Zero : queue.Handle);
|
||||
queue: queue.GetHandle ());
|
||||
if (handle != IntPtr.Zero)
|
||||
InitializeHandle (handle);
|
||||
}
|
||||
|
@ -390,7 +402,7 @@ namespace CoreFoundation {
|
|||
|
||||
public ProcessMonitor (IntPtr handle, bool owns) : base (handle, owns){}
|
||||
public ProcessMonitor (IntPtr handle) : base (handle, false){}
|
||||
public ProcessMonitor (int processId, ProcessMonitorFlags monitorKind = ProcessMonitorFlags.Exit, DispatchQueue queue = null)
|
||||
public ProcessMonitor (int processId, ProcessMonitorFlags monitorKind = ProcessMonitorFlags.Exit, DispatchQueue? queue = null)
|
||||
{
|
||||
|
||||
if (type_proc == IntPtr.Zero)
|
||||
|
@ -399,7 +411,7 @@ namespace CoreFoundation {
|
|||
var handle = dispatch_source_create (type_proc,
|
||||
handle: (IntPtr) processId,
|
||||
mask: (IntPtr) monitorKind,
|
||||
queue: queue == null ? IntPtr.Zero : queue.Handle);
|
||||
queue: queue.GetHandle ());
|
||||
if (handle != IntPtr.Zero)
|
||||
InitializeHandle (handle);
|
||||
}
|
||||
|
@ -427,7 +439,7 @@ namespace CoreFoundation {
|
|||
static IntPtr type_read;
|
||||
public ReadMonitor (IntPtr handle, bool owns) : base (handle, owns){}
|
||||
public ReadMonitor (IntPtr handle) : base (handle, false){}
|
||||
public ReadMonitor (int fileDescriptor, DispatchQueue queue = null)
|
||||
public ReadMonitor (int fileDescriptor, DispatchQueue? queue = null)
|
||||
{
|
||||
|
||||
if (type_read == IntPtr.Zero)
|
||||
|
@ -436,7 +448,7 @@ namespace CoreFoundation {
|
|||
var handle = dispatch_source_create (type_read,
|
||||
handle: (IntPtr) fileDescriptor,
|
||||
mask: IntPtr.Zero,
|
||||
queue: queue == null ? IntPtr.Zero : queue.Handle);
|
||||
queue: queue.GetHandle ());
|
||||
if (handle != IntPtr.Zero)
|
||||
InitializeHandle (handle);
|
||||
}
|
||||
|
@ -464,7 +476,7 @@ namespace CoreFoundation {
|
|||
static IntPtr type_signal;
|
||||
public SignalMonitor (IntPtr handle, bool owns) : base (handle, owns){}
|
||||
public SignalMonitor (IntPtr handle) : base (handle, false){}
|
||||
public SignalMonitor (int signalNumber, DispatchQueue queue = null)
|
||||
public SignalMonitor (int signalNumber, DispatchQueue? queue = null)
|
||||
{
|
||||
if (type_signal == IntPtr.Zero)
|
||||
type_signal = Dlfcn.dlsym (Libraries.System.Handle, "_dispatch_source_type_signal");
|
||||
|
@ -472,7 +484,7 @@ namespace CoreFoundation {
|
|||
var handle = dispatch_source_create (type_signal,
|
||||
handle: (IntPtr) signalNumber,
|
||||
mask: IntPtr.Zero,
|
||||
queue: queue == null ? IntPtr.Zero : queue.Handle);
|
||||
queue: queue.GetHandle ());
|
||||
if (handle != IntPtr.Zero)
|
||||
InitializeHandle (handle);
|
||||
}
|
||||
|
@ -500,9 +512,9 @@ namespace CoreFoundation {
|
|||
static IntPtr type_timer;
|
||||
public Timer (IntPtr handle, bool owns) : base (handle, owns){}
|
||||
public Timer (IntPtr handle) : base (handle, false){}
|
||||
public Timer (DispatchQueue queue = null) : this (false, queue) {}
|
||||
public Timer (DispatchQueue? queue = null) : this (false, queue) {}
|
||||
|
||||
public Timer (bool strict = false, DispatchQueue queue = null)
|
||||
public Timer (bool strict = false, DispatchQueue? queue = null)
|
||||
{
|
||||
if (type_timer == IntPtr.Zero)
|
||||
type_timer = Dlfcn.dlsym (Libraries.System.Handle, "_dispatch_source_type_timer");
|
||||
|
@ -510,7 +522,7 @@ namespace CoreFoundation {
|
|||
var handle = dispatch_source_create (type_timer,
|
||||
handle: IntPtr.Zero,
|
||||
mask: strict ? (IntPtr) 1 : IntPtr.Zero,
|
||||
queue: queue == null ? IntPtr.Zero : queue.Handle);
|
||||
queue: queue.GetHandle ());
|
||||
if (handle != IntPtr.Zero)
|
||||
InitializeHandle (handle);
|
||||
}
|
||||
|
@ -544,7 +556,7 @@ namespace CoreFoundation {
|
|||
public VnodeMonitor (IntPtr handle, bool owns) : base (handle, owns){}
|
||||
public VnodeMonitor (IntPtr handle) : base (handle, false){}
|
||||
|
||||
public VnodeMonitor (int fileDescriptor, VnodeMonitorKind vnodeKind, DispatchQueue queue = null)
|
||||
public VnodeMonitor (int fileDescriptor, VnodeMonitorKind vnodeKind, DispatchQueue? queue = null)
|
||||
{
|
||||
if (type_vnode == IntPtr.Zero)
|
||||
type_vnode = Dlfcn.dlsym (Libraries.System.Handle, "_dispatch_source_type_vnode");
|
||||
|
@ -553,7 +565,7 @@ namespace CoreFoundation {
|
|||
var handle = dispatch_source_create (type_vnode,
|
||||
handle: (IntPtr) fileDescriptor,
|
||||
mask: (IntPtr) vnodeKind,
|
||||
queue: queue == null ? IntPtr.Zero : queue.Handle);
|
||||
queue: queue.GetHandle ());
|
||||
if (handle != IntPtr.Zero)
|
||||
InitializeHandle (handle);
|
||||
}
|
||||
|
@ -565,10 +577,10 @@ namespace CoreFoundation {
|
|||
[DllImport (Constants.libcLibrary)]
|
||||
internal extern static int close (int fd);
|
||||
|
||||
public VnodeMonitor (string path, VnodeMonitorKind vnodeKind, DispatchQueue queue = null)
|
||||
public VnodeMonitor (string path, VnodeMonitorKind vnodeKind, DispatchQueue? queue = null)
|
||||
{
|
||||
if (path == null)
|
||||
throw new ArgumentNullException ("path");
|
||||
if (path is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (path));
|
||||
|
||||
fd = open (path, O_EVTONLY);
|
||||
if (fd == -1)
|
||||
|
@ -580,7 +592,7 @@ namespace CoreFoundation {
|
|||
var handle = dispatch_source_create (type_vnode,
|
||||
handle: (IntPtr) fd,
|
||||
mask: (IntPtr) vnodeKind,
|
||||
queue: queue == null ? IntPtr.Zero : queue.Handle);
|
||||
queue: queue.GetHandle ());
|
||||
if (handle != IntPtr.Zero)
|
||||
InitializeHandle (handle);
|
||||
}
|
||||
|
@ -619,7 +631,7 @@ namespace CoreFoundation {
|
|||
public WriteMonitor (IntPtr handle, bool owns) : base (handle, owns){}
|
||||
public WriteMonitor (IntPtr handle) : base (handle, false){}
|
||||
|
||||
public WriteMonitor (int fileDescriptor, DispatchQueue queue = null)
|
||||
public WriteMonitor (int fileDescriptor, DispatchQueue? queue = null)
|
||||
{
|
||||
if (type_write == IntPtr.Zero)
|
||||
type_write = Dlfcn.dlsym (Libraries.System.Handle, "_dispatch_source_type_write");
|
||||
|
@ -627,7 +639,7 @@ namespace CoreFoundation {
|
|||
var handle = dispatch_source_create (type_write,
|
||||
handle: (IntPtr) fileDescriptor,
|
||||
mask: IntPtr.Zero,
|
||||
queue: queue == null ? IntPtr.Zero : queue.Handle);
|
||||
queue: queue.GetHandle ());
|
||||
if (handle != IntPtr.Zero)
|
||||
InitializeHandle (handle);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
|
||||
using Foundation;
|
||||
|
@ -46,11 +48,11 @@ namespace CoreFoundation {
|
|||
#endif
|
||||
public sealed class OSLog : NativeObject {
|
||||
|
||||
static OSLog _default;
|
||||
static OSLog? _default;
|
||||
|
||||
public static OSLog Default {
|
||||
get {
|
||||
if (_default == null) {
|
||||
if (_default is null) {
|
||||
var h = Dlfcn.dlsym (Libraries.System.Handle, "_os_log_default");
|
||||
if (h == IntPtr.Zero)
|
||||
throw new NotSupportedException ("Feature not available on this OS version");
|
||||
|
@ -92,10 +94,10 @@ namespace CoreFoundation {
|
|||
|
||||
public OSLog (string subsystem, string category)
|
||||
{
|
||||
if (subsystem == null)
|
||||
throw new ArgumentNullException (nameof (subsystem));
|
||||
if (category == null)
|
||||
throw new ArgumentNullException (nameof (category));
|
||||
if (subsystem is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (subsystem));
|
||||
if (category is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (category));
|
||||
|
||||
Handle = os_log_create (subsystem, category);
|
||||
}
|
||||
|
@ -107,8 +109,8 @@ namespace CoreFoundation {
|
|||
|
||||
public void Log (OSLogLevel level, string message)
|
||||
{
|
||||
if (message == null)
|
||||
throw new ArgumentNullException (nameof (message));
|
||||
if (message is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (message));
|
||||
|
||||
xamarin_os_log (Handle, level, message);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -21,7 +23,7 @@ namespace CoreMedia {
|
|||
extern static /* CFDictionaryRef */ IntPtr CMCopyDictionaryOfAttachments (/* CFAllocatorRef */ IntPtr allocator, /* CMAttachmentBearerRef */ IntPtr target,
|
||||
/* CMAttachmentMode */ CMAttachmentMode attachmentMode);
|
||||
|
||||
public static NSDictionary GetAttachments (this ICMAttachmentBearer target, CMAttachmentMode attachmentMode)
|
||||
public static NSDictionary? GetAttachments (this ICMAttachmentBearer target, CMAttachmentMode attachmentMode)
|
||||
{
|
||||
if (target is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (target));
|
||||
|
@ -33,7 +35,7 @@ namespace CoreMedia {
|
|||
|
||||
// There is some API that needs a more strongly typed version of a NSDictionary
|
||||
// and there is no easy way to downcast from NSDictionary to NSDictionary<TKey, TValue>
|
||||
public static NSDictionary<TKey, TValue> GetAttachments<TKey, TValue> (this ICMAttachmentBearer target, CMAttachmentMode attachmentMode)
|
||||
public static NSDictionary<TKey, TValue>? GetAttachments<TKey, TValue> (this ICMAttachmentBearer target, CMAttachmentMode attachmentMode)
|
||||
where TKey : class, INativeObject
|
||||
where TValue : class, INativeObject
|
||||
{
|
||||
|
@ -49,7 +51,7 @@ namespace CoreMedia {
|
|||
[DllImport(Constants.CoreMediaLibrary)]
|
||||
extern static /* CFTypeRef */ IntPtr CMGetAttachment (/* CMAttachmentBearerRef */ IntPtr target, /* CFStringRef */ IntPtr key,
|
||||
/* CMAttachmentMode */ out CMAttachmentMode attachmentModeOut);
|
||||
public static T GetAttachment<T> (this ICMAttachmentBearer target, string key, out CMAttachmentMode attachmentModeOut) where T: class, INativeObject
|
||||
public static T? GetAttachment<T> (this ICMAttachmentBearer target, string key, out CMAttachmentMode attachmentModeOut) where T: class, INativeObject
|
||||
{
|
||||
if (target is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (target));
|
||||
|
@ -63,7 +65,7 @@ namespace CoreMedia {
|
|||
return default (T);
|
||||
}
|
||||
#if !WATCH
|
||||
public static T GetAttachment<T> (this ICMAttachmentBearer target, CMSampleBufferAttachmentKey key, out CMAttachmentMode attachmentModeOut) where T: class, INativeObject
|
||||
public static T? GetAttachment<T> (this ICMAttachmentBearer target, CMSampleBufferAttachmentKey key, out CMAttachmentMode attachmentModeOut) where T: class, INativeObject
|
||||
{
|
||||
return GetAttachment<T> (target, key.GetConstant (), out attachmentModeOut);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
//
|
||||
// Copyright 2015 Xamarin Inc.
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -59,7 +62,9 @@ namespace CoreMedia {
|
|||
static IntPtr AllocateCallback (IntPtr refCon, nuint sizeInBytes)
|
||||
{
|
||||
var gch = GCHandle.FromIntPtr (refCon);
|
||||
return ((CMCustomBlockAllocator) gch.Target).Allocate (sizeInBytes);
|
||||
if (gch.Target is CMCustomBlockAllocator target)
|
||||
return target.Allocate (sizeInBytes);
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
public virtual IntPtr Allocate (nuint sizeInBytes)
|
||||
|
@ -73,7 +78,8 @@ namespace CoreMedia {
|
|||
static void FreeCallback (IntPtr refCon, IntPtr doomedMemoryBlock, nuint sizeInBytes)
|
||||
{
|
||||
var gch = GCHandle.FromIntPtr (refCon);
|
||||
((CMCustomBlockAllocator) gch.Target).Free (doomedMemoryBlock, sizeInBytes);
|
||||
if (gch.Target is CMCustomBlockAllocator allocator)
|
||||
allocator.Free (doomedMemoryBlock, sizeInBytes);
|
||||
}
|
||||
|
||||
public virtual void Free (IntPtr doomedMemoryBlock, nuint sizeInBytes)
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
//
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -163,7 +165,7 @@ namespace CoreMedia {
|
|||
}
|
||||
}
|
||||
|
||||
public string FontFamilyName {
|
||||
public string? FontFamilyName {
|
||||
get {
|
||||
return GetStringValue (CMTextMarkupAttributesKeys.FontFamilyName);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
// Copyright 2010-2011 Novell Inc
|
||||
// Copyright 2012-2014 Xamarin Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using CoreFoundation;
|
||||
|
@ -184,7 +187,7 @@ namespace CoreMedia {
|
|||
return comp >= 0;
|
||||
}
|
||||
|
||||
public override bool Equals (object obj)
|
||||
public override bool Equals (object? obj)
|
||||
{
|
||||
if (obj is CMTime time)
|
||||
return CMTimeCompare (this, time) == 0;
|
||||
|
@ -348,10 +351,10 @@ namespace CoreMedia {
|
|||
}
|
||||
|
||||
// FIXME: generated will need some changes to emit [Field] in partial struct (not class)
|
||||
public readonly static NSString ValueKey;
|
||||
public readonly static NSString ScaleKey;
|
||||
public readonly static NSString EpochKey;
|
||||
public readonly static NSString FlagsKey;
|
||||
public readonly static NSString? ValueKey;
|
||||
public readonly static NSString? ScaleKey;
|
||||
public readonly static NSString? EpochKey;
|
||||
public readonly static NSString? FlagsKey;
|
||||
|
||||
static CMTime ()
|
||||
{
|
||||
|
@ -373,13 +376,13 @@ namespace CoreMedia {
|
|||
[DllImport(Constants.CoreMediaLibrary)]
|
||||
extern static /* CFStringRef */ IntPtr CMTimeCopyDescription (/* CFAllocatorRef */ IntPtr allocator, CMTime time);
|
||||
|
||||
public string Description {
|
||||
public string? Description {
|
||||
get {
|
||||
return CFString.FromHandle (CMTimeCopyDescription (IntPtr.Zero, this));
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
public override string? ToString ()
|
||||
{
|
||||
return Description;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
// Copyright 2010-2011 Novell Inc
|
||||
// Copyright 2012-2014 Xamarin Inc
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using CoreFoundation;
|
||||
|
@ -76,7 +79,7 @@ namespace CoreMedia {
|
|||
[iOS (9,0)]
|
||||
[Mac (10,11)]
|
||||
#endif
|
||||
public static NSString TimeMappingSourceKey { get; private set; }
|
||||
public static NSString? TimeMappingSourceKey { get; private set; }
|
||||
|
||||
#if NET
|
||||
[SupportedOSPlatform ("ios9.0")]
|
||||
|
@ -87,22 +90,24 @@ namespace CoreMedia {
|
|||
[iOS (9,0)]
|
||||
[Mac (10,11)]
|
||||
#endif
|
||||
public static NSString TimeMappingTargetKey { get; private set; }
|
||||
public static NSString? TimeMappingTargetKey { get; private set; }
|
||||
|
||||
static CMTimeRange () {
|
||||
var lib = Libraries.CoreMedia.Handle;
|
||||
var retZero = Dlfcn.dlsym (lib, "kCMTimeRangeZero");
|
||||
Zero = (CMTimeRange)Marshal.PtrToStructure (retZero, typeof(CMTimeRange));
|
||||
Zero = (CMTimeRange)Marshal.PtrToStructure (retZero, typeof(CMTimeRange))!;
|
||||
|
||||
var retInvalid = Dlfcn.dlsym (lib, "kCMTimeRangeInvalid");
|
||||
#if !XAMCORE_3_0
|
||||
Invalid = (CMTimeRange)Marshal.PtrToStructure (retInvalid, typeof(CMTimeRange));
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
Invalid = (CMTimeRange)Marshal.PtrToStructure (retInvalid, typeof(CMTimeRange))!;
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
#endif
|
||||
InvalidRange = (CMTimeRange)Marshal.PtrToStructure (retInvalid, typeof(CMTimeRange));
|
||||
InvalidRange = (CMTimeRange)Marshal.PtrToStructure (retInvalid, typeof(CMTimeRange))!;
|
||||
|
||||
var retMappingInvalid = Dlfcn.dlsym (lib, "kCMTimeMappingInvalid");
|
||||
if (retMappingInvalid != IntPtr.Zero)
|
||||
InvalidMapping = (CMTimeRange)Marshal.PtrToStructure (retMappingInvalid, typeof(CMTimeRange));
|
||||
InvalidMapping = (CMTimeRange)Marshal.PtrToStructure (retMappingInvalid, typeof(CMTimeRange))!;
|
||||
|
||||
TimeMappingSourceKey = Dlfcn.GetStringConstant (lib, "kCMTimeMappingSourceKey");
|
||||
TimeMappingTargetKey = Dlfcn.GetStringConstant (lib, "kCMTimeMappingTargetKey");
|
||||
|
@ -190,7 +195,7 @@ namespace CoreMedia {
|
|||
[iOS (9,0)]
|
||||
[Mac (10,11)]
|
||||
#endif
|
||||
public string Description
|
||||
public string? Description
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using ObjCRuntime;
|
||||
|
||||
namespace CoreMedia {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -134,7 +137,7 @@ namespace CoreMidi {
|
|||
[DllImport (Constants.CoreMidiLibrary)]
|
||||
extern static MidiDeviceRef MIDIGetDevice (nint /* ItemCount = unsigned long */ item);
|
||||
|
||||
public static MidiDevice GetDevice (nint deviceIndex)
|
||||
public static MidiDevice? GetDevice (nint deviceIndex)
|
||||
{
|
||||
var h = MIDIGetDevice (deviceIndex);
|
||||
if (h == MidiObject.InvalidRef)
|
||||
|
@ -142,7 +145,7 @@ namespace CoreMidi {
|
|||
return new MidiDevice (h);
|
||||
}
|
||||
|
||||
public static MidiDevice GetExternalDevice (nint deviceIndex)
|
||||
public static MidiDevice? GetExternalDevice (nint deviceIndex)
|
||||
{
|
||||
var h = MIDIGetExternalDevice (deviceIndex);
|
||||
if (h == MidiObject.InvalidRef)
|
||||
|
@ -303,14 +306,14 @@ namespace CoreMidi {
|
|||
|
||||
[DllImport (Constants.CoreMidiLibrary)]
|
||||
extern static int /* OSStatus = SInt32 */ MIDIObjectGetDictionaryProperty (MidiObjectRef obj, IntPtr str, out IntPtr dict);
|
||||
internal NSDictionary GetDictionary (IntPtr property)
|
||||
internal NSDictionary? GetDictionary (IntPtr property)
|
||||
{
|
||||
IntPtr val;
|
||||
int code;
|
||||
|
||||
code = MIDIObjectGetDictionaryProperty (handle, property, out val);
|
||||
if (code == 0) {
|
||||
var dict = (NSDictionary) Runtime.GetNSObject (val);
|
||||
var dict = Runtime.GetNSObject (val) as NSDictionary;
|
||||
if (val != IntPtr.Zero)
|
||||
CFObject.CFRelease (val);
|
||||
return dict;
|
||||
|
@ -328,14 +331,14 @@ namespace CoreMidi {
|
|||
[DllImport (Constants.CoreMidiLibrary)]
|
||||
extern static int /* OSStatus = SInt32 */ MIDIObjectGetDataProperty (MidiObjectRef obj, IntPtr str, out IntPtr data);
|
||||
|
||||
public NSData GetData (IntPtr property)
|
||||
public NSData? GetData (IntPtr property)
|
||||
{
|
||||
IntPtr val;
|
||||
int code;
|
||||
|
||||
code = MIDIObjectGetDataProperty (handle, property, out val);
|
||||
if (code == 0) {
|
||||
var data = (NSData) Runtime.GetNSObject (val);
|
||||
var data = Runtime.GetNSObject (val) as NSData;
|
||||
if (val != IntPtr.Zero)
|
||||
CFObject.CFRelease (val);
|
||||
return data;
|
||||
|
@ -348,15 +351,15 @@ namespace CoreMidi {
|
|||
|
||||
public void SetData (IntPtr property, NSData data)
|
||||
{
|
||||
if (data == null)
|
||||
throw new ArgumentNullException ("data");
|
||||
if (data is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (data));
|
||||
MIDIObjectSetDataProperty (handle, property, data.Handle);
|
||||
}
|
||||
|
||||
[DllImport (Constants.CoreMidiLibrary)]
|
||||
extern static int /* OSStatus = SInt32 */ MIDIObjectGetStringProperty (MidiObjectRef obj, IntPtr str, out IntPtr data);
|
||||
|
||||
public string GetString (IntPtr property)
|
||||
public string? GetString (IntPtr property)
|
||||
{
|
||||
IntPtr val;
|
||||
int code;
|
||||
|
@ -376,8 +379,8 @@ namespace CoreMidi {
|
|||
|
||||
public void SetString (IntPtr property, string value)
|
||||
{
|
||||
if (value == null)
|
||||
throw new ArgumentNullException ("value");
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
using (var nsval = new NSString (value)){
|
||||
MIDIObjectSetDictionaryProperty (handle, property, nsval.Handle);
|
||||
}
|
||||
|
@ -395,12 +398,12 @@ namespace CoreMidi {
|
|||
[DllImport (Constants.CoreMidiLibrary)]
|
||||
extern static int /* OSStatus = SInt32 */ MIDIObjectGetProperties (MidiObjectRef obj, out IntPtr dict, [MarshalAs (UnmanagedType.U1)] bool deep);
|
||||
|
||||
public NSDictionary GetDictionaryProperties (bool deep)
|
||||
public NSDictionary? GetDictionaryProperties (bool deep)
|
||||
{
|
||||
IntPtr val;
|
||||
if (MIDIObjectGetProperties (handle, out val, deep) != 0 || val == IntPtr.Zero)
|
||||
return null;
|
||||
var value = (NSDictionary) Runtime.GetNSObject (val);
|
||||
var value = Runtime.GetNSObject (val) as NSDictionary;
|
||||
CFObject.CFRelease (val);
|
||||
return value;
|
||||
}
|
||||
|
@ -444,7 +447,7 @@ namespace CoreMidi {
|
|||
[DllImport (Constants.CoreMidiLibrary)]
|
||||
extern static MidiError /* OSStatus = SInt32 */ MIDIObjectFindByUniqueID (int /* MIDIUniqueID = SInt32 */ uniqueId, out MidiObjectRef obj, out MidiObjectType objectType);
|
||||
|
||||
static internal MidiObject MidiObjectFromType (MidiObjectType type, MidiObjectRef handle)
|
||||
static internal MidiObject? MidiObjectFromType (MidiObjectType type, MidiObjectRef handle)
|
||||
{
|
||||
if (handle == MidiObject.InvalidRef)
|
||||
return null;
|
||||
|
@ -470,7 +473,7 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
static public MidiError FindByUniqueId (int uniqueId, out MidiObject result)
|
||||
static public MidiError FindByUniqueId (int uniqueId, out MidiObject? result)
|
||||
{
|
||||
MidiObjectRef handle;
|
||||
MidiObjectType type;
|
||||
|
@ -580,7 +583,7 @@ namespace CoreMidi {
|
|||
[Deprecated (PlatformName.iOS, 14,0)]
|
||||
[Deprecated (PlatformName.MacOSX, 11,0)]
|
||||
#endif
|
||||
public MidiEndpoint CreateVirtualSource (string name, out MidiError statusCode)
|
||||
public MidiEndpoint? CreateVirtualSource (string name, out MidiError statusCode)
|
||||
{
|
||||
using (var nsstr = new NSString (name)){
|
||||
MidiObjectRef ret;
|
||||
|
@ -609,7 +612,7 @@ namespace CoreMidi {
|
|||
[Deprecated (PlatformName.iOS, 14,0)]
|
||||
[Deprecated (PlatformName.MacOSX, 11,0)]
|
||||
#endif
|
||||
public MidiEndpoint CreateVirtualDestination (string name, out MidiError status)
|
||||
public MidiEndpoint? CreateVirtualDestination (string name, out MidiError status)
|
||||
{
|
||||
var m = new MidiEndpoint (this, name, out status);
|
||||
if (status == MidiError.Ok)
|
||||
|
@ -629,13 +632,13 @@ namespace CoreMidi {
|
|||
return new MidiPort (this, name, false);
|
||||
}
|
||||
|
||||
public event EventHandler SetupChanged;
|
||||
public event EventHandler<ObjectAddedOrRemovedEventArgs> ObjectAdded;
|
||||
public event EventHandler<ObjectAddedOrRemovedEventArgs> ObjectRemoved;
|
||||
public event EventHandler<ObjectPropertyChangedEventArgs> PropertyChanged;
|
||||
public event EventHandler ThruConnectionsChanged;
|
||||
public event EventHandler SerialPortOwnerChanged;
|
||||
public event EventHandler<IOErrorEventArgs> IOError;
|
||||
public event EventHandler? SetupChanged;
|
||||
public event EventHandler<ObjectAddedOrRemovedEventArgs>? ObjectAdded;
|
||||
public event EventHandler<ObjectAddedOrRemovedEventArgs>? ObjectRemoved;
|
||||
public event EventHandler<ObjectPropertyChangedEventArgs>? PropertyChanged;
|
||||
public event EventHandler? ThruConnectionsChanged;
|
||||
public event EventHandler? SerialPortOwnerChanged;
|
||||
public event EventHandler<IOErrorEventArgs>? IOError;
|
||||
|
||||
#if !MONOMAC
|
||||
[MonoPInvokeCallback (typeof (MidiNotifyProc))]
|
||||
|
@ -643,53 +646,53 @@ namespace CoreMidi {
|
|||
static void ClientCallback (IntPtr message, IntPtr context)
|
||||
{
|
||||
GCHandle gch = GCHandle.FromIntPtr (context);
|
||||
MidiClient client = (MidiClient) gch.Target;
|
||||
MidiClient? client = gch.Target as MidiClient;
|
||||
|
||||
var id = (MidiNotificationMessageId) Marshal.ReadInt32 (message); // SInt32
|
||||
switch (id){
|
||||
case MidiNotificationMessageId.SetupChanged:
|
||||
var esc = client.SetupChanged;
|
||||
if (esc != null)
|
||||
var esc = client?.SetupChanged;
|
||||
if (esc is not null)
|
||||
esc (client, EventArgs.Empty);
|
||||
break;
|
||||
case MidiNotificationMessageId.ObjectAdded:
|
||||
var eoa = client.ObjectAdded;
|
||||
if (eoa != null){
|
||||
var data = (MidiObjectAddRemoveNotification) Marshal.PtrToStructure (message, typeof (MidiObjectAddRemoveNotification));
|
||||
var eoa = client?.ObjectAdded;
|
||||
if (eoa is not null){
|
||||
var data = (MidiObjectAddRemoveNotification) Marshal.PtrToStructure (message, typeof (MidiObjectAddRemoveNotification))!;
|
||||
eoa (client, new ObjectAddedOrRemovedEventArgs (MidiObjectFromType (data.ParentType, data.Parent),
|
||||
MidiObjectFromType (data.ChildType, data.Child)));
|
||||
}
|
||||
break;
|
||||
case MidiNotificationMessageId.ObjectRemoved:
|
||||
var eor = client.ObjectRemoved;
|
||||
if (eor != null){
|
||||
var data = (MidiObjectAddRemoveNotification) Marshal.PtrToStructure (message, typeof (MidiObjectAddRemoveNotification));
|
||||
var eor = client?.ObjectRemoved;
|
||||
if (eor is not null){
|
||||
var data = (MidiObjectAddRemoveNotification) Marshal.PtrToStructure (message, typeof (MidiObjectAddRemoveNotification))!;
|
||||
eor (client, new ObjectAddedOrRemovedEventArgs (MidiObjectFromType (data.ParentType, data.Parent),
|
||||
MidiObjectFromType (data.ChildType, data.Child)));
|
||||
}
|
||||
break;
|
||||
case MidiNotificationMessageId.PropertyChanged:
|
||||
var epc = client.PropertyChanged;
|
||||
if (epc != null){
|
||||
var data = (MidiObjectPropertyChangeNotification) Marshal.PtrToStructure (message, typeof (MidiObjectPropertyChangeNotification));
|
||||
var epc = client?.PropertyChanged;
|
||||
if (epc is not null){
|
||||
var data = (MidiObjectPropertyChangeNotification) Marshal.PtrToStructure (message, typeof (MidiObjectPropertyChangeNotification))!;
|
||||
epc (client, new ObjectPropertyChangedEventArgs (
|
||||
MidiObjectFromType (data.ObjectType, data.ObjectHandle), CFString.FromHandle (data.PropertyName)));
|
||||
}
|
||||
break;
|
||||
case MidiNotificationMessageId.ThruConnectionsChanged:
|
||||
var e = client.ThruConnectionsChanged;
|
||||
if (e != null)
|
||||
var e = client?.ThruConnectionsChanged;
|
||||
if (e is not null)
|
||||
e (client, EventArgs.Empty);
|
||||
break;
|
||||
case MidiNotificationMessageId.SerialPortOwnerChanged:
|
||||
e = client.SerialPortOwnerChanged;
|
||||
if (e != null)
|
||||
e = client?.SerialPortOwnerChanged;
|
||||
if (e is not null)
|
||||
e (client, EventArgs.Empty);
|
||||
break;
|
||||
case MidiNotificationMessageId.IOError:
|
||||
var eio = client.IOError;
|
||||
if (eio != null){
|
||||
var data = (MidiIOErrorNotification) Marshal.PtrToStructure (message, typeof (MidiIOErrorNotification));
|
||||
var eio = client?.IOError;
|
||||
if (eio is not null){
|
||||
var data = (MidiIOErrorNotification) Marshal.PtrToStructure (message, typeof (MidiIOErrorNotification))!;
|
||||
eio (client, new IOErrorEventArgs (new MidiDevice (data.DeviceRef), data.ErrorCode));
|
||||
}
|
||||
break;
|
||||
|
@ -758,7 +761,7 @@ namespace CoreMidi {
|
|||
#if !COREBUILD
|
||||
public long TimeStamp;
|
||||
IntPtr byteptr;
|
||||
byte [] bytes;
|
||||
byte [] bytes = Array.Empty<byte> ();
|
||||
int start;
|
||||
public ushort Length;
|
||||
|
||||
|
@ -779,8 +782,8 @@ namespace CoreMidi {
|
|||
|
||||
MidiPacket (long timestamp, byte [] bytes, int start, int length, bool check)
|
||||
{
|
||||
if (bytes == null)
|
||||
throw new ArgumentNullException ("bytes");
|
||||
if (bytes is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (bytes));
|
||||
if (length > UInt16.MaxValue)
|
||||
throw new ArgumentException ("length is bigger than 64k");
|
||||
|
||||
|
@ -824,7 +827,7 @@ namespace CoreMidi {
|
|||
|
||||
public IntPtr Bytes {
|
||||
get {
|
||||
if (bytes == null)
|
||||
if (bytes is null)
|
||||
return byteptr;
|
||||
unsafe {
|
||||
fixed (byte *p = &bytes [start]){
|
||||
|
@ -914,7 +917,7 @@ namespace CoreMidi {
|
|||
dest += 8;
|
||||
Marshal.WriteInt16 (buffer, dest, (short) packet_size);
|
||||
dest += 2;
|
||||
if (packet.ByteArray == null) {
|
||||
if (packet.ByteArray is null) {
|
||||
Buffer.MemoryCopy ((void*) packet.BytePointer, (void*) (buffer + dest), packet_size, packet_size);
|
||||
} else {
|
||||
Marshal.Copy (packet.ByteArray, packet.start, buffer + dest, packet_size);
|
||||
|
@ -1005,7 +1008,7 @@ namespace CoreMidi {
|
|||
base.Dispose (disposing);
|
||||
}
|
||||
|
||||
public event EventHandler<MidiPacketsEventArgs> MessageReceived;
|
||||
public event EventHandler<MidiPacketsEventArgs>? MessageReceived;
|
||||
|
||||
#if !MONOMAC
|
||||
[MonoPInvokeCallback (typeof (MidiReadProc))]
|
||||
|
@ -1013,11 +1016,11 @@ namespace CoreMidi {
|
|||
static void Read (IntPtr packetList, IntPtr context, IntPtr srcPtr)
|
||||
{
|
||||
GCHandle gch = GCHandle.FromIntPtr (context);
|
||||
MidiPort port = (MidiPort) gch.Target;
|
||||
|
||||
if (gch.Target is MidiPort port) {
|
||||
var e = port.MessageReceived;
|
||||
if (e != null) {
|
||||
using (var args = new MidiPacketsEventArgs (packetList)) {
|
||||
if (e is not null) {
|
||||
using (var args = new MidiPacketsEventArgs (packetList))
|
||||
e (port, args);
|
||||
}
|
||||
}
|
||||
|
@ -1031,15 +1034,15 @@ namespace CoreMidi {
|
|||
|
||||
public MidiError ConnectSource (MidiEndpoint endpoint)
|
||||
{
|
||||
if (endpoint == null)
|
||||
throw new ArgumentNullException ("endpoint");
|
||||
if (endpoint is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (endpoint));
|
||||
return (MidiError) MIDIPortConnectSource (handle, endpoint.handle, GCHandle.ToIntPtr (gch));
|
||||
}
|
||||
|
||||
public MidiError Disconnect (MidiEndpoint endpoint)
|
||||
{
|
||||
if (endpoint == null)
|
||||
throw new ArgumentNullException ("endpoint");
|
||||
if (endpoint is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (endpoint));
|
||||
return (MidiError) MIDIPortDisconnectSource (handle, endpoint.handle);
|
||||
}
|
||||
|
||||
|
@ -1083,10 +1086,10 @@ namespace CoreMidi {
|
|||
#endif
|
||||
public MidiError Send (MidiEndpoint endpoint, MidiPacket [] packets)
|
||||
{
|
||||
if (endpoint == null)
|
||||
throw new ArgumentNullException ("endpoint");
|
||||
if (packets == null)
|
||||
throw new ArgumentNullException ("packets");
|
||||
if (endpoint is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (endpoint));
|
||||
if (packets is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (packets));
|
||||
var p = MidiPacket.CreatePacketList (packets);
|
||||
var code = MIDISend (handle, endpoint.handle, p);
|
||||
Marshal.FreeHGlobal (p);
|
||||
|
@ -1116,7 +1119,7 @@ namespace CoreMidi {
|
|||
[DllImport (Constants.CoreMidiLibrary)]
|
||||
extern static MidiEndpointRef MIDIEntityGetSource (MidiEntityRef entity, nint idx);
|
||||
|
||||
public MidiEndpoint GetDestination (nint idx)
|
||||
public MidiEndpoint? GetDestination (nint idx)
|
||||
{
|
||||
var dest = MIDIEntityGetDestination (handle, idx);
|
||||
if (dest == MidiObject.InvalidRef)
|
||||
|
@ -1124,7 +1127,7 @@ namespace CoreMidi {
|
|||
return new MidiEndpoint (dest, false);
|
||||
}
|
||||
|
||||
public MidiEndpoint GetSource (nint idx)
|
||||
public MidiEndpoint? GetSource (nint idx)
|
||||
{
|
||||
var dest = MIDIEntityGetSource (handle, idx);
|
||||
if (dest == MidiObject.InvalidRef)
|
||||
|
@ -1153,7 +1156,7 @@ namespace CoreMidi {
|
|||
[DllImport (Constants.CoreMidiLibrary)]
|
||||
extern static int /* OSStatus = SInt32 */ MIDIEntityGetDevice (MidiEntityRef handle, out MidiDeviceRef devRef);
|
||||
|
||||
public MidiDevice Device {
|
||||
public MidiDevice? Device {
|
||||
get {
|
||||
MidiEntityRef res;
|
||||
if (MIDIEntityGetDevice (handle, out res) == 0)
|
||||
|
@ -1189,11 +1192,13 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public NSData ConnectionUniqueIDData {
|
||||
public NSData? ConnectionUniqueIDData {
|
||||
get {
|
||||
return GetData (kMIDIPropertyConnectionUniqueID);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetData (kMIDIPropertyConnectionUniqueID, value);
|
||||
}
|
||||
}
|
||||
|
@ -1207,20 +1212,24 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public string DisplayName {
|
||||
public string? DisplayName {
|
||||
get {
|
||||
return GetString (kMIDIPropertyDisplayName);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyDisplayName, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string DriverOwner {
|
||||
public string? DriverOwner {
|
||||
get {
|
||||
return GetString (kMIDIPropertyDriverOwner);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyDriverOwner, value);
|
||||
}
|
||||
}
|
||||
|
@ -1306,29 +1315,35 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public string Model {
|
||||
public string? Model {
|
||||
get {
|
||||
return GetString (kMIDIPropertyModel);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyModel, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string Name {
|
||||
public string? Name {
|
||||
get {
|
||||
return GetString (kMIDIPropertyName);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyName, value);
|
||||
}
|
||||
}
|
||||
|
||||
public NSDictionary NameConfiguration {
|
||||
public NSDictionary? NameConfiguration {
|
||||
get {
|
||||
return GetDictionary (kMIDIPropertyNameConfiguration);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetDictionary (kMIDIPropertyNameConfiguration, value);
|
||||
}
|
||||
}
|
||||
|
@ -1528,7 +1543,7 @@ namespace CoreMidi {
|
|||
[DllImport (Constants.CoreMidiLibrary)]
|
||||
extern static int MIDIDeviceAddEntity (MidiDeviceRef device, /* CFString */ IntPtr name, [MarshalAs (UnmanagedType.U1)] bool embedded, nuint numSourceEndpoints, nuint numDestinationEndpoints, MidiEntityRef newEntity);
|
||||
|
||||
public MidiEntity GetEntity (nint entityIndex)
|
||||
public MidiEntity? GetEntity (nint entityIndex)
|
||||
{
|
||||
if (handle == MidiObject.InvalidRef)
|
||||
throw new ObjectDisposedException ("handle");
|
||||
|
@ -1564,20 +1579,24 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public string Image {
|
||||
public string? Image {
|
||||
get {
|
||||
return GetString (kMIDIPropertyImage);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyImage, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string DriverDeviceEditorApp {
|
||||
public string? DriverDeviceEditorApp {
|
||||
get {
|
||||
return GetString (kMIDIPropertyDriverDeviceEditorApp);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyDriverDeviceEditorApp, value);
|
||||
}
|
||||
}
|
||||
|
@ -1609,20 +1628,24 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public string FactoryPatchNameFile {
|
||||
public string? FactoryPatchNameFile {
|
||||
get {
|
||||
return GetString (kMIDIPropertyFactoryPatchNameFile);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyFactoryPatchNameFile, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string UserPatchNameFile {
|
||||
public string? UserPatchNameFile {
|
||||
get {
|
||||
return GetString (kMIDIPropertyUserPatchNameFile);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyUserPatchNameFile, value);
|
||||
}
|
||||
}
|
||||
|
@ -1635,11 +1658,13 @@ namespace CoreMidi {
|
|||
[Mac (10,15)]
|
||||
[iOS (13,0)]
|
||||
#endif
|
||||
public string NameConfigurationDictionary {
|
||||
public string? NameConfigurationDictionary {
|
||||
get {
|
||||
return GetString (kMIDIPropertyNameConfigurationDictionary);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyNameConfigurationDictionary, value);
|
||||
}
|
||||
}
|
||||
|
@ -1671,11 +1696,13 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public NSData ConnectionUniqueIDData {
|
||||
public NSData? ConnectionUniqueIDData {
|
||||
get {
|
||||
return GetData (kMIDIPropertyConnectionUniqueID);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetData (kMIDIPropertyConnectionUniqueID, value);
|
||||
}
|
||||
}
|
||||
|
@ -1689,20 +1716,24 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public string DisplayName {
|
||||
public string? DisplayName {
|
||||
get {
|
||||
return GetString (kMIDIPropertyDisplayName);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyDisplayName, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string DriverOwner {
|
||||
public string? DriverOwner {
|
||||
get {
|
||||
return GetString (kMIDIPropertyDriverOwner);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyDriverOwner, value);
|
||||
}
|
||||
}
|
||||
|
@ -1746,11 +1777,13 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public string Manufacturer {
|
||||
public string? Manufacturer {
|
||||
get {
|
||||
return GetString (kMIDIPropertyManufacturer);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyManufacturer, value);
|
||||
}
|
||||
}
|
||||
|
@ -1788,29 +1821,35 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public string Model {
|
||||
public string? Model {
|
||||
get {
|
||||
return GetString (kMIDIPropertyModel);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyModel, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string Name {
|
||||
public string? Name {
|
||||
get {
|
||||
return GetString (kMIDIPropertyName);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyName, value);
|
||||
}
|
||||
}
|
||||
|
||||
public NSDictionary NameConfiguration {
|
||||
public NSDictionary? NameConfiguration {
|
||||
get {
|
||||
return GetDictionary (kMIDIPropertyNameConfiguration);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetDictionary (kMIDIPropertyNameConfiguration, value);
|
||||
}
|
||||
}
|
||||
|
@ -2022,7 +2061,7 @@ namespace CoreMidi {
|
|||
return MIDIDeviceListGetNumberOfDevices (handle);
|
||||
}
|
||||
|
||||
public MidiDevice Get (nuint index)
|
||||
public MidiDevice? Get (nuint index)
|
||||
{
|
||||
if (handle == MidiObject.InvalidRef)
|
||||
throw new ObjectDisposedException ("handle");
|
||||
|
@ -2136,7 +2175,7 @@ namespace CoreMidi {
|
|||
EndpointName = endpointName;
|
||||
}
|
||||
|
||||
public static MidiEndpoint GetSource (nint sourceIndex)
|
||||
public static MidiEndpoint? GetSource (nint sourceIndex)
|
||||
{
|
||||
var h = MIDIGetSource (sourceIndex);
|
||||
if (h == MidiObject.InvalidRef)
|
||||
|
@ -2144,7 +2183,7 @@ namespace CoreMidi {
|
|||
return new MidiEndpoint (h, "Source" + sourceIndex, false);
|
||||
}
|
||||
|
||||
public static MidiEndpoint GetDestination (nint destinationIndex)
|
||||
public static MidiEndpoint? GetDestination (nint destinationIndex)
|
||||
{
|
||||
var h = MIDIGetDestination (destinationIndex);
|
||||
if (h == MidiObject.InvalidRef)
|
||||
|
@ -2168,7 +2207,7 @@ namespace CoreMidi {
|
|||
base.Dispose (disposing);
|
||||
}
|
||||
|
||||
public event EventHandler<MidiPacketsEventArgs> MessageReceived;
|
||||
public event EventHandler<MidiPacketsEventArgs>? MessageReceived;
|
||||
|
||||
#if !MONOMAC
|
||||
[MonoPInvokeCallback (typeof (MidiReadProc))]
|
||||
|
@ -2176,12 +2215,13 @@ namespace CoreMidi {
|
|||
static void Read (IntPtr packetList, IntPtr context, IntPtr srcPtr)
|
||||
{
|
||||
GCHandle gch = GCHandle.FromIntPtr (context);
|
||||
MidiEndpoint port = (MidiEndpoint) gch.Target;
|
||||
|
||||
if (gch.Target is MidiEndpoint port) {
|
||||
var e = port.MessageReceived;
|
||||
if (e != null)
|
||||
if (e is not null)
|
||||
e (port, new MidiPacketsEventArgs (packetList));
|
||||
}
|
||||
}
|
||||
|
||||
public void FlushOutput ()
|
||||
{
|
||||
|
@ -2205,8 +2245,8 @@ namespace CoreMidi {
|
|||
#endif
|
||||
public MidiError Received (MidiPacket [] packets)
|
||||
{
|
||||
if (packets == null)
|
||||
throw new ArgumentNullException ("packets");
|
||||
if (packets is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (packets));
|
||||
|
||||
var block = MidiPacket.CreatePacketList (packets);
|
||||
var code = MIDIReceived (handle, block);
|
||||
|
@ -2217,7 +2257,7 @@ namespace CoreMidi {
|
|||
[DllImport (Constants.CoreMidiLibrary)]
|
||||
extern static int /* OSStatus = SInt32 */ MIDIEndpointGetEntity (MidiEndpointRef endpoint, out MidiEntityRef entity);
|
||||
|
||||
public MidiEntity Entity {
|
||||
public MidiEntity? Entity {
|
||||
get {
|
||||
MidiEntityRef entity;
|
||||
var code = MIDIEndpointGetEntity (handle, out entity);
|
||||
|
@ -2230,7 +2270,7 @@ namespace CoreMidi {
|
|||
public bool IsNetworkSession {
|
||||
get {
|
||||
using (var dict = GetDictionaryProperties (true)){
|
||||
if (dict == null)
|
||||
if (dict is null)
|
||||
return false;
|
||||
|
||||
using (var key = new NSString ("apple.midirtp.session"))
|
||||
|
@ -2257,29 +2297,35 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public NSData ConnectionUniqueIDData {
|
||||
public NSData? ConnectionUniqueIDData {
|
||||
get {
|
||||
return GetData (kMIDIPropertyConnectionUniqueID);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetData (kMIDIPropertyConnectionUniqueID, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string DisplayName {
|
||||
public string? DisplayName {
|
||||
get {
|
||||
return GetString (kMIDIPropertyDisplayName);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyDisplayName, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string DriverOwner {
|
||||
public string? DriverOwner {
|
||||
get {
|
||||
return GetString (kMIDIPropertyDriverOwner);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyDriverOwner, value);
|
||||
}
|
||||
}
|
||||
|
@ -2302,11 +2348,13 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public string Manufacturer {
|
||||
public string? Manufacturer {
|
||||
get {
|
||||
return GetString (kMIDIPropertyManufacturer);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyManufacturer, value);
|
||||
}
|
||||
}
|
||||
|
@ -2326,20 +2374,24 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public string Name {
|
||||
public string? Name {
|
||||
get {
|
||||
return GetString (kMIDIPropertyName);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetString (kMIDIPropertyName, value);
|
||||
}
|
||||
}
|
||||
|
||||
public NSDictionary NameConfiguration {
|
||||
public NSDictionary? NameConfiguration {
|
||||
get {
|
||||
return GetDictionary (kMIDIPropertyNameConfiguration);
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
SetDictionary (kMIDIPropertyNameConfiguration, value);
|
||||
}
|
||||
}
|
||||
|
@ -2404,13 +2456,13 @@ namespace CoreMidi {
|
|||
[SupportedOSPlatform ("macos")]
|
||||
#endif
|
||||
public class ObjectAddedOrRemovedEventArgs : EventArgs {
|
||||
public ObjectAddedOrRemovedEventArgs (MidiObject parent, MidiObject child)
|
||||
public ObjectAddedOrRemovedEventArgs (MidiObject? parent, MidiObject? child)
|
||||
{
|
||||
Parent = parent;
|
||||
Child = child;
|
||||
}
|
||||
public MidiObject Parent { get; private set; }
|
||||
public MidiObject Child { get; private set; }
|
||||
public MidiObject? Parent { get; private set; }
|
||||
public MidiObject? Child { get; private set; }
|
||||
}
|
||||
|
||||
#if NET
|
||||
|
@ -2419,13 +2471,13 @@ namespace CoreMidi {
|
|||
[SupportedOSPlatform ("macos")]
|
||||
#endif
|
||||
public class ObjectPropertyChangedEventArgs : EventArgs {
|
||||
public ObjectPropertyChangedEventArgs (MidiObject midiObject, string propertyName)
|
||||
public ObjectPropertyChangedEventArgs (MidiObject? midiObject, string? propertyName)
|
||||
{
|
||||
MidiObject = midiObject;
|
||||
PropertyName = propertyName;
|
||||
}
|
||||
public MidiObject MidiObject { get; private set; }
|
||||
public string PropertyName { get; private set; }
|
||||
public MidiObject? MidiObject { get; private set; }
|
||||
public string? PropertyName { get; private set; }
|
||||
}
|
||||
|
||||
#if NET
|
||||
|
@ -2455,7 +2507,7 @@ namespace CoreMidi {
|
|||
{
|
||||
#if !COREBUILD
|
||||
IntPtr packetList;
|
||||
MidiPacket [] list;
|
||||
MidiPacket []? list;
|
||||
|
||||
internal MidiPacketsEventArgs (IntPtr packetList)
|
||||
{
|
||||
|
@ -2475,7 +2527,7 @@ namespace CoreMidi {
|
|||
|
||||
public MidiPacket [] Packets {
|
||||
get {
|
||||
if (list == null)
|
||||
if (list is null)
|
||||
list = MidiPacket.ReadPacketList (packetList);
|
||||
return list;
|
||||
}
|
||||
|
@ -2491,7 +2543,7 @@ namespace CoreMidi {
|
|||
{
|
||||
// The list of packets may have pointers into packetList, make sure
|
||||
// we invalidate those pointers.
|
||||
if (list != null) {
|
||||
if (list is not null) {
|
||||
foreach (var packet in list)
|
||||
packet.Dispose ();
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace CoreMidi {
|
|||
if (Handle == InvalidRef)
|
||||
throw new ObjectDisposedException ("MidiThruConnection");
|
||||
if (connectionParams is null)
|
||||
throw new ArgumentNullException (nameof (connectionParams));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (connectionParams));
|
||||
|
||||
using (var data = connectionParams.WriteStruct ()) {
|
||||
var error = MIDIThruConnectionSetParams (Handle, data.Handle);
|
||||
|
@ -147,7 +147,7 @@ namespace CoreMidi {
|
|||
public static MidiThruConnection[]? Find (string persistentOwnerID, out MidiError error)
|
||||
{
|
||||
if (persistentOwnerID is null)
|
||||
throw new ArgumentNullException (nameof (persistentOwnerID));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (persistentOwnerID));
|
||||
|
||||
IntPtr ret;
|
||||
var persistentOwnerIDHandle = CFString.CreateNative (persistentOwnerID);
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// Copyright 2016 Xamarin Inc.
|
||||
//
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
|
@ -68,8 +70,8 @@ namespace CoreMidi {
|
|||
return map_value ?? (map_value = new byte [128]);
|
||||
}
|
||||
set {
|
||||
if (value == null)
|
||||
throw new ArgumentNullException (nameof (value));
|
||||
if (value is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (value));
|
||||
if (value.Length != 128)
|
||||
throw new ArgumentOutOfRangeException (nameof (value), "The length of the Value array must be 128");
|
||||
map_value = value;
|
||||
|
@ -125,13 +127,13 @@ namespace CoreMidi {
|
|||
public uint Version;
|
||||
public uint NumSources;
|
||||
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public MidiThruConnectionEndpoint[] Sources;
|
||||
public MidiThruConnectionEndpoint[]? Sources;
|
||||
public uint NumDestinations;
|
||||
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public MidiThruConnectionEndpoint[] Destinations;
|
||||
public MidiThruConnectionEndpoint[]? Destinations;
|
||||
|
||||
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] ChannelMap;
|
||||
public byte[]? ChannelMap;
|
||||
public byte LowVelocity;
|
||||
public byte HighVelocity;
|
||||
public byte LowNote;
|
||||
|
@ -178,7 +180,7 @@ namespace CoreMidi {
|
|||
MIDIThruConnectionParamsInitialize (out connectionParams);
|
||||
}
|
||||
|
||||
public MidiThruConnectionEndpoint[] Sources {
|
||||
public MidiThruConnectionEndpoint[]? Sources {
|
||||
get { return connectionParams.Sources; }
|
||||
set {
|
||||
if (value?.Length > 8)
|
||||
|
@ -187,7 +189,7 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public MidiThruConnectionEndpoint[] Destinations {
|
||||
public MidiThruConnectionEndpoint[]? Destinations {
|
||||
get { return connectionParams.Destinations; }
|
||||
set {
|
||||
if (value?.Length > 8)
|
||||
|
@ -196,7 +198,7 @@ namespace CoreMidi {
|
|||
}
|
||||
}
|
||||
|
||||
public byte[] ChannelMap {
|
||||
public byte[]? ChannelMap {
|
||||
get { return connectionParams.ChannelMap; }
|
||||
set {
|
||||
if (value?.Length > 16)
|
||||
|
@ -280,13 +282,13 @@ namespace CoreMidi {
|
|||
set { connectionParams.FilterOutAllControls = value ? (byte)1 : (byte)0; }
|
||||
}
|
||||
|
||||
public MidiControlTransform[] Controls { get; set; }
|
||||
public MidiValueMap[] Maps { get; set; }
|
||||
public MidiControlTransform[]? Controls { get; set; }
|
||||
public MidiValueMap[]? Maps { get; set; }
|
||||
|
||||
internal void ReadStruct (NSData data)
|
||||
{
|
||||
IntPtr buffer = data.Bytes;
|
||||
connectionParams = (MidiThruConnectionParamsStruct) Marshal.PtrToStructure (buffer, typeof (MidiThruConnectionParamsStruct));
|
||||
connectionParams = (MidiThruConnectionParamsStruct) Marshal.PtrToStructure (buffer, typeof (MidiThruConnectionParamsStruct))!;
|
||||
|
||||
// Put ourselves at the end of the static struct in case we need to fetch the dynamic part of the struct
|
||||
IntPtr bufferEnd = IntPtr.Add (buffer, Marshal.SizeOf (typeof (MidiThruConnectionParamsStruct)));
|
||||
|
@ -319,32 +321,32 @@ namespace CoreMidi {
|
|||
|
||||
internal NSData WriteStruct ()
|
||||
{
|
||||
if (Sources?.Length > 0) {
|
||||
if (Sources?.Length > 0 && connectionParams.Sources is not null) {
|
||||
connectionParams.NumSources = (uint)Sources.Length;
|
||||
for (int i = 0; i < Sources.Length; i++)
|
||||
connectionParams.Sources[i] = Sources[i];
|
||||
}
|
||||
|
||||
if (Destinations?.Length > 0) {
|
||||
if (Destinations?.Length > 0 && connectionParams.Destinations is not null) {
|
||||
connectionParams.NumDestinations = (uint)Destinations.Length;
|
||||
for (int i = 0; i < Destinations.Length; i++)
|
||||
connectionParams.Destinations[i] = Destinations[i];
|
||||
}
|
||||
|
||||
if (ChannelMap?.Length > 0) {
|
||||
if (ChannelMap?.Length > 0 && connectionParams.ChannelMap is not null) {
|
||||
for (int i = 0; i < ChannelMap.Length; i++)
|
||||
connectionParams.ChannelMap[i] = ChannelMap[i];
|
||||
}
|
||||
|
||||
connectionParams.NumControlTransforms = Controls != null ? (ushort) Controls.Length : (ushort) 0;
|
||||
connectionParams.NumMaps = Maps != null ? (ushort) Maps.Length : (ushort) 0;
|
||||
connectionParams.NumControlTransforms = Controls is not null ? (ushort) Controls.Length : (ushort) 0;
|
||||
connectionParams.NumMaps = Maps is not null ? (ushort) Maps.Length : (ushort) 0;
|
||||
|
||||
var paramsSize = Marshal.SizeOf (typeof (MidiThruConnectionParamsStruct));
|
||||
var controlsSize = Marshal.SizeOf (typeof (MidiControlTransform));
|
||||
// Get the full size of the struct, static + dynamic parts
|
||||
var fullSize = paramsSize +
|
||||
(Controls == null ? 0 : controlsSize * Controls.Length) +
|
||||
(Maps == null ? 0 : 128 * Maps.Length);
|
||||
(Controls is null ? 0 : controlsSize * Controls.Length) +
|
||||
(Maps is null ? 0 : 128 * Maps.Length);
|
||||
var buffer = Marshal.AllocHGlobal (fullSize);
|
||||
var bufferEnd = IntPtr.Add (buffer, Marshal.SizeOf (typeof (MidiThruConnectionParamsStruct)));
|
||||
|
||||
|
@ -354,7 +356,7 @@ namespace CoreMidi {
|
|||
|
||||
if (connectionParams.NumControlTransforms > 0) {
|
||||
unsafe {
|
||||
fixed (void* arrAddr = &Controls[0])
|
||||
fixed (void* arrAddr = &Controls![0])
|
||||
Buffer.MemoryCopy (arrAddr, (void*) bufferEnd, controlsSize * connectionParams.NumControlTransforms, controlsSize * connectionParams.NumControlTransforms);
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +366,7 @@ namespace CoreMidi {
|
|||
bufferEnd = IntPtr.Add (bufferEnd, controlsSize * connectionParams.NumControlTransforms);
|
||||
unsafe {
|
||||
for (int i = 0; i < connectionParams.NumMaps; i++) {
|
||||
fixed (void* arrAddr = &Maps[i].Value [0])
|
||||
fixed (void* arrAddr = &Maps![i].Value [0])
|
||||
Buffer.MemoryCopy (arrAddr, (void*) bufferEnd, 128, 128);
|
||||
bufferEnd += 128;
|
||||
}
|
||||
|
|
|
@ -296,7 +296,7 @@ namespace CoreServices
|
|||
public FSEventStream (FSEventStreamCreateOptions options)
|
||||
{
|
||||
if (options is null)
|
||||
throw new ArgumentNullException (nameof (options));
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (options));
|
||||
|
||||
NSArray pathsToWatch;
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
//
|
||||
// NOTE: KEEP IN SYNC WITH TESTS!
|
||||
|
||||
#nullable enable
|
||||
|
||||
#if MONOMAC
|
||||
|
||||
using System;
|
||||
|
@ -98,10 +100,10 @@ namespace CoreServices
|
|||
#else
|
||||
[Mac (10, 10)]
|
||||
#endif
|
||||
public static NSUrl GetDefaultApplicationUrlForUrl (NSUrl url, LSRoles roles = LSRoles.All)
|
||||
public static NSUrl? GetDefaultApplicationUrlForUrl (NSUrl url, LSRoles roles = LSRoles.All)
|
||||
{
|
||||
if (url == null)
|
||||
throw new ArgumentNullException (nameof (url));
|
||||
if (url is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
|
||||
|
||||
return Runtime.GetNSObject<NSUrl> (
|
||||
LSCopyDefaultApplicationURLForURL (url.Handle, roles, IntPtr.Zero)
|
||||
|
@ -121,10 +123,10 @@ namespace CoreServices
|
|||
#else
|
||||
[Mac (10, 10)]
|
||||
#endif
|
||||
public static NSUrl GetDefaultApplicationUrlForContentType (string contentType, LSRoles roles = LSRoles.All)
|
||||
public static NSUrl? GetDefaultApplicationUrlForContentType (string contentType, LSRoles roles = LSRoles.All)
|
||||
{
|
||||
if (contentType == null)
|
||||
throw new ArgumentNullException (nameof (contentType));
|
||||
if (contentType is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (contentType));
|
||||
|
||||
return Runtime.GetNSObject<NSUrl> (
|
||||
LSCopyDefaultApplicationURLForContentType (new NSString (contentType).Handle, roles, IntPtr.Zero)
|
||||
|
@ -136,8 +138,8 @@ namespace CoreServices
|
|||
|
||||
public static NSUrl [] GetApplicationUrlsForUrl (NSUrl url, LSRoles roles = LSRoles.All)
|
||||
{
|
||||
if (url == null)
|
||||
throw new ArgumentNullException (nameof (url));
|
||||
if (url is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
|
||||
|
||||
return NSArray.ArrayFromHandle<NSUrl> (
|
||||
LSCopyApplicationURLsForURL (url.Handle, roles)
|
||||
|
@ -153,10 +155,10 @@ namespace CoreServices
|
|||
public static bool CanUrlAcceptUrl (NSUrl itemUrl, NSUrl targetUrl,
|
||||
LSRoles roles, LSAcceptanceFlags acceptanceFlags, out LSResult result)
|
||||
{
|
||||
if (itemUrl == null)
|
||||
throw new ArgumentNullException (nameof (itemUrl));
|
||||
if (targetUrl == null)
|
||||
throw new ArgumentNullException (nameof (targetUrl));
|
||||
if (itemUrl is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (itemUrl));
|
||||
if (targetUrl is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (targetUrl));
|
||||
|
||||
byte acceptsItem;
|
||||
result = LSCanURLAcceptURL (itemUrl.Handle, targetUrl.Handle, roles, acceptanceFlags, out acceptsItem);
|
||||
|
@ -185,8 +187,8 @@ namespace CoreServices
|
|||
#endif
|
||||
public static NSUrl [] GetApplicationUrlsForBundleIdentifier (string bundleIdentifier)
|
||||
{
|
||||
if (bundleIdentifier == null)
|
||||
throw new ArgumentNullException (nameof (bundleIdentifier));
|
||||
if (bundleIdentifier is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (bundleIdentifier));
|
||||
|
||||
return NSArray.ArrayFromHandle<NSUrl> (
|
||||
LSCopyApplicationURLsForBundleIdentifier (new NSString (bundleIdentifier).Handle, IntPtr.Zero)
|
||||
|
@ -202,16 +204,16 @@ namespace CoreServices
|
|||
|
||||
public unsafe static LSResult Open (NSUrl url)
|
||||
{
|
||||
if (url == null)
|
||||
throw new ArgumentNullException (nameof (url));
|
||||
if (url is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
|
||||
|
||||
return LSOpenCFURLRef (url.Handle, (void **)0);
|
||||
}
|
||||
|
||||
public unsafe static LSResult Open (NSUrl url, out NSUrl launchedUrl)
|
||||
public unsafe static LSResult Open (NSUrl url, out NSUrl? launchedUrl)
|
||||
{
|
||||
if (url == null)
|
||||
throw new ArgumentNullException (nameof (url));
|
||||
if (url is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
|
||||
|
||||
void *launchedUrlHandle;
|
||||
var result = LSOpenCFURLRef (url.Handle, &launchedUrlHandle);
|
||||
|
@ -228,8 +230,8 @@ namespace CoreServices
|
|||
|
||||
public static LSResult Register (NSUrl url, bool update)
|
||||
{
|
||||
if (url == null)
|
||||
throw new ArgumentNullException (nameof (url));
|
||||
if (url is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url));
|
||||
|
||||
return LSRegisterURL (url.Handle, (byte)(update ? 1 : 0));
|
||||
}
|
||||
|
@ -241,10 +243,10 @@ namespace CoreServices
|
|||
[DllImport (Constants.CoreServicesLibrary)]
|
||||
static extern IntPtr LSCopyAllRoleHandlersForContentType (IntPtr inContentType, LSRoles inRole);
|
||||
|
||||
public static string [] GetAllRoleHandlersForContentType (string contentType, LSRoles roles = LSRoles.All)
|
||||
public static string?[]? GetAllRoleHandlersForContentType (string contentType, LSRoles roles = LSRoles.All)
|
||||
{
|
||||
if (contentType == null)
|
||||
throw new ArgumentNullException (nameof (contentType));
|
||||
if (contentType is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (contentType));
|
||||
|
||||
return CFArray.StringArrayFromHandle (
|
||||
LSCopyAllRoleHandlersForContentType (new NSString (contentType).Handle, roles)
|
||||
|
@ -256,8 +258,8 @@ namespace CoreServices
|
|||
|
||||
public static string GetDefaultRoleHandlerForContentType (string contentType, LSRoles roles = LSRoles.All)
|
||||
{
|
||||
if (contentType == null)
|
||||
throw new ArgumentNullException (nameof (contentType));
|
||||
if (contentType is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (contentType));
|
||||
|
||||
return (string)Runtime.GetNSObject<NSString> (
|
||||
LSCopyDefaultRoleHandlerForContentType (new NSString (contentType).Handle, roles)
|
||||
|
@ -272,10 +274,10 @@ namespace CoreServices
|
|||
public static LSResult SetDefaultRoleHandlerForContentType (string contentType, string handlerBundleId,
|
||||
LSRoles roles = LSRoles.All)
|
||||
{
|
||||
if (contentType == null)
|
||||
throw new ArgumentNullException (nameof (contentType));
|
||||
if (handlerBundleId == null)
|
||||
throw new ArgumentNullException (nameof (handlerBundleId));
|
||||
if (contentType is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (contentType));
|
||||
if (handlerBundleId is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handlerBundleId));
|
||||
|
||||
return LSSetDefaultRoleHandlerForContentType (
|
||||
new NSString (contentType).Handle,
|
||||
|
@ -305,10 +307,10 @@ namespace CoreServices
|
|||
#else
|
||||
[Deprecated (PlatformName.MacOSX, 10,15, message: "Use 'GetApplicationUrlsForUrl' instead.")]
|
||||
#endif
|
||||
public static string [] GetAllHandlersForUrlScheme (string urlScheme)
|
||||
public static string?[]? GetAllHandlersForUrlScheme (string urlScheme)
|
||||
{
|
||||
if (urlScheme == null)
|
||||
throw new ArgumentNullException (nameof (urlScheme));
|
||||
if (urlScheme is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (urlScheme));
|
||||
|
||||
return CFArray.StringArrayFromHandle (
|
||||
LSCopyAllHandlersForURLScheme (new NSString (urlScheme).Handle)
|
||||
|
@ -338,8 +340,8 @@ namespace CoreServices
|
|||
#endif
|
||||
public static string GetDefaultHandlerForUrlScheme (string urlScheme)
|
||||
{
|
||||
if (urlScheme == null)
|
||||
throw new ArgumentNullException (nameof (urlScheme));
|
||||
if (urlScheme is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (urlScheme));
|
||||
|
||||
return (string)Runtime.GetNSObject<NSString> (
|
||||
LSCopyDefaultHandlerForURLScheme (new NSString (urlScheme).Handle)
|
||||
|
@ -351,10 +353,10 @@ namespace CoreServices
|
|||
|
||||
public static LSResult SetDefaultHandlerForUrlScheme (string urlScheme, string handlerBundleId)
|
||||
{
|
||||
if (urlScheme == null)
|
||||
throw new ArgumentNullException (nameof (urlScheme));
|
||||
if (handlerBundleId == null)
|
||||
throw new ArgumentNullException (nameof (handlerBundleId));
|
||||
if (urlScheme is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (urlScheme));
|
||||
if (handlerBundleId is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handlerBundleId));
|
||||
|
||||
return LSSetDefaultHandlerForURLScheme (
|
||||
new NSString (urlScheme).Handle,
|
||||
|
|
|
@ -317,6 +317,8 @@ namespace Foundation {
|
|||
protected CMTime? GetCMTimeValue (NSString key)
|
||||
{
|
||||
var dictValue = GetNSDictionary (key);
|
||||
if (dictValue is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (dictValue));
|
||||
var value = CMTime.FromDictionary (dictValue);
|
||||
if (value.IsInvalid)
|
||||
return null;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
|
@ -17,7 +19,7 @@ namespace HomeKit {
|
|||
get {
|
||||
var s = _ActionSetType;
|
||||
// safety in case the field does not exists / cannot be loaded / new in future iOS versions...
|
||||
if (s == null)
|
||||
if (s is null)
|
||||
return HMActionSetType.Unknown;
|
||||
if (s == HMActionSetTypesInternal.WakeUp)
|
||||
return HMActionSetType.WakeUp;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
|
||||
using ObjCRuntime;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
|
||||
using ObjCRuntime;
|
||||
|
|
|
@ -98,8 +98,10 @@ namespace HomeKit {
|
|||
|
||||
public partial class HMAccessorySetupManager {
|
||||
|
||||
#pragma warning disable CS0618 // HMChipServiceTopology and HMErrorHandler is obsolete
|
||||
public virtual void AddAndSetUpAccessories (HMChipServiceTopology topology, HMErrorHandler completion) => throw new InvalidOperationException ();
|
||||
public virtual Task AddAndSetUpAccessoriesAsync (HMChipServiceTopology topology) => throw new InvalidOperationException ();
|
||||
#pragma warning restore CS0618 // HMChipServiceTopology and HMErrorHandler is obsolete
|
||||
|
||||
} /* class HMAccessorySetupManager */
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
|
@ -24,7 +26,10 @@ namespace HomeKit {
|
|||
#endif
|
||||
static public NSPredicate CreatePredicateForEvaluatingTriggerOccurringBeforeSignificantEvent (HMSignificantEvent significantEvent, NSDateComponents offset)
|
||||
{
|
||||
return CreatePredicateForEvaluatingTriggerOccurringBeforeSignificantEvent (significantEvent.GetConstant (), offset);
|
||||
var constant = significantEvent.GetConstant ();
|
||||
if (constant is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (significantEvent));
|
||||
return CreatePredicateForEvaluatingTriggerOccurringBeforeSignificantEvent (constant, offset);
|
||||
}
|
||||
|
||||
#if NET
|
||||
|
@ -45,7 +50,10 @@ namespace HomeKit {
|
|||
#endif
|
||||
static public NSPredicate CreatePredicateForEvaluatingTriggerOccurringAfterSignificantEvent (HMSignificantEvent significantEvent, NSDateComponents offset)
|
||||
{
|
||||
return CreatePredicateForEvaluatingTriggerOccurringAfterSignificantEvent (significantEvent.GetConstant (), offset);
|
||||
var constant = significantEvent.GetConstant ();
|
||||
if (constant is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (significantEvent));
|
||||
return CreatePredicateForEvaluatingTriggerOccurringAfterSignificantEvent (constant, offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -8,9 +10,9 @@ namespace HomeKit {
|
|||
|
||||
public partial class HMHome
|
||||
{
|
||||
public HMService [] GetServices (HMServiceType serviceTypes)
|
||||
public HMService []? GetServices (HMServiceType serviceTypes)
|
||||
{
|
||||
var arr = new List<NSString> ();
|
||||
var arr = new ServiceTypeList<NSString> ();
|
||||
|
||||
if ((serviceTypes & HMServiceType.LightBulb) == HMServiceType.LightBulb)
|
||||
arr.Add (HMServiceType.LightBulb.GetConstant ());
|
||||
|
@ -80,6 +82,14 @@ namespace HomeKit {
|
|||
return GetServices (arr.ToArray ());
|
||||
}
|
||||
|
||||
class ServiceTypeList<T> : List<T> {
|
||||
public new void Add (T? item)
|
||||
{
|
||||
if (item is not null)
|
||||
base.Add (item);
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET
|
||||
[NoTV]
|
||||
[NoWatch]
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
|
@ -1546,7 +1546,7 @@ $(SHARED_PATH)/Delegates.generated.cs: $(SHARED_PATH)/Delegates.cs.t4 $(SHARED_P
|
|||
$(Q) $(MAKE) -C $(SHARED_PATH) Delegates.generated.cs
|
||||
|
||||
$(BUILD_DIR)/common/NativeTypes/%.cs: $(TOP)/src/NativeTypes/%.tt | $(BUILD_DIR)/common/NativeTypes
|
||||
$(Q_GEN) cd $(TOP) && $(TT) $(abspath $<) -o $(abspath $@) 1>/dev/null
|
||||
$(Q_GEN) $(TT) $(abspath $<) -o $(abspath $@) 1>/dev/null
|
||||
|
||||
$(COMMON_TARGET_DIRS):
|
||||
$(Q) mkdir -p $@
|
||||
|
@ -1577,10 +1577,6 @@ $(DOTNET_BUILD_DIR)/Constants.%.generated.cs: Makefile $(DOTNET_GENERATE_FRAMEWO
|
|||
$(Q) mono --debug $(DOTNET_GENERATE_FRAMEWORKS_CONSTANTS) "$*" "$@.tmp"
|
||||
$(Q) mv "$@.tmp" "$@"
|
||||
|
||||
# This tells NuGet to use the exact same dotnet version we've configured in Make.config
|
||||
global.json: $(TOP)/global6.json
|
||||
$(Q) $(CP) $< $@
|
||||
|
||||
install-local:: $(INSTALL_TARGETS)
|
||||
all-local:: $(ALL_TARGETS)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ $(BUILD_DIR)/generator.csproj: generator.csproj | $(BUILD_DIR)
|
|||
$(BUILD_DIR)/common/bgen.exe: $(generator_dependencies) Makefile.generator $(BUILD_DIR)/generator-frameworks.g.cs
|
||||
$(Q_GEN) $(SYSTEM_MSBUILD) "/bl:$@.binlog" $(XBUILD_VERBOSITY) /p:Configuration=Debug generator.csproj /p:IntermediateOutputPath=$(BUILD_DIR)/IDE/obj/common/ /p:OutputPath=$(BUILD_DIR)/common /restore
|
||||
|
||||
$(DOTNET_BUILD_DIR)/bgen/bgen: $(generator_dependencies) Makefile.generator $(BUILD_DIR)/generator-frameworks.g.cs global.json | $(DOTNET_BUILD_DIR)/bgen
|
||||
$(DOTNET_BUILD_DIR)/bgen/bgen: $(generator_dependencies) Makefile.generator $(BUILD_DIR)/generator-frameworks.g.cs | $(DOTNET_BUILD_DIR)/bgen
|
||||
$(Q_DOTNET_BUILD) $(DOTNET) publish bgen/bgen.csproj $(DOTNET_BUILD_VERBOSITY) /p:Configuration=Debug /p:IntermediateOutputPath=$(abspath $(DOTNET_BUILD_DIR)/IDE/obj/common/bgen)/ /p:OutputPath=$(abspath $(DOTNET_BUILD_DIR)/IDE/bin/common/bgen/)/
|
||||
$(Q) $(CP) $(DOTNET_BUILD_DIR)/IDE/bin/common/bgen/publish/* $(dir $@)
|
||||
$(Q) printf 'exec $(DOTNET) "$$(dirname "$$0")"/bgen.dll $$@\n' > $@
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace MediaPlayer {
|
|||
ulong UInt64ForProperty (NSString property)
|
||||
{
|
||||
var prop = ValueForProperty (property) as NSNumber;
|
||||
if (prop == null)
|
||||
if (prop is null)
|
||||
return 0;
|
||||
return prop.UInt64Value;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace MediaPlayer {
|
|||
uint UInt32ForProperty (NSString property)
|
||||
{
|
||||
var prop = ValueForProperty (property) as NSNumber;
|
||||
if (prop == null)
|
||||
if (prop is null)
|
||||
return 0;
|
||||
return prop.UInt32Value;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace MediaPlayer {
|
|||
int Int32ForProperty (NSString property)
|
||||
{
|
||||
var prop = ValueForProperty (property) as NSNumber;
|
||||
if (prop == null)
|
||||
if (prop is null)
|
||||
return 0;
|
||||
return prop.Int32Value;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace MediaPlayer {
|
|||
double DoubleForProperty (NSString property)
|
||||
{
|
||||
var prop = ValueForProperty (property) as NSNumber;
|
||||
if (prop == null)
|
||||
if (prop is null)
|
||||
return 0;
|
||||
return prop.DoubleValue;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ namespace MediaPlayer {
|
|||
bool BoolForProperty (NSString property)
|
||||
{
|
||||
var prop = ValueForProperty (property) as NSNumber;
|
||||
if (prop == null)
|
||||
if (prop is null)
|
||||
return false;
|
||||
return prop.BoolValue;
|
||||
}
|
||||
|
|
|
@ -170,15 +170,15 @@ namespace MediaPlayer {
|
|||
if (DefaultPlaybackRate.HasValue)
|
||||
Add (dict, MPNowPlayingInfoCenter.PropertyDefaultPlaybackRate, new NSNumber (DefaultPlaybackRate.Value));
|
||||
|
||||
if (AvailableLanguageOptions != null && AvailableLanguageOptions.Length != 0)
|
||||
if (AvailableLanguageOptions is not null && AvailableLanguageOptions.Length != 0)
|
||||
Add (dict, MPNowPlayingInfoCenter.PropertyAvailableLanguageOptions, NSArray.FromObjects (AvailableLanguageOptions));
|
||||
if (CurrentLanguageOptions != null && CurrentLanguageOptions.Length != 0)
|
||||
if (CurrentLanguageOptions is not null && CurrentLanguageOptions.Length != 0)
|
||||
Add (dict, MPNowPlayingInfoCenter.PropertyCurrentLanguageOptions, NSArray.FromObjects (CurrentLanguageOptions));
|
||||
if (CollectionIdentifier != null)
|
||||
if (CollectionIdentifier is not null)
|
||||
Add (dict, MPNowPlayingInfoCenter.PropertyCollectionIdentifier, new NSString (CollectionIdentifier));
|
||||
if (ExternalContentIdentifier != null)
|
||||
if (ExternalContentIdentifier is not null)
|
||||
Add (dict, MPNowPlayingInfoCenter.PropertyExternalContentIdentifier, new NSString (ExternalContentIdentifier));
|
||||
if (ExternalUserProfileIdentifier != null)
|
||||
if (ExternalUserProfileIdentifier is not null)
|
||||
Add (dict, MPNowPlayingInfoCenter.PropertyExternalUserProfileIdentifier, new NSString (ExternalUserProfileIdentifier));
|
||||
if (PlaybackProgress.HasValue)
|
||||
Add (dict, MPNowPlayingInfoCenter.PropertyPlaybackProgress, new NSNumber (PlaybackProgress.Value));
|
||||
|
@ -186,9 +186,9 @@ namespace MediaPlayer {
|
|||
Add (dict, MPNowPlayingInfoCenter.PropertyMediaType, new NSNumber ((int)MediaType.Value));
|
||||
if (IsLiveStream.HasValue)
|
||||
Add (dict, MPNowPlayingInfoCenter.PropertyIsLiveStream, new NSNumber (IsLiveStream.Value));
|
||||
if (AssetUrl != null)
|
||||
if (AssetUrl is not null)
|
||||
Add (dict, MPNowPlayingInfoCenter.PropertyAssetUrl, AssetUrl);
|
||||
if (CurrentPlaybackDate != null)
|
||||
if (CurrentPlaybackDate is not null)
|
||||
Add (dict, MPNowPlayingInfoCenter.PropertyCurrentPlaybackDate, CurrentPlaybackDate);
|
||||
|
||||
if (AlbumTrackCount.HasValue)
|
||||
|
@ -204,17 +204,17 @@ namespace MediaPlayer {
|
|||
if (PlaybackDuration.HasValue)
|
||||
dict.Add (MPMediaItem.PlaybackDurationProperty, new NSNumber (PlaybackDuration.Value));
|
||||
|
||||
if (AlbumTitle != null)
|
||||
if (AlbumTitle is not null)
|
||||
dict.Add (MPMediaItem.AlbumTitleProperty, new NSString (AlbumTitle));
|
||||
if (Artist != null)
|
||||
if (Artist is not null)
|
||||
dict.Add (MPMediaItem.ArtistProperty, new NSString (Artist));
|
||||
if (Artwork != null)
|
||||
if (Artwork is not null)
|
||||
dict.Add (MPMediaItem.ArtworkProperty, Artwork);
|
||||
if (Composer != null)
|
||||
if (Composer is not null)
|
||||
dict.Add (MPMediaItem.ComposerProperty, new NSString (Composer));
|
||||
if (Genre != null)
|
||||
if (Genre is not null)
|
||||
dict.Add (MPMediaItem.GenreProperty, new NSString (Genre));
|
||||
if (Title != null)
|
||||
if (Title is not null)
|
||||
dict.Add (MPMediaItem.TitleProperty, new NSString (Title));
|
||||
|
||||
return dict;
|
||||
|
@ -222,13 +222,13 @@ namespace MediaPlayer {
|
|||
|
||||
void Add (NSMutableDictionary dictionary, NSObject key, NSObject value)
|
||||
{
|
||||
if (key != null)
|
||||
if (key is not null)
|
||||
dictionary.Add (key, value);
|
||||
}
|
||||
|
||||
bool TryGetValue (NSDictionary source, NSObject? key, [NotNullWhen (true)] out NSObject? result)
|
||||
{
|
||||
if (key != null)
|
||||
if (key is not null)
|
||||
return source.TryGetValue (key, out result);
|
||||
result = null;
|
||||
return false;
|
||||
|
@ -236,7 +236,7 @@ namespace MediaPlayer {
|
|||
|
||||
internal MPNowPlayingInfo (NSDictionary? source)
|
||||
{
|
||||
if (source == null)
|
||||
if (source is null)
|
||||
return;
|
||||
|
||||
NSObject? result;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace MediaPlayer {
|
|||
public double[]? PreferredIntervals {
|
||||
get {
|
||||
NSArray a = _PreferredIntervals;
|
||||
if ((a == null) || (a.Count == 0))
|
||||
if ((a is null) || (a.Count == 0))
|
||||
return null;
|
||||
|
||||
return NSArray.ArrayFromHandle<double> (a.Handle, input => {
|
||||
|
@ -26,7 +26,7 @@ namespace MediaPlayer {
|
|||
});
|
||||
}
|
||||
set {
|
||||
if (value == null)
|
||||
if (value is null)
|
||||
_PreferredIntervals = new NSArray ();
|
||||
else {
|
||||
NSObject [] nsoa = new NSObject [value.Length];
|
||||
|
|
|
@ -28,6 +28,12 @@ namespace ObjCRuntime {
|
|||
throw new ArgumentNullException (argumentName);
|
||||
}
|
||||
|
||||
[DoesNotReturn]
|
||||
public static void ThrowArgumentNullException (string argumentName, string message)
|
||||
{
|
||||
throw new ArgumentNullException (argumentName, message);
|
||||
}
|
||||
|
||||
[DoesNotReturn]
|
||||
public static void ThrowArgumentOutOfRangeException (string argumentName, string message)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace HomeKit {
|
|||
[Protocolize]
|
||||
HMHomeManagerDelegate Delegate { get; set; }
|
||||
|
||||
[Export ("primaryHome", ArgumentSemantic.Retain)]
|
||||
[NullAllowed, Export ("primaryHome", ArgumentSemantic.Retain)]
|
||||
HMHome PrimaryHome { get; }
|
||||
|
||||
[Export ("homes", ArgumentSemantic.Copy)]
|
||||
|
@ -391,10 +391,10 @@ namespace HomeKit {
|
|||
[Export ("properties", ArgumentSemantic.Copy)]
|
||||
NSString [] Properties { get; }
|
||||
|
||||
[Export ("metadata", ArgumentSemantic.Retain)]
|
||||
[NullAllowed, Export ("metadata", ArgumentSemantic.Retain)]
|
||||
HMCharacteristicMetadata Metadata { get; }
|
||||
|
||||
[Export ("value", ArgumentSemantic.Copy)]
|
||||
[NullAllowed, Export ("value", ArgumentSemantic.Copy)]
|
||||
NSObject Value { get; }
|
||||
|
||||
[Export ("notificationEnabled")]
|
||||
|
@ -416,7 +416,7 @@ namespace HomeKit {
|
|||
[NoWatch]
|
||||
[Async]
|
||||
[Export ("updateAuthorizationData:completionHandler:")]
|
||||
void UpdateAuthorizationData (NSData data, Action<NSError> completion);
|
||||
void UpdateAuthorizationData ([NullAllowed] NSData data, Action<NSError> completion);
|
||||
|
||||
[iOS (9,0)]
|
||||
[Export ("localizedDescription")]
|
||||
|
@ -500,27 +500,27 @@ namespace HomeKit {
|
|||
[BaseType (typeof (NSObject))]
|
||||
partial interface HMCharacteristicMetadata {
|
||||
|
||||
[Export ("minimumValue")]
|
||||
[NullAllowed, Export ("minimumValue")]
|
||||
NSNumber MinimumValue { get; }
|
||||
|
||||
[Export ("maximumValue")]
|
||||
[NullAllowed, Export ("maximumValue")]
|
||||
NSNumber MaximumValue { get; }
|
||||
|
||||
[Export ("stepValue")]
|
||||
[NullAllowed, Export ("stepValue")]
|
||||
NSNumber StepValue { get; }
|
||||
|
||||
[Export ("maxLength")]
|
||||
[NullAllowed, Export ("maxLength")]
|
||||
NSNumber MaxLength { get; }
|
||||
|
||||
[Internal]
|
||||
[Export ("format", ArgumentSemantic.Copy)]
|
||||
[NullAllowed, Export ("format", ArgumentSemantic.Copy)]
|
||||
NSString _Format { get; }
|
||||
|
||||
[Internal]
|
||||
[Export ("units", ArgumentSemantic.Copy)]
|
||||
[NullAllowed, Export ("units", ArgumentSemantic.Copy)]
|
||||
NSString _Units { get; }
|
||||
|
||||
[Export ("manufacturerDescription")]
|
||||
[NullAllowed, Export ("manufacturerDescription")]
|
||||
string ManufacturerDescription { get; }
|
||||
|
||||
[Watch (3,0), iOS (10,0)]
|
||||
|
@ -626,6 +626,7 @@ namespace HomeKit {
|
|||
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
[Export ("servicesWithTypes:")]
|
||||
[return: NullAllowed]
|
||||
HMService [] GetServices (NSString [] serviceTypes);
|
||||
|
||||
[NoTV]
|
||||
|
@ -934,7 +935,7 @@ namespace HomeKit {
|
|||
[Export ("name")]
|
||||
string Name { get; }
|
||||
|
||||
[Export ("associatedServiceType")]
|
||||
[NullAllowed, Export ("associatedServiceType")]
|
||||
string AssociatedServiceType { get; }
|
||||
|
||||
[Export ("characteristics", ArgumentSemantic.Copy)]
|
||||
|
@ -1026,13 +1027,13 @@ namespace HomeKit {
|
|||
[Export ("fireDate", ArgumentSemantic.Copy)]
|
||||
NSDate FireDate { get; }
|
||||
|
||||
[Export ("timeZone", ArgumentSemantic.Copy)]
|
||||
[NullAllowed, Export ("timeZone", ArgumentSemantic.Copy)]
|
||||
NSTimeZone TimeZone { get; }
|
||||
|
||||
[Export ("recurrence", ArgumentSemantic.Copy)]
|
||||
[NullAllowed, Export ("recurrence", ArgumentSemantic.Copy)]
|
||||
NSDateComponents Recurrence { get; }
|
||||
|
||||
[Export ("recurrenceCalendar", ArgumentSemantic.Copy)]
|
||||
[NullAllowed, Export ("recurrenceCalendar", ArgumentSemantic.Copy)]
|
||||
NSCalendar RecurrenceCalendar { get; }
|
||||
|
||||
[NoTV]
|
||||
|
@ -1070,7 +1071,7 @@ namespace HomeKit {
|
|||
[Export ("actionSets", ArgumentSemantic.Copy)]
|
||||
HMActionSet [] ActionSets { get; }
|
||||
|
||||
[Export ("lastFireDate", ArgumentSemantic.Copy)]
|
||||
[NullAllowed, Export ("lastFireDate", ArgumentSemantic.Copy)]
|
||||
NSDate LastFireDate { get; }
|
||||
|
||||
[NoTV]
|
||||
|
|
|
@ -214,7 +214,7 @@ namespace ImageCaptureCore {
|
|||
[Export ("modulePath")]
|
||||
string ModulePath { get; }
|
||||
|
||||
[Export ("moduleVersion")]
|
||||
[NullAllowed, Export ("moduleVersion")]
|
||||
string ModuleVersion { get; }
|
||||
|
||||
[Export ("moduleExecutableArchitecture")]
|
||||
|
@ -353,16 +353,16 @@ namespace ImageCaptureCore {
|
|||
[BaseType (typeof(NSObject))]
|
||||
interface ICCameraItem {
|
||||
|
||||
[Export ("device")]
|
||||
[NullAllowed, Export ("device")]
|
||||
ICCameraDevice Device { get; }
|
||||
|
||||
[Export ("parentFolder")]
|
||||
[NullAllowed, Export ("parentFolder")]
|
||||
ICCameraFolder ParentFolder { get; }
|
||||
|
||||
[Export ("name")]
|
||||
[NullAllowed, Export ("name")]
|
||||
string Name { get; }
|
||||
|
||||
[Export ("UTI")]
|
||||
[NullAllowed, Export ("UTI")]
|
||||
string Uti { get; }
|
||||
|
||||
[NullAllowed, Export ("fileSystemPath")]
|
||||
|
@ -406,7 +406,7 @@ namespace ImageCaptureCore {
|
|||
[BaseType (typeof(ICCameraItem))]
|
||||
interface ICCameraFolder {
|
||||
|
||||
[Export ("contents")]
|
||||
[NullAllowed, Export ("contents")]
|
||||
ICCameraItem[] Contents { get; }
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,7 @@ namespace ImageCaptureCore {
|
|||
[Export ("duration")]
|
||||
double Duration { get; }
|
||||
|
||||
[Export ("sidecarFiles")]
|
||||
[NullAllowed, Export ("sidecarFiles")]
|
||||
ICCameraItem[] SidecarFiles { get; }
|
||||
}
|
||||
|
||||
|
@ -495,7 +495,7 @@ namespace ImageCaptureCore {
|
|||
interface ICCameraDeviceDownloadDelegate {
|
||||
|
||||
[Export ("didDownloadFile:error:options:contextInfo:")]
|
||||
void DidDownloadFile (ICCameraFile file, [NullAllowed] NSError error, [NullAllowed] NSDictionary<NSString, NSObject> options, [NullAllowed] IntPtr contextInfo);
|
||||
void DidDownloadFile (ICCameraFile file, [NullAllowed] NSError error, NSDictionary<NSString, NSObject> options, [NullAllowed] IntPtr contextInfo);
|
||||
|
||||
[Export ("didReceiveDownloadProgressForFile:downloadedBytes:maxBytes:")]
|
||||
void DidReceiveDownloadProgress (ICCameraFile file, long downloadedBytes, long maxBytes);
|
||||
|
@ -555,13 +555,13 @@ namespace ImageCaptureCore {
|
|||
void CancelDelete ();
|
||||
|
||||
[Export ("requestDownloadFile:options:downloadDelegate:didDownloadSelector:contextInfo:")]
|
||||
void RequestDownloadFile (ICCameraFile file, [NullAllowed] NSDictionary<NSString, NSObject> options, IICCameraDeviceDownloadDelegate downloadDelegate, Selector didDownloadSelector, [NullAllowed] IntPtr contextInfo);
|
||||
void RequestDownloadFile (ICCameraFile file, NSDictionary<NSString, NSObject> options, IICCameraDeviceDownloadDelegate downloadDelegate, Selector didDownloadSelector, [NullAllowed] IntPtr contextInfo);
|
||||
|
||||
[Export ("cancelDownload")]
|
||||
void CancelDownload ();
|
||||
|
||||
[Export ("requestUploadFile:options:uploadDelegate:didUploadSelector:contextInfo:")]
|
||||
void RequestUploadFile (NSUrl fileUrl, [NullAllowed] NSDictionary<NSString, NSObject> options, NSObject uploadDelegate, Selector didUploadSelector, [NullAllowed] IntPtr contextInfo);
|
||||
void RequestUploadFile (NSUrl fileUrl, NSDictionary<NSString, NSObject> options, NSObject uploadDelegate, Selector didUploadSelector, [NullAllowed] IntPtr contextInfo);
|
||||
|
||||
[Export ("requestReadDataFromFile:atOffset:length:readDelegate:didReadDataSelector:contextInfo:")]
|
||||
void RequestReadDataFromFile (ICCameraFile file, long offset, long length, NSObject readDelegate, Selector didReadDataSelector, [NullAllowed] IntPtr contextInfo);
|
||||
|
|
|
@ -933,55 +933,6 @@ function check_simulators ()
|
|||
fi
|
||||
}
|
||||
|
||||
function check_dotnet ()
|
||||
{
|
||||
if test -n "$IGNORE_DOTNET"; then return; fi
|
||||
|
||||
local DOTNET_VERSION
|
||||
local DOTNET_FILENAME
|
||||
local URL
|
||||
local INSTALL_DIR
|
||||
local CACHED_FILE
|
||||
local DOWNLOADED_FILE
|
||||
|
||||
DOTNET_VERSION=$(grep "^SYSTEM_DOTNET_VERSION=" dotnet.config | sed 's/.*=//')
|
||||
ARCH=$(arch)
|
||||
if [[ "$ARCH" =~ "arm64" ]]; then
|
||||
URL=https://dotnetcli.azureedge.net/dotnet/Sdk/"$DOTNET_VERSION"/dotnet-sdk-"$DOTNET_VERSION"-osx-arm64.pkg
|
||||
else
|
||||
URL=https://dotnetcli.azureedge.net/dotnet/Sdk/"$DOTNET_VERSION"/dotnet-sdk-"$DOTNET_VERSION"-osx-x64.pkg
|
||||
fi
|
||||
INSTALL_DIR=/usr/local/share/dotnet/sdk/"$DOTNET_VERSION"
|
||||
|
||||
if test -d "$INSTALL_DIR"; then
|
||||
ok "Found dotnet $DOTNET_VERSION in $INSTALL_DIR (exactly $DOTNET_VERSION is required)."
|
||||
return
|
||||
fi
|
||||
if test -z "$PROVISION_DOTNET"; then
|
||||
fail "You must install dotnet $DOTNET_VERSION. You can download it from ${COLOR_BLUE}$URL${COLOR_RESET}."
|
||||
fail "Alternatively you can ${COLOR_MAGENTA}export IGNORE_DOTNET=1${COLOR_RED} to skip this check."
|
||||
return
|
||||
fi
|
||||
|
||||
DOTNET_FILENAME=$(basename "$URL")
|
||||
|
||||
CACHED_FILE=$HOME/Library/Caches/xamarin-macios/$DOTNET_FILENAME
|
||||
if test -f "$CACHED_FILE"; then
|
||||
log "Found cached version in $CACHED_FILE, will install from cache."
|
||||
DOWNLOADED_FILE="$HOME/Library/Caches/xamarin-macios/$DOTNET_FILENAME"
|
||||
else
|
||||
log "Downloading dotnet $DOTNET_VERSION from $URL..."
|
||||
mkdir -p "$PROVISION_DOWNLOAD_DIR"
|
||||
DOWNLOADED_FILE="$PROVISION_DOWNLOAD_DIR/$DOTNET_FILENAME"
|
||||
curl -f -L "$URL" -o "$DOWNLOADED_FILE"
|
||||
fi
|
||||
|
||||
log "Installing dotnet $DOTNET_VERSION into $INSTALL_DIR..."
|
||||
$SUDO installer -pkg "$DOWNLOADED_FILE" -target /
|
||||
|
||||
ok "Installed dotnet $DOTNET_VERSION into $INSTALL_DIR."
|
||||
}
|
||||
|
||||
echo "Checking system..."
|
||||
|
||||
check_osx_version
|
||||
|
@ -995,7 +946,6 @@ check_cmake
|
|||
check_7z
|
||||
check_objective_sharpie
|
||||
check_simulators
|
||||
check_dotnet ""
|
||||
if test -z "$IGNORE_DOTNET"; then
|
||||
ok "Installed .NET SDKs:"
|
||||
(IFS=$'\n'; for i in $(/usr/local/share/dotnet/dotnet --list-sdks); do log "$i"; done)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
global.json
|
||||
NuGet.config
|
||||
generated-projects
|
||||
*index.html
|
||||
*.log
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
*
|
|
@ -1,3 +0,0 @@
|
|||
global.json
|
||||
NuGet.config
|
||||
|
|
@ -68,7 +68,6 @@ test.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Version.De
|
|||
@echo "MONO_IOS_SDK_DESTDIR=$(MONO_IOS_SDK_DESTDIR)" >> $@
|
||||
@echo "MONO_MAC_SDK_DESTDIR=$(MONO_MAC_SDK_DESTDIR)" >> $@
|
||||
@echo "ENABLE_XAMARIN=$(ENABLE_XAMARIN)" >> $@
|
||||
@echo "SYSTEM_DOTNET=$(SYSTEM_DOTNET)" >> $@
|
||||
@echo "DOTNET=$(DOTNET)" >> $@
|
||||
@echo "IOS_SDK_VERSION=$(IOS_SDK_VERSION)" >> $@
|
||||
@echo "TVOS_SDK_VERSION=$(TVOS_SDK_VERSION)" >> $@
|
||||
|
@ -91,7 +90,6 @@ test-system.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Ver
|
|||
@echo "INCLUDE_DEVICE=$(INCLUDE_DEVICE)" >> $@
|
||||
@echo "MONO_IOS_SDK_DESTDIR=$(MONO_IOS_SDK_DESTDIR)" >> $@
|
||||
@echo "MONO_MAC_SDK_DESTDIR=$(MONO_MAC_SDK_DESTDIR)" >> $@
|
||||
@echo "SYSTEM_DOTNET=$(SYSTEM_DOTNET)" >> $@
|
||||
@echo "DOTNET=$(DOTNET)" >> $@
|
||||
@echo "IOS_SDK_VERSION=$(IOS_SDK_VERSION)" >> $@
|
||||
@echo "TVOS_SDK_VERSION=$(TVOS_SDK_VERSION)" >> $@
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
global.json
|
||||
NuGet.config
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
global.json
|
||||
NuGet.config
|
||||
|
|
@ -984,25 +984,6 @@ namespace Xamarin.Tests
|
|||
}
|
||||
}
|
||||
|
||||
public static string [] CopyDotNetSupportingFiles (params string[] targetDirectories)
|
||||
{
|
||||
var srcDirectory = Path.Combine (SourceRoot, "tests", "dotnet");
|
||||
var files = new string [] { "global.json", "NuGet.config" };
|
||||
var targets = new List<string> ();
|
||||
for (var i = 0; i < files.Length; i++) {
|
||||
var fn = files [i];
|
||||
var src = Path.Combine (srcDirectory, fn);
|
||||
if (!File.Exists (src))
|
||||
ExecutionHelper.Execute ("make", new [] { "-C", srcDirectory, fn });
|
||||
foreach (var targetDirectory in targetDirectories) {
|
||||
var target = Path.Combine (targetDirectory, fn);
|
||||
File.Copy (src, target, true);
|
||||
targets.Add (target);
|
||||
}
|
||||
}
|
||||
return targets.ToArray ();
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> GetBuildEnvironment (ApplePlatform platform)
|
||||
{
|
||||
Dictionary<string, string> environment = new Dictionary<string, string> ();
|
||||
|
|
|
@ -2,11 +2,7 @@ TOP=../../../..
|
|||
|
||||
include $(TOP)/Make.config
|
||||
|
||||
NuGet%config global%json:
|
||||
$(Q) $(MAKE) -C $(TOP)/tests/dotnet all
|
||||
$(Q) $(CP) $(TOP)/tests/dotnet/global.json $(TOP)/tests/dotnet/NuGet.config .
|
||||
|
||||
.build-stamp.binlog: Makefile $(wildcard *.cs) $(wildcard *.csproj) $(wildcard *.resx) $(wildcard *.config) NuGet.config global.json
|
||||
.build-stamp.binlog: Makefile $(wildcard *.cs) $(wildcard *.csproj) $(wildcard *.resx) $(wildcard *.config)
|
||||
$(Q) $(DOTNET) build *.csproj $(MSBUILD_VERBOSITY) /bl:$@
|
||||
|
||||
all-local:: .build-stamp.binlog
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace Xamarin.Mac.Tests {
|
|||
Thread.Sleep (3000);
|
||||
// If we're still here, then something went wrong. Let's exit.
|
||||
Console.WriteLine ($"The process didn't exit within 3s of returning from Main. Assuming something is deadlocked, and will now exit immediately and forcefully (with exit code {exit_code}).");
|
||||
Console.Out.Flush ();
|
||||
Console.Error.Flush ();
|
||||
_exit (exit_code);
|
||||
}) {
|
||||
Name = "Exit monitor",
|
||||
|
@ -34,6 +36,8 @@ namespace Xamarin.Mac.Tests {
|
|||
};
|
||||
exit_monitor.Start ();
|
||||
#else
|
||||
Console.Out.Flush ();
|
||||
Console.Error.Flush ();
|
||||
_exit (exit_code);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ type MainClass =
|
|||
let exit_code = obj :?> int
|
||||
Thread.Sleep (3000)
|
||||
Console.WriteLine ($"The process didn't exit within 3s of returning from Main. Assuming something is deadlocked, and will now exit immediately and forcefully (with exit code {exit_code}).")
|
||||
Console.Out.Flush ()
|
||||
Console.Error.Flush ()
|
||||
PInvokes._exit (exit_code)
|
||||
|
||||
static member asyncMainTask (args: string[]) : int =
|
||||
|
|
|
@ -11,7 +11,7 @@ TESTNAME:=$(notdir $(shell dirname "$(shell dirname "$(CURDIR)")"))
|
|||
endif
|
||||
|
||||
prepare:
|
||||
$(Q) $(MAKE) -C $(TOP)/tests/dotnet copy-dotnet-config
|
||||
@# nothing to do here right now
|
||||
|
||||
reload:
|
||||
$(Q) $(MAKE) -C $(TOP) -j8 all
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
global.json
|
||||
NuGet.config
|
||||
report.md
|
||||
|
|
Двоичные данные
tests/dotnet/AppWithResources/DirWithResources/linkedArt.scnassets/scene.scn
Normal file
Двоичные данные
tests/dotnet/AppWithResources/DirWithResources/linkedArt.scnassets/scene.scn
Normal file
Двоичный файл не отображается.
Двоичные данные
tests/dotnet/AppWithResources/DirWithResources/linkedArt.scnassets/texture.png
Normal file
Двоичные данные
tests/dotnet/AppWithResources/DirWithResources/linkedArt.scnassets/texture.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 342 KiB |
|
@ -19,6 +19,8 @@
|
|||
<!-- ImageAssets: included by default (each platform has a Resources/Images.xcassets directory) -->
|
||||
<!-- InterfaceDefinition: included by default (each platform has a separate storyboard) -->
|
||||
<SceneKitAsset Include="../*.scnassets/*" />
|
||||
<SceneKitAsset Include="../*/linkedArt.scnassets/*" Link="%(RecursiveDir)%(FileName)%(Extension)" />
|
||||
|
||||
<Collada Include="../*.dae" />
|
||||
<AtlasTexture Include="../*.atlas/**/*" />
|
||||
<CoreMLModel Include="../*.mlmodel" />
|
||||
|
|
|
@ -2,34 +2,7 @@ TOP=../..
|
|||
|
||||
include $(TOP)/Make.config
|
||||
|
||||
# This tells NuGet to use the nupkgs we're building locally,
|
||||
# and to put any extracted packages in the 'packages' directory (to not clutter up ~/.nuget/packages)
|
||||
NuGet.config: $(TOP)/NuGet.config Makefile
|
||||
$(Q) mkdir -p "$(abspath $(NUGET_TEST_FEED))"
|
||||
$(Q) $(CP) $< $@.tmp
|
||||
ifdef CUSTOM_DOTNET
|
||||
$(Q) nuget sources add -Name dev-runtime-feed -Source $(abspath $(DOTNET_RUNTIME_PATH)/artifacts/packages/Release/Shipping) -ConfigFile $@.tmp
|
||||
endif
|
||||
$(Q) nuget sources add -Name local-tests-feed -Source $(abspath $(NUGET_TEST_FEED)) -ConfigFile $@.tmp
|
||||
$(Q) nuget config -Set globalPackagesFolder=$(abspath $(CURDIR)/packages) -Config $@.tmp
|
||||
$(Q) nuget config -Set repositorypath=$(abspath $(CURDIR)/packages) -Config $@.tmp
|
||||
$(Q) mv $@.tmp $@
|
||||
|
||||
# This tells NuGet to use the exact same dotnet version we've configured in Make.config
|
||||
global.json: $(TOP)/global6.json
|
||||
$(CP) $< $@
|
||||
|
||||
../bgen/global.json: global.json
|
||||
$(Q) $(CP) $< $@
|
||||
|
||||
../bgen/NuGet.config: NuGet.config
|
||||
$(Q) $(CP) $< $@
|
||||
|
||||
TARGETS += \
|
||||
NuGet.config \
|
||||
global.json \
|
||||
../bgen/NuGet.config \
|
||||
../bgen/global.json \
|
||||
|
||||
run-unit-tests:
|
||||
$(MAKE) -C UnitTests $@
|
||||
|
@ -58,12 +31,3 @@ run-dotnet: $(TARGETS)
|
|||
|
||||
run-dotnet-sim: $(TARGETS)
|
||||
$(DOTNET) build -t:Run size-comparison/MySingleView/dotnet/MySingleView.csproj /p:Configuration=Release --runtime iossimulator-x64 /p:Platform=iPhoneSimulator /bl:$@.binlog
|
||||
|
||||
# this target will copy NuGet.config and global.json to the directories that need it for their .NET build to work correctly.
|
||||
|
||||
copy-dotnet-config: $(TARGETS)
|
||||
$(Q) for dir in $(abspath $(TOP))/tests/*/dotnet $(abspath $(TOP))/tests/linker/*/*/dotnet; do \
|
||||
rsync -a NuGet.config global.json "$$dir"; \
|
||||
done
|
||||
$(Q) rsync -a NuGet.config global.json $(TOP)/external/Touch.Unit/Touch.Client/dotnet
|
||||
$(Q) rsync -a NuGet.config global.json $(TOP)/external/MonoTouch.Dialog/MonoTouch.Dialog/dotnet
|
||||
|
|
|
@ -26,7 +26,6 @@ namespace Xamarin.Tests {
|
|||
|
||||
var project_path = GetProjectPath (project, platform: platform);
|
||||
Clean (project_path);
|
||||
Configuration.CopyDotNetSupportingFiles (Path.GetDirectoryName (project_path));
|
||||
|
||||
var tmpdir = Cache.CreateTemporaryDirectory ();
|
||||
var outputPath = Path.Combine (tmpdir, "OutputPath");
|
||||
|
@ -57,7 +56,6 @@ namespace Xamarin.Tests {
|
|||
|
||||
var project_path = Path.Combine (Configuration.RootPath, "tests", project, "dotnet", platform.AsString (), $"{project}.csproj");
|
||||
Clean (project_path);
|
||||
Configuration.CopyDotNetSupportingFiles (Path.GetDirectoryName (project_path));
|
||||
|
||||
var tmpdir = Cache.CreateTemporaryDirectory ();
|
||||
var outputPath = Path.Combine (tmpdir, "OutputPath");
|
||||
|
@ -115,7 +113,6 @@ namespace Xamarin.Tests {
|
|||
|
||||
var project_path = Path.Combine (Configuration.RootPath, "tests", project, "dotnet", platform.AsString (), $"{project}.csproj");
|
||||
Clean (project_path);
|
||||
Configuration.CopyDotNetSupportingFiles (Path.GetDirectoryName (project_path));
|
||||
|
||||
var tmpdir = Cache.CreateTemporaryDirectory ();
|
||||
var outputPath = Path.Combine (tmpdir, "OutputPath");
|
||||
|
|
|
@ -124,7 +124,6 @@ namespace Xamarin.Tests {
|
|||
var project_dir = Path.Combine (dotnet_bindings_dir, platform);
|
||||
var project_path = Path.Combine (project_dir, $"{assemblyName}.csproj");
|
||||
Clean (project_path);
|
||||
Configuration.CopyDotNetSupportingFiles (dotnet_bindings_dir);
|
||||
var result = DotNet.AssertBuild (project_path, verbosity);
|
||||
var lines = BinLog.PrintToLines (result.BinLogPath);
|
||||
// Find the resulting binding assembly from the build log
|
||||
|
@ -157,7 +156,6 @@ namespace Xamarin.Tests {
|
|||
var project_dir = Path.Combine (dotnet_bindings_dir, platform);
|
||||
var project_path = Path.Combine (project_dir, $"{assemblyName}.fsproj");
|
||||
Clean (project_path);
|
||||
Configuration.CopyDotNetSupportingFiles (dotnet_bindings_dir);
|
||||
var result = DotNet.AssertBuild (project_path, verbosity);
|
||||
var lines = BinLog.PrintToLines (result.BinLogPath);
|
||||
// Find the resulting binding assembly from the build log
|
||||
|
@ -185,7 +183,6 @@ namespace Xamarin.Tests {
|
|||
var project_path = Path.Combine (project_dir, $"{assemblyName}.csproj");
|
||||
|
||||
Clean (project_path);
|
||||
Configuration.CopyDotNetSupportingFiles (dotnet_bindings_dir);
|
||||
var result = DotNet.AssertBuild (project_path, verbosity);
|
||||
var lines = BinLog.PrintToLines (result.BinLogPath).ToList ();
|
||||
Console.WriteLine (string.Join ("\n", lines));
|
||||
|
@ -217,7 +214,6 @@ namespace Xamarin.Tests {
|
|||
var project_path = Path.Combine (project_dir, $"{assemblyName}.csproj");
|
||||
|
||||
Clean (project_path);
|
||||
Configuration.CopyDotNetSupportingFiles (dotnet_bindings_dir);
|
||||
var result = DotNet.AssertBuild (project_path, verbosity);
|
||||
var lines = BinLog.PrintToLines (result.BinLogPath);
|
||||
// Find the resulting binding assembly from the build log
|
||||
|
@ -248,7 +244,6 @@ namespace Xamarin.Tests {
|
|||
var project_path = Path.Combine (project_dir, $"{assemblyName}.csproj");
|
||||
|
||||
Clean (project_path);
|
||||
Configuration.CopyDotNetSupportingFiles (dotnet_bindings_dir);
|
||||
var result = DotNet.AssertBuild (project_path, verbosity);
|
||||
var lines = BinLog.PrintToLines (result.BinLogPath);
|
||||
// Find the resulting binding assembly from the build log
|
||||
|
@ -281,14 +276,6 @@ namespace Xamarin.Tests {
|
|||
var project_path = Path.Combine (project_dir, $"{assemblyName}.csproj");
|
||||
|
||||
Clean (project_path);
|
||||
Configuration.CopyDotNetSupportingFiles (dotnet_bindings_dir);
|
||||
Configuration.CopyDotNetSupportingFiles (dotnet_bindings_dir.Replace (assemblyName, "bindings-test"));
|
||||
Configuration.CopyDotNetSupportingFiles (dotnet_bindings_dir.Replace (assemblyName, "bindings-test2"));
|
||||
var cleanupSupportFiles = Configuration.CopyDotNetSupportingFiles (
|
||||
Path.Combine (Configuration.SourceRoot, "external", "Touch.Unit", "Touch.Client", "dotnet"),
|
||||
Path.Combine (Configuration.SourceRoot, "external", "MonoTouch.Dialog", "MonoTouch.Dialog", "dotnet")
|
||||
);
|
||||
try {
|
||||
var result = DotNet.AssertBuild (project_path, verbosity);
|
||||
var lines = BinLog.PrintToLines (result.BinLogPath);
|
||||
// Find the resulting binding assembly from the build log
|
||||
|
@ -326,10 +313,7 @@ namespace Xamarin.Tests {
|
|||
var ad2 = AssemblyDefinition.ReadAssembly (Path.Combine (asmDir, "bindings-test2.dll"), new ReaderParameters { ReadingMode = ReadingMode.Deferred });
|
||||
// The native library is removed from the resources by the linker
|
||||
Assert.That (ad2.MainModule.Resources.Count, Is.EqualTo (0), "0 resources for bindings-test2.dll");
|
||||
} finally {
|
||||
foreach (var file in cleanupSupportFiles)
|
||||
File.Delete (file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -368,12 +352,6 @@ namespace Xamarin.Tests {
|
|||
Configuration.IgnoreIfIgnoredPlatform (platform);
|
||||
|
||||
var project_path = Path.Combine (Configuration.SourceRoot, "tests", "monotouch-test", "dotnet", platform.AsString (), "monotouch-test.csproj");
|
||||
Configuration.CopyDotNetSupportingFiles (Path.GetDirectoryName (Path.GetDirectoryName (project_path)));
|
||||
Configuration.CopyDotNetSupportingFiles (Path.Combine (Configuration.SourceRoot, "tests", "bindings-test", "dotnet"));
|
||||
Configuration.CopyDotNetSupportingFiles (Path.Combine (Configuration.SourceRoot, "tests", "bindings-test2", "dotnet"));
|
||||
Configuration.CopyDotNetSupportingFiles (Path.Combine (Configuration.SourceRoot, "tests", "EmbeddedResources", "dotnet"));
|
||||
Configuration.CopyDotNetSupportingFiles (Path.Combine (Configuration.SourceRoot, "tests", "fsharplibrary", "dotnet"));
|
||||
Configuration.CopyDotNetSupportingFiles (Path.Combine (Configuration.SourceRoot, "external", "Touch.Unit", "Touch.Client", "dotnet"));
|
||||
Clean (project_path);
|
||||
var properties = GetDefaultProperties (runtimeIdentifiers);
|
||||
if (additionalProperties != null) {
|
||||
|
@ -847,9 +825,6 @@ namespace Xamarin.Tests {
|
|||
Clean (extensionProjectDir);
|
||||
Clean (consumingProjectDir);
|
||||
|
||||
Configuration.CopyDotNetSupportingFiles (Path.GetDirectoryName (extensionProjectDir));
|
||||
Configuration.CopyDotNetSupportingFiles (Path.GetDirectoryName (consumingProjectDir));
|
||||
|
||||
DotNet.AssertBuild (consumingProjectDir, verbosity);
|
||||
|
||||
var extensionPath = Path.Combine (Path.GetDirectoryName (consumingProjectDir)!, "bin", "Debug", platform.ToFramework (), GetDefaultRuntimeIdentifier (platform), "MySimpleApp.app", GetPlugInsRelativePath (platform), "ExtensionProject.appex");
|
||||
|
|
|
@ -53,7 +53,6 @@ class MainClass {
|
|||
</Project>";
|
||||
|
||||
var tmpdir = Cache.CreateTemporaryDirectory ();
|
||||
Configuration.CopyDotNetSupportingFiles (tmpdir);
|
||||
var project_path = Path.Combine (tmpdir, "TestProject.csproj");
|
||||
File.WriteAllText (project_path, csproj);
|
||||
File.WriteAllText (Path.Combine (tmpdir, "Info.plist"), EmptyAppManifest);
|
||||
|
@ -88,7 +87,6 @@ class MainClass {
|
|||
</ItemGroup>
|
||||
</Project>";
|
||||
|
||||
Configuration.CopyDotNetSupportingFiles (tmpdir);
|
||||
var project_path = Path.Combine (tmpdir, "TestProject.csproj");
|
||||
File.WriteAllText (project_path, csproj);
|
||||
File.WriteAllText (Path.Combine (tmpdir, "Info.plist"), EmptyAppManifest);
|
||||
|
@ -161,7 +159,6 @@ $@"<Project Sdk=""Microsoft.NET.Sdk"">
|
|||
var csprojfn = Path.Combine (projdir, Path.GetFileName (projdir) + ".csproj");
|
||||
File.WriteAllText (csprojfn, csproj);
|
||||
|
||||
Configuration.CopyDotNetSupportingFiles (tmpdir);
|
||||
DotNet.AssertBuild (csprojfn);
|
||||
ExecuteProjectWithMagicWordAndAssert (csprojfn, platform);
|
||||
}
|
||||
|
@ -179,7 +176,6 @@ $@"<Project Sdk=""Microsoft.NET.Sdk"">
|
|||
</Project>";
|
||||
|
||||
var tmpdir = Cache.CreateTemporaryDirectory ();
|
||||
Configuration.CopyDotNetSupportingFiles (tmpdir);
|
||||
var project_path = Path.Combine (tmpdir, "TestProject.csproj");
|
||||
File.WriteAllText (project_path, csproj);
|
||||
File.WriteAllText (Path.Combine (tmpdir, "Main.cs"), EmptyMainFile);
|
||||
|
|
|
@ -95,7 +95,6 @@ namespace Xamarin.Tests {
|
|||
|
||||
Configuration.IgnoreIfIgnoredPlatform (info.Platform);
|
||||
var tmpDir = Cache.CreateTemporaryDirectory ();
|
||||
Configuration.CopyDotNetSupportingFiles (tmpDir);
|
||||
var outputDir = Path.Combine (tmpDir, info.Template);
|
||||
DotNet.AssertNew (outputDir, info.Template);
|
||||
var csproj = Path.Combine (outputDir, info.Template + ".csproj");
|
||||
|
|
|
@ -263,8 +263,6 @@ namespace Xamarin.Tests {
|
|||
|
||||
File.WriteAllText (csproj, sb.ToString ());
|
||||
|
||||
Configuration.CopyDotNetSupportingFiles (dir);
|
||||
|
||||
var appPathRuntimeIdentifier = runtimeIdentifiers.IndexOf (';') >= 0 ? "" : runtimeIdentifiers;
|
||||
appPath = Path.Combine (dir, "bin", "Debug", platform.ToFramework (), appPathRuntimeIdentifier, name + ".app");
|
||||
|
||||
|
|
|
@ -3,13 +3,8 @@ TOP=../../../..
|
|||
include $(TOP)/Make.config
|
||||
|
||||
TARGETS += \
|
||||
.config.stamp \
|
||||
.install-workloads.stamp \
|
||||
|
||||
.config.stamp: Makefile
|
||||
$(Q) $(MAKE) -C ../.. NuGet.config global.json
|
||||
$(Q) touch $@
|
||||
|
||||
all-local:: compare
|
||||
|
||||
compare compare-size: $(TARGETS)
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
global.json
|
||||
NuGet.config
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
global.json
|
||||
NuGet.config
|
||||
|
|
@ -1,5 +1,2 @@
|
|||
*.air
|
||||
*.metallib
|
||||
global.json
|
||||
NuGet.config
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче