Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dixin committed Feb 19, 2019
1 parent 01fdbc8 commit db21bce
Show file tree
Hide file tree
Showing 37 changed files with 852 additions and 0 deletions.
38 changes: 38 additions & 0 deletions LiveWriter.Live.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.271
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSPaste.WindowsLiveWriter", "VSPaste.WindowsLiveWriter\VSPaste.WindowsLiveWriter.csproj", "{7825FE0B-C646-45D2-9C67-7FBAFD5EB90F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSPaste.OpenLiveWriter", "VSPaste.OpenLiveWriter\VSPaste.OpenLiveWriter.csproj", "{6D032F1A-21D0-47A6-B6BD-860168DCEBF9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F6D51286-6F27-476B-BAFD-2BBF730AE08F}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
appveyor.yml = appveyor.yml
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7825FE0B-C646-45D2-9C67-7FBAFD5EB90F}.Debug|x86.ActiveCfg = Debug|x86
{7825FE0B-C646-45D2-9C67-7FBAFD5EB90F}.Debug|x86.Build.0 = Debug|x86
{7825FE0B-C646-45D2-9C67-7FBAFD5EB90F}.Release|x86.ActiveCfg = Release|x86
{7825FE0B-C646-45D2-9C67-7FBAFD5EB90F}.Release|x86.Build.0 = Release|x86
{6D032F1A-21D0-47A6-B6BD-860168DCEBF9}.Debug|x86.ActiveCfg = Debug|x86
{6D032F1A-21D0-47A6-B6BD-860168DCEBF9}.Debug|x86.Build.0 = Debug|x86
{6D032F1A-21D0-47A6-B6BD-860168DCEBF9}.Release|x86.ActiveCfg = Release|x86
{6D032F1A-21D0-47A6-B6BD-860168DCEBF9}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3FD3EEA3-BFE3-4CB6-89E9-3D6EFDE8CB8D}
EndGlobalSection
EndGlobal
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# LiveWriter.VSPaste

[![Build status](https://ci.appveyor.com/api/projects/status/i51qh09mkvnr5wd3?svg=true)](https://ci.appveyor.com/project/Dixin/livewriter-vspaste)

Port Windows Live Writer plugin "VS Paste" to Open Live Writer.

Many thanks to Douglas Stockwell, the original author of Windows Live Writer plugin "VS Paste", which is very old code. The original download page http://plugins.live.com/writer/detail/paste-from-visual-studio is removed by Microsoft. And the original author's website is also down http://www.11011.net/software/vs2html.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
92 changes: 92 additions & 0 deletions VSPaste.OpenLiveWriter/VSPaste.OpenLiveWriter.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<ProjectType>local</ProjectType>
<ProjectVersion>7.10.377</ProjectVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6D032F1A-21D0-47A6-B6BD-860168DCEBF9}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<AssemblyName>VSPaste.OpenLiveWriter</AssemblyName>
<OutputType>Library</OutputType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;OPEN_LIVE_WRITER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;OPEN_LIVE_WRITER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Reference Include="OpenLiveWriter.Api, Version=0.6.2.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>ReferenceAssemblies\OpenLiveWriter.Api.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<None Include="ReferenceAssemblies\OpenLiveWriter.Api.dll" />
<None Include="ReferenceAssemblies\OpenLiveWriter.BrowserControl.dll" />
<None Include="ReferenceAssemblies\OpenLiveWriter.Controls.dll" />
<None Include="ReferenceAssemblies\OpenLiveWriter.CoreServices.dll" />
<None Include="ReferenceAssemblies\OpenLiveWriter.HtmlParser.dll" />
<None Include="ReferenceAssemblies\OpenLiveWriter.Interop.dll" />
<None Include="ReferenceAssemblies\OpenLiveWriter.Interop.Mshtml.dll" />
<None Include="ReferenceAssemblies\OpenLiveWriter.Interop.SHDocVw.dll" />
<None Include="ReferenceAssemblies\OpenLiveWriter.Localization.dll" />
<None Include="ReferenceAssemblies\OpenLiveWriter.Mshtml.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\VSPaste.WindowsLiveWriter\ColorProcessor.cs">
<Link>ColorProcessor.cs</Link>
</Compile>
<Compile Include="..\VSPaste.WindowsLiveWriter\HTMLRootProcessor.cs">
<Link>HTMLRootProcessor.cs</Link>
</Compile>
<Compile Include="..\VSPaste.WindowsLiveWriter\ProcessorStack.cs">
<Link>ProcessorStack.cs</Link>
</Compile>
<Compile Include="..\VSPaste.WindowsLiveWriter\Properties\AssemblyInfo.cs">
<Link>Properties\AssemblyInfo.cs</Link>
</Compile>
<Compile Include="..\VSPaste.WindowsLiveWriter\RTF\IProcessor.cs">
<Link>RTF\IProcessor.cs</Link>
</Compile>
<Compile Include="..\VSPaste.WindowsLiveWriter\RTF\Parser.cs">
<Link>RTF\Parser.cs</Link>
</Compile>
<Compile Include="..\VSPaste.WindowsLiveWriter\RTF\Scanner.cs">
<Link>RTF\Scanner.cs</Link>
</Compile>
<Compile Include="..\VSPaste.WindowsLiveWriter\VoidProcessor.cs">
<Link>VoidProcessor.cs</Link>
</Compile>
<Compile Include="..\VSPaste.WindowsLiveWriter\VSPaste\VSPaste.cs">
<Link>VSPaste\VSPaste.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="..\VSPaste.WindowsLiveWriter\VSPaste.icon.png">
<Link>VSPaste.icon.png</Link>
</Content>
</ItemGroup>
</Project>
79 changes: 79 additions & 0 deletions VSPaste.WindowsLiveWriter/ColorProcessor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using RTF;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Reflection;

internal class ColorProcessor : IProcessor
{
private List<Color> colors = new List<Color>();
private Color current = Color.Black;
private static Dictionary<int, string> namedColors = new Dictionary<int, string>();

static ColorProcessor()
{
foreach (PropertyInfo info in typeof(Color).GetProperties(BindingFlags.Public | BindingFlags.Static))
{
if (info.PropertyType == typeof(Color))
{
Color color = (Color) info.GetValue(null, null);
namedColors[color.ToArgb()] = info.Name;
}
}
}

public void Close()
{
}

public string CssColor(int i)
{
if ((i >= 0) && (i < this.colors.Count))
{
string str = null;
Color color = this.colors[i];
if (namedColors.TryGetValue(color.ToArgb(), out str) && (str.Length <= 7))
{
return str.ToLower();
}
return string.Format("#{1:x2}{2:x2}{3:x2}", new object[] { i, color.R, color.G, color.B });
}
return "black";
}

public void Open()
{
}

public void Symbol(char symbol)
{
}

public void Text(char c)
{
if (c == ';')
{
this.colors.Add(this.current);
this.current = Color.Black;
}
}

public void Word(string word, int? param)
{
switch (word)
{
case "red":
this.current = Color.FromArgb(param.Value, this.current.G, this.current.B);
break;

case "green":
this.current = Color.FromArgb(this.current.R, param.Value, this.current.B);
break;

case "blue":
this.current = Color.FromArgb(this.current.R, this.current.G, param.Value);
break;
}
}
}

Loading

0 comments on commit db21bce

Please sign in to comment.