Skip to content

Commit

Permalink
Add copy/paste translate - thx LeonCheung :)
Browse files Browse the repository at this point in the history
  • Loading branch information
niksedk committed Jan 6, 2019
1 parent 8fff223 commit 067c75e
Show file tree
Hide file tree
Showing 43 changed files with 5,692 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CopyPasteTranslate/DLL/App.config
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>
132 changes: 132 additions & 0 deletions CopyPasteTranslate/DLL/CopyPasteTranslate.csproj
@@ -0,0 +1,132 @@
<?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>{8B75158E-A6DD-46BB-9030-BF84C80BF7CC}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>CopyPasteTranslate</RootNamespace>
<AssemblyName>CopyPasteTranslate</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</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>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Design" />
<Reference Include="System.Web" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="IPlugin.cs" />
<Compile Include="Logic\Configuration.cs" />
<Compile Include="Logic\Formatting.cs" />
<Compile Include="Logic\HtmlUtil.cs" />
<Compile Include="Logic\Json.cs" />
<Compile Include="Logic\LanguageAutoDetect.cs" />
<Compile Include="Logic\Paragraph.cs" />
<Compile Include="Logic\StringExtensions.cs" />
<Compile Include="Logic\SubRip.cs" />
<Compile Include="Logic\Subtitle.cs" />
<Compile Include="Logic\SubtitleFormat.cs" />
<Compile Include="Logic\TimeCode.cs" />
<Compile Include="Logic\TinyJsonParser.cs" />
<Compile Include="Logic\Utilities.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Plugin.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TranslateBlock.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="TranslateBlock.Designer.cs">
<DependentUpon>TranslateBlock.cs</DependentUpon>
</Compile>
<Compile Include="Translator\CopyBlock.cs" />
<Compile Include="Translator\CopyPasteTranslator.cs" />
<Compile Include="Translator\Formatting.cs" />
<Compile Include="Translator\ITranslator.cs" />
<Compile Include="Translator\TranslationHelper.cs" />
<Compile Include="Translator\TranslationPair.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="TranslateBlock.resx">
<DependentUpon>TranslateBlock.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
93 changes: 93 additions & 0 deletions CopyPasteTranslate/DLL/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions CopyPasteTranslate/DLL/Form1.cs
@@ -0,0 +1,53 @@
using System;
using System.Linq;
using System.Windows.Forms;
using WebViewTranslate.Logic;

namespace WebViewTranslate
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
using (var form = new MainForm(new Subtitle { Paragraphs =
{
new Paragraph("<i>Previously on</i>\r\nRiverdale...",0,0),
new Paragraph("I'm Fine?",0,0),
new Paragraph("How nice of you to join us today" + Environment.NewLine +
"so we all can work on the project together",0,0),
new Paragraph("Tuesday",0,0),
new Paragraph("Wedensday",0,0),
new Paragraph("Thursday",0,0),
new Paragraph("Friday",0,0),
new Paragraph("Godbye.",0,0),
}
}, "test", "descr", this))
{
form.ShowDialog(this);
}
}

private void button2_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
{
var sub = new Subtitle();
new SubRip().LoadSubtitle(sub, System.IO.File.ReadAllLines(openFileDialog1.FileName).ToList(), null);
using (var form = new MainForm(sub, "test", "descr", this))
{
form.ShowDialog(this);
}
}
}

private void openFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
{

}
}
}

0 comments on commit 067c75e

Please sign in to comment.