このサイトは別な国語を表示されています。下手な翻訳に申し訳ないです。もし手伝いたいなら、私に連絡してください。

見せる/隠す
何か
2008年 2月 19日 火曜日 06:13:01 MDT

このURL: http://ja.pastebin.ca/909715
代替物: プレーンテキスト
言語: C# ソース
齢: 4ヶ月6日17時間55分と18秒
  1. class AutoExtracter {
  2.         BackgroundWorker backgroundWorker1;
  3.         Process notePad;
  4.         string Directory = "";
  5.  
  6.         System.Windows.Forms.RichTextBox output;
  7.    
  8.        
  9.         // This delegate enables asynchronous calls for setting
  10.         // the text property on a TextBox control.
  11.         delegate void SetTextCallback(string text);
  12.  
  13.         public AutoExtracter() {
  14.             backgroundWorker1 = new BackgroundWorker();
  15.             this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
  16.             this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
  17.         }
  18.  
  19.         void dostuff() {
  20.             if(dirs != null) {
  21.                 Directory = dirs[counter++];
  22.                 this.output = "";
  23.                 backgroundWorker1.RunWorkerAsync();
  24.             }
  25.         }     
  26.  
  27.         private void SetText(string text) {
  28.             // InvokeRequired required compares the thread ID of the
  29.             // calling thread to the thread ID of the creating thread.
  30.             // If these threads are different, it returns true.
  31.                        
  32.             if(this.output.InvokeRequired) {
  33.                 SetTextCallback d = new SetTextCallback(SetText);
  34.                 this.Invoke(d, new object[] { text });
  35.             } else {
  36.                 this.output.Text += text + "\r\n";
  37.             }
  38.         }
  39.  
  40.         void notePad_OutputDataReceived(object sender, DataReceivedEventArgs e) {
  41.             this.SetText(e.Data);
  42.         }
  43.  
  44.         private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) {
  45.             if(!String.IsNullOrEmpty(Directory)) {
  46.                 notePad = new Process();
  47.                 notePad.StartInfo.FileName = @"filenamehere";
  48.              
  49.                 notePad.StartInfo.Arguments = "vt \""+Directory+"\"";
  50.                 notePad.OutputDataReceived += new DataReceivedEventHandler(notePad_OutputDataReceived);
  51.                 notePad.StartInfo.CreateNoWindow = true;
  52.                 notePad.StartInfo.RedirectStandardOutput = true;
  53.                 notePad.StartInfo.UseShellExecute = false;
  54.                 notePad.Start();
  55.                 notePad.BeginOutputReadLine();
  56.                 notePad.WaitForExit();
  57.             }
  58.         }
  59.  
  60.         private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
  61.             Regex obj = new Regex("--------[\n\r]*? ((.|\r|\n)*?)[\r\n]*?------", RegexOptions.Multiline);
  62.             Regex obj2 = new Regex("(.*?)\\r");
  63.             Regex obj3 = new Regex("(\\d+)(\\s+\\d+\\s+[\\d%<>-]+\\s+[\\d-]+\\s[\\d:]+\\s+)([\\w\\.-]+)");
  64.  
  65.             string[] d = obj.Match(output).Groups[1].Value.Split('\n');
  66.  
  67.             List<dir> ls = new List<dir>();
  68.  
  69.             for(int i = 0; i<d.Length; i+=3) {
  70.                 dir di = new dir();
  71.                 if(!obj2.Match(d[i]).Groups[1].Value.Trim().Contains("Data header type:")) {
  72.                    
  73.                    
  74.                         ls.Add(di);
  75.                    
  76.                 }
  77.             } 
  78.  
  79.            
  80.         }
  81.  
  82.      
  83.     }

合計ペーストビュー回数: 1 — トラックバック (0) — パーマリンクペーストを削除

見せる/隠すポストを更新

このポストは更新できる、または、新しいポストを作成

You may also comment on this post.

ペーストの更新
All posts expire in 30 days by default now.
ポストの詳細 (随意)

注目: ペーストのコンテントだけで必要ですが、以下の情報は便利かも知れません。

名前/タイトルを保存する?

(スペースで切る, 随意)



Please note that information posted here will not expire by default. If you want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right
fantasy-obligation