protected internal virtual void ExecuteCommand(OptionItem optionItem, Option systemOption, Out @out) { OptionItem nameItem = OptionUtility.GetItemByName(optionItem, systemOption, false); if (CheckOption(nameItem, "-b:b") == true) { this.baseOpt_ = 1; } else if (CheckOption(nameItem, "-b:c") == true) { this.baseOpt_ = 2; } else if (CheckOption(nameItem, "-b:e") == true) { this.baseOpt_ = 3; } else if (CheckOption(nameItem, "-b:ex") == true) { this.baseOpt_ = 4; } else if (CheckOption(nameItem, "-c:a") == true) { this.category_ |= Category.ToValue("adj"); } else if (CheckOption(nameItem, "-c:all") == true) { this.category_ |= 0x7FF; } else if (CheckOption(nameItem, "-c:b") == true) { this.category_ |= Category.ToValue("adv"); } else if (CheckOption(nameItem, "-c:c") == true) { this.category_ |= Category.ToValue("compl"); } else if (CheckOption(nameItem, "-c:d") == true) { this.category_ |= Category.ToValue("det"); } else if (CheckOption(nameItem, "-c:h") == true) { LexAccessHelp.CategoryHelp(this.outWriter_, this.fileOutput_, @out); this.runFlag_ = false; } else if (CheckOption(nameItem, "-c:j") == true) { this.category_ |= Category.ToValue("conj"); } else if (CheckOption(nameItem, "-c:m") == true) { this.category_ |= Category.ToValue("modal"); } else if (CheckOption(nameItem, "-c:n") == true) { this.category_ |= Category.ToValue("noun"); } else if (CheckOption(nameItem, "-c:p") == true) { this.category_ |= Category.ToValue("prep"); } else if (CheckOption(nameItem, "-c:r") == true) { this.category_ |= Category.ToValue("pron"); } else if (CheckOption(nameItem, "-c:v") == true) { this.category_ |= Category.ToValue("verb"); } else if (CheckOption(nameItem, "-c:x") == true) { this.category_ |= Category.ToValue("aux"); } else if (CheckOption(nameItem, "-ci") == true) { try { bool useClassPath = false; string configFile = this.configFile_; if (string.ReferenceEquals(configFile, null)) { useClassPath = true; configFile = "data.config.lexAccess"; } Configuration conf = new Configuration(configFile, useClassPath); if (this.properties_ != null) { conf.OverwriteProperties(this.properties_); } @out.Println(this.outWriter_, conf.GetInformation(), this.fileOutput_, false); } catch (IOException) { } this.runFlag_ = false; } else if (CheckOption(nameItem, "-cn:LONG") == true) { long cat = long.Parse(nameItem.GetOptionArgument()); if ((cat <= 0L) || (cat > 2047L)) { string temp = "*** Error: Illegal value for category (" + cat + ")."; try { @out.Println(this.outWriter_, temp, this.fileOutput_, false); } catch (IOException) { } this.runFlag_ = false; } else { this.category_ = long.Parse(nameItem.GetOptionArgument()); } } else if (CheckOption(nameItem, "-cnf:LONG") == true) { this.outCat_ = long.Parse(nameItem.GetOptionArgument()); } else if (CheckOption(nameItem, "-f:b") == true) { this.formatOpt_ = 3; } else if (CheckOption(nameItem, "-f:bd") == true) { this.formatOpt_ = 4; } else if (CheckOption(nameItem, "-f:h") == true) { LexAccessHelp.FormatHelp(this.outWriter_, this.fileOutput_, @out); this.runFlag_ = false; } else if (CheckOption(nameItem, "-f:i") == true) { this.formatOpt_ = 7; } else if (CheckOption(nameItem, "-f:id") == true) { this.formatOpt_ = 8; } else if (CheckOption(nameItem, "-f:s") == true) { this.formatOpt_ = 5; } else if (CheckOption(nameItem, "-f:sd") == true) { this.formatOpt_ = 6; } else if (CheckOption(nameItem, "-f:t") == true) { this.formatOpt_ = 0; } else if (CheckOption(nameItem, "-f:tx") == true) { this.formatOpt_ = 2; } else if (CheckOption(nameItem, "-f:x") == true) { this.formatOpt_ = 1; } else if (CheckOption(nameItem, "-h") == true) { LexAccessHelp.LexAccessHelp(this.outWriter_, this.fileOutput_, @out); this.runFlag_ = false; } else if (CheckOption(nameItem, "-hs") == true) { systemOption.PrintOptionHierachy(); this.runFlag_ = false; } else if (CheckOption(nameItem, "-i:STR") == true) { string inFile = nameItem.GetOptionArgument(); if (!string.ReferenceEquals(inFile, null)) { try { this.inReader_ = new System.IO.StreamReader( new System.IO.FileStream(inFile, System.IO.FileMode.Open, System.IO.FileAccess.Read), Encoding.UTF8); } catch (IOException) { this.runFlag_ = false; Console.Error.WriteLine("**Error: problem of opening/reading file " + inFile); } } } else if (CheckOption(nameItem, "-n") == true) { this.noOutputFlag_ = true; } else if (CheckOption(nameItem, "-o:STR") == true) { string outFile = nameItem.GetOptionArgument(); if (!string.ReferenceEquals(outFile, null)) { try { this.outWriter_ = new System.IO.StreamWriter( new System.IO.FileStream(outFile, System.IO.FileMode.Create, System.IO.FileAccess.Write), Encoding.UTF8); this.fileOutput_ = true; } catch (IOException) { this.runFlag_ = false; Console.Error.WriteLine("**Error: problem of opening/writing file " + outFile); } } } else if (CheckOption(nameItem, "-p") == true) { this.promptFlag_ = true; } else if (CheckOption(nameItem, "-q") == true) { this.query_ = this.option_.GetOptionStr(); this.showQuery_ = true; } else if (CheckOption(nameItem, "-rv:STR") == true) { this.version_ = nameItem.GetOptionArgument(); if (!SetVersionInConfig(this.version_)) { Console.Error.WriteLine("**Err@LexAccessCmdApi(): Illegal version setting (" + this.version_ + ")"); this.runFlag_ = false; } } else if (CheckOption(nameItem, "-s:STR") == true) { string separator = nameItem.GetOptionArgument(); if (separator.Equals("\\t")) { separator = (new char?('\t')).ToString(); } GlobalBehavior.GetInstance().SetFieldSeparator(separator); } else if (CheckOption(nameItem, "-t") == true) { this.showTotalRecNum_ = true; } else if (CheckOption(nameItem, "-v") == true) { try { string releaseStr = "lexAccess.2016"; @out.Println(this.outWriter_, releaseStr, this.fileOutput_, false); } catch (IOException) { } this.runFlag_ = false; } else if (CheckOption(nameItem, "-x:STR") == true) { this.configFile_ = nameItem.GetOptionArgument(); } }
protected internal virtual void ExecuteCommand(OptionItem optionItem, Option systemOption, Out @out) { OptionItem nameItem = OptionUtility.GetItemByName(optionItem, systemOption, false); if (CheckOption(nameItem, "-d") == true) { debugFlag_ = true; } else if (CheckOption(nameItem, "-f:r") == true) { format_ = 4; } else if (CheckOption(nameItem, "-f:t") == true) { format_ = 0; } else if (CheckOption(nameItem, "-f:tx") == true) { format_ = 3; } else if (CheckOption(nameItem, "-f:x") == true) { format_ = 1; } else if (CheckOption(nameItem, "-f:nxh") == true) { printXmlHeader_ = false; } else if (CheckOption(nameItem, "-h") == true) { helpMenu(@out); runFlag_ = false; } else if (CheckOption(nameItem, "-hs") == true) { systemOption.PrintOptionHierachy(); runFlag_ = false; } else if (CheckOption(nameItem, "-i:STR") == true) { string inFile = nameItem.GetOptionArgument(); if (!string.ReferenceEquals(inFile, null)) { try { inReader_ = new System.IO.StreamReader( new System.IO.FileStream(inFile, System.IO.FileMode.Open, System.IO.FileAccess.Read), Encoding.UTF8); } catch (IOException) { runFlag_ = false; Console.Error.WriteLine("**Error: problem of opening/reading file " + inFile); } } } else if (CheckOption(nameItem, "-o:STR") == true) { string outFile = nameItem.GetOptionArgument(); try { outWriter_ = new System.IO.StreamWriter( new System.IO.FileStream(outFile, System.IO.FileMode.Create, System.IO.FileAccess.Write), Encoding.UTF8); fileOutput_ = true; } catch (Exception) { runFlag_ = false; Console.Error.WriteLine("**Error: problem of opening/writing file " + outFile); } } else if (CheckOption(nameItem, "-v") == true) { try { string releaseStr = "lexCheck.2016"; @out.Println(outWriter_, releaseStr, fileOutput_, false); } catch (Exception) { } runFlag_ = false; } else if (CheckOption(nameItem, "-x:STR") == true) { configFile_ = nameItem.GetOptionArgument(); } }