private bool IsClientStale()
        {
            var directoryInfo = new DirectoryInfo(clientConfig.DbDir);

            if (directoryInfo.Exists)
            {
                var pid = directoryInfo.Parent.GetFiles("*.pid");
                if (pid.Length > 0)
                {
                    throw new Exception(String.Format("Существует pid файл {0}, забыл закрыть консоль?", pid[0].FullName));
                }
            }
            var sanityCheck = new SanityCheck();

            sanityCheck.Config = clientConfig;
            //если схема изменилась нужно обновить эталонную копию, иначе в эталонной копии не будет полей
            if (sanityCheck.Check())
            {
                return(true);
            }
            using (var session = Factory.OpenSession()) {
                var user = session.Query <User>().FirstOrDefault();
                if (user == null || serverUserId != user.Id)
                {
                    return(true);
                }
            }
            return(false);
        }
        void Start()
        {
            SanityCheck.Check(this, CCCP, FluffingADuck);

            PlayTrack(SceneManager.GetActiveScene());
            SceneManager.activeSceneChanged += UpdateMusic;
            FluffingADuck.Play();
        }
Example #3
0
        void Start()
        {
            SanityCheck.Check(this, SpriteRenderer, AudioSource);

            RandomizeDelta();
            AudioSource.pitch = UnityEngine.Random.Range(0.8f, 1.25f);
            Reposition();
            transform.eulerAngles += new Vector3(0.0f, 0.0f, -boardAngle);
            CorrectAngle();
        }
Example #4
0
        protected void Start()
        {
            SanityCheck.Check(this, CurrentEye, Index >= 1 && Index <= 3);

            //switch (Index)
            //{
            //    case 1:
            //        transform.Find("Display").GetComponent<MeshRenderer>().material.color = Color.black;
            //        break;
            //    case 2:
            //        transform.Find("Display").GetComponent<MeshRenderer>().material.color = Color.gray;
            //        break;
            //    case 3:
            //        transform.Find("Display").GetComponent<MeshRenderer>().material.color = Color.white;
            //        break;
            //    default:
            //        DebugLogger.Warn("unexpected index in arrow controller start");
            //        break;
            //}
        }
Example #5
0
        void Start()
        {
            SanityCheck.Check(this, Cell, LilyPad, Board, ButtonSkip, ButtonCredits);

            Handler       = this;
            _sceneCurrent = SceneManager.GetActiveScene().name;
            if (_gameBeat || SceneType.TutorialReact == _sceneCurrent || SceneType.TutorialRotate == _sceneCurrent)
            {
                if (SceneType.Hard != _sceneCurrent && SceneType.Replay != _sceneCurrent && SceneType.Menu != _sceneCurrent && SceneType.Credits != _sceneCurrent)
                {
                    Instantiate(ButtonSkip);
                }
            }

            if (_gameBeat && SceneType.Menu == _sceneCurrent)
            {
                Instantiate(ButtonCredits);
            }

            GenerateLevel();
        }
        private void InitDb()
        {
            if (NHibernate != null)
            {
                return;
            }

            SqlMapperExtensions.GetDatabaseType = x => "mysqlconnection";
            NHibernate = new Config.NHibernate.NHibernate();
            NHibernate.Init();

            if (Config.Cmd.Match("repair"))
            {
                using (var cmd = new RepairDb(Config)) {
                    cmd.Execute();
                }
            }

            var count = 0;

repeat:
            try {
                count++;
                using (var sanityCheck = new SanityCheck(Config)) {
                    sanityCheck.Check(Config.Cmd.Match("import"));
                }
            }
            catch (Exception e) {
                log.Error("Ошибка при запуске приложения", e);
                if (count > 1 || !RepairDb.TryToRepair(e, Config))
                {
                    throw;
                }
                goto repeat;
            }
        }
        public void Migrate()
        {
            var priceId    = localSession.Query <Price>().First().Id.PriceId;
            var supplierId = localSession.Query <Supplier>().First().Id;
            var addressId  = localSession.Query <Address>().First().Id;

            Directory.GetFiles(".", "*.txt").Each(File.Delete);
            FileHelper.InitDir("in\\update");
            localSession.Clear();
            DbHelper.Drop();
            using (var sanityCheck = new SanityCheck(clientConfig))
                sanityCheck.Check(true);

            using (var cleaner = new FileCleaner()) {
                var cmd = new UpdateCommand();
                cmd.Configure(settings, clientConfig);
                cmd.Process(() => {
                    cmd.Download();
                    var dir = Directory.CreateDirectory("in\\update");
                    cleaner.WatchDir(dir.FullName);
                    new DirectoryInfo(clientConfig.UpdateTmpDir).EnumerateFiles().Each(x => {
                        x.MoveTo(Path.Combine(dir.FullName, x.Name));
                    });
                    //идентфикаторы в тестовых данных
                    return(UpdateResult.OK);
                });

                cmd = new UpdateCommand();
                cmd.Configure(settings, clientConfig);
                cmd.Process(() => {
                    new DirectoryInfo("../../Assets/").EnumerateFiles().Each(x => cleaner.Watch(x.CopyTo(x.Name, true).FullName));
                    cmd.Migrate();
                    return(UpdateResult.OK);
                });
            }
            //идентификаторы не совпадают тк данные для переноса статичные, подделываем id для проверки
            localSession.CreateSQLQuery(@"
update Prices set PriceId = 7537 where PriceId = :priceId;
update Suppliers set Id = 234 where Id = :supplierId;
update Addresses set Id =  2575 where Id = :addressId")
            .SetParameter("priceId", priceId)
            .SetParameter("supplierId", supplierId)
            .SetParameter("addressId", addressId)
            .ExecuteUpdate();

            settings = localSession.Query <Settings>().First();
            Assert.IsNotNull(settings.Password);
            Assert.AreEqual(Taxation.Nds, settings.Waybills[0].Taxation);
            var map = localSession.Query <DirMap>().First(x => x.Supplier.Id == 18089);

            Assert.AreEqual(".\\Загрузка\\Предельные цены производителей", map.Dir);

            var order = localSession.Query <Order>().First();

            Assert.IsNotNull(order.Price);
            Assert.IsNotNull(order.Address);
            Assert.That(order.Lines[0].ResultCost, Is.GreaterThan(0));
            Assert.That(order.Lines[0].Producer, Is.Not.Null.Or.Empty);

            var sentOrder = localSession.Query <SentOrder>().First();

            Assert.IsNotNull(sentOrder.Price);
            Assert.IsNotNull(sentOrder.Address);
            Assert.That(sentOrder.Lines[0].ResultCost, Is.GreaterThan(0));
            Assert.That(sentOrder.Lines[0].Producer, Is.Not.Null.Or.Empty);

            var waybill = localSession.Query <Waybill>().First(x => x.Id == 39153110);

            Assert.IsNotNull(waybill.Supplier);
            Assert.IsNotNull(waybill.Address);
            var line = waybill.Lines.FirstOrDefault(x => x.SerialNumber == "10891996");

            Assert.AreEqual(35, line.MaxRetailMarkup);
            Assert.AreEqual(678.50, line.RetailCost);
            Assert.AreEqual(35, line.RetailMarkup);
            Assert.AreEqual(35, line.RealRetailMarkup);

            line = waybill.Lines.FirstOrDefault(x => x.SerialNumber == "10137353" &&
                                                x.Product.Contains("Ацетилсалициловой"));
            Assert.AreEqual(29.99m, line.RetailMarkup);
            Assert.AreEqual(70.21m, line.RealRetailMarkup);
            Assert.AreEqual(613.70m, line.RetailCost);

            line = waybill.Lines.FirstOrDefault(x => x.SerialNumber == "017022014");
            Assert.AreEqual(21.36m, line.RetailMarkup);
            Assert.AreEqual(49.99m, line.RealRetailMarkup);
            Assert.AreEqual(540.80m, line.RetailCost);

            line = waybill.Lines.FirstOrDefault(x => x.SerialNumber == "156014");
            Assert.AreEqual(77.63m, line.RetailMarkup);
            Assert.AreEqual(82.03m, line.RealRetailMarkup);
            Assert.AreEqual(500m, line.RetailCost);
        }
Example #8
0
 protected void Start()
 {
     SanityCheck.Check(this, _target);
 }
Example #9
0
 protected void Start()
 {
     DebugLogger.Log("eye controller is on", this);
     SanityCheck.Check(this, EyeController, QxSlider, QySlider, QzSlider, QwSlider, XSlider, YSlider, ZSlider, QxText, QyText, QzText, QwText, XText, YText, ZText);
 }
 public void Make_check()
 {
     check.Check();
 }
Example #11
0
 void Start()
 {
     SanityCheck.Check(this, Scene);
 }
Example #12
0
 void Start()
 {
     SanityCheck.Check(this, SpriteRenderer);
 }