Differences
This shows you the differences between the selected revisions of the page.
2011-03-07 | 2011-03-09 | ||
Restored revision 1287296327. Undoing revision 1299496319. (martin) (hidden) | using only two slashes for comment (martin) | ||
Line 61: | Line 61: | ||
if (winscp.ExitCode != 0) | if (winscp.ExitCode != 0) | ||
{ | { | ||
- | /// Error processing | + | // Error processing |
} | } | ||
else | else | ||
{ | { | ||
- | /// Success processing | + | // Success processing |
} | } | ||
</code> | </code> | ||
Line 113: | Line 113: | ||
const string logname = "log.xml"; | const string logname = "log.xml"; | ||
- | /// Run hidden WinSCP process | + | // Run hidden WinSCP process |
Process winscp = new Process(); | Process winscp = new Process(); | ||
winscp.StartInfo.FileName = "winscp.com"; | winscp.StartInfo.FileName = "winscp.com"; | ||
Line 123: | Line 123: | ||
winscp.Start(); | winscp.Start(); | ||
- | /// Feed in the scripting commands | + | // Feed in the scripting commands |
winscp.StandardInput.WriteLine("option batch abort"); | winscp.StandardInput.WriteLine("option batch abort"); | ||
winscp.StandardInput.WriteLine("option confirm off"); | winscp.StandardInput.WriteLine("option confirm off"); | ||
Line 131: | Line 131: | ||
winscp.StandardInput.Close(); | winscp.StandardInput.Close(); | ||
- | /// Collect all output (not used in this example) | + | // Collect all output (not used in this example) |
string output = winscp.StandardOutput.ReadToEnd(); | string output = winscp.StandardOutput.ReadToEnd(); | ||
- | /// Wait until WinSCP finishes | + | // Wait until WinSCP finishes |
winscp.WaitForExit(); | winscp.WaitForExit(); | ||
- | /// Parse and interpret the XML log | + | // Parse and interpret the XML log |
- | /// (Note that in case of fatal failure the log file may not exist at all) | + | // (Note that in case of fatal failure the log file may not exist at all) |
XPathDocument log = new XPathDocument(logname); | XPathDocument log = new XPathDocument(logname); | ||
XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable()); | XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable()); | ||
Line 144: | Line 144: | ||
XPathNavigator nav = log.CreateNavigator(); | XPathNavigator nav = log.CreateNavigator(); | ||
- | /// Success (0) or error? | + | // Success (0) or error? |
if (winscp.ExitCode != 0) | if (winscp.ExitCode != 0) | ||
{ | { | ||
Console.WriteLine("Error occured"); | Console.WriteLine("Error occured"); | ||
- | /// See if there are any messages associated with the error | + | // See if there are any messages associated with the error |
foreach (XPathNavigator message in nav.Select("//w:message", ns)) | foreach (XPathNavigator message in nav.Select("//w:message", ns)) | ||
{ | { | ||
Line 157: | Line 157: | ||
else | else | ||
{ | { | ||
- | /// It can be worth looking for directory listing even in case of | + | // It can be worth looking for directory listing even in case of |
- | /// error as possibly only upload may fail | + | // error as possibly only upload may fail |
XPathNodeIterator files = nav.Select("//w:file", ns); | XPathNodeIterator files = nav.Select("//w:file", ns); |