~n0mn0m/archivist

fd0058b717e9bd263a4d63ff50989608680181f6 — n0mn0m 5 months ago b7c0657 master
Clean up namespaces.

Move from bare functionality to namespaces and separate interace from functionality.
18 files changed, 198 insertions(+), 19 deletions(-)

A .idea/.idea.Archivist/.idea/.gitignore
A .idea/.idea.Archivist/.idea/encodings.xml
A .idea/.idea.Archivist/.idea/indexLayout.xml
A .idea/.idea.Archivist/.idea/misc.xml
A .idea/.idea.Archivist/.idea/vcs.xml
R PdfToText.sln => Archivist.sln
R PdfToText.sln.DotSettings.user => Archivist.sln.DotSettings.user
R PdfToText/{PdfToText.csproj => eInterface/CommandLineInterface.csproj}
R PdfToText/{Program.cs => eInterface/Program.cs}
A Extractor/Extractor.csproj
A Extractor/ITextExtractor.cs
R PdfToText/{PdfParser.cs => PdfExtractor.cs}
R TestPdfToText/{TestPdfToText.csproj => TestExtractor.csproj}
R TestPdfToText/{TestPdfParsing.cs => TestPdfParsing.cs}
A TestExtractor/assets/EclipsePhase_License.txt
A TestExtractor/assets/EclipsePhase_SecondEdition_QuickStart.pdf
D TestPdfToText/docs/EclipsePhase_License.txt
D TestPdfToText/docs/EclipsePhase_SecondEdition_Glossary.pdf
A .idea/.idea.Archivist/.idea/.gitignore => .idea/.idea.Archivist/.idea/.gitignore +13 -0
@@ 0,0 1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/projectSettingsUpdater.xml
/.idea.Archivist.iml
/modules.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

A .idea/.idea.Archivist/.idea/encodings.xml => .idea/.idea.Archivist/.idea/encodings.xml +4 -0
@@ 0,0 1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>
\ No newline at end of file

A .idea/.idea.Archivist/.idea/indexLayout.xml => .idea/.idea.Archivist/.idea/indexLayout.xml +8 -0
@@ 0,0 1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ContentModelUserStore">
    <attachedFolders />
    <explicitIncludes />
    <explicitExcludes />
  </component>
</project>
\ No newline at end of file

A .idea/.idea.Archivist/.idea/misc.xml => .idea/.idea.Archivist/.idea/misc.xml +6 -0
@@ 0,0 1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="JavaScriptSettings">
    <option name="languageLevel" value="ES6" />
  </component>
</project>
\ No newline at end of file

A .idea/.idea.Archivist/.idea/vcs.xml => .idea/.idea.Archivist/.idea/vcs.xml +6 -0
@@ 0,0 1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="VcsDirectoryMappings">
    <mapping directory="$PROJECT_DIR$" vcs="Git" />
  </component>
</project>
\ No newline at end of file

R PdfToText.sln => Archivist.sln +8 -2
@@ 1,8 1,10 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PdfToText", "PdfToText\PdfToText.csproj", "{87BF7238-14C6-4C58-9591-A946F3933C87}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandLineInterface", "CommandLineInterface\CommandLineInterface.csproj", "{87BF7238-14C6-4C58-9591-A946F3933C87}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestPdfToText", "TestPdfToText\TestPdfToText.csproj", "{EF080A6A-D49F-4C6F-993B-C33CD35AAC4C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestExtractor", "TestExtractor\TestExtractor.csproj", "{EF080A6A-D49F-4C6F-993B-C33CD35AAC4C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Extractor", "Extractor\Extractor.csproj", "{432B8C13-9B8F-4308-9CDC-D8332B4A1346}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution


@@ 18,5 20,9 @@ Global
		{EF080A6A-D49F-4C6F-993B-C33CD35AAC4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{EF080A6A-D49F-4C6F-993B-C33CD35AAC4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{EF080A6A-D49F-4C6F-993B-C33CD35AAC4C}.Release|Any CPU.Build.0 = Release|Any CPU
		{432B8C13-9B8F-4308-9CDC-D8332B4A1346}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{432B8C13-9B8F-4308-9CDC-D8332B4A1346}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{432B8C13-9B8F-4308-9CDC-D8332B4A1346}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{432B8C13-9B8F-4308-9CDC-D8332B4A1346}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
EndGlobal

R PdfToText.sln.DotSettings.user => Archivist.sln.DotSettings.user +3 -0
@@ 1,4 1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
	<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=405e5a3e_002D9f00_002D48bb_002Dba1d_002D8999cc31ce5a/@EntryIndexedValue">&lt;SessionState ContinuousTestingIsOn="False" ContinuousTestingMode="0" FrameworkVersion="{x:Null}" IsLocked="False" Name="All tests from &amp;lt;TestPdfToText&amp;gt;" PlatformMonoPreference="{x:Null}" PlatformType="{x:Null}" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  &lt;Project Location="/Users/n0mn0m/RiderProjects/PdfToText/TestPdfToText" Presentation="&amp;lt;TestPdfToText&amp;gt;" /&gt;
&lt;/SessionState&gt;</s:String>
	<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=c3a36d0d_002D4074_002D49fc_002Dbe33_002D3cc19939682d/@EntryIndexedValue">&lt;SessionState ContinuousTestingIsOn="False" ContinuousTestingMode="0" FrameworkVersion="{x:Null}" IsLocked="False" Name="All tests from &amp;lt;TestExtractor&amp;gt;" PlatformMonoPreference="{x:Null}" PlatformType="{x:Null}" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  &lt;Project Location="/Users/n0mn0m/RiderProjects/Archivist/TestExtractor" Presentation="&amp;lt;TestExtractor&amp;gt;" /&gt;
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary>
\ No newline at end of file

R PdfToText/PdfToText.csproj => CommandLineInterface/CommandLineInterface.csproj +4 -0
@@ 15,4 15,8 @@
      </None>
    </ItemGroup>

    <ItemGroup>
      <ProjectReference Include="..\Extractor\Extractor.csproj" />
    </ItemGroup>

</Project>

R PdfToText/Program.cs => CommandLineInterface/Program.cs +6 -4
@@ 1,19 1,21 @@
using System;
using System.IO;
using System.Linq;
using Extractor;

namespace PdfToText
namespace CommandLineInterface
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Please provide the location of the PDF to load.");
            string inputPdf = Console.ReadLine();
            var inputPdf = Console.ReadLine();
            if (File.Exists(inputPdf))
            {
                Console.WriteLine($"Loading {inputPdf}");
                var result = PdfParser.ExtractTextFromPdf(inputPdf);
                result.ForEach(i => Console.Write("{0}\t", i));
                var result = new PdfExtractor(inputPdf).ExtractText();
                Console.WriteLine(string.Join("\t", result));
            } else {
                Console.WriteLine($"{inputPdf} not found.");
            } 

A Extractor/Extractor.csproj => Extractor/Extractor.csproj +11 -0
@@ 0,0 1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFramework>netstandard2.1</TargetFramework>
    </PropertyGroup>

    <ItemGroup>
      <PackageReference Include="itext7" Version="7.1.12" />
    </ItemGroup>

</Project>

A Extractor/ITextExtractor.cs => Extractor/ITextExtractor.cs +10 -0
@@ 0,0 1,10 @@
using System.Collections;
using System.Collections.Generic;

namespace Extractor
{
    public interface ITextExtractor<T>
    {
        public ICollection<T> ExtractText();
    }
}
\ No newline at end of file

R PdfToText/PdfParser.cs => Extractor/PdfExtractor.cs +10 -4
@@ 4,13 4,19 @@ using iText.Kernel.Pdf;
using iText.Kernel.Pdf.Canvas.Parser;
using iText.Kernel.Pdf.Canvas.Parser.Listener;

namespace PdfToText
namespace Extractor
{
    public class PdfParser
    public class PdfExtractor : ITextExtractor<string>
    {
        public static List<string> ExtractTextFromPdf(string filePath)
        private string _inputFile;
        public PdfExtractor(string inputFile)
        {
            var pdfReader = new PdfReader(filePath);
           _inputFile = inputFile;
        }

        public ICollection<string> ExtractText()
        {
            var pdfReader = new PdfReader(_inputFile);
            var pdfDoc = new PdfDocument(pdfReader);
            var extractedLines = new List<string>();
            for (var page = 1; page <= pdfDoc.GetNumberOfPages(); page++)

R TestPdfToText/TestPdfToText.csproj => TestExtractor/TestExtractor.csproj +4 -4
@@ 14,13 14,13 @@
    </ItemGroup>

    <ItemGroup>
      <ProjectReference Include="..\PdfToText\PdfToText.csproj" />
      <None Update="assets\EclipsePhase_SecondEdition_QuickStart.pdf">
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      </None>
    </ItemGroup>

    <ItemGroup>
      <None Update="docs\EclipsePhase_SecondEdition_Glossary.pdf">
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      </None>
      <ProjectReference Include="..\Extractor\Extractor.csproj" />
    </ItemGroup>

</Project>

R TestPdfToText/TestPdfParsing.cs => TestExtractor/TestPdfParsing.cs +4 -4
@@ 1,16 1,16 @@
using System;
using Xunit;
using PdfToText;
using Extractor;

namespace TestPdfToText
namespace TestExtractor
{
    public class TestPdfParsing
    {
        [Fact]
        public void TestSuccessfulParse()
        {
            var result = PdfParser.ExtractTextFromPdf("./docs/EclipsePhase_SecondEdition_Glossary.pdf");
            Assert.Equal(4, result.Count);
            var result = new PdfExtractor("./assets/EclipsePhase_SecondEdition_QuickStart.pdf").ExtractText();
            Assert.Equal(22, result.Count);
        }
    }
}
\ No newline at end of file

A TestExtractor/assets/EclipsePhase_License.txt => TestExtractor/assets/EclipsePhase_License.txt +101 -0
@@ 0,0 1,101 @@
https://eclipsephase.com/cclicense

Creative Commons License
We encourage people to play in our sandbox. We want our players and fans to
share the game with their friends, write fan fiction, create websites for
their campaigns, post their house rules online, publish netbooks based on
their personalized settings, create crossover systems for running Eclipse
Phase using other published (or home-brewed) rules sets, or even mesh Eclipse
Phase with other favored crossover worlds. To this end, we've published the
Eclipse Phase RPG under a Creative Commons license. Details on how this
license works, and any exceptions that apply, are noted below. 


Eclipse Phase Website

The original text of this website is licensed under the Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License. View this license

Original artwork content of eclipsephase.com is copyright© 2008-2018 Posthuman
Studios, LLC unless otherwise specified and is licensed under the Creative
Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. 

Eclipse Phase Products

Creative Commons License

Eclipse Phase products (including printed rulebooks/sourcebooks and PDFs) by
Posthuman Studios are licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 License, with the following
exceptions noted below.

View this license

What this means is that you are free to copy, share, and remix the text and
artwork within these books and PDFs (with the exceptions noted below) under
the following conditions: 

1) You do so only for noncommercial purposes; 
2) You attribute Posthuman Studios (see below); 
3) You license any derivatives under the same license.

Exceptions
The following items are not covered under the Creative Commons license:

The Eclipse Phase logo as seen on this website and any book is trademarked.

The Circle-A anarchist logo on p. 77 of the EP core rulebook is public domain
and usable by anyone for any purpose. 

All artwork by Sean McMurchy (pp. 243, 314, 319, 363, and 377 in the first and
second printings of the EP core rulebook) is copyright© 2009 Posthuman Studios,
LLC, and may not be reused without permission. 

Note that permission is still granted to freely share this copyrighted material
(but not to reuse, remix, or sell).

Attribution

When reusing/remixing Creative Commons-licensed Eclipse Phase material, credit
must be given to Posthuman Studios, LLC. Please also provide a link to
http://eclipsephase.com

Though it is not legally necessary, we also encourage you to provide credit to
our partners and contributors. For written material and artwork, please consult
the Credits page of that product, or ask us.

Artwork Credit

We'd like to see our artists get credit if their artwork is re-used. To assist,
this, we've provided this handy guide for referencing which artist did which piece.
If you want bonus points, you could even provide a link to the artist's website!

Eclipse Phase Core Rulebook Justin Albers: p. 124
Rich Anderson: pp. 12-13
Adam Bain/Opus Artz: p. 329
Davi Blight: p. 373
Leanne Buckley: pp. 110, 120, 142, 147, 210, 227
Robin Chyo: p. 276 
Daniel Clarke: pp. 61, 154, 156, 157, 158, 162, 163, 164, 167, 168, 233, 285, 299
Paul Davies: pp. 59, 89, 94, 136, 138, 198, 205
Michaela Eaves: pp. 75 (LLA logo), 76 (Tharsis League logo)
Nathan Geppert: pp. 366, 387
Jack Graham: pp. 75 (Jovian Republic logo), 76 (AA logo), 79, 82 
Zachary Graves: p. 103, 382
Tariq Hassan: pp. 85, 126, 175, 250
Matt Heerdt: p. 87 (solar system map)
Thomas Jung: pp. 326, 332
Sergey Kondratovich: pp. 51, 179, 185, 195
Hal Mangold: pp. 75 (Morningstar logo), 76 (Planetary Consortium logo)
Stephan Martiniere: Cover Art
Dug Nation: p. 230
Ben Newman: pp. 133, 153, 159, 160, 165
Justin Oaksford: p. 117
Efrem Palacios: pp. 155, 161, 166, 169
Sacha-Mikhail Roberts: pp. 42, 47, 69, 107
Silver Saaramael: pp. 222, 270, 290, 309, 358
Daniel Stultz: pp. 55, 246, 254, 258, 263
Viktor Titov: pp. 65, 77, 98, 182, 191
Alexandre Tuis: pp. 304, 346
Bruno Werneck: pp. 16-17, 20, 30-31, 35, 39, 112-113, 128-129, 170-171, 186, 216-217, 235, 238, 266-267, 293, 294-295, 350-351
Dr. C.M. Wong/Opus Artz: pp. 22, 281, 337, 342, 349, 355

A TestExtractor/assets/EclipsePhase_SecondEdition_QuickStart.pdf => TestExtractor/assets/EclipsePhase_SecondEdition_QuickStart.pdf +0 -0
D TestPdfToText/docs/EclipsePhase_License.txt => TestPdfToText/docs/EclipsePhase_License.txt +0 -1
@@ 1,1 0,0 @@
https://eclipsephase.com/cclicense
\ No newline at end of file

D TestPdfToText/docs/EclipsePhase_SecondEdition_Glossary.pdf => TestPdfToText/docs/EclipsePhase_SecondEdition_Glossary.pdf +0 -0