| 1 |
/* |
| 2 |
* FeliCa2Money |
| 3 |
* |
| 4 |
* Copyright (C) 2001-2008 Takuya Murakami |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU General Public License as published by |
| 8 |
* the Free Software Foundation; either version 2 of the License, or |
| 9 |
* (at your option) any later version. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this program; if not, write to the Free Software |
| 18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 |
*/ |
| 20 |
|
| 21 |
using System; |
| 22 |
using System.Collections.Generic; |
| 23 |
using System.Text; |
| 24 |
using System.Diagnostics; |
| 25 |
|
| 26 |
namespace FeliCa2Money |
| 27 |
{ |
| 28 |
class SfcPeep |
| 29 |
{ |
| 30 |
private List<string> lines; |
| 31 |
|
| 32 |
// SFCPeep ��������������������������������������������������������� |
| 33 |
public List<string> Execute(string arg) |
| 34 |
{ |
| 35 |
lines = new List<string>(); |
| 36 |
|
| 37 |
string SfcPeepPath = FeliCa2Money.Properties.Settings.Default.SFCPeepPath; |
| 38 |
|
| 39 |
Process p = new Process(); |
| 40 |
p.StartInfo.FileName = SfcPeepPath; |
| 41 |
p.StartInfo.Arguments = arg; |
| 42 |
p.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(SfcPeepPath); |
| 43 |
p.StartInfo.UseShellExecute = false; |
| 44 |
p.StartInfo.RedirectStandardOutput = true; |
| 45 |
p.StartInfo.CreateNoWindow = true; |
| 46 |
p.OutputDataReceived += new DataReceivedEventHandler(EventHandler_OutputDataReceived); |
| 47 |
p.Start(); |
| 48 |
|
| 49 |
p.BeginOutputReadLine(); |
| 50 |
p.WaitForExit(); |
| 51 |
|
| 52 |
return lines; |
| 53 |
} |
| 54 |
|
| 55 |
private void EventHandler_OutputDataReceived(object sender, DataReceivedEventArgs ev) |
| 56 |
{ |
| 57 |
if (ev.Data != null) |
| 58 |
{ |
| 59 |
lines.Add(ev.Data); |
| 60 |
} |
| 61 |
} |
| 62 |
} |
| 63 |
} |