{"id":238395,"date":"2014-09-28T01:01:03","date_gmt":"2014-09-27T21:01:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=238395"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=238395","title":{"rendered":"<span class=\"post_title\">\u041f\u043e\u0438\u0441\u043a-\u0444\u0438\u043b\u044c\u0442\u0440 \u043f\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c \u0441\u043a\u0430\u0439\u043f\u0430<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t\u0412\u0447\u0435\u0440\u0430 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u0443\u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u043b\u043e\u0433\u0438 \u0441\u043a\u0430\u0439\u043f\u0430 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 .sqlite. \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u044f, \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u0438\u0435 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439.<br \/>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0445\u0430\u0431\u0440\u0443, \u043d\u0430\u0448\u0435\u043b \u0442\u0435\u043c\u0443, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u0443\u044e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u044b \u2014 <a href=\"http:\/\/habrahabr.ru\/post\/160315\/\">\u0442\u0435\u043c\u0430<\/a>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044e \u044d\u0442\u043e\u0439 \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u044b \u2014 <a href=\"http:\/\/habrahabr.ru\/post\/160629\/\">\u0442\u0435\u043c\u0430<\/a> \u0438 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043a\u0438 SkypeLogViewer. \u0417\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u044f, \u043f\u043e\u0440\u0430 \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0443\u043f\u043e\u0440\u043e\u0442\u044b\u0439 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434.<br \/>  \u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430: \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0447\u0430\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 lua \u2014 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0436\u0435\u043b\u0430\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u043f\u043e\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 lua, sql-\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0438 lua-\u0430\u043d\u0430\u043b\u043e\u0433\u0430 linq, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u0435\u043c, \u043a\u043e\u0433\u043e \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0441\u043a\u0430\u0439\u043f\u0430. \u0421\u0430\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0430 C#(WPF).<br \/>  \u0427\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u2014 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u2014 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 lua \u0438 sqlite.<\/p>\n<p>  \u0412\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 NLua \u0438 System.Data.Sqlite \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c NuGet.<\/p>\n<p>  install-package nlua<br \/>  install-package system.data.sqlite<\/p>\n<p>  \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0438 \u043d\u0430 \u0432\u0441\u044f\u043a \u043f\u043e\u0436\u0430\u0440\u043d\u044b\u0439 \u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043b\u0430\u0441\u0441-wrapper \u0434\u043b\u044f lua<\/p>\n<pre><code class=\"cs\">public class LuaLogic     {         public Lua lua = new Lua();          \/\/\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0440\u0435\u0433\u0435\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c public - \u043c\u0435\u0442\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 C# \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437 lua         public void reg(object target, string funcname)         {             try             {                 lua.RegisterFunction(funcname, target, target.GetType().GetMethod(funcname));             }             catch (Exception ex)             {              }         }          \/\/\u0412\u044b\u0437\u043e\u0432 lua-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u0448\u0430\u0440\u043f\u0430         public object[] call(string lua_func, params object[] args)         {             try             {                 var func = lua[lua_func] as LuaFunction;                 return func.Call(args);             }             catch (Exception ex)             {                 return null;             }         }     } <\/code><\/pre>\n<p>  \u0418 \u0434\u0430, \u044f \u0432 \u043a\u0443\u0440\u0441\u0435, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u0447\u0438\u0442\u0430\u044e\u0442, \u0447\u0442\u043e Exception \u043e\u0431\u044f\u0437\u0430\u043d \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u2014 \u0432\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0432 \u044d\u0442\u043e\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0432\u0438\u0436\u0443.<\/p>\n<p>  \u0420\u0430\u0437\u043c\u0435\u0442\u043a\u0443 \u0434\u043b\u044f gui \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u043f\u043e\u0442\u043e\u043c\u0443 \u0432\u043e\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432 \u043a\u043e\u0434\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 GUI:<\/p>\n<p>  output \u2014 RichTextBox, \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043f\u043e\u0448\u043b\u044b\u0445 \u0448\u0443\u0442\u043e\u043a \u0438\u043b\u0438 ascii-\u0430\u0440\u0442\u0430<br \/>  runlua \u2014 Button, \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f lua-\u043a\u043e\u0434\u0430. \u0412\u043e\u043e\u0431\u0449\u0435-\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0432\u0435\u0441\u0438\u0442\u044c \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <a href=\"http:\/\/stackoverflow.com\/questions\/15017506\/using-filesystemwatcher-to-monitor-a-directory\">FileSystemWatcher&#8217;\u0430<\/a>, \u043d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0430 \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044f<br \/>  accounts \u2014 ComboBox, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441\u043a\u0430\u0439\u043f\u0430, \u043a\u043e\u0433\u0434\u0430-\u043b\u0438\u0431\u043e \u043b\u043e\u0433\u0438\u043d\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a \u043a\u043e\u0434\u0443. \u041d\u0430\u0447\u043d\u0435\u043c \u0441\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<pre><code class=\"cs\">         static LuaLogic logic = new LuaLogic();         public string current_path = &quot;&quot;;         private List&lt;Dictionary&lt;string, object&gt;&gt; data;           \/\/\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0431\u0430\u0437\u0435. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u043c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0435.         private List&lt;Dictionary&lt;string, object&gt;&gt; _query(string comm)         {             var result = new List&lt;Dictionary&lt;string, object&gt;&gt;();             using (var db = new SQLiteConnection(@&quot;data source=&quot; + current_path))             {                 db.Open();                 using (var command = new SQLiteCommand(comm, db))                 {                     command.CommandTimeout = 999;                     using (var reader = command.ExecuteReader())                     {                         while (reader.Read())                         {                             result.Add(Enumerable.Range(0, reader.FieldCount)                                 .ToDictionary(                                     reader.GetName,                                     reader.GetValue));                         }                     }                 }                 db.Close();             }             return result;         }           \/\/\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0432 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 lua \u0444\u043e\u0440\u043c\u0430\u0442. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 List&lt;Dictionary&lt;string, object&gt;&gt; \u0447\u0435\u0440\u0435\u0437 lua \u0442\u0430\u043a \u0438 \u043d\u0435 \u0434\u043e\u043f\u0435\u0440. \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0432 lua-\u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0443\u044e\u044e \u0438\u0437 lua-\u0442\u0430\u0431\u043b\u0438\u0446.         public LuaTable genTable(List&lt;Dictionary&lt;string, object&gt;&gt; d)         {             logic.lua.NewTable(&quot;datatable&quot;);             var table = logic.lua.GetTable(&quot;datatable&quot;);             for(int i=0; i&lt;d.Count; i++)             {                 logic.lua.NewTable(&quot;f&quot;);                 table[i] = logic.lua.GetTable(&quot;f&quot;);                 foreach (var entry in d[i])                 {                     ((LuaTable) table[i])[entry.Key] = entry.Value;                 }             }             return table;         }           \/*** \u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0438\u0437 lua ***\/          \/\/\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0411\u0414. \u0412\u044b\u0437\u043e\u0432 \u043f\u0435\u0440\u0435\u043d\u0435\u0441 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 lua \u0434\u043b\u044f \u043f\u0443\u0449\u0435\u0433\u043e \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430.         public void scanDB(string request=null)         {             if(data!=null)                 data.Clear();              data = new List&lt;Dictionary&lt;string, object&gt;&gt;();             data = _query(request??&quot;select from_dispname,body_xml,timestamp from messages order by timestamp desc&quot;);             genTable(data);         }          \/\/\u0412\u044b\u0432\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 RichTextBox         public void _print(object obj)         {             Dispatcher.Invoke(() =&gt;output.AppendText(obj + &quot;\\n&quot;));         }          \/\/\u0415\u0449\u0435 1 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 RichTextBox. \u041f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a.         public void _printblock(string text)         {             Dispatcher.Invoke(() =&gt;              output.Document.Blocks.Add(new Paragraph(new Run(text))                                            {                                                Margin = new Thickness(0)                                            }));         }          \/\/\u041e\u0447\u0438\u0441\u0442\u043a\u0430 RichTextBox         public void _clear()         {             Dispatcher.Invoke(() =&gt; output.Document.Blocks.Clear());         } <\/code><\/pre>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u2014 \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f!<\/p>\n<pre><code class=\"cs\">public MainWindow()         {             InitializeComponent();              \/\/\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u0434\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0441\u043a\u0430\u0439\u043f\u0430. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043b\u0435\u0436\u0438\u0442 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043c\u0435\u0441\u0442\u0435 - \u043d\u0443 \u0447\u0442\u043e \u0436, \u0434\u043e\u043f\u0438\u043b\u043a\u0443 \u043b\u043e\u0431\u0437\u0438\u043a\u043e\u043c \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043e\u0442\u043c\u0435\u043d\u044f\u043b             var searchpath = Environment.ExpandEnvironmentVariables(&quot;%AppData%\\\\Skype&quot;);             var dirs = Directory.GetDirectories(searchpath);             \/\/\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u0435\u043c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u043f\u043e\u043a \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u044e\u0437\u0435\u0440\u043e\u0432, \u043d\u043e \u0443\u043c\u043d\u0435\u0435 \u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0435\u0435 \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b             var userlist = dirs.Where(dir =&gt; File.Exists(dir + &quot;\\\\main.db&quot;)).Select(x=&gt;x.Replace(searchpath+&quot;\\\\&quot;, &quot;&quot;)).ToList();              accounts.ItemsSource = userlist;             accounts.SelectedItem = accounts.Items[0];              \/\/\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u043b\u043e\u0433\u0430\u043c\u0438 \u043f\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 ComboBox'\u0435             accounts.SelectionChanged += (sender, args) =&gt; current_path = Environment.ExpandEnvironmentVariables(&quot;%AppData%\\\\Skype&quot;) + &quot;\\\\&quot; + accounts.SelectedItem + &quot;\\\\main.db&quot;;              if(userlist.Count&gt;0)                  current_path = Environment.ExpandEnvironmentVariables(&quot;%AppData%\\\\Skype&quot;) + &quot;\\\\&quot; + userlist[0] + &quot;\\\\main.db&quot;;             else             {                  _print(&quot;\u0417\u0430\u0447\u0435\u043c \u0442\u0435\u0431\u0435 \u0447\u0438\u0442\u0430\u043b\u043a\u0430 \u043b\u043e\u0433\u043e\u0432 \u0441\u043a\u0430\u0439\u043f\u0430, \u0435\u0441\u043b\u0438 \u0443 \u0442\u0435\u0431\u044f \u0434\u0430\u0436\u0435 \u0441\u043a\u0430\u0439\u043f\u0430 \u043d\u0435\u0442\u0443?&quot;);             }              \/\/\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0448\u0430\u0440\u043f\u043e\u0432\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u0438\u0437 Lua             logic.reg(this, &quot;_print&quot;);             logic.reg(this, &quot;_clear&quot;);             logic.reg(this, &quot;_printblock&quot;);             logic.reg(this, &quot;scanDB&quot;);                            runlua.Click += (sender, args) =&gt;             {                 try                 {                     new Thread(() =&gt;                                    {                                        \/\/\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c 2 \u0441\u043a\u0440\u0438\u043f\u0442\u0430- \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 linq-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c\u0438 where \u0438 select \u0438, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442. Lua-linq \u044f \u0447\u0435\u0441\u0442\u043d\u043e \u0441\u043f\u0435\u0440 \u0438 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u043b \u043f\u043e\u0434 \u0441\u0432\u043e\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 &lt;a href=&quot;http:\/\/codea.io\/talk\/discussion\/618\/linq-for-lua-functional-collection-class\/p1&quot;&gt;\u043e\u0442\u0441\u044e\u0434\u0430&lt;\/a&gt;.                                        logic.lua.DoFile(@&quot;scripts\\pseudolinq.lua&quot;);                                        logic.lua.DoFile(@&quot;scripts\\script.lua&quot;);                                         \/\/\u0412\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f lua-\u043b\u043e\u0433\u0438\u043a\u0430. \u041a\u0441\u0442\u0430\u0442\u0438, \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u043d\u0443\u0436\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 lua-\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432                                        logic.call(&quot;search_pattern&quot;);                                    }).Start();                 }                 catch (Exception ex)                 {                     _printblock(ex.Message);                 }             };              \/\/\u0421\u0442\u0430\u0440\u0430\u044f \u0434\u043e\u0431\u0440\u0430\u044f \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430, \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043b\u0435\u043d\u044c \u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438             Closing += (sender, args) =&gt; Process.GetCurrentProcess().Kill();         } <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u043d\u0430 \u0437\u0430\u043a\u0443\u0441\u043a\u0443 \u2014 lua-\u043a\u043e\u0434.<\/p>\n<p>  pseudolinq.lua  <\/p>\n<pre><code class=\"lua\">LinqArray = {}  function LinqArray:new( arr ) \t\tRet = {} \t\tRet.arr = arr; \t\tsetmetatable( Ret , self ) \t\tself.__index = self; \t\treturn Ret; end  --[[function LinqArray:init(items) \tif items then self:addRange(items) end end]]--  function LinqArray:add(item) table.insert(self.arr, item) end  function LinqArray:addRange(items) for k,v in ipairs(items) do self.arr:add(v) end end  function LinqArray:where(func) local results = {}; for k, v in ipairs(self.arr) do \tif func(v) then \t\ttable.insert(results, v); \tend end  return LinqArray:new(results) end  function LinqArray:select(func) local results = {} for k, v in ipairs(self.arr) do \t_print(func(v)); \ttable.insert(results, func(v)); end  return LinqArray:new(results) end <\/code><\/pre>\n<p>  script.lua<\/p>\n<pre><code class=\"lua\">function search_pattern()\t\t         --\u043f\u043e\u0434\u0447\u0438\u0449\u0430\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \t_clear(); \tlocal f = LinqArray:new(datatable);          --\u0441\u0430\u043c\u0430\u044f \u043c\u044f\u043a\u043e\u0442\u043a\u0430 - linq-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \tlocal filtered = f:where(function(x) return string.len(x[&quot;from_dispname&quot;])&gt;1; end):select(function(x) return x[&quot;from_dispname&quot;]; end); \t         --\u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0435\u0436\u0435\u043b\u0430\u0435\u043c\u043e \u0438 \u0432\u043e\u043e\u0431\u0449\u0435, \u043d\u0435\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u043e. \u0415\u0441\u043b\u0438 \u0447\u0442\u043e - \u044f \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0434\u0438\u043b.  \tlocal i=0; \tfor i=1,#filtered.arr,1 do \t\tlocal arg = filtered.arr[i];\t \t\t _printblock(arg[&quot;from_dispname&quot;]..&quot;: &quot;); \t\t _print(arg[&quot;body_xml&quot;]); \tend end  --\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0431\u0430\u0437\u0435. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e 1 \u0440\u0430\u0437, \u0447\u0442\u043e \u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 lua, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 if(datatable==nil) then \t\tscanDB(&quot;select * from messages limit 100&quot;); end <\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0441\u044c \u0447\u0443\u0442\u044c \u043f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0435.<br \/>  \u0412\u043e\u043e\u0431\u0449\u0435, \u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u0432 linq-\u043f\u043e\u0434\u043e\u0431\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0434\u0430 \u0438 \u0441\u0430\u043c \u0444\u0438\u043b\u044c\u0442\u0440 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u2014 \u043d\u043e \u044d\u0442\u043e \u0436\u0435 \u0445\u0430\u0431 \u00ab\u043d\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00bb, \u043d\u0443\u0436\u043d\u043e \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435.<br \/>  \u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430.<\/p>\n<p>  \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u044d\u0442\u043e \u0432\u0441\u0435.<br \/>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!      \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/238395\/\"> http:\/\/habrahabr.ru\/post\/238395\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t\u0412\u0447\u0435\u0440\u0430 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u0443\u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u043b\u043e\u0433\u0438 \u0441\u043a\u0430\u0439\u043f\u0430 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 .sqlite. \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u044f, \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u0438\u0435 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439.<br \/>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0445\u0430\u0431\u0440\u0443, \u043d\u0430\u0448\u0435\u043b \u0442\u0435\u043c\u0443, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u0443\u044e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u044b \u2014 <a href=\"http:\/\/habrahabr.ru\/post\/160315\/\">\u0442\u0435\u043c\u0430<\/a>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044e \u044d\u0442\u043e\u0439 \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u044b \u2014 <a href=\"http:\/\/habrahabr.ru\/post\/160629\/\">\u0442\u0435\u043c\u0430<\/a> \u0438 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043a\u0438 SkypeLogViewer. \u0417\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u044f, \u043f\u043e\u0440\u0430 \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0443\u043f\u043e\u0440\u043e\u0442\u044b\u0439 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434.<br \/>  \u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430: \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0447\u0430\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 lua \u2014 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0436\u0435\u043b\u0430\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u043f\u043e\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 lua, sql-\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0438 lua-\u0430\u043d\u0430\u043b\u043e\u0433\u0430 linq, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u0435\u043c, \u043a\u043e\u0433\u043e \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0441\u043a\u0430\u0439\u043f\u0430. \u0421\u0430\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0430 C#(WPF).<br \/>  \u0427\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u2014 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-238395","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/238395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=238395"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/238395\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=238395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=238395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=238395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}