Пример #1
0
        private static void writeRatePage()
        {
            long parsedDate = parsedDateTime / 1000000L;

            using (MutexObject.section(Consts.MTX_OUTPUT))
            {
                foreach (string code in currencyPairs.Keys)
                {
                    CurrencyData i = currencyPairs[code];

                    string wFile = Path.Combine(wRootDir, parsedDate + "_" + code + ".act");
                    string line  =
                        parsedDateTime + "," +
                        i.sOpen + "," +
                        i.sHigh + "," +
                        i.sLow + "," +
                        i.sAsk + "," +
                        i.sBid;

                    Console.WriteLine("< " + line);
                    Console.WriteLine("> " + wFile);

                    File.AppendAllLines(wFile, new string[] { line }, Encoding.ASCII);

                    Console.WriteLine("write-ok");
                }
            }
        }
Пример #2
0
        public EngineTh()
        {
            try
            {
                init();
            }
            catch (Exception e)
            {
                FaultOperation.caught(e);
            }

            th = new Thread((ThreadStart) delegate
            {
                while (death == false)
                {
                    using (MutexObject.section(m))
                    {
                        try
                        {
                            perform();
                        }
                        catch (Exception e)
                        {
                            Gnd.i.logger.writeLine("EngineTh error: " + e);

                            doInvoke(delegate
                            {
                                FaultOperation.caught(e);
                            });

                            Gnd.i.logger.writeLine("EngineTh MBoxラッシュ回避 wait start");

                            for (int c = 0; c < 15 && death == false; c++)                             // MBoxラッシュ回避
                            {
                                Thread.Sleep(2000);
                            }

                            Gnd.i.logger.writeLine("EngineTh MBoxラッシュ回避 wait end");
                        }
                    }
                    Thread.Sleep(100);
                }
            });
            th.Start();

            Gnd.i.logger.writeLine("EngineTh started");
        }