After Mini C# Lab ver 1.2, I got several important feedbacks from community, a friend, elleryq, told me that there is a free software Snippet Compiler providing colorful formatting, line number, document outlining, method list dropdown, even Intellisence, almost as luxurious as Visual Studio. Wow! It's really cool.

Compared with Snippet Compiler, Mini C# Lab's code editor is quite weak. The Snippet Compiler integrated ActiPro's SyntaxEditor control to provide friendly editing environment, but this make it fatter (about 3MB, but still not big) and not open-source. If Mini C# Lab can improve its code editor, the mini size (less than 100KB), open-source, and single file features still can distinguish it from such fancy solutions as Snippet Compiler, IMHO.

Another friend, adminjew (AKA Yotzichok), did a splendid job!  The open source code editor, ICSharpCode.TextEditor, was integrated to provide adequate features for C# coding, although no Intellisense and method list, it's good enough for mini coding job.  Except the new code editor, adminjew also add a whole bunch of new features, including undo/redo, a tool bar, splitted window, copy as formatted HTML...

I postponed the release of ver 1.3 for several weeks for dogfooding it by myself.  I was excited about the nice experience of using Mini C# Lab on remote machine via terminal service, download and run!  The best experience is when I had to write and test C# code directly on a Bloomberg terminal, I was not allowed to setup Visual Studio on it because of memory limitation and authorization issue.  My code cause Snippet Compiler failed, so I use Mini C# Lab 1.3 to complete the whole coding and testing, it's totally adequate for the job!

Here are the new features of Mini C# Lab v1.3:

*  Replace RichTextBox+CSharpFormat with ICSharpCode.TextEditor
*  Add toolbar and cut/copy/paste, print, undo, redo, split code box, copy as html functions...
*  Terminate execution by force while exiting
*  Prompt to save modified code before exiting
*  Remember saved file name for latter saving

You can download the v1.3 from CodePlex or from http://www.darkthread.net/MiniCSharpLab/MiniCSharpLab.zip directly.

【中文摘要】

Mini C# Lab 1.2推出後,我收到不少珍貴的回饋。elleryq提到了Snippet Compiler,同樣是即寫即編即跑,但內建的ActiPro SyntaxEditor程式碼編輯器支援Intellisense(是的,他加了洋葱 XD),豪華到讓人感動落淚,跟Mini C# 1.2簡陋到不行的克難程式碼編輯器,簡直是拿XX比XX。

不過,上天的安排真是巧妙,另一位天使出現。來自美國紐約的adminjew咻咻咻地擴充了我的Mini C# Lab,加入一缸子新功能,還包含一個可怕的新東西--ICSharpCode.TextEditor,一個Open Source的程式碼編輯器,雖然不及ActiPro SyntaxEditor豪華,但已經比之前RichTextBox+CSharpFormat土法鍊鋼好上一百倍,剛好補強原本最弱的一環。現在行號有了,也可以即時變換文字顏色,還可以Undo... 酷呆了! 最重要的是,ICSharpCode.TextEditor是Open Source的,這樣Mini C# Lab就可以維持Open Source下去。

adminjew在好幾週前就提出了他的改良,我卻遲推了好幾個星期才釋出新版,理由是我花了幾週吃自己的狗食(dogfooding)後才推出。這段時間,好幾次在Terminal Service到遠端主機時,直接Copy Mini C# Lab過去寫Code測試某些程式跑不起來的問題。而最棒的一次經驗是則是在Bloomberg Terminal上寫整合程式,因為記憶體限制跟未獲機器主人授權的理由,我不可能在上面裝一套Visual Studio,而該程式在Snippet Compiler上執行會出錯,所以我切回Mini C# Lab上,邊寫邊測地把程式寫完。

跟雄偉的Snippet Compiler巨人相比,Mini C# Lab仍具有Open Source、可自行擴充、單一執行檔的優點,但由於缺乏Intellisense,並不適合對語法生疏的情境,算是提供給大家另一個選擇。

整理一下1.3版的新特色:

*  以ICSharpCode.TextEditor取代原本RichTextBox+CSharpFormat
*  加入工具列,支援剪下/複製/貼上、列印、復原(Undo)、分割顯示、複製成HTML等功能
*  程式結束時會強迫停止執行中的程式
*  結束前提示是否要存檔
*  連續多次存檔時會記住前次的存檔檔名


Comments

# by 感動的流眼淚≡

大大,我永遠支持您, 還Open Source,太感動啦! 並羨慕您的英文寫作能力啊!

# by Jeffrey

to 流淚兄, 感謝您的情義相挺! 這個專案是我第一次投身Open Source的處女秀,而這次經驗十分美好! 想想看,你把程式碼丟出去,有人主動跳出來補充原本不知道的替代解決方案,然後素昧平生的美國高手忽然冒出來把你的醜小鴨變成天鵝,這種感覺實在太美妙了! 這種不求報酬,超越國界的社群分享互動,正是我一心嚮往的網路烏托邦... 美極了!

# by Ammon

我有個小想法,可以增加啟動的參數,傳入要執行的cs 例如 : MiniCSLab /run test.cs 如果能將 console 輸出記錄到檔案,並且依照日期分開就更完美了! 例如: MiniCSLab /run test.cs /log:C:\testlog\ 主要是想拿來當類似 vbs 的方式排程使用 :p (雖然這專案放在CodePlex, 但不大會用........)

# by Jeffrey

to Ammon, 如您提的需求,我多半會寫成Console EXE,不過加/run與/log的方式並不會更動程式的主要運作,而單純只是增加程式應用的方法,我會將此點收納起來,下次換版時加入。感謝建議!

# by 413x

太讚了~~~爽啦!!

# by Leo

感謝前輩無私的分享 ^^ 單獨 NET2.0 的程式檢查時我都用您的軟體看,不過 NET 1.1 我就用 SnippetCompiler 。 然後,我有個關於 SnippetCompiler 的問題很困擾啊... 為什麼我用他開啟現有專案的 vb 檔,裡面的中文都變亂碼呢?有解決方法嗎?感謝 ^^

# by Ammon

太感謝了 因為有時用vbs有些事情做不到,用c#寫很快,但寫成 console exe 每次修改都要 compile 再發佈覺得挺麻煩的,要是有了這個會方便很多 ;)

# by Jeffrey

to Leo, 我猜應該是因為你現有專案的VB檔是存成BIG5編碼吧? 用Notepad開啟,另存成UTF-8後再試試,看看問題是否解除?

# by Leo

已解決,感謝大大 ^^

# by Can

不過... 我用Snippet Compiler並沒出現Intellisense耶.....

# by karron

如果能够增加Add reference功能就更好了, 我使用Mini C# Lab执行简单的Linq操作, 发现会报错. Compilation Errors: Line: 18 Column 27 - Could not find an implementation of the query pattern for source type 'int[]'. 'Where' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'? 还有, 增加 Comment & UnComment 功能也是很重要的. 这个小小的工具我很喜欢, 之前一直用Snippet Compiler, 可惜对framework 3.5 支持不佳. 谢谢.

# by Jeffrey

to Karron, Mini C# Lab是可以自訂Reference的,你可參考http://blog.darkthread.net/blogs/darkthreadtw/archive/2008/05/30/mini-c-lab-ver-1-1.aspx的範例,可以用//REFDLL System.Windows.Forms亮出MessageBox,也可以跑Linq,細節可以參考ver 1.1那篇文章。 如果要玩Linq,有另一個不錯的選擇: LinqPad: http://www.linqpad.net/。

# by wei

似乎不能下載@@?

# by Jeffrey

to wei, 謝謝指正,URL的Sharp少了一個p,已訂正。(雖然貼文前都會重新檢查過一次,發現我的文章錯字率還挺高的,汗顏)

# by Sam

在客戶的主機上做測試真的很方便! 但內容為: using System; using System.Data; using System.Text; using System.Data.OleDb; using System.IO; 的時候會出現: Compilation Errors: Line: 2 Column 14 - 命名空間 'System' 中沒有型別或命名空間名稱 'Data' (您是否遺漏了組件參考?) Line: 4 Column 14 - 命名空間 'System' 中沒有型別或命名空間名稱 'Data' (您是否遺漏了組件參考?) Line: 69 Column 23 - 找不到型別或命名空間名稱 'DataSet' (您是否遺漏 using 指示詞或組件參考?) 請問該如何加入組件的參考呢?

# by Sam

不好意思,請刪除之前的那篇意見 ^^|||

# by Tim Gluz

Thanks, nice tool! I'm using it in school projects. Fast, lightweight, helpful, and free.

# by daoodaoo

关于Intellisense功能其实完全可以用Reflector即NET的反射技术来实现的;我研究过snippetcompiler,他是把Using的所有程序集的对象名称全部一次性的提取出来放到如下目录"C:\Documents and Settings\daoo.DAOODAOO\Application Data\SnippetCompiler\IntelliSense\TypeCache.xml",当你在输入字符'.'的时候,他就会从这个文件中搜索可能的子项, 这里贴出这个文件的部分内容可以证明: <types> <type name="System" lname="system" type="namespace"> <type name="__ComObject" type="class" /> <type name="_AppDomain" type="interface" /> <type name="Activator" type="class" /> <type name="AppDomain" type="class" /> <type name="AppDomainSetup" type="class" /> <type name="AppDomainUnloadedException" type="class" /> <type name="ApplicationException" type="class" /> <type name="ArgIterator" type="value" />

# by player

如果要改成 console exe 的話 建議把編譯後的結果輸出成檔案 再用比對檔案時間的機制 來判斷是否需要重新編譯 如果原始檔沒改過 再次執行 無需再次編譯

# by player

關於編譯時動態加入組件 要改 Form1.cs 的 public void Run(string code) 要先從 string code 篩選出出組件的名稱 (例如用正規化表示法去切字串) 再用 cp.ReferencedAssemblies.Add(...) 依序加入

# by player

f ((m = Regex.Match(code, "(?ims)^[/']{2}REFDLL (?<ref>.+?)$")).Success) 這個正規化的語法是錯的 無法切出要載入的組件名稱 誰知道該怎麼切出字串的正確的語法? using 後的字串?

# by player

請改用 Regex.Match(code, @"using\s+(?<ref>[\w.]+)") 這個試看看? 期待1.4版早日出爐

# by Jeffrey

to Player,我不是用using去決定要Reference哪些DLL,理由是不是所有的using都需要額外參考DLL(例如: System.Text就在System.dll中),要參考的DLL名稱也未必與using的Namespace一致。因此我設計成另外寫一列//REFDLL System.Windows.Forms;System.Data;System.Data.OracleClient這種宣告要求,告知要額外參考System.Windows.Forms.dll, System.Data, System.Data.OracleClient.dll三個Assembly。

# by player

目前發現 .Net的各組件的DLL是與Class為對應關係? 而不是與Namespace做對應? 例如使用 regedit.exe 打開 HKEY_CLASSES_ROOT\System.Text.StringBuilder\CLSID 預設值={E724B749-18D6-36AB-9F6D-09C36D9C6016} 再 HKEY_CLASSES_ROOT\CLSID\{E724B749-18D6-36AB-9F6D-09C36D9C6016}\InprocServer32\2.0.0.0 可以看到 Class=System.Text.StringBuilder Assembly=mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

# by Zzz

預設的字型對我來說太小了,可以請你加上改變字體及大小的功能嗎?

# by Jeffrey

to Zzz, 謝謝您的回饋,我會納入下個版本的待辦事項。

# by chen.zl@live.cn

Mini C# Lab ver 1.3 在菜单项 copy as html时会获得空的数值,或者是数据不完整,从而出错 需要优化的是,增加对指出的错误的行列的指引,和获得鼠标所在行列,因为数行列实在是件另人痛苦的事 output栏应该和错误栏分开显示 让用户获得已编译的可执行性文件 增加调试功能

# by Jeffrey

to chen.zl, 感謝您的意見,我會納入未來改版的參考。

# by Hsing

黑暗執行緒先生 由於研究上需要 想請您幫忙 但是一直找不到聯絡您的方式 是否可以請您聯絡小弟~~或是留各可以聯絡到您的信箱呢? 謝謝您

# by 阿呆

//REFDLL System.Data; 這句是有問題的,以下才對 //REFDLL System.Data

Post a comment