<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
  <channel>
    <title><![CDATA[Q.yuhen]]></title> 
    <link>http://www.rainsts.net/</link> 
    <description><![CDATA[秋雨漏更夜，琴音动心痕。RainTrail Studio.China 2000-2008]]></description> 
    <language>zh-cn</language> 
    <copyright><![CDATA[Copyright 2008, Q.yuhen]]></copyright> 
    <webMaster><![CDATA[qyuhen@hotmail.com (Q.yuhen)]]></webMaster> 
    <generator>LBS v2.0.313</generator> 
    <pubDate>Thu, 28 Aug 2008 10:22:26 +0800</pubDate> 
    <ttl>60</ttl>
  
    <item>
      <title><![CDATA[Linq to SQL: 自定义排序]]></title> 
      <link><![CDATA[http://www.rainsts.net/article.asp?id=742]]></link> 
      <category><![CDATA[ADO.NET]]></category> 
      <author><![CDATA[yuhen <null@null.com>]]></author> 
      <pubDate>Tue, 26 Aug 2008 15:30:15 +0800</pubDate> 
      <description><![CDATA[某些时候我们需要按照某个特定的序列来完成结果排序，比如说按 in 条件中的 Id 顺序返回文章(Archive)。<br /><br /><b>SQL</b><div class="code">select Id, Title from Archive where Id in (25, 23, 19, 21, 22, 26)<br />order by (<br />&nbsp;&nbsp;select <br />&nbsp;&nbsp;case Id <br />&nbsp;&nbsp;&nbsp;&nbsp;when 25 then 0 <br />&nbsp;&nbsp;&nbsp;&nbsp;when 23 then 1 <br />&nbsp;&nbsp;&nbsp;&nbsp;when 19 then 2 <br />&nbsp;&nbsp;&nbsp;&nbsp;when 21 then 3 <br />&nbsp;&nbsp;&nbsp;&nbsp;when 22 then 4 <br />&nbsp;&nbsp;&nbsp;&nbsp;when 26 then 5 <br />&nbsp;&nbsp;end)</div><br /><b>SQL 2</b><div class="code">select Id, Title<br />from Archive<br />where Id IN (25, 23, 19, 21, 22, 26) </div>]]></description>
      <wfw:commentRss><![CDATA[http://www.rainsts.net/feed.asp?q=comment&id=742]]></wfw:commentRss>
    </item>
      
    <item>
      <title><![CDATA[重命名混淆名称]]></title> 
      <link><![CDATA[http://www.rainsts.net/article.asp?id=741]]></link> 
      <category><![CDATA[Tools]]></category> 
      <author><![CDATA[yuhen <null@null.com>]]></author> 
      <pubDate>Thu, 21 Aug 2008 01:13:03 +0800</pubDate> 
      <description><![CDATA[看到这样的东西，我的眼前会冒出很多小星星~~~~  <img src="http://www.rainsts.net/styles/default/images/smilies/icon_cry.gif" border="0" alt="[cry]" /> <br /><br /><div style="width: 100%;overflow-x : auto;"><a href="http://www.rainsts.net/uploads/200808/21_011315_rename.png" target="_blank"><img src="http://www.rainsts.net/uploads/200808/21_011315_rename.png" alt="http://www.rainsts.net/uploads/200808/21_011315_rename.png" /></a></div><br /><br />当然，我们有很多种手段避开这些难看的家伙。不过呢，下面这点代码或许有那么点用处。别忘了 <a href="http://www.mono-project.com/Cecil" title="http://www.mono-project.com/Cecil" target="_blank">Mono.Cecil</a>。<br /><div class="code">private static void ReflectionRename()<br />{<br />&nbsp;&nbsp;int x = 0, m = 0, p = 0, f = 0;<br /><br />&nbsp;&nbsp;AssemblyDefinition asm = AssemblyFactory.GetAssembly(&quot;z:\\crack\\a.dll&quot;);<br />&nbsp;&nbsp;foreach (TypeDefinition type in asm.MainModule.Types)</div>]]></description>
      <wfw:commentRss><![CDATA[http://www.rainsts.net/feed.asp?q=comment&id=741]]></wfw:commentRss>
    </item>
      
    <item>
      <title><![CDATA[文件夹实时同步工具]]></title> 
      <link><![CDATA[http://www.rainsts.net/article.asp?id=739]]></link> 
      <category><![CDATA[Tools]]></category> 
      <author><![CDATA[yuhen <null@null.com>]]></author> 
      <pubDate>Fri, 15 Aug 2008 10:35:22 +0800</pubDate> 
      <description><![CDATA[在负载均衡环境下，经常需要将一台机器上的文件实时同步到其他主机上。找了很多工具，似乎都没有监测实时变化的。<br />这个小东西非常简单，使用 FileSystemWatcher 和 UNC (Share Floder) 进行操作。多数负载均衡服务器都有内网线路，因此使用 UNC 也没有啥严重的安全问题。当然，感兴趣的可以用 Reflector 查看源码，使用策略模式重构，提供 FtpSync 等更多的读写方式。<br /><br />测试版，不建议用于实际生产环境。<br />具体使用方法，参见压缩包中的 Readme.txt。<br /><br /><a href="http://www.rainsts.net/uploads/200808/15_103835_uncsync.rar" title="http://www.rainsts.net/uploads/200808/15_103835_uncsync.rar" target="_blank"><img src="http://www.rainsts.net/styles/default/images/icon_file.gif" border="0" /> 点击下载</a>]]></description>
      <wfw:commentRss><![CDATA[http://www.rainsts.net/feed.asp?q=comment&id=739]]></wfw:commentRss>
    </item>
      
    <item>
      <title><![CDATA[WPF 学习笔记 - 3. Navigation]]></title> 
      <link><![CDATA[http://www.rainsts.net/article.asp?id=737]]></link> 
      <category><![CDATA[WPF Silverlight]]></category> 
      <author><![CDATA[yuhen <null@null.com>]]></author> 
      <pubDate>Tue, 12 Aug 2008 20:05:39 +0800</pubDate> 
      <description><![CDATA[互联网的兴起，造就和培养了一种新的用户交互界面 —— Page &amp; Navigation。无论是前进、后退还是页面，都完全是一个全新的门类，不同于以往的 SDI/MDI。WPF 或者是它的简化版 Silverlight 都不可避免地遵从了这种改良的 B/S 模式，使用 URI 来串接 UI 流程。<br /><br />NavigationService、Page、Hyperlink、Journal(日志/历史记录)  是 WPF 整个导航体系的核心。NavigationService 提供了类似 IE Host 的控制环境，Journal 可以记录和恢复相关 Page 的状态，我们通常会选用的宿主方式包括：Browser(XBAP) 和 NavigationWindow。<br /><br /><b>1. NavigationWindow</b><br /><br />NavigationWindow 继承自 Window，不知什么原因，我并没有在 ]]></description>
      <wfw:commentRss><![CDATA[http://www.rainsts.net/feed.asp?q=comment&id=737]]></wfw:commentRss>
    </item>
      
    <item>
      <title><![CDATA[WPF 学习笔记 - 2. Dispatcher]]></title> 
      <link><![CDATA[http://www.rainsts.net/article.asp?id=736]]></link> 
      <category><![CDATA[WPF Silverlight]]></category> 
      <author><![CDATA[yuhen <null@null.com>]]></author> 
      <pubDate>Mon, 11 Aug 2008 19:13:00 +0800</pubDate> 
      <description><![CDATA[WPF 使用一个专用的 UI 线程来完成界面的操作和更新，这个线程会关联一个唯一的 <b>Dispatcher</b> 对象，用于调度按优先顺序排列的工作项队列。Application.Run() 实际上就是对 Dispatcher.Run() 的间接调用。<br /><br />Dispatcher 通过循环来处理工作项队列，这个循环通常被成为 &quot;帧 (DispatcherFrame)&quot;。Dispatcher.Run() 创建并启动这个帧，这也是 Application.Run() 启动消息循环的最终途径。<br /><div class="code">public sealed class Dispatcher<br />{<br />&nbsp;&nbsp;[SecurityCritical, UIPermission(SecurityAction.LinkDemand, Unrestricted=true)]<br />&nbsp;&nbsp;public static void Run()<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;PushFrame(new DispatcherFrame());</div>]]></description>
      <wfw:commentRss><![CDATA[http://www.rainsts.net/feed.asp?q=comment&id=736]]></wfw:commentRss>
    </item>
      
    <item>
      <title><![CDATA[WPF 学习笔记 - 1. Application]]></title> 
      <link><![CDATA[http://www.rainsts.net/article.asp?id=735]]></link> 
      <category><![CDATA[WPF Silverlight]]></category> 
      <author><![CDATA[yuhen <null@null.com>]]></author> 
      <pubDate>Mon, 11 Aug 2008 17:10:22 +0800</pubDate> 
      <description><![CDATA[和 WinForm 类似， WPF 同样需要一个 Application 来统领一些全局的行为和操作，并且每个 Domain 中只能有一个 Application 实例存在。和 WinForm 不同的是 WPF Application 默认由两部分组成 : App.xaml 和 App.xaml.cs，这有点类似于 Delphi Form，将定义和行为代码相分离。当然，WebForm 也采用了类似的方式。XAML 从严格意义上说并不是一个纯粹的 XML 格式文件，它更像是一种 DSL，它的所有定义都直接映射成某些代码，只不过具体的翻译工作由编译器完成而已。<br /><br />下面是一个简单的 App 定义。<br /><div class="code">public partial class App : Application<br />{<br />}</div><br />当你在自动生成的 Project 代码中看到 <b>paritial</b>]]></description>
      <wfw:commentRss><![CDATA[http://www.rainsts.net/feed.asp?q=comment&id=735]]></wfw:commentRss>
    </item>
      
    <item>
      <title><![CDATA[不注册使用 {SmartAssembly}]]></title> 
      <link><![CDATA[http://www.rainsts.net/article.asp?id=733]]></link> 
      <category><![CDATA[Tools]]></category> 
      <author><![CDATA[yuhen <null@null.com>]]></author> 
      <pubDate>Wed, 06 Aug 2008 21:16:05 +0800</pubDate> 
      <description><![CDATA[本文目的和<a href="http://www.rainsts.net/article.asp?id=679" title="http://www.rainsts.net/article.asp?id=679" target="_blank">《不注册使用 .NET Reactor》</a>相同，适合懒人阅读。<br /><br />默认情况下，{SmartAssembly} 试用版会在加密的程序集中注入一个 20 天的限制代码，如果超出时间，则会弹出如下一个对话框。<br /><br /><div style="width: 100%;overflow-x : auto;"><a href="http://www.rainsts.net/uploads/200808/06_212034_smartassembly.png" target="_blank"><img src="http://www.rainsts.net/uploads/200808/06_212034_smartassembly.png" alt="http://www.rainsts.net/uploads/200808/06_212034_smartassembly.png" /></a></div><br /><br />这个对话框讨厌不说，单击确定后直接终止程序执行。 <img src="http://www.rainsts.net/styles/default/images/smilies/icon_angry.gif" border="0" alt="[angry]" /> <br /><br />好了，不废话，我们开始解除这个限制。首先自然是用 ILDasm.exe 获取 IL 源代码了，利用对话框上的特征字符串，很容易找到目标方法。<br /><div class="code">.method private hidebysig static bool (bool) cil managed<br />{<br />&nbsp;&nbsp;.maxstack 4<br />&nbsp;&nbsp;.locals init (</div>]]></description>
      <wfw:commentRss><![CDATA[http://www.rainsts.net/feed.asp?q=comment&id=733]]></wfw:commentRss>
    </item>
      
    <item>
      <title><![CDATA[还原 {SmartAssembly} 字符串解密算法]]></title> 
      <link><![CDATA[http://www.rainsts.net/article.asp?id=732]]></link> 
      <category><![CDATA[Tools]]></category> 
      <author><![CDATA[yuhen <null@null.com>]]></author> 
      <pubDate>Wed, 06 Aug 2008 20:13:01 +0800</pubDate> 
      <description><![CDATA[<b><a href="http://www.smartassembly.com/" title="http://www.smartassembly.com/" target="_blank">{SmartAssembly}</a></b> 是个很不错的 .NET 混淆软件，尤其是它的名称混淆，很无奈很变态。推荐大家使用！(本文不是描述如何使用或者破解 {SmartAssembly})<br /><br />寻找特征字符串是软件破解的一个常用手段，所以几乎所有的混淆软件都支持字符串加密。如果我们能还原这些字符串，那么对于定位关键算法或者窗体还是有些帮助的。和所有混淆软件一样，{SmartAssembly} 同样会在加密的目标程序集文件中注入一些代码。<br /><div class="code">.class private auto ansi sealed beforefieldinit &#39;&#39;.&#39;&#39;<br />&nbsp;&nbsp;   extends [mscorlib]System.Object<br />{<br />&nbsp;.field private static class </div>]]></description>
      <wfw:commentRss><![CDATA[http://www.rainsts.net/feed.asp?q=comment&id=732]]></wfw:commentRss>
    </item>
      
    <item>
      <title><![CDATA[ASP.NET MVC Preview 4 分析 - 2. Filter]]></title> 
      <link><![CDATA[http://www.rainsts.net/article.asp?id=731]]></link> 
      <category><![CDATA[ASP.NET]]></category> 
      <author><![CDATA[yuhen <null@null.com>]]></author> 
      <pubDate>Sun, 20 Jul 2008 10:38:33 +0800</pubDate> 
      <description><![CDATA[过滤器 (Filter) 是 MVC 的一个重要特征，它提供了非常灵活的扩展和解耦机制。P4 版的过滤器总算像那么回事了，同时做了更深度的划分，使得开发人员可以控制更多的细节和流程。<br /><br /><b>1. IActionFilter</b><br /><br />主要用来干预 Action 的执行，我们可以通过上下文对象修改请求参数或者取消 Action 的执行。<br /><div class="code">public interface IActionFilter<br />{<br />&nbsp;&nbsp;void OnActionExecuting(ActionExecutingContext filterContext);<br />&nbsp;&nbsp;void OnActionExecuted(ActionExecutedContext filterContext);<br />}</div><br />默认实现是 ActionFilterAttribute，这也是我们开发自定义过滤器通常所用的基类。<br />&#91;code]&#91;/code]]]></description>
      <wfw:commentRss><![CDATA[http://www.rainsts.net/feed.asp?q=comment&id=731]]></wfw:commentRss>
    </item>
      
    <item>
      <title><![CDATA[ASP.NET MVC Preview 4 分析 - 1. ActionInvoker]]></title> 
      <link><![CDATA[http://www.rainsts.net/article.asp?id=730]]></link> 
      <category><![CDATA[ASP.NET]]></category> 
      <author><![CDATA[yuhen <null@null.com>]]></author> 
      <pubDate>Sat, 19 Jul 2008 15:13:01 +0800</pubDate> 
      <description><![CDATA[MVC 的执行核心是 ControllerActionInvoker，好在 P4 相比 P3 的变化要小了很多。<br /><br />P3 ControllerActionInvoker.InvokeAction<div class="code">public virtual bool InvokeAction(string actionName, IDictionary&lt;string, object&gt; values)<br />{<br />&nbsp;&nbsp;// ...<br /><br />&nbsp;&nbsp;MethodInfo methodInfo = FindActionMethod(actionName, values);<br />&nbsp;&nbsp;if (methodInfo != null)<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;IDictionary&lt;string, object&gt; parameters = GetParameterValues(methodInfo, values);<br />&nbsp;&nbsp;&nbsp;&nbsp;IList&lt;IActionFilter&gt; </div>]]></description>
      <wfw:commentRss><![CDATA[http://www.rainsts.net/feed.asp?q=comment&id=730]]></wfw:commentRss>
    </item>
      
  </channel>
</rss>
