private static void Main(string[] args) { string fname = null; bool showProcessing = false; bool generateMatrix = false; int tThreads = -1; long tSeeds = -1L; string seedType = null; try { Console.Title = string.Concat(new string[] { "SF.Expand.Secure.GenerateTokens [ init:", DateTime.Now.ToShortDateString(), " ", DateTime.Now.ToLongTimeString(), "]" }); if (ParseCommandLine.Execute(args, out seedType, out fname, out tThreads, out tSeeds, out showProcessing, out generateMatrix)) { GenerateSeeds.Generate(seedType, fname, tThreads, tSeeds, showProcessing, generateMatrix); } Console.ReadKey(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static void Generate(string seedType, string _fname, int tThreads, long tSeeds, bool showProcessing, bool generateMatrix) { DateTime now = DateTime.Now; ArrayList arrayList = new ArrayList(); Thread[] array = new Thread[tThreads]; long num = tSeeds / (long)tThreads; long num2 = tSeeds % (long)tThreads; Thread.Sleep(new Random().Next(1, 9)); int num3; int num4; ThreadPool.GetAvailableThreads(out num3, out num4); string text = BaseFunctions.GenerateSupplierLotNumber(tSeeds.ToString(), null); TokenTypeBaseParams tokenTypeBaseParams = new TokenParamsDAO().loadTokenBaseParams(seedType); generateMatrix = (tokenTypeBaseParams.MovingFactorType == TokenMovingFactorType.TransactionAuthenticationNumber); for (int i = 0; i < array.Length; i++) { array[i] = new Thread(new ParameterizedThreadStart(GenerateSeeds.buildSeeds)); array[i].Start(new object[] { tokenTypeBaseParams, (i == 0) ? (num + num2) : num, text, i.ToString(), arrayList, generateMatrix }); } bool flag; do { flag = true; for (int j = 0; j < array.Length; j++) { if (array[j].IsAlive) { Thread.Sleep(1000); flag = false; break; } } }while (!flag); Console.WriteLine(GenerateSeeds.SyncronizeAllFiles(tThreads, _fname, text, generateMatrix) ? (_fname + " created suceffuly") : (_fname + " not created! ERROR!")); Console.WriteLine("Processing completed on [" + DateTime.Now.Subtract(now).ToString() + "]"); }
static void Main(string[] args) { string sName = null; bool showsResults = false; bool generateMatrix = false; int iThreads = -1; long lTotalSeeds = -1; string sSeedType = null; try { Console.Title = "SF.Expand.Secure.GenerateTokens [ init:" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + "]"; if (ParseCommandLine.Execute(args, out sSeedType, out sName, out iThreads, out lTotalSeeds, out showsResults, out generateMatrix)) { GenerateSeeds.Generate(sSeedType, sName, iThreads, lTotalSeeds, showsResults, generateMatrix); } Console.ReadKey(); return; } catch (Exception ex) { Console.WriteLine(ex.Message); } }