initial commit
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/.vs/05-AddMeta/v15/.suo
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/.vs/05-AddMeta/v15/.suo
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/.vs/05-AddMeta/v15/sqlite3/storage.ide
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/.vs/05-AddMeta/v15/sqlite3/storage.ide
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/.vs/05-AddMeta/v16/.suo
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/.vs/05-AddMeta/v16/.suo
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										28
									
								
								C# Projects/05-AddMeta/05-AddMeta.sln
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								C# Projects/05-AddMeta/05-AddMeta.sln
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
 | 
			
		||||
Microsoft Visual Studio Solution File, Format Version 12.00
 | 
			
		||||
# Visual Studio 15
 | 
			
		||||
VisualStudioVersion = 15.0.26430.14
 | 
			
		||||
MinimumVisualStudioVersion = 10.0.40219.1
 | 
			
		||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "05-AddMeta", "05-AddMeta\05-AddMeta.csproj", "{00A533D9-32DC-4A37-A202-322F15614B2F}"
 | 
			
		||||
EndProject
 | 
			
		||||
Global
 | 
			
		||||
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 | 
			
		||||
		Debug|Any CPU = Debug|Any CPU
 | 
			
		||||
		Debug|x64 = Debug|x64
 | 
			
		||||
		Release|Any CPU = Release|Any CPU
 | 
			
		||||
		Release|x64 = Release|x64
 | 
			
		||||
	EndGlobalSection
 | 
			
		||||
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 | 
			
		||||
		{00A533D9-32DC-4A37-A202-322F15614B2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 | 
			
		||||
		{00A533D9-32DC-4A37-A202-322F15614B2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
			
		||||
		{00A533D9-32DC-4A37-A202-322F15614B2F}.Debug|x64.ActiveCfg = Debug|x64
 | 
			
		||||
		{00A533D9-32DC-4A37-A202-322F15614B2F}.Debug|x64.Build.0 = Debug|x64
 | 
			
		||||
		{00A533D9-32DC-4A37-A202-322F15614B2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
			
		||||
		{00A533D9-32DC-4A37-A202-322F15614B2F}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
			
		||||
		{00A533D9-32DC-4A37-A202-322F15614B2F}.Release|x64.ActiveCfg = Release|x64
 | 
			
		||||
		{00A533D9-32DC-4A37-A202-322F15614B2F}.Release|x64.Build.0 = Release|x64
 | 
			
		||||
	EndGlobalSection
 | 
			
		||||
	GlobalSection(SolutionProperties) = preSolution
 | 
			
		||||
		HideSolutionNode = FALSE
 | 
			
		||||
	EndGlobalSection
 | 
			
		||||
EndGlobal
 | 
			
		||||
							
								
								
									
										72
									
								
								C# Projects/05-AddMeta/05-AddMeta/05-AddMeta.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								C# Projects/05-AddMeta/05-AddMeta/05-AddMeta.csproj
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<Project ToolsVersion="15.0" 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>{00A533D9-32DC-4A37-A202-322F15614B2F}</ProjectGuid>
 | 
			
		||||
    <OutputType>Exe</OutputType>
 | 
			
		||||
    <RootNamespace>_05_AddMeta</RootNamespace>
 | 
			
		||||
    <AssemblyName>05-AddMeta</AssemblyName>
 | 
			
		||||
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
 | 
			
		||||
    <FileAlignment>512</FileAlignment>
 | 
			
		||||
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
 | 
			
		||||
    <PlatformTarget>AnyCPU</PlatformTarget>
 | 
			
		||||
    <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' ">
 | 
			
		||||
    <PlatformTarget>AnyCPU</PlatformTarget>
 | 
			
		||||
    <DebugType>pdbonly</DebugType>
 | 
			
		||||
    <Optimize>true</Optimize>
 | 
			
		||||
    <OutputPath>bin\Release\</OutputPath>
 | 
			
		||||
    <DefineConstants>TRACE</DefineConstants>
 | 
			
		||||
    <ErrorReport>prompt</ErrorReport>
 | 
			
		||||
    <WarningLevel>4</WarningLevel>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
 | 
			
		||||
    <DebugSymbols>true</DebugSymbols>
 | 
			
		||||
    <OutputPath>bin\x64\Debug\</OutputPath>
 | 
			
		||||
    <DefineConstants>DEBUG;TRACE</DefineConstants>
 | 
			
		||||
    <DebugType>full</DebugType>
 | 
			
		||||
    <PlatformTarget>x64</PlatformTarget>
 | 
			
		||||
    <ErrorReport>prompt</ErrorReport>
 | 
			
		||||
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
 | 
			
		||||
    <Prefer32Bit>true</Prefer32Bit>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
 | 
			
		||||
    <OutputPath>bin\x64\Release\</OutputPath>
 | 
			
		||||
    <DefineConstants>TRACE</DefineConstants>
 | 
			
		||||
    <Optimize>true</Optimize>
 | 
			
		||||
    <DebugType>pdbonly</DebugType>
 | 
			
		||||
    <PlatformTarget>x64</PlatformTarget>
 | 
			
		||||
    <ErrorReport>prompt</ErrorReport>
 | 
			
		||||
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
 | 
			
		||||
    <Prefer32Bit>true</Prefer32Bit>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Reference Include="System" />
 | 
			
		||||
    <Reference Include="System.Core" />
 | 
			
		||||
    <Reference Include="System.Xml.Linq" />
 | 
			
		||||
    <Reference Include="System.Data.DataSetExtensions" />
 | 
			
		||||
    <Reference Include="Microsoft.CSharp" />
 | 
			
		||||
    <Reference Include="System.Data" />
 | 
			
		||||
    <Reference Include="System.Net.Http" />
 | 
			
		||||
    <Reference Include="System.Xml" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Compile Include="Program.cs" />
 | 
			
		||||
    <Compile Include="Properties\AssemblyInfo.cs" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <None Include="App.config" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 | 
			
		||||
</Project>
 | 
			
		||||
							
								
								
									
										6
									
								
								C# Projects/05-AddMeta/05-AddMeta/App.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								C# Projects/05-AddMeta/05-AddMeta/App.config
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8" ?>
 | 
			
		||||
<configuration>
 | 
			
		||||
    <startup> 
 | 
			
		||||
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
 | 
			
		||||
    </startup>
 | 
			
		||||
</configuration>
 | 
			
		||||
							
								
								
									
										306
									
								
								C# Projects/05-AddMeta/05-AddMeta/Program.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										306
									
								
								C# Projects/05-AddMeta/05-AddMeta/Program.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,306 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace _05_AddMeta
 | 
			
		||||
{
 | 
			
		||||
    class Program
 | 
			
		||||
    {
 | 
			
		||||
        static void Main(string[] args)
 | 
			
		||||
        {
 | 
			
		||||
            if (args.Length!=0)
 | 
			
		||||
            {
 | 
			
		||||
                foreach(string s in args)
 | 
			
		||||
                {
 | 
			
		||||
                    string text = "Copyright (c) 2017 Retro-Commodore.eu pdf creating help utility" + Environment.NewLine;
 | 
			
		||||
                    switch (s)
 | 
			
		||||
                    {
 | 
			
		||||
                        case "-help":
 | 
			
		||||
                            text += "-help Help text";
 | 
			
		||||
                            break;
 | 
			
		||||
                        case "-v":
 | 
			
		||||
                            text += "Version 0.01" + Environment.NewLine;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case "-meta":
 | 
			
		||||
                            add_meta_to_pdfs();
 | 
			
		||||
                            break;
 | 
			
		||||
                        case "-extract":
 | 
			
		||||
                            extract_pages_from_pdfs();
 | 
			
		||||
                            break;
 | 
			
		||||
                        case "-g4compress":
 | 
			
		||||
                            g4compress();
 | 
			
		||||
                            break;
 | 
			
		||||
                        case "-makepdf":
 | 
			
		||||
                            make_pdfs_in_dirs();
 | 
			
		||||
                            break;
 | 
			
		||||
                        case "-createtorrent":
 | 
			
		||||
                            create_torrent();
 | 
			
		||||
                            break;
 | 
			
		||||
                        default:
 | 
			
		||||
                            break;
 | 
			
		||||
                    }
 | 
			
		||||
                    Console.WriteLine(text);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            extract_pages_from_pdfs();
 | 
			
		||||
            //g4compress();
 | 
			
		||||
           // make_pdfs_in_dirs();
 | 
			
		||||
           //add_meta_to_pdfs();
 | 
			
		||||
            // create_torrent();
 | 
			
		||||
            Console.WriteLine("Jobs done...");
 | 
			
		||||
            Console.ReadKey();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void add_meta_to_file(string filename, string outname)
 | 
			
		||||
        {
 | 
			
		||||
            ProcessStartInfo startInfo = new ProcessStartInfo()
 | 
			
		||||
            {
 | 
			
		||||
                FileName = "pdftk.exe",
 | 
			
		||||
                Arguments = "\"" + filename + "\"" + " update_info G:\\Retro-Work\\metadata.txt output " + "\"" + outname + "\"",
 | 
			
		||||
                UseShellExecute = false,
 | 
			
		||||
                CreateNoWindow = true,
 | 
			
		||||
                RedirectStandardError = true, 
 | 
			
		||||
                RedirectStandardOutput = true
 | 
			
		||||
            };
 | 
			
		||||
            Process p = new Process();
 | 
			
		||||
            //p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
 | 
			
		||||
            p.StartInfo = startInfo;
 | 
			
		||||
            p.Start();
 | 
			
		||||
            //p.BeginOutputReadLine();
 | 
			
		||||
            string output = p.StandardOutput.ReadToEnd();
 | 
			
		||||
            Console.WriteLine(output);
 | 
			
		||||
            string err = p.StandardError.ReadToEnd();
 | 
			
		||||
            Console.WriteLine(err);
 | 
			
		||||
 | 
			
		||||
            p.WaitForExit();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void extract_images_from_pdf(string filename, string outdir)
 | 
			
		||||
        {
 | 
			
		||||
            string fArgument = "-q -dNOPAUSE -r600 -sDEVICE=tiff24nc -sCompression=lzw -sOutputFile=\"" + outdir + "\\_%04d.tif\" \"" + filename + "\" -c quit";
 | 
			
		||||
            ProcessStartInfo startInfo = new ProcessStartInfo()
 | 
			
		||||
            {
 | 
			
		||||
                FileName = "c:\\Program Files\\gs\\gs9.27\\bin\\gswin64c.exe",
 | 
			
		||||
                Arguments = fArgument,
 | 
			
		||||
                UseShellExecute = false,
 | 
			
		||||
                CreateNoWindow = true,
 | 
			
		||||
                RedirectStandardError = true,
 | 
			
		||||
                RedirectStandardOutput = true
 | 
			
		||||
            };
 | 
			
		||||
            Process p = new Process();
 | 
			
		||||
            //p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
 | 
			
		||||
            p.StartInfo = startInfo;
 | 
			
		||||
            p.Start();
 | 
			
		||||
            //p.BeginOutputReadLine();
 | 
			
		||||
            string output = p.StandardOutput.ReadToEnd();
 | 
			
		||||
            Console.WriteLine(output);
 | 
			
		||||
            string err = p.StandardError.ReadToEnd();
 | 
			
		||||
            Console.WriteLine(err);
 | 
			
		||||
 | 
			
		||||
            p.WaitForExit();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        static void add_meta_to_pdfs()
 | 
			
		||||
        {
 | 
			
		||||
            //var files = Directory.EnumerateFiles("C:\\path", "*.*", SearchOption.AllDirectories)
 | 
			
		||||
            // .Where(s => s.EndsWith(".mp3") || s.EndsWith(".jpg"));
 | 
			
		||||
            string[] files = Directory.GetFiles("G:\\Retro-Work\\Manual\\New folder\\", "*_recognized.pdf");
 | 
			
		||||
 | 
			
		||||
            Parallel.ForEach(files, (file) =>
 | 
			
		||||
                            {
 | 
			
		||||
                                string outFileName = Path.GetFileNameWithoutExtension(file.Replace("_recognized", ""));
 | 
			
		||||
                                string outdir = "G:\\Retro-Work\\Manual\\New folder\\ToTorrent\\";
 | 
			
		||||
 | 
			
		||||
                              //  if (!Directory.Exists(outdir + outFileName))
 | 
			
		||||
                               // {
 | 
			
		||||
                                //    DirectoryInfo di = Directory.CreateDirectory(outdir + outFileName);
 | 
			
		||||
                               // }
 | 
			
		||||
 | 
			
		||||
                                add_meta_to_file(file, outdir + outFileName + ".pdf");
 | 
			
		||||
                            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        static void extract_pages_from_pdfs()
 | 
			
		||||
        {
 | 
			
		||||
            string[] files = Directory.GetFiles(@"G:\Retro-Work\Manual\PDF-Extract\", "*.pdf");
 | 
			
		||||
 | 
			
		||||
            Parallel.ForEach(files, (file) =>
 | 
			
		||||
                            {
 | 
			
		||||
                                string outdir = @"G:\Retro-Work\Manual\PDF-Extract\";
 | 
			
		||||
                                string fileName = Path.GetFileNameWithoutExtension(file);
 | 
			
		||||
 | 
			
		||||
                                if (!Directory.Exists(outdir + fileName + "\\"))
 | 
			
		||||
                                {
 | 
			
		||||
                                    DirectoryInfo di = Directory.CreateDirectory(outdir + fileName);
 | 
			
		||||
                                }
 | 
			
		||||
                                extract_images_from_pdf(file, outdir + fileName);
 | 
			
		||||
 | 
			
		||||
                            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        static void g4compress()
 | 
			
		||||
        {
 | 
			
		||||
            string[] dirs = Directory.GetDirectories("G:\\Retro-Work\\Manual\\New folder\\work\\");
 | 
			
		||||
 | 
			
		||||
            foreach(string dir in dirs)
 | 
			
		||||
            {
 | 
			
		||||
                string outdir = dir + "\\g4out";
 | 
			
		||||
 | 
			
		||||
                if (!Directory.Exists(outdir))
 | 
			
		||||
                {
 | 
			
		||||
                    DirectoryInfo di = Directory.CreateDirectory(outdir);
 | 
			
		||||
                }
 | 
			
		||||
                g4compress_files(dir);
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        static void g4compress_files(string dir)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            string[] files = Directory.GetFiles(dir, "*.tif");
 | 
			
		||||
 | 
			
		||||
            Parallel.ForEach(files, (file) =>
 | 
			
		||||
                            {
 | 
			
		||||
                                string filename = Path.GetFileName(file);
 | 
			
		||||
                                string fArgument = "\"" + file + "\"" + " /tifc=4 /convert=\"" + dir + "\\g4out\\" + filename + "\"";
 | 
			
		||||
                                ProcessStartInfo startInfo = new ProcessStartInfo()
 | 
			
		||||
                                {
 | 
			
		||||
                                    FileName = "c:\\Program Files (x86)\\IrfanView\\i_view32.exe",
 | 
			
		||||
                                    Arguments = fArgument,
 | 
			
		||||
                                    UseShellExecute = false,
 | 
			
		||||
                                    CreateNoWindow = true,
 | 
			
		||||
                                    RedirectStandardError = true,
 | 
			
		||||
                                    RedirectStandardOutput = true
 | 
			
		||||
                                };
 | 
			
		||||
                                Process p = new Process();
 | 
			
		||||
                                //p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
 | 
			
		||||
                                p.StartInfo = startInfo;
 | 
			
		||||
                                p.Start();
 | 
			
		||||
                                //p.BeginOutputReadLine();
 | 
			
		||||
                                string output = p.StandardOutput.ReadToEnd();
 | 
			
		||||
                                Console.WriteLine(output);
 | 
			
		||||
                                string err = p.StandardError.ReadToEnd();
 | 
			
		||||
                                Console.WriteLine(err);
 | 
			
		||||
 | 
			
		||||
                                p.WaitForExit();
 | 
			
		||||
                            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        static void make_pdfs_in_dirs()
 | 
			
		||||
        {
 | 
			
		||||
            string[] dirs = Directory.GetDirectories("G:\\Retro-Work\\Manual\\New folder\\work\\");
 | 
			
		||||
 | 
			
		||||
            foreach (string dir in dirs)
 | 
			
		||||
            {
 | 
			
		||||
                string outdir = dir + "\\pdf";
 | 
			
		||||
 | 
			
		||||
                if (!Directory.Exists(outdir))
 | 
			
		||||
                {
 | 
			
		||||
                    DirectoryInfo di = Directory.CreateDirectory(outdir);
 | 
			
		||||
                }
 | 
			
		||||
                make_pdf(dir);
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        static void make_pdf(string dir)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            string[] files = Directory.GetFiles(dir, "*.tif");
 | 
			
		||||
 | 
			
		||||
            Parallel.ForEach(files, (file) =>
 | 
			
		||||
            {
 | 
			
		||||
                string filename = Path.GetFileName(file);
 | 
			
		||||
                string fArgument = "\"" + file + "\" " + "\"" + dir + "\\pdf\\" + filename + ".pdf\"";
 | 
			
		||||
                ProcessStartInfo startInfo = new ProcessStartInfo()
 | 
			
		||||
                {
 | 
			
		||||
                    FileName = "C:\\Program Files\\ImageMagick-6.9.3-Q16\\convert.exe",
 | 
			
		||||
                    Arguments = fArgument,
 | 
			
		||||
                    UseShellExecute = false,
 | 
			
		||||
                    CreateNoWindow = true,
 | 
			
		||||
                    RedirectStandardError = true,
 | 
			
		||||
                    RedirectStandardOutput = true
 | 
			
		||||
                };
 | 
			
		||||
                Process p = new Process();
 | 
			
		||||
                p.StartInfo = startInfo;
 | 
			
		||||
                p.Start();
 | 
			
		||||
                string output = p.StandardOutput.ReadToEnd();
 | 
			
		||||
                Console.WriteLine(output);
 | 
			
		||||
                string err = p.StandardError.ReadToEnd();
 | 
			
		||||
                Console.WriteLine(err);
 | 
			
		||||
 | 
			
		||||
                p.WaitForExit();
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            string fileName = Path.GetFileName(dir);
 | 
			
		||||
            string fArgumentPDF = "\"" + dir + "\\pdf\\*.pdf\" G:\\Retro-Work\\brought_to_you_by_[TABLET].pdf cat output \"" + dir + "\\..\\" + fileName + ".pdf\"";
 | 
			
		||||
            ProcessStartInfo startInfo2 = new ProcessStartInfo()
 | 
			
		||||
            {
 | 
			
		||||
                FileName = "C:\\Program Files (x86)\\PDFtk Server\\bin\\pdftk.exe",
 | 
			
		||||
                Arguments = fArgumentPDF,
 | 
			
		||||
                UseShellExecute = false,
 | 
			
		||||
                CreateNoWindow = true,
 | 
			
		||||
                RedirectStandardError = true,
 | 
			
		||||
                RedirectStandardOutput = true
 | 
			
		||||
            };
 | 
			
		||||
            Process p2 = new Process();
 | 
			
		||||
            //p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
 | 
			
		||||
            p2.StartInfo = startInfo2;
 | 
			
		||||
            p2.Start();
 | 
			
		||||
            //p.BeginOutputReadLine();
 | 
			
		||||
            string output2 = p2.StandardOutput.ReadToEnd();
 | 
			
		||||
            Console.WriteLine(output2);
 | 
			
		||||
            string err2 = p2.StandardError.ReadToEnd();
 | 
			
		||||
            Console.WriteLine(err2);
 | 
			
		||||
 | 
			
		||||
            p2.WaitForExit();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        static void create_torrent(string dir = "G:\\Retro-Work\\Manual\\New folder\\ToTorrent")
 | 
			
		||||
        {
 | 
			
		||||
            string comment = "\"From the archives of http://retro-commodore.eu\"";
 | 
			
		||||
            string[] files = Directory.GetDirectories(dir);
 | 
			
		||||
 | 
			
		||||
            Parallel.ForEach(files, (file) =>
 | 
			
		||||
            {
 | 
			
		||||
                string fileName = Path.GetFileNameWithoutExtension(file);
 | 
			
		||||
                string fArgument = "-p -c " + comment + " -t udp://AmigaCity.xyz:6969 -o \"" + dir + "\\" + fileName + ".torrent\" \"" + file + "\"";
 | 
			
		||||
                ProcessStartInfo startInfo = new ProcessStartInfo()
 | 
			
		||||
                {
 | 
			
		||||
                    FileName = "C:\\Program Files\\Transmission\\transmission-create.exe",
 | 
			
		||||
                    Arguments = fArgument,
 | 
			
		||||
                    UseShellExecute = false,
 | 
			
		||||
                    CreateNoWindow = true,
 | 
			
		||||
                    RedirectStandardError = true,
 | 
			
		||||
                    RedirectStandardOutput = true
 | 
			
		||||
                };
 | 
			
		||||
                Process p = new Process();
 | 
			
		||||
                //p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
 | 
			
		||||
                p.StartInfo = startInfo;
 | 
			
		||||
                p.Start();
 | 
			
		||||
                //p.BeginOutputReadLine();
 | 
			
		||||
                string output = p.StandardOutput.ReadToEnd();
 | 
			
		||||
                Console.WriteLine(output);
 | 
			
		||||
                string err = p.StandardError.ReadToEnd();
 | 
			
		||||
                Console.WriteLine(err);
 | 
			
		||||
 | 
			
		||||
                p.WaitForExit();
 | 
			
		||||
 | 
			
		||||
                File.AppendAllText(file + ".txt", Environment.NewLine + "torrent: " + fileName + ".torrent" + Environment.NewLine);
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										36
									
								
								C# Projects/05-AddMeta/05-AddMeta/Properties/AssemblyInfo.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								C# Projects/05-AddMeta/05-AddMeta/Properties/AssemblyInfo.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using System.Runtime.CompilerServices;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
// General Information about an assembly is controlled through the following
 | 
			
		||||
// set of attributes. Change these attribute values to modify the information
 | 
			
		||||
// associated with an assembly.
 | 
			
		||||
[assembly: AssemblyTitle("05-AddMeta")]
 | 
			
		||||
[assembly: AssemblyDescription("")]
 | 
			
		||||
[assembly: AssemblyConfiguration("")]
 | 
			
		||||
[assembly: AssemblyCompany("")]
 | 
			
		||||
[assembly: AssemblyProduct("05-AddMeta")]
 | 
			
		||||
[assembly: AssemblyCopyright("Copyright ©  2017")]
 | 
			
		||||
[assembly: AssemblyTrademark("")]
 | 
			
		||||
[assembly: AssemblyCulture("")]
 | 
			
		||||
 | 
			
		||||
// Setting ComVisible to false makes the types in this assembly not visible
 | 
			
		||||
// to COM components.  If you need to access a type in this assembly from
 | 
			
		||||
// COM, set the ComVisible attribute to true on that type.
 | 
			
		||||
[assembly: ComVisible(false)]
 | 
			
		||||
 | 
			
		||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
 | 
			
		||||
[assembly: Guid("00a533d9-32dc-4a37-a202-322f15614b2f")]
 | 
			
		||||
 | 
			
		||||
// Version information for an assembly consists of the following four values:
 | 
			
		||||
//
 | 
			
		||||
//      Major Version
 | 
			
		||||
//      Minor Version
 | 
			
		||||
//      Build Number
 | 
			
		||||
//      Revision
 | 
			
		||||
//
 | 
			
		||||
// You can specify all the values or you can default the Build and Revision Numbers
 | 
			
		||||
// by using the '*' as shown below:
 | 
			
		||||
// [assembly: AssemblyVersion("1.0.*")]
 | 
			
		||||
[assembly: AssemblyVersion("1.0.0.0")]
 | 
			
		||||
[assembly: AssemblyFileVersion("1.0.0.0")]
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/05-AddMeta/bin/x64/Debug/05-AddMeta.exe
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/05-AddMeta/bin/x64/Debug/05-AddMeta.exe
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8" ?>
 | 
			
		||||
<configuration>
 | 
			
		||||
    <startup> 
 | 
			
		||||
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
 | 
			
		||||
    </startup>
 | 
			
		||||
</configuration>
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/05-AddMeta/bin/x64/Debug/05-AddMeta.pdb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/05-AddMeta/bin/x64/Debug/05-AddMeta.pdb
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
// <autogenerated />
 | 
			
		||||
using System;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5.2", FrameworkDisplayName = ".NET Framework 4.5.2")]
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
e38c97fec5c79956b4cc71ae4769b605a35df62e
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
D:\CloudDrives\NextCloud\Projects\Code\05-AddMeta\05-AddMeta\bin\x64\Debug\05-AddMeta.exe.config
 | 
			
		||||
D:\CloudDrives\NextCloud\Projects\Code\05-AddMeta\05-AddMeta\bin\x64\Debug\05-AddMeta.exe
 | 
			
		||||
D:\CloudDrives\NextCloud\Projects\Code\05-AddMeta\05-AddMeta\bin\x64\Debug\05-AddMeta.pdb
 | 
			
		||||
D:\CloudDrives\NextCloud\Projects\Code\05-AddMeta\05-AddMeta\obj\x64\Debug\05-AddMeta.csproj.AssemblyReference.cache
 | 
			
		||||
D:\CloudDrives\NextCloud\Projects\Code\05-AddMeta\05-AddMeta\obj\x64\Debug\05-AddMeta.csproj.CoreCompileInputs.cache
 | 
			
		||||
D:\CloudDrives\NextCloud\Projects\Code\05-AddMeta\05-AddMeta\obj\x64\Debug\05-AddMeta.exe
 | 
			
		||||
D:\CloudDrives\NextCloud\Projects\Code\05-AddMeta\05-AddMeta\obj\x64\Debug\05-AddMeta.pdb
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/05-AddMeta/obj/x64/Debug/05-AddMeta.exe
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/05-AddMeta/obj/x64/Debug/05-AddMeta.exe
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/05-AddMeta/obj/x64/Debug/05-AddMeta.pdb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								C# Projects/05-AddMeta/05-AddMeta/obj/x64/Debug/05-AddMeta.pdb
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user