diff options
author | emkael <emkael@tlen.pl> | 2012-11-17 13:55:44 +0000 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2012-11-17 13:55:44 +0000 |
commit | 732d3a0a0cf46cd041748d8b0f81d26e1e459a0a (patch) | |
tree | acf1526ee7f29706f87443e845bbe58eb989e751 /Analizator9000/Analizator9000/DealerWrapper.cs | |
parent | 4ef50b1d961130eb86b5a0e10431b3847ff849eb (diff) |
* code documentation
git-svn-id: https://svn.emkael.info/an9k@19 05ec0d5d-773b-4d93-9e23-c81a7ac79feb
Diffstat (limited to 'Analizator9000/Analizator9000/DealerWrapper.cs')
-rw-r--r-- | Analizator9000/Analizator9000/DealerWrapper.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Analizator9000/Analizator9000/DealerWrapper.cs b/Analizator9000/Analizator9000/DealerWrapper.cs index 4184d8e..e538d5e 100644 --- a/Analizator9000/Analizator9000/DealerWrapper.cs +++ b/Analizator9000/Analizator9000/DealerWrapper.cs @@ -8,15 +8,42 @@ using System.Text.RegularExpressions; namespace Analizator9000
{
+ /// <summary>
+ /// Runs dealer generator and captures its output.
+ /// </summary>
class DealerWrapper
{
+ /// <summary>
+ /// Calling user interfaces instance.
+ /// </summary>
private Form1 debugForm;
+ /// <summary>
+ /// Name of the input script file.
+ /// </summary>
private String scriptname;
+ /// <summary>
+ /// Stream to the generation results output file.
+ /// </summary>
private StreamWriter outputFile;
+ /// <summary>
+ /// Flag ensuring only one instance of dealer is running.
+ /// </summary>
private bool running = false;
+ /// <summary>
+ /// Number of lines (deals) to produce.
+ /// </summary>
private long produce = 0;
+ /// <summary>
+ /// Number of lines (deals) already produced.
+ /// </summary>
private long lineCount = 0;
+ /// <summary>
+ /// Dealer wrapper class constructor.
+ /// </summary>
+ /// <param name="scriptname">Input script file name.</param>
+ /// <param name="debugForm">Calling interface form.</param>
+ /// <param name="produce">Number of deals to produce.</param>
public DealerWrapper(String scriptname, Form1 debugForm, long produce)
{
if (!File.Exists(scriptname))
@@ -32,10 +59,19 @@ namespace Analizator9000 this.produce = produce;
}
+ /// <summary>
+ /// Sends a single line to debug field of the calling form.
+ /// </summary>
+ /// <param name="line">Message to be appended to the debug output.</param>
private void debugWriteLine(String line) {
this.debugForm.addStatusLine(line);
}
+ /// <summary>
+ /// Processes a chunk of dealer output.
+ /// </summary>
+ /// <param name="data">Output string of dealer instance.</param>
+ /// <returns>TRUE if dealer it still running, FALSE if null string arrived -> process ended.</returns>
private bool handleData(string data)
{
if (data != null)
@@ -59,12 +95,23 @@ namespace Analizator9000 return false;
}
+ /// <summary>
+ /// Closes the output file stream.
+ /// </summary>
public void closeFile()
{
this.outputFile.Close();
}
+ /// <summary>
+ /// Delegate for process end callback invocation.
+ /// </summary>
+ /// <param name="filename">Output file name.</param>
private delegate void onEndDelegate(String filename);
+ /// <summary>
+ /// Worker method for dealer generating.
+ /// </summary>
+ /// <param name="onEnd">Callback to the function which takes output file name as a parameter.</param>
public void run(Action<String> onEnd)
{
if (!this.running)
|