static void Main(string[] args) { int mode = GetMode(args); if (mode == -1) { Usage(args); } else { ControlType control = new ControlType(); control.valet = 1; // VALET_SCORING_IAF; control.leadFlag = true; control.datumHardRounding = false; int errorCode; char[] line = new char[160]; if ((errorCode = VlibImport.ValetSetControl(ref control)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(line); } else { VlibImport.ValetClear(); VlibImport.ValetSetBoardNumber(1); if (mode == 0) { for (int i = 0; i < TEST_ENTRIES; i++) { char[] inputline = (example[i] + "\0").ToCharArray(); if ((errorCode = VlibImport.ValetAddByLine(inputline)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(example[i]); Console.WriteLine(line); } } } else if (mode == 1) { PlayersTagType players = new PlayersTagType(); InputResultType input = new InputResultType(); for (uint i = 0; i < TEST_ENTRIES; i++) { SetTagInputs(ref players, ref input, i); if ((errorCode = VlibImport.ValetAddByTag(ref players, ref input)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(line); } } } else { PlayersNumberType players = new PlayersNumberType(); InputResultType input = new InputResultType(); for (uint i = 0; i < TEST_ENTRIES; i++) { SetNumberInputs(ref players, ref input, i); if ((errorCode = VlibImport.ValetAddByNumber(ref players, ref input)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(line); } } } VlibImport.ValetCalculate(); if (mode == 0 || mode == 1) { PositionsTagType players = new PositionsTagType(); OutputResultType output = new OutputResultType(); while (VlibImport.ValetGetNextScoreByTag(ref players, ref output)) { if (!output.declFlag1 && !output.declFlag2) { PrintPassedResultByTag(players, output); } else { PrintPlayedResultByTag(players, output); } Console.WriteLine(); } } else { PositionsNumberType players = new PositionsNumberType(); OutputResultType output = new OutputResultType(); while (VlibImport.ValetGetNextScoreByNumber(ref players, ref output)) { if (players.decl1 == 0 || players.decl2 == 0 || players.def1 == 0 || players.def1 == 0) { Console.WriteLine("A player tag was not numerical"); } else { if (!output.declFlag1 && !output.declFlag2) { PrintPassedResultByNumber(players, output); } else { PrintPlayedResultByNumber(players, output); } } Console.WriteLine(); } } } } Console.WriteLine("Press any key to exit"); Console.ReadKey(); }
public static extern int ValetSetControl(ref ControlType control);
static void Main(string[] args) { int mode = GetMode(args); if (mode == -1) { Usage(args); } else { ControlType control = new ControlType(); control.valet = 1; // VALET_SCORING_IAF; control.leadFlag = true; control.datumHardRounding = false; int errorCode; char[] line = new char[160]; if ((errorCode = VlibImport.ValetSetControl(ref control)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(line); } else { VlibImport.ValetClear(); VlibImport.ValetSetBoardNumber(1); if (mode == 0) { for (int i = 0; i < TEST_ENTRIES; i++) { char[] inputline = (example[i] + "\0").ToCharArray(); if ((errorCode = VlibImport.ValetAddByLine(inputline)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(example[i]); Console.WriteLine(line); } } } else if (mode == 1) { PlayersTagType players = new PlayersTagType(); InputResultType input = new InputResultType(); for (uint i = 0; i < TEST_ENTRIES; i++) { SetTagInputs(ref players, ref input, i); if ((errorCode = VlibImport.ValetAddByTag( ref players, ref input)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(line); } } } else { PlayersNumberType players = new PlayersNumberType(); InputResultType input = new InputResultType(); for (uint i = 0; i < TEST_ENTRIES; i++) { SetNumberInputs(ref players, ref input, i); if ((errorCode = VlibImport.ValetAddByNumber(ref players, ref input)) != RETURN_NO_FAULT) { VlibImport.ValetErrorMessage(errorCode, line); Console.WriteLine(line); } } } VlibImport.ValetCalculate(); if (mode == 0 || mode == 1) { PositionsTagType players = new PositionsTagType(); OutputResultType output = new OutputResultType(); while (VlibImport.ValetGetNextScoreByTag(ref players, ref output)) { if (!output.declFlag1 && !output.declFlag2) PrintPassedResultByTag(players, output); else PrintPlayedResultByTag(players, output); Console.WriteLine(); } } else { PositionsNumberType players = new PositionsNumberType(); OutputResultType output = new OutputResultType(); while (VlibImport.ValetGetNextScoreByNumber(ref players, ref output)) { if (players.decl1 == 0 || players.decl2 == 0 || players.def1 == 0 || players.def1 == 0) { Console.WriteLine("A player tag was not numerical"); } else { if (!output.declFlag1 && !output.declFlag2) PrintPassedResultByNumber(players, output); else PrintPlayedResultByNumber(players, output); } Console.WriteLine(); } } } } Console.WriteLine("Press any key to exit"); Console.ReadKey(); }