Browse Source

Prepared SVG in .NET for autoporting.

RND-746
pull/5/head
Michael Demey 8 years ago
parent
commit
f1ca7a6ca7
  1. 44
      .gitattributes
  2. 224
      .gitignore
  3. 9
      itext.tests/itext.svg.tests/App.config
  4. 24
      itext.tests/itext.svg.tests/Properties/AssemblyInfo.cs
  5. BIN
      itext.tests/itext.svg.tests/itext.snk
  6. 86
      itext.tests/itext.svg.tests/itext.svg.tests.csproj
  7. 64
      itext.tests/itext.svg.tests/itext.svg.tests.netstandard.csproj
  8. 9
      itext.tests/itext.svg.tests/itext/svg/FooTest.cs
  9. 4
      itext.tests/itext.svg.tests/packages.config
  10. 0
      itext.tests/itext.svg.tests/resources/itext/svg/.gitkeep
  11. 26
      itext/itext.svg/Properties/AssemblyInfo.cs
  12. 456
      itext/itext.svg/SvgExtensions.cs
  13. BIN
      itext/itext.svg/itext.snk
  14. 82
      itext/itext.svg/itext.svg.csproj
  15. 44
      itext/itext.svg/itext.svg.netstandard.csproj
  16. 9
      itext/itext.svg/itext/svg/Foo.cs
  17. 5
      itext/itext.svg/packages.config
  18. 1
      port-hash

44
.gitattributes

@ -0,0 +1,44 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to LF line endings on checkout.
*.afm text eol=lf
*.cmap text eol=lf
*.crt text eol=lf
*.cs text eol=lf ident
*.html text eol=lf
*.java text eol=lf ident
*.lng text eol=lf
*.md text eol=lf
*.pom text eol=lf
*.properties text eol=lf
*.txt text eol=lf
*.xfdf text eol=lf
*.xml text eol=lf
port-hash text eol=lf
# Declare files that will always have CRLF line endings on checkout.
*.bat text eol=crlf
*.csproj text eol=crlf
*.sln text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.bmp binary
*.cmp binary
*.dib binary
*.gif binary
*.j2k binary
*.jb2 binary
*.jp2 binary
*.jpg binary
*.key binary
*.otf binary
*.pdf binary
*.pfb binary
*.png binary
*.tif binary
*.tiff binary
*.ttc binary
*.ttf binary
*.wmf binary

224
.gitignore

@ -0,0 +1,224 @@
# Created by https://www.gitignore.io
### VisualStudio ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studo 2015 cache/options directory
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
*.[Cc]ache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
target/
nbactions*.xml
src/core/iTextSharp.xml

9
itext.tests/itext.svg.tests/App.config

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<uri>
<schemeSettings>
<add name="http" genericUriParserOptions="DontUnescapePathDotsAndSlashes"/>
<add name="https" genericUriParserOptions="DontUnescapePathDotsAndSlashes"/>
</schemeSettings>
</uri>
</configuration>

24
itext.tests/itext.svg.tests/Properties/AssemblyInfo.cs

@ -0,0 +1,24 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("iText.Svg.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("iText Group NV")]
[assembly: AssemblyProduct("iText")]
[assembly: AssemblyCopyright("Copyright (c) 1998-2018 iText Group NV")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("ae4e5743-0665-4705-9a33-07ea57cdd269")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0-SNAPSHOT")]
#if !NETSTANDARD1_6
[assembly: NUnit.Framework.Timeout(300000)]
#endif

BIN
itext.tests/itext.svg.tests/itext.snk

86
itext.tests/itext.svg.tests/itext.svg.tests.csproj

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EA3251AA-1452-3815-1A43-0041AEDEA112}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>
</RootNamespace>
<AssemblyName>itext.svg.tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>itext.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\NUnit.3.4.1\lib\net40\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="itext\svg\**\*.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\itextcore\itext\itext.io\itext.io.csproj">
<Project>{cee5e7e1-1bf0-4be1-9941-903262ce2f83}</Project>
<Name>itext.io</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\itextcore\itext\itext.kernel\itext.kernel.csproj">
<Project>{4e7819e8-7555-4e2e-9a01-d8718a2cfdda}</Project>
<Name>itext.kernel</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\itextcore\itext\itext.layout\itext.layout.csproj">
<Project>{42173642-db52-44d3-9883-3e34c65c53bc}</Project>
<Name>itext.layout</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.csproj">
<Project>{f9880dc4-f015-4413-af86-66d0e9512774}</Project>
<Name>itext.pdftest</Name>
</ProjectReference>
<ProjectReference Include="..\..\itext\itext.svg\itext.svg.csproj">
<Project>{DDEC35D2-5781-471D-5EA1-A6E433EDDB11}</Project>
<Name>itext.svg</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\styled-xml-parser\itext.styledxmlparser\styledxmlparser.csproj">
<Project>{8636F290-00DF-403E-B841-E4BFD6D9CE7A}</Project>
<Name>styled-xml-parser</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="itext.snk" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

64
itext.tests/itext.svg.tests/itext.svg.tests.netstandard.csproj

@ -0,0 +1,64 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup Label="Configuration">
<SignAssembly>True</SignAssembly>
<DelaySign>False</DelaySign>
<RootNamespace></RootNamespace>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netcoreapp1.0;net40</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net40' ">
<OutputType>library</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<OutputType>Library</OutputType>
<DefineConstants>NETSTANDARD1_6</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>itext.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationIcon />
<OutputTypeEx>library</OutputTypeEx>
<StartupObject />
<AssemblyName>itext.svg.tests</AssemblyName>
</PropertyGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="TeamCity.VSTest.TestAdapter" Version="1.0.0" />
<PackageReference Include="NUnit" Version="3.7.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="itext.snk" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\itextcore\itext\itext.io\itext.io.netstandard.csproj" />
<ProjectReference Include="..\..\..\itextcore\itext\itext.kernel\itext.kernel.netstandard.csproj" />
<ProjectReference Include="..\..\..\itextcore\itext\itext.layout\itext.layout.netstandard.csproj" />
<ProjectReference Include="..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.netstandard.csproj" />
<ProjectReference Include="..\..\..\styled-xml-parser\itext\itext.styledxmlparser\itext.styledxmlparser.netstandard.csproj" />
<ProjectReference Include="..\..\itext\itext.svg\itext.svg.netstandard.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.0'">
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>15.0.0</Version>
</PackageReference>
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation">
<Version>4.3.0</Version>
</PackageReference>
</ItemGroup>
</Project>

9
itext.tests/itext.svg.tests/itext/svg/FooTest.cs

@ -0,0 +1,9 @@
namespace iText.Svg {
public class FooTest {
[NUnit.Framework.Test]
public virtual void Test() {
Foo foo = new Foo();
NUnit.Framework.Assert.AreEqual(foo.ToString(), "Hello, world");
}
}
}

4
itext.tests/itext.svg.tests/packages.config

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="3.4.1" targetFramework="net4" />
</packages>

0
itext.tests/itext.svg.tests/resources/itext/svg/.gitkeep

26
itext/itext.svg/Properties/AssemblyInfo.cs

@ -0,0 +1,26 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("iText.Svg")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("iText Group NV")]
[assembly: AssemblyProduct("iText")]
[assembly: AssemblyCopyright("Copyright (c) 1998-2018 iText Group NV")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("itext.svg.tests,PublicKey=0024000004800000940000000602000000240000525" +
"3413100040000010001008b21ed5b3fc1c11996390981fe22bbe71a39a9e11d3c2ce" +
"fddd6ee92920fa871f9666ae0fa941af0280d0653df048ae2d93f8c5e2d820dba3c8" +
"df9ed468c8be40a6fffeb32aa481a254f0fb9f37aa7c3ec1c0acd2c009746bbdafcb" +
"75bcdbcecb7caf1f0f4b6e7d013906ba60b66eb1c8298e4efb052caf6cece4bf1816" +
"902cc")]
[assembly: ComVisible(false)]
[assembly: Guid("ff6ba09d-3655-466a-8c17-a7bfd3479ca1")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0-SNAPSHOT")]

456
itext/itext.svg/SvgExtensions.cs

@ -0,0 +1,456 @@
/*
This file is part of the iText (R) project.
Copyright (c) 1998-2017 iText Group NV
Authors: iText Software.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation with the addition of the
following permission added to Section 15 as permitted in Section 7(a):
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
OF THIRD PARTY RIGHTS
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program; if not, see http://www.gnu.org/licenses or write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA, 02110-1301 USA, or download the license from the following URL:
http://itextpdf.com/terms-of-use/
The interactive user interfaces in modified source and object code versions
of this program must display Appropriate Legal Notices, as required under
Section 5 of the GNU Affero General Public License.
In accordance with Section 7(b) of the GNU Affero General Public License,
a covered work must retain the producer line in every PDF that is created
or manipulated using iText.
You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the iText software without
disclosing the source code of your own applications.
These activities include: offering paid services to customers as an ASP,
serving PDFs on the fly in a web application, shipping iText with a closed
source product.
For more information, please contact iText Software Corp. at this
address: sales@itextpdf.com */
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using iText.IO.Util;
using System.Reflection;
internal static class SvgExtensions {
public static String Name(this Encoding e) {
return e.WebName.ToUpperInvariant();
}
public static String DisplayName(this Encoding e) {
return e.WebName.ToUpperInvariant();
}
public static bool RegionMatches(this string s, bool ignoreCase, int toffset, String other, int ooffset, int len) {
return 0 == String.Compare(s, toffset, other, ooffset, len, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
}
public static bool StartsWith(this string s, string prefix, int pos) {
int to = pos;
int po = 0;
int pc = prefix.Length;
if ((pos < 0) || (pos > s.Length - pc)) {
return false;
}
while (--pc >= 0) {
if (s[to++] != prefix[po++]) {
return false;
}
}
return true;
}
public static void ReadFully(this FileStream stream, byte[] bytes) {
stream.Read(bytes, 0, bytes.Length);
}
public static String ToExternalForm(this Uri u) {
/*
// pre-compute length of StringBuffer
int len = u.Scheme.Length + 1;
if (!String.IsNullOrEmpty(u.Authority))
len += 2 + u.Authority.Length;
if (!String.IsNullOrEmpty(u.AbsolutePath))
len += u.AbsolutePath.Length - (u.AbsolutePath.EndsWith("/") ? 1 : 0);
if (!String.IsNullOrEmpty(u.Query))
len += u.Query.Length;
if (!String.IsNullOrEmpty(u.Fragment))
len += 1 + u.Fragment.Length;
StringBuilder result = new StringBuilder(len);
result.Append(u.Scheme);
result.Append(":");
if (!String.IsNullOrEmpty(u.Authority)) {
result.Append("//");
result.Append(u.Authority);
}
if (!String.IsNullOrEmpty(u.AbsolutePath)) {
var path = u.AbsolutePath;
if (path.EndsWith("/"))
path = path.Substring(0, path.Length - 1);
result.Append(path);
}
if (!String.IsNullOrEmpty(u.Query))
result.Append(u.Query);
if (!String.IsNullOrEmpty(u.Fragment))
result.Append(u.Fragment);
return result.ToString();
*/
return u.AbsoluteUri;
}
public static bool CanEncode(this Encoding encoding, char c) {
return encoding.CanEncode(c.ToString());
}
public static bool CanEncode(this Encoding encoding, String chars) {
byte[] src = Encoding.Unicode.GetBytes(chars);
return encoding.CanEncode(src);
}
public static bool CanEncode(this Encoding encoding, byte[] src) {
try {
byte[] dest = Encoding.Convert(Encoding.Unicode,
EncodingUtil.GetEncoding(encoding.CodePage, new EncoderExceptionFallback(),
new DecoderExceptionFallback()), src);
} catch (EncoderFallbackException) {
return false;
}
return true;
}
public static Stream GetResourceAsStream(this Type type, string filename) {
Stream s =
ResourceUtil.GetResourceStream(type.Namespace.ToLowerInvariant() + "." + filename,
type);
if (s == null) {
throw new IOException();
}
return s;
}
public static int CodePointAt(this String str, int index) {
return char.ConvertToUtf32(str, index);
}
public static StringBuilder AppendCodePoint(this StringBuilder sb, int codePoint) {
return sb.Append(char.ConvertFromUtf32(codePoint));
}
public static String JSubstring(this String str, int beginIndex, int endIndex) {
return str.Substring(beginIndex, endIndex - beginIndex);
}
public static void JReset(this MemoryStream stream) {
stream.Position = 0;
}
public static StringBuilder Delete(this StringBuilder sb, int beginIndex, int endIndex) {
return sb.Remove(beginIndex, endIndex - beginIndex);
}
public static void Write(this Stream stream, int value) {
stream.WriteByte((byte) value);
}
public static int Read(this Stream stream) {
return stream.ReadByte();
}
public static int Read(this Stream stream, byte[] buffer) {
int size = stream.Read(buffer, 0, buffer.Length);
return size == 0 ? -1 : size;
}
public static int JRead(this Stream stream, byte[] buffer, int offset, int count) {
int result = stream.Read(buffer, offset, count);
return result == 0 ? -1 : result;
}
public static void Write(this Stream stream, byte[] buffer) {
stream.Write(buffer, 0, buffer.Length);
}
public static byte[] GetBytes(this String str) {
return System.Text.Encoding.UTF8.GetBytes(str);
}
public static byte[] GetBytes(this String str, Encoding encoding) {
return encoding.GetBytes(str);
}
public static byte[] GetBytes(this String str, String encodingName) {
return EncodingUtil.GetEncoding(encodingName).GetBytes(str);
}
public static long Seek(this FileStream fs, long offset) {
return fs.Seek(offset, SeekOrigin.Begin);
}
public static long Skip(this Stream s, long n) {
s.Seek(n, SeekOrigin.Current);
return n;
}
public static List<T> SubList<T>(this IList<T> list, int fromIndex, int toIndex) {
return ((List<T>) list).GetRange(fromIndex, toIndex - fromIndex);
}
public static void GetChars(this StringBuilder sb, int srcBegin, int srcEnd, char[] dst, int dstBegin) {
sb.CopyTo(srcBegin, dst, dstBegin, srcEnd - srcBegin);
}
public static String[] Split(this String str, String regex) {
return str.Split(regex.ToCharArray());
}
public static void AddAll<T>(this ICollection<T> c, IEnumerable<T> collectionToAdd) {
foreach (T o in collectionToAdd) {
c.Add(o);
}
}
public static void AddAll<T>(this Stack<T> c, IEnumerable<T> collectionToAdd) {
foreach (T o in collectionToAdd) {
c.Push(o);
}
}
public static T[] ToArray<T>(this ICollection<T> col) {
T[] result = new T[col.Count];
return col.ToArray<T>(result);
}
public static T[] ToArray<T>(this ICollection<T> col, T[] toArray) {
T[] r;
int colSize = col.Count;
if (colSize <= toArray.Length) {
col.CopyTo(toArray, 0);
if (colSize != toArray.Length) {
toArray[colSize] = default(T);
}
r = toArray;
} else {
r = new T[colSize];
col.CopyTo(r, 0);
}
return r;
}
public static bool RemoveAll<T>(this ICollection<T> set, ICollection<T> c) {
bool modified = false;
foreach (var item in c) {
if (set.Remove(item)) modified = true;
}
return modified;
}
public static TValue JRemove<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) {
TValue value;
dictionary.TryGetValue(key, out value);
dictionary.Remove(key);
return value;
}
public static T JRemoveFirst<T>(this LinkedList<T> list)
{
T value = list.First.Value;
list.RemoveFirst();
return value;
}
public static bool Matches(this String str, String regex) {
return Regex.IsMatch(str, "^"+regex+"$");
}
public static String ReplaceFirst(this String input, String pattern, String replacement) {
var regex = new Regex(pattern);
return regex.Replace(input, replacement, 1);
}
public static bool EqualsIgnoreCase(this String str, String anotherString) {
return String.Equals(str, anotherString, StringComparison.OrdinalIgnoreCase);
}
public static void AddAll<TKey, TValue>(this IDictionary<TKey, TValue> c,
IDictionary<TKey, TValue> collectionToAdd) {
foreach (KeyValuePair<TKey, TValue> pair in collectionToAdd) {
c[pair.Key] = pair.Value;
}
}
public static void AddAll<T>(this IList<T> list, int index, IList<T> c) {
for (int i = c.Count - 1; i >= 0; i--) {
list.Insert(index, c[i]);
}
}
public static bool IsEmpty<T>(this Stack<T> c) {
return c.Count == 0;
}
public static bool IsEmpty<T>(this ICollection<T> c) {
return c.Count == 0;
}
public static bool IsEmpty<T>(this IList<T> l) {
return l.Count == 0;
}
public static void Add<T>(this IList<T> list, int index, T elem) {
list.Insert(index, elem);
}
public static bool Add<T>(this LinkedList<T> list, T elem) {
list.AddLast(elem);
return true;
}
public static T JRemove<T>(this LinkedList<T> list) {
T head = list.First.Value;
list.RemoveFirst();
return head;
}
public static T JRemoveAt<T>(this IList<T> list, int index) {
T value = list[index];
list.RemoveAt(index);
return value;
}
public static TValue Get<TKey, TValue>(this IDictionary<TKey, TValue> col, TKey key) {
TValue value = default(TValue);
if (key != null) {
col.TryGetValue(key, out value);
}
return value;
}
public static TValue Put<TKey, TValue>(this IDictionary<TKey, TValue> col, TKey key, TValue value) {
TValue oldVal = col.Get(key);
col[key] = value;
return oldVal;
}
public static bool Contains<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) {
return dictionary.ContainsKey(key);
}
public static T JGetFirst<T>(this LinkedList<T> list) {
return list.First.Value;
}
public static void EnsureCapacity<T>(this List<T> list, int capacity) {
if (capacity > list.Count) {
list.Capacity = capacity;
}
}
public static StringBuilder JAppend(this StringBuilder sb, String str, int begin, int end) {
return sb.Append(str, begin, end - begin);
}
public static StringBuilder Reverse(this StringBuilder sb) {
char MIN_SURROGATE = '\uD800';
char MAX_SURROGATE = '\uDFFF';
bool hasSurrogate = false;
int n = sb.Length - 1;
for (int j = (n - 1) >> 1; j >= 0; --j) {
char temp = sb[j];
char temp2 = sb[n - j];
if (!hasSurrogate) {
hasSurrogate = (temp >= MIN_SURROGATE && temp <= MAX_SURROGATE)
|| (temp2 >= MIN_SURROGATE && temp2 <= MAX_SURROGATE);
}
sb[j] = temp2;
sb[n - j] = temp;
}
if (hasSurrogate) {
// Reverse back all valid surrogate pairs
for (int i = 0; i < sb.Length - 1; i++) {
char c2 = sb[i];
if (char.IsLowSurrogate(c2)) {
char c1 = sb[i + 1];
if (char.IsHighSurrogate(c1)) {
sb[i++] = c1;
sb[i] = c2;
}
}
}
}
return sb;
}
#if !NETSTANDARD1_6
public static Attribute GetCustomAttribute(this Assembly assembly, Type attributeType)
{
object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType, false);
if (customAttributes.Length > 0 && customAttributes[0] is Attribute)
{
return customAttributes[0] as Attribute;
}
else
{
return null;
}
}
#endif
public static Assembly GetAssembly(this Type type)
{
#if !NETSTANDARD1_6
return type.Assembly;
#else
return type.GetTypeInfo().Assembly;
#endif
}
#if NETSTANDARD1_6
public static MethodInfo GetMethod(this Type type, String methodName, Type[] parameterTypes) {
return type.GetTypeInfo().GetMethod(methodName, parameterTypes);
}
public static MethodInfo GetMethod(this Type type, String methodName) {
return type.GetTypeInfo().GetMethod(methodName);
}
public static ConstructorInfo GetConstructor(this Type type, Type[] parameterTypes) {
return type.GetTypeInfo().GetConstructor(parameterTypes);
}
public static bool IsInstanceOfType(this Type type, object objToCheck) {
return type.GetTypeInfo().IsInstanceOfType(objToCheck);
}
public static FieldInfo[] GetFields(this Type type, BindingFlags flags) {
return type.GetTypeInfo().GetFields(flags);
}
public static byte[] GetBuffer(this MemoryStream memoryStream) {
ArraySegment<byte> buf;
memoryStream.TryGetBuffer(out buf);
return buf.Array;
}
#endif
}

BIN
itext/itext.svg/itext.snk

82
itext/itext.svg/itext.svg.csproj

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DDEC35D2-5781-471D-5EA1-A6E433EDDB11}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>
</RootNamespace>
<AssemblyName>itext.svg</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>itext.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\itext.svg.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\itext.svg.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging, Version=3.4.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
<HintPath>$(SolutionDir)\packages\Common.Logging.3.4.1\lib\net40\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Common.Logging.Core, Version=3.4.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
<HintPath>$(SolutionDir)\packages\Common.Logging.Core.3.4.1\lib\net40\Common.Logging.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="itext\svg\**\*.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SvgExtensions.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\itextcore\itext\itext.io\itext.io.csproj">
<Project>{cee5e7e1-1bf0-4be1-9941-903262ce2f83}</Project>
<Name>itext.io</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\itextcore\itext\itext.kernel\itext.kernel.csproj">
<Project>{4e7819e8-7555-4e2e-9a01-d8718a2cfdda}</Project>
<Name>itext.kernel</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\itextcore\itext\itext.layout\itext.layout.csproj">
<Project>{42173642-db52-44d3-9883-3e34c65c53bc}</Project>
<Name>itext.layout</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\styled-xml-parser\itext\itext.styledxmlparser\itext.styledxmlparser.csproj">
<Project>{8636F290-00DF-403E-B841-E4BFD6D9CE7A}</Project>
<Name>itext.styled-xml-parser</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="itext.snk" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

44
itext/itext.svg/itext.svg.netstandard.csproj

@ -0,0 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup Label="Configuration">
<SignAssembly>True</SignAssembly>
<DelaySign>False</DelaySign>
<RootNamespace></RootNamespace>
<DocumentationFile>$(TargetDir)bin\$(Configuration)\$(TargetFramework)\itext.svg.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netstandard1.6;net40</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<OutputType>library</OutputType>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>itext.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>itext.svg</AssemblyName>
<RootNamespace />
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<PackageReference Include="NETStandard.Library" Version="1.6.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\itextcore\itext\itext.io\itext.io.netstandard.csproj" />
<ProjectReference Include="..\..\..\itextcore\itext\itext.kernel\itext.kernel.netstandard.csproj" />
<ProjectReference Include="..\..\..\itextcore\itext\itext.layout\itext.layout.netstandard.csproj" />
<ProjectReference Include="..\..\..\styled-xml-parser\itext\itext.styledxmlparser\itext.styledxmlparser.netstandard.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Common.Logging" Version="3.4.1" />
</ItemGroup>
</Project>

9
itext/itext.svg/itext/svg/Foo.cs

@ -0,0 +1,9 @@
using System;
namespace iText.Svg {
public class Foo {
public override String ToString() {
return "Hello, world";
}
}
}

5
itext/itext.svg/packages.config

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Common.Logging" version="3.4.1" targetFramework="net40" />
<package id="Common.Logging.Core" version="3.4.1" targetFramework="net40" />
</packages>

1
port-hash

@ -0,0 +1 @@
aeeb4c925dc8c4b3f3dcd3e8c0e4b2ad1f84c5d2
Loading…
Cancel
Save