Skip to content

Commit

Permalink
setup common project for both implementations for Xamarin
Browse files Browse the repository at this point in the history
  • Loading branch information
kfrancis committed Mar 26, 2024
1 parent 5b9f9dd commit 07fdf70
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Plugin.Xamarin.OCR.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin.Shared.OCR", "Plugin
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.Xamarin.OCR.iOS", "Plugin.Xamarin.OCR.iOS\Plugin.Xamarin.OCR.iOS.csproj", "{DB3F6043-D151-4D28-806B-9B6A78552E6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.Xamarin.OCR", "Plugin.Xamarin.OCR\Plugin.Xamarin.OCR.csproj", "{0486AFA0-8165-4572-820F-D93281B99E40}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -27,6 +29,10 @@ Global
{DB3F6043-D151-4D28-806B-9B6A78552E6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB3F6043-D151-4D28-806B-9B6A78552E6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB3F6043-D151-4D28-806B-9B6A78552E6C}.Release|Any CPU.Build.0 = Release|Any CPU
{0486AFA0-8165-4572-820F-D93281B99E40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0486AFA0-8165-4572-820F-D93281B99E40}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0486AFA0-8165-4572-820F-D93281B99E40}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0486AFA0-8165-4572-820F-D93281B99E40}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
19 changes: 19 additions & 0 deletions src/Plugin.Xamarin.OCR/Ocr.android.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Plugin.Shared.OCR;

namespace Plugin.Xamarin.OCR;

partial class OcrImplementation : IOcrService
{
public Task InitAsync(CancellationToken ct = default)
{
throw new NotImplementedException();
}

public Task<OcrResult> RecognizeTextAsync(byte[] imageData, CancellationToken ct = default)
{
throw new NotImplementedException();
}
}
19 changes: 19 additions & 0 deletions src/Plugin.Xamarin.OCR/Ocr.ios.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using Plugin.Shared.OCR;
using System.Threading.Tasks;
using System.Threading;

namespace Plugin.Xamarin.OCR;

partial class OcrImplementation : IOcrService
{
public Task InitAsync(CancellationToken ct = default)
{
throw new NotImplementedException();
}

public Task<OcrResult> RecognizeTextAsync(byte[] imageData, CancellationToken ct = default)
{
throw new NotImplementedException();
}
}
20 changes: 20 additions & 0 deletions src/Plugin.Xamarin.OCR/Ocr.shared.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
using Plugin.Shared.OCR;

namespace Plugin.Xamarin.OCR;

public static class OCR
{
static IOcrService? s_defaultImplementation;

/// <summary>
/// Provides the default implementation for static usage of this API.
/// </summary>
public static IOcrService Default =>
s_defaultImplementation ??= new OcrImplementation();

internal static void SetDefault(IOcrService? implementation) =>
s_defaultImplementation = implementation;
}
74 changes: 74 additions & 0 deletions src/Plugin.Xamarin.OCR/Plugin.Xamarin.OCR.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<Project Sdk="MSBuild.Sdk.Extras/3.0.22">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;Xamarin.iOS10;MonoAndroid13.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<!-- NuGet -->
<Authors>kfrancis</Authors>
<Copyright>Copyright © Kori Francis</Copyright>
<IsPackable>True</IsPackable>
<PackageProjectUrl>https://github.com/kfrancis/ocr</PackageProjectUrl>
<RepositoryUrl>https://github.com/kfrancis/ocr</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>dotnet-maui;maui;plugin;</PackageTags>
<IncludeSymbols>True</IncludeSymbols>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Title>.NET Xamarin OCR Plugin</Title>
<Description>Plugin.Xamarin.OCR provides the ability to perform OCR on an image using platform API.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<DebugType>portable</DebugType>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>

</PropertyGroup>

<!-- Package additions -->
<ItemGroup>
<None Include="..\..\nuget.png" PackagePath="icon.png" Pack="true" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>


<ItemGroup>
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Compile Include="**\*.shared.cs" />
<Compile Include="**\*.shared.*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
<Compile Include="**\*.netstandard.cs" />
<Compile Include="**\*.netstandard.*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('MonoAndroid')) ">
<Compile Include="**\*.android.cs" />
<Compile Include="**\*.android.*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.iOS')) ">
<Compile Include="**\*.ios.cs" />
<Compile Include="**\*.ios.*.cs" />
</ItemGroup>

<ItemGroup>
<Compile Remove="Ocr.shared.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Plugin.Shared.OCR\Plugin.Shared.OCR.csproj" />
</ItemGroup>

</Project>

0 comments on commit 07fdf70

Please sign in to comment.