首页 > 其他分享 >使用open live write发布的博客

使用open live write发布的博客

时间:2022-12-30 11:06:11浏览次数:58  
标签:CNs OLW dll write live ._ OpenLiveWriter open WindowsLiveWriter

官方教程的FAQ:

包含了几个工具 可以都看看

--------------------------------------------------------------------------------

1、OpenLiveWriter安装

     Windows Live Writer在2012年就停止了更新,Open Live Writer(以下简称OLW)是由Windows Live WriterWriter更名而来,是由微软推出的一款能够免费使用的博客写作软件,主要为用户提供博客在线撰写和编辑功能,相比Windows Live Writer,OLW首个版本仍然缺少一些功能,不过团队已经制订了更新路线图,一些新功能会陆续推出。相信以后他将是一个写博客的好利器。

    但从github源代码(​​https://github.com/OpenLiveWriter/OpenLiveWriter​​)来看,已经有9个月未更新了,而官网更是未见一个插件,“钱途”堪忧呀。

    官网地址:​​http://openlivewriter.org/​​​ 点击download下载:​​https://openlivewriter.azureedge.net/stable/Releases/OpenLiveWriterSetup.exe​

​​使用open live write发布的博客_Code​​

​​使用open live write发布的博客_Windows_02​​(界面血漂亮)

   默认安装到C:\Users\用户\AppData\Local\OpenLiveWriter目录,结构如下:

​​使用open live write发布的博客_Code_03​​、

    标红色的是OLW的主程序:

​​使用open live write发布的博客_Code_04​​

    双击OpenLiveWriter.exe即可打开OLW编辑器:

​​使用open live write发布的博客_Windows_05​​

    作为一个开发人员,对代码进行着色是不可缺少的,如何在OLW下实现插入代码并着色呢?

2、如何实现代码着色

   前奏:从的官网获取,在windows live writer下,可用WindowsLiveWriter.CNs.CodeHighlighter进行代码着色,是有有效的

   实验:将WindowsLiveWriter.CNs.CodeHighlighter.dll插件放到C:\Users\用户\AppData\Local\OpenLiveWriter\app-0.6.0.0\Plugins目录下,启动并未有见插件

​​使用open live write发布的博客_Windows_06​​

    分析:通过调试OLW的源码代码调试,加载插件出现异常;通过ILSpy分析WindowsLiveWriter.CNs.CodeHighlighter.dll,如下图

​​使用open live write发布的博客_Windows_07​​

   WindowsLiveWriter.CNs.CodeHighlighter.dll引用WindowsLive.Writer.Api,与现有OLW的新接口OpenLiveWriter.Api不匹配。

   解决方案一:反编译WindowsLiveWriter.CNs.CodeHighlighter.dll修改引用类库,将WindowsLive.Writer.Api.dll更改为OpenLiveWriter.Api.dll,不建议使用本方法。

   解决方案二:由于是从Windows Live Writer Source Code plugin for SyntaxHighlighter(​​http://sourcecodeplugin.codeplex.com/​​)进行优化而来,可以从本开源项目进行优化。

   封装编译之后的dll为:OpenLiveWriter.CNs.SourceCode.dll,下载地址为:​​OpenLiveWriter.CNs.SourceCode.zip​​

   插件安装之后:

​​使用open live write发布的博客_Code_08​​

​​使用open live write发布的博客_Code_09​​

3、代码着色项目下载
3.1 项目下载

   (1)原始项目下载地址:​​http://sourcecodeplugin.codeplex.com/SourceControl/latest​

​​使用open live write发布的博客_Code_10​​

    点击“download”下载,只需按照3.2修订WindowsLiveWriter.SourceCode项目编译。

   (2)修改后的项目可从github下载:

​https://github.com/zsy619/OpenLiveWriter.SourceCode​​,下载编辑即可使用。

3.2 编译配置

   (1)修改类库引用,WindowsLive.Writer.Api.dll更改为OpenLiveWriter.Api.dll(可以从OLW安装的目录下找到)

   (2)修改输出地址:

​​使用open live write发布的博客_Windows_11​​

    OpenLiveWriter.CNs.SourceCode类库输出地址:copy "$(TargetPath)" "C:\Users\xxtt\AppData\Local\OpenLiveWriter\app-0.6.0.0\Plugins"

   (3)CodeForm窗体代码修订

    修改Code属性:

public string Code
{
get
{
return this._code;
}
set
{
this._code = value;
}
}

   新增博的远程代码着色方法(可参考WindowsLiveWriter.CNs.CodeHighlighter.dll):

private string RemoteCodeHighlight()
{
string requestUriString = "";
HttpWebRequest httpWebRequest = WebRequest.Create(requestUriString) as HttpWebRequest;
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
string value = string.Format("language={0}&code={1}", HttpUtility.UrlEncode(this.comboBrush.Text.Trim()), HttpUtility.UrlEncode(this.textCode.Text.Trim()));
using (StreamWriter streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
streamWriter.Write(value);
}
string result;
using (WebResponse response = httpWebRequest.GetResponse())
{
using (StreamReader streamReader = new StreamReader(response.GetResponseStream()))
{
result = streamReader.ReadToEnd();
}
}
return result;
}

    修改buttonOK_Click方法:

private void buttonOK_Click(object sender, EventArgs e)
{
this._configDb.Config.Brush = this.comboBrush.Text;
this._configDb.Config.MainFormX = base.Left;
this._configDb.Config.MainFormY = base.Top;
this._configDb.Config.MainFormWidth = base.Width;
this._configDb.Config.MainFormHeight = base.Height;
this._configDb.SavePluginConfigurationData();
try
{
this._code = this.RemoteCodeHighlight();
}
catch (Exception exception)
{
MessageBox.Show(exception.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
base.DialogResult = DialogResult.OK;
base.Close();
}
3.3 使用效果

    C#代码展示如上​​接口还不支持go语言,有点遗憾,期待更新!

为人:谦逊、激情、博学、审问、慎思、明辨、 笃行
学问:纸上得来终觉浅,绝知此事要躬行
为事:工欲善其事,必先利其器。
态度:道阻且长,行则将至;行而不辍,未来可期
.....................................................................
------- 换了个头像,静静的想,默默的思恋,一丝淡淡的忧伤 ----------
------- 桃之夭夭,灼灼其华。之子于归,宜其室家。 ---------------
------- 桃之夭夭,有蕡其实。之子于归,宜其家室。 ---------------
------- 桃之夭夭,其叶蓁蓁。之子于归,宜其家人。 ---------------
=====================================================================
转载请标注出处!



标签:CNs,OLW,dll,write,live,._,OpenLiveWriter,open,WindowsLiveWriter
From: https://blog.51cto.com/ios9/5979235

相关文章

  • Ubuntu18.04安装opencv和opencv_contrib1.undefined reference to `TIFFReadDirectory
    Ubuntu18.04安装opencv和opencv_contrib目录​​Ubuntu18.04安装opencv和opencv_contrib​​​​1.版本​​​​2.源码编译和安装opencv和opencv_contrib​​​​(1)下载o......
  • layer.open(常用)
    layer.open(常用)迷迭绿于2022-04-0813:38:49发布12797收藏15分类专栏:前端UI框架--layui文章标签:layui前端前端框架版权华为云开发者联盟该内容已......
  • 基于OpenHarmony的智联北斗海防系统
    本项目由黎明职业大学唐源、李辉、魏依平同学完成,作品获得福建省首届开发者大赛三等奖,感谢王国栋老师倾情供稿!1、项目背景      深耕蓝色国土,经略蓝色海洋,必须以......
  • OpenCV 4.5.3发布,快来看看哦!!
    本次发布亮点Highgui:增加了对多个highgui后端的支持;Videoio:使用FFmpeg实现硬件加速编码解码;Video:DaSiamRPN跟踪器使用OpenCV算法实现;DNN模块:支持OpenVINO2021.4发布的DNN......
  • window.open用法详解
    window.open用法详解夕山雨于2020-08-0917:44:52发布49906收藏111分类专栏:js基础文章标签:window.open版权华为云开发者联盟该内容已被华为云开发者联......
  • 启动Java项目报错Problematic frame:Failed to write core dump. Minidumps are not e
    ❗Problematicframe:有问题的框架✔fastjson空指针不能正确抛空指针异常,换成fastjson2即可。AfatalerrorhasbeendetectedbytheJavaRuntimeEnvironment:EXC......
  • OpenHarmony应用开发[1]-入门
    目标系统环境系统:HarmonyOS3.0.0(API8)架构:ARM64核心:Cortex-A76核,Cortex-A55核开发环境DevEcoStudio3.0ReleaseArkUI和eTS开发范式OpenHarmony为应用开......
  • SARscape中Opencl安装说明
     1、介绍SARscape逐步采用通用图像处理器(GPGPU)技术,通过提高并行度来提高处理性能。我们的解决方案基于开放计算语言(OpenCL)框架,这是一个被大多数硬件制造商和软件开发人......
  • 自动化定位元素-图像识别获取元素位置:opencv 模板匹配
    背景没有背景我想在当前图片上找到某一块图片(称为模板),然后再根据坐标点击操作模板图片:我期望在下面图片上找到他:opencv模板匹配上代码:importcv2ascvfrommat......
  • OpenCV自学笔记13. 训练自己的分类器
    训练自己的分类器本小节使用的图片为:最近在项目中遇到了一个问题,需要识别图像中的红色圆形。Hough变换的效果还可以,但是存在计算量大等问题,因此,还需要一种更为准确的方法,识......