{"id":260778,"date":"2015-07-06T14:40:02","date_gmt":"2015-07-06T10:40:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=260778"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=260778","title":{"rendered":"\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c header-\u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f git \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 C#"},"content":{"rendered":"<br \/>\n<h4>\u0417\u0430\u0447\u0435\u043c? \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u0438<\/h4>\n<p>  \u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u0420\u0430\u0431\u043e\u0442\u0430\u044e \u044f \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u2013 \u043c\u044b \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0438 \u0431\u043b\u043e\u043a\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0438\u0445 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u043b\u044f \u043d\u0430\u0437\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430. \u0422\u0430\u043a \u0443\u0436 \u0443 \u043d\u0430\u0441 \u0437\u0430\u0434\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432\u0435\u0440\u0441\u0438\u0439 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u041f\u041e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c\/\u0431\u0430\u0433\u0430\u043c\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0437\u0430\u0448\u0438\u0432\u0430\u043b\u0438 \u0432 \u0440\u0430\u0437\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u0437\u0430\u0434\u0430\u0447: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u041f\u041e \u0438\u043b\u0438 \u0435\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432 \u0437\u0430\u0448\u0438\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0431\u043b\u043e\u043a\u0435. <\/p>\n<p>  \u0420\u0430\u043d\u0435\u0435, \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0441\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u0438 \u041f\u041e. \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043d\u0430 git \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u0447\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u043d\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0430\u043c\u0438\u043c!<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u043c!<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u043a\u0430\u043a\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0435\u0439.<br \/>  \u0421\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0432\u043e\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 1 \u043a\u043b\u0438\u043a(\u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430)<\/li>\n<li>\u0412 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u0445 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0444\u0430\u0439\u043b\u044b-\u0448\u0430\u0431\u043b\u043e\u043d\u044b<\/li>\n<li>\u0420\u044f\u0434\u043e\u043c \u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0440\u044f\u0434\u043e\u043c \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438<\/li>\n<\/ul>\n<p>  \u0418 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u00ab\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445\u00bb \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0438 \u0441\u0430\u043c \u0448\u0430\u0431\u043b\u043e\u043d:<\/p>\n<ul>\n<li>$git_commit \u2014 \u043f\u043e\u043b\u043d\u044b\u0439 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u00abgit status -s\u00bb <\/li>\n<li>$git_namespace \u2014 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/li>\n<li>$git_countFromHead \u2014 \u0447\u0438\u0441\u043b\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u0432 \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/li>\n<li>$git_hash \u2014 \u0445\u044d\u0448 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u0430(5 \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432)<\/li>\n<li>$git_numUnrevisionedFiles \u2014 \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0437\u0430\u043a\u043e\u043c\u043c\u0438\u0447\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432<\/li>\n<li>$git_timeNow_second \u2014 \u0421\u0435\u043a\u0443\u043d\u0434\u0430 \u0441\u0431\u043e\u0440\u043a\u0438<\/li>\n<li>$git_timeNow_minute \u2014 \u041c\u0438\u043d\u0443\u0442\u0430 \u0441\u0431\u043e\u0440\u043a\u0438<\/li>\n<li>$git_timeNow_hour \u2014 \u0427\u0430\u0441 \u0441\u0431\u043e\u0440\u043a\u0438<\/li>\n<li>$git_timeNow_day \u2014 \u0414\u0435\u043d\u044c \u0441\u0431\u043e\u0440\u043a\u0438<\/li>\n<li>$git_timeNow_month \u2014 \u041c\u0435\u0441\u044f\u0446 \u0441\u0431\u043e\u0440\u043a\u0438<\/li>\n<li>$git_timeNow_year \u2014 \u0413\u043e\u0434 \u0441\u0431\u043e\u0440\u043a\u0438<\/li>\n<\/ul>\n<p>   \u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442 std::tm  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0428\u0430\u0431\u043b\u043e\u043d<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">$git_commit  #ifndef $git_namespace #define $git_namespace  #include &lt;ctime&gt;  namespace $git_namespace {   const unsigned int countFromHead = $git_countFromHead;   const unsigned int hash = 0x$git_hash;   const unsigned int numUnrevisionedFiles = $git_numUnrevisionedFiles;   const std::tm timeNow =   {     $git_timeNow_second,     $git_timeNow_minute,     $git_timeNow_hour,     $git_timeNow_day,     $git_timeNow_month,     $git_timeNow_year - 1900   }; } #endif  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h5>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430<\/h5>\n<p>  <\/p>\n<h6>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c git \u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435<\/h6>\n<p>  <\/p>\n<pre><code class=\"cs\"> Process git = new Process();                   git.StartInfo = new ProcessStartInfo(f[0], &quot; --login -i&quot;);                                    git.StartInfo.RedirectStandardInput = true;\/\/ \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0445\u043e\u0434                   git.StartInfo.RedirectStandardOutput = true;\/\/\u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u044b\u0445\u043e\u0434                   git.StartInfo.UseShellExecute = false;                      git.Start();                   git.StandardInput.WriteLine(&quot;git rev-list HEAD --count&quot;);                   string revlist = git.StandardOutput.ReadLine(); <\/code><\/pre>\n<p>  <\/p>\n<h6>\u0418\u0449\u0435\u043c \u0438 \u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435<\/h6>\n<p>   <\/p>\n<pre><code class=\"cs\">           string str = string.Empty;                         File.Copy(path + filename + &quot;.template&quot;,filename + &quot;.h&quot;);                         using (System.IO.StreamReader reader = System.IO.File.OpenText(filename + &quot;.h&quot;))                         {                             str = reader.ReadToEnd();                         }                          str = str.Replace(&quot;$git_namespace&quot;, cur_head[0]);  \/\/ \u0425\u044d\u0448 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u0430                         str = str.Replace(&quot;$git_countFromHead&quot;, git_revlist(cur_head));                         str = str.Replace(&quot;$git_numUnrevisionedFiles&quot;, cur_commit.Length);                          str = str.Replace(&quot;$git_hash&quot;, cur_hash);  \/\/ \u0425\u044d\u0448 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u0430                         str = str.Replace(&quot;$git_timeNow_second&quot;, DateTime.Now.Second.ToString());  \/\/ \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u044f-\u0434\u0430\u0442\u0430                         str = str.Replace(&quot;$git_timeNow_minute&quot;, DateTime.Now.Minute.ToString());  \/\/ \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u044f-\u0434\u0430\u0442\u0430                         str = str.Replace(&quot;$git_timeNow_hour&quot;, DateTime.Now.Hour.ToString());  \/\/ \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u044f-\u0434\u0430\u0442\u0430                         str = str.Replace(&quot;$git_timeNow_day&quot;, DateTime.Now.Day.ToString());  \/\/ \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u044f-\u0434\u0430\u0442\u0430                         str = str.Replace(&quot;$git_timeNow_month&quot;, DateTime.Now.Month.ToString());  \/\/ \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u044f-\u0434\u0430\u0442\u0430                         str = str.Replace(&quot;$git_timeNow_year&quot;, DateTime.Now.Year.ToString());  \/\/ \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u044f-\u0434\u0430\u0442\u0430                         str = str.Replace(&quot;$git_commit&quot;, cur_commit);  \/\/ \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u043c\u043c\u0438\u0442\u0430                          using (System.IO.StreamWriter file = new System.IO.StreamWriter(cur_head[0] + &quot;.h&quot;))                         {                             file.Write(str);                         } <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u0438\u0441\u0442\u0438\u043d\u0433 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e! \u041c\u043d\u043e\u0433\u043e \u0431\u044b\u0434\u043b\u043e\u043a\u043e\u0434\u0430!<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using System.Diagnostics;   namespace hgitcreate {        class Program     {       static string git_hash(string[] head)         {             string git_hash = &quot;0&quot;;              string[] f = Directory.GetFiles(@&quot;C:\\Program Files (x86)\\Git\\bin&quot;, &quot;sh.exe&quot;); \/\/\u0438\u0449\u0435\u043c git             if (f.Length == 0)             {                 f = Directory.GetFiles(@&quot;C:\\Program Files\\Git\\bin&quot;, &quot;sh.exe&quot;);             }             else             {                 if (f.Length != 0)                 {                     Process git = new Process();                     git.StartInfo = new ProcessStartInfo(f[0], &quot; --login -i&quot;);\/\/\u0437\u0430\u0434\u0430\u0435\u043c \u0438\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430                     \/\/git.StartInfo.CreateNoWindow = true;\/\/\u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u043a\u043d\u043e                     \/\/git.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;                     git.StartInfo.RedirectStandardInput = true;\/\/ \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0445\u043e\u0434                     git.StartInfo.RedirectStandardOutput = true;\/\/\u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u044b\u0445\u043e\u0434                     git.StartInfo.UseShellExecute = false;\/\/\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445                    \/\/ Process.Start(f[0], &quot; --login -i&quot;);                     git.Start();                     git.StandardOutput.ReadLine();                     git.StandardOutput.ReadLine();                     git.StandardOutput.ReadLine();                     git.StandardOutput.ReadLine();                     git.StandardOutput.ReadLine();                     git.StandardInput.WriteLine(&quot;git log&quot;);                     git_hash = git.StandardOutput.ReadLine();                     git_hash = git_hash.Substring(7, 7);                                                                                                                     }                 else                 {                     Console.Write(&quot;git(sh.exe) not found&quot;);                 }              }             return git_hash;         }        static string git_commit(string[] head)       {           string git_commit = &quot;0&quot;;            string[] f = Directory.GetFiles(@&quot;C:\\Program Files (x86)\\Git\\bin&quot;, &quot;sh.exe&quot;); \/\/\u0438\u0449\u0435\u043c git           if (f.Length == 0)           {               f = Directory.GetFiles(@&quot;C:\\Program Files\\Git\\bin&quot;, &quot;sh.exe&quot;);           }           else           {               if (f.Length != 0)               {                   Process git = new Process();                   git.StartInfo = new ProcessStartInfo(f[0], &quot; --login -i&quot;);\/\/\u0437\u0430\u0434\u0430\u0435\u043c \u0438\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430                   \/\/git.StartInfo.CreateNoWindow = true;\/\/\u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u043a\u043d\u043e                   \/\/git.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;                   git.StartInfo.RedirectStandardInput = true;\/\/ \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0445\u043e\u0434                   git.StartInfo.RedirectStandardOutput = true;\/\/\u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u044b\u0445\u043e\u0434                   git.StartInfo.UseShellExecute = false;\/\/\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445                   \/\/ Process.Start(f[0], &quot; --login -i&quot;);                   git.Start();                   git.StandardOutput.ReadLine();                   git.StandardOutput.ReadLine();                   git.StandardOutput.ReadLine();                   git.StandardOutput.ReadLine();                   git.StandardOutput.ReadLine();                   git.StandardInput.WriteLine(&quot;git status -s&quot;);                   git_commit = &quot;\/* &quot;;                   int i = 1;                   git_commit += git.StandardOutput.ReadLine() + &quot; \\n &quot;;                   while (git.StandardOutput.Peek() != -1)                   {                       i++;                       git_commit += git.StandardOutput.ReadLine() + &quot; \\n &quot;;                                          }                    git_commit += &quot; *\/ \\n \/\/&quot; + i.ToString();                     }               else               {                   Console.Write(&quot;git(sh.exe) not found&quot;);               }            }           return git_commit;       }        static string git_revlist(string[] head)       {           string git_revlist = &quot;0&quot;;            string[] f = Directory.GetFiles(@&quot;C:\\Program Files (x86)\\Git\\bin&quot;, &quot;sh.exe&quot;); \/\/\u0438\u0449\u0435\u043c git           if (f.Length == 0)           {               f = Directory.GetFiles(@&quot;C:\\Program Files\\Git\\bin&quot;, &quot;sh.exe&quot;);           }           else           {               if (f.Length != 0)               {                   Process git = new Process();                   git.StartInfo = new ProcessStartInfo(f[0], &quot; --login -i&quot;);\/\/\u0437\u0430\u0434\u0430\u0435\u043c \u0438\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430                   \/\/git.StartInfo.CreateNoWindow = true;\/\/\u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u043a\u043d\u043e                   \/\/git.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;                   git.StartInfo.RedirectStandardInput = true;\/\/ \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0445\u043e\u0434                   git.StartInfo.RedirectStandardOutput = true;\/\/\u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u044b\u0445\u043e\u0434                   git.StartInfo.UseShellExecute = false;\/\/\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445                   \/\/ Process.Start(f[0], &quot; --login -i&quot;);                   git.Start();                   git.StandardOutput.ReadLine();                   git.StandardOutput.ReadLine();                   git.StandardOutput.ReadLine();                   git.StandardOutput.ReadLine();                   git.StandardOutput.ReadLine();                   git.StandardInput.WriteLine(&quot;git rev-list HEAD --count&quot;);                   git_revlist = git.StandardOutput.ReadLine();               }               else               {                   Console.Write(&quot;git(sh.exe) not found&quot;);               }            }           return git_revlist;       }           static void Main(string[] args)         {             try             {                 string[] heads = File.ReadAllLines(&quot;config.csv&quot;);                 if (heads.Length &gt; 0)                 {                     for (int i = 0; i &lt; heads.Length; i++)                     {                         string[] cur_head = heads[i].Split(';');                         File.Delete(cur_head[1] + cur_head[0] + &quot;.h&quot;);                         File.Copy(cur_head[1] + cur_head[0] + &quot;.template&quot;, cur_head[1] + cur_head[0] + &quot;.h&quot;);                          string cur_hash = git_hash(cur_head);                         string cur_commit = git_commit(cur_head);                         \/\/Console.ReadKey();                           string str = string.Empty;                         using (System.IO.StreamReader reader = System.IO.File.OpenText(cur_head[1] + cur_head[0] + &quot;.h&quot;))                         {                             str = reader.ReadToEnd();                         }                          str = str.Replace(&quot;$git_namespace&quot;, cur_head[0]);  \/\/ \u0425\u044d\u0448 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u0430                          str = str.Replace(&quot;$git_countFromHead&quot;, git_revlist(cur_head));                         str = str.Replace(&quot;$git_numUnrevisionedFiles&quot;, cur_commit.Substring(cur_commit.Length - 1, 1));                           str = str.Replace(&quot;$git_hash&quot;, cur_hash);  \/\/ \u0425\u044d\u0448 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u0430                         str = str.Replace(&quot;$git_timeNow_second&quot;, DateTime.Now.Second.ToString());  \/\/ \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u044f-\u0434\u0430\u0442\u0430                         str = str.Replace(&quot;$git_timeNow_minute&quot;, DateTime.Now.Minute.ToString());  \/\/ \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u044f-\u0434\u0430\u0442\u0430                         str = str.Replace(&quot;$git_timeNow_hour&quot;, DateTime.Now.Hour.ToString());  \/\/ \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u044f-\u0434\u0430\u0442\u0430                         str = str.Replace(&quot;$git_timeNow_day&quot;, DateTime.Now.Day.ToString());  \/\/ \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u044f-\u0434\u0430\u0442\u0430                         str = str.Replace(&quot;$git_timeNow_month&quot;, DateTime.Now.Month.ToString());  \/\/ \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u044f-\u0434\u0430\u0442\u0430                         str = str.Replace(&quot;$git_timeNow_year&quot;, DateTime.Now.Year.ToString());  \/\/ \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u044f-\u0434\u0430\u0442\u0430                         str = str.Replace(&quot;$git_commit&quot;, cur_commit);  \/\/ \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u043c\u043c\u0438\u0442\u0430                            using (System.IO.StreamWriter file = new System.IO.StreamWriter(cur_head[1] + cur_head[0] + &quot;.h&quot;))                         {                             file.Write(str);                         }                       }                 }                 else                 {                     Console.WriteLine(&quot;\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u0443\u0441\u0442\u044c&quot;);                 }             }             catch(ArgumentException ex)             {                 Console.WriteLine(ex.Message);              \/\/   Console.ReadKey();             }         }       } }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/*  D ..\/..\/..\/git_header_maker\/git.ps1    D ..\/..\/..\/git_header_maker\/gitAll.ps1    M ..\/..\/..\/git_header_maker\/git_test1.h    M ..\/..\/..\/git_header_maker\/git_test2.h    D &quot;..\/..\/..\/git_header_maker\/git_version_lpc2000 \\342\\200\\224 \\320\\272\\320\\276\\320\\277\\320\\270\\321\\217.h&quot;    M ..\/..\/..\/git_header_maker\/git_version_lpc2000.h    D ..\/..\/..\/git_header_maker\/git_version_lpc2000.h    M ..\/..\/App.config    M ..\/..\/Program.cs    M ..\/..\/Properties\/AssemblyInfo.cs    M ..\/..\/hgitcreate.csproj   ?? ..\/..\/..\/config.csv   ?? ..\/..\/..\/hgitcreate.exe   ?? ..\/..\/..\/main exe\/    *\/   \/\/14  #ifndef git_version_lpc2000 #define git_version_lpc2000  #include &lt;ctime&gt;  namespace git_version_lpc2000 {   const unsigned int countFromHead = 3;   const unsigned int hash = 0x957d20e;   const unsigned int numUnrevisionedFiles = 4;   const std::tm timeNow =   {     56,     33,     17,     3,     7,     2015 - 1900   }; } #endif <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0412\u044b\u0432\u043e\u0434\u044b<\/h4>\n<p>  \u0410 \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0435\u0442, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u0441\u0442\u044b\u043b\u044c \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0443.         <\/p>\n<div class=\"clear\"><\/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:\/\/geektimes.ru\/post\/253034\/\"> http:\/\/geektimes.ru\/post\/253034\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<br \/>\n<h4>\u0417\u0430\u0447\u0435\u043c? \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u0438<\/h4>\n<p>  \u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u0420\u0430\u0431\u043e\u0442\u0430\u044e \u044f \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u2013 \u043c\u044b \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0438 \u0431\u043b\u043e\u043a\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0438\u0445 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u043b\u044f \u043d\u0430\u0437\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430. \u0422\u0430\u043a \u0443\u0436 \u0443 \u043d\u0430\u0441 \u0437\u0430\u0434\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432\u0435\u0440\u0441\u0438\u0439 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u041f\u041e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c\/\u0431\u0430\u0433\u0430\u043c\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0437\u0430\u0448\u0438\u0432\u0430\u043b\u0438 \u0432 \u0440\u0430\u0437\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u0437\u0430\u0434\u0430\u0447: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u041f\u041e \u0438\u043b\u0438 \u0435\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432 \u0437\u0430\u0448\u0438\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0431\u043b\u043e\u043a\u0435. <\/p>\n<p>  \u0420\u0430\u043d\u0435\u0435, \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0441\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u0438 \u041f\u041e. \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043d\u0430 git \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u0447\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u043d\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0430\u043c\u0438\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-260778","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/260778","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=260778"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/260778\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=260778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=260778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=260778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}