2012年2月14日星期二

如何把寫好的 Windows Live Writer plugin包裝成安裝檔 (How to package your Windows Live writer plugin?)

由於要修改去年寫給自己用的小工具 (WLWPlurk),看到其他在Codeplex上面的人都是用WIX(Windows Installer XML)來做包裝plugin的動作。

所以也去好好的搜尋一下有沒有相關可以用的東西。 由於我自己也不是專業在做Installer的人~ 裡面的一些設定也真的把我搞糊塗,才了解前因後果。還好找到了相關的文件WiX Script for installing Live Writer Plugins,雖然他上面的sample是針對 WIX 2.0,不過我也把它修改過後分享給大家。

希望有需要的人就拿去用吧。

  1. Install WIX 3.6 from http://wix.sourceforge.net/downloadv3.html
  2. Setup your path setting to your install path.
  3. Inser follow code (it should be XXX.WXS)
  4. You might need repace follow string as follows:
    1. {$Plugin Name$} : your plugin name
    2. {$InstallGUID$}: A GUID for your installation program
    3. {$Manufacturer$}: Manufacturer name
    4. {$PluginGUID$}: A GUID for your plugin
    5. {$Description$}: A description for your plugin
    6. {$FILE_ID$}: ID for your binary which need install. (could be multiple file)
    7. {$FILE_NAME$}: Name for your binary which need install. (could be multiple file)
    8. {$FILE_Address$}: File address for your binary which need install. (could be multiple file)
  5. Compiler your WIX source code
    1. candle XXX.wxs
    2. light -ext WixUIExtension XXX.wixobj

WLWPlurk 2.0 installer release

這幾天弄了好久~ 好不容易把Windows Installer XML (WIX) 3.6給搞懂。
等等寫另外一篇來記錄詳細資料,在這裡先請有需要安裝檔的去下載吧。

http://wlwplurk.codeplex.com/releases/52834/download/342411

有任何需要改進的麻煩留言告訴我!!

2012年2月13日星期一

WLWPlurk 第二版發布

欠了好久~ 總算一口氣把它寫完:
請到這裡下載:  http://wlwplurk.codeplex.com/
1. Upgrade code with VS2010.
2. Add login page for change account. Using registry to save your login information.
WLWPlurk_1.jpg
3. Add post content page to let you modify your plurk before post it.
WLWPlurk_2.jpg

How to use it:
Just download this binary, extract it and put on your Windows Live Writer plugin folder such as C:\Program Files\Windows Live\Writer\Plugins


This project implement base on two major component:
1. Json.net (http://json.codeplex.com/)
2. NPlurk (http://nplurk.codeplex.com/)
You need plurk API key from http://www.plurk.com/API/ to use this source code.

2010年9月27日星期一

Get tinyURL from your C# code

最近在Implement的時候,發現NPlurk能傳送的字串似乎比直接再plurk上面打的字串還少上許多(大概少上10~15個字元),看起來去使用TinyURL在code裡面也是勢在必行的。

2010年9月24日星期五

WLWPlurk 第一版發布

摘要: 這是在Window Live Writer上面發布plurk的一個plugin.

雖然是最簡單的code,但是還是決定發布出來。有需要的人可以到codeplex的http://wlwplurk.codeplex.com/ 去下載第一版source code.

P.S.: 我發現我架設codeplex的時間都比我整理出第一版WLWPlurk還要費工夫。

2010年9月22日星期三

WLW Plurk 相關資訊

幾經尋找~總算找到一個好用的plurk API使用軟體。不過在此之前還是有一些事情得先做。

  1. 申請Plurk API Key: 到此去申請一個你自己使用的plurk API key.
  2. NPlurk去下載相關source code吧~ 這個超好用的

測試過後,已經可以正常的把文章發不到Plurk去。算是好用吧(?)

測試結果: http://www.plurk.com/p/7qp2eq 是成功發文。

不過由於login架構尚未完成,現在整個plugin  也只有我自己可以使用。感覺有點弱。還有以下的工作項目需要完成:

不過有人需要我也是可以幫你客制一個先給你用

2010年9月8日星期三

工作日誌2010/09/08: 關於PublishNotificationHook

自從寫完第一個Hello World之後,本來緊接著就打算繼續把PublishNotificationHook放入原來的第一個Hello World之中。

參考網路這篇文章(The New Live Writer SDK)裡面的source code,單純的把code加入之後,就像以下的狀態。

1 using WindowsLive.Writer.Api;
2
3 namespace LiveWriterHelloWorld
4 {
5 [WriterPluginAttribute
6 ("2f437bf1-fe57-41c8-931a-d20066ea174e", "Hello World!2",
7 PublisherUrl = "http://wlwextensionlearning.blogspot.com/",
8 Description = "Going to 2nd testing code")]
9 [InsertableContentSourceAttribute("Hello World!", SidebarText = "Hello World!")]
10 public class HelloWorldPlugin : ContentSource
11 {
12 public override DialogResult CreateContent(IWin32Window dialogOwner, ref string content)
13 {
14 content = "<b>Hello World!</b>";
15
16 return DialogResult.OK;
17 }
18 }
19 public class PublishNotificationExample : PublishNotificationHook
20 {
21 public override bool OnPrePublish(IWin32Window dialogOwner,
22 IProperties properties, IPublishingContext publishingContext,
23 bool publish)
24 {
25 // Check the post contents to see if liveside appears, if it does, // return true (publish),
26 // if it doesn't, return false (cancel publish)
27 return publishingContext.PostInfo.Contents.ToLower().Contains("liveside");
28 }
29 public override void OnPostPublish(IWin32Window dialogOwner,
30 IProperties properties, IPublishingContext publishingContext,
31 bool publish)
32 {
33 // If this post is a draft (false), don't do anything
34 // if it's an actual publish, then publish = true;
35 if (!publish)
36 return;
37
38 string updateTwitter = string.Format("{0} - {1}",
39 publishingContext.PostInfo.Title,
40 publishingContext.PostInfo.Permalink);
41
42 // Code to update Twitter
43 }
44 }
45 }

編譯完之後,會發現無法收到callback event… 持續探討(The New Live Writer SDK) 的原始碼之後。 發現問題可能出在



1 public class HelloWorldPlugin : ContentSource
2 {
3 public override DialogResult CreateContent(IWin32Window dialogOwner, ref string content)
4 {
5 content = "<b>Hello World!</b>";
6
7 return DialogResult.OK;
8 }
9 }
10
也就是主要是因為有implement ContentSource 的關係,造成無法收到相關的event。  這個主要原因可能有待詳細查看。當你改好並且把DLL 複製好之後你就會在你的blog 的plugin上面查看到。

WLW0908.jpg




以上..