public MySQL(Config.Config config)
        {
            this.config = config;
            this.Table = config.Table;

            String connectionString = "server={0};port={1};uid={2};pwd={3};";
            connectionString = String.Format(connectionString,
                config.Host, config.Port, config.User, config.Pass);

            conn = new MySqlConnection();
            conn.ConnectionString = connectionString;
            conn.Open();
            // Create DB
            var cmd = conn.CreateCommand();
            cmd.CommandText = String.Format("CREATE DATABASE IF NOT EXISTS `{0}`;", config.Database);
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            cmd = conn.CreateCommand();
            cmd.CommandText = String.Format("USE `{0}`;", config.Database);
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            // Create Table
            cmd = conn.CreateCommand();
            cmd.CommandText = String.Format(getTableCreateString(), config.Table);
            cmd.ExecuteNonQuery();
            cmd.Dispose();
        }
Beispiel #2
0
 public Setting(Config.Config config)
 {
     this.config = config;
     stores = new Stores(this);
     hosts = new Hosts(this);
     rules = new Rules(this);
 }
Beispiel #3
0
        public MainForm()
        {
            InitializeComponent();

            m_config = ConfigManager.LoadConfig();

            m_focusFactorCalculator = new FocusFactorCalculator(m_config.FocusFactors);

            s_viewColumnsIndexes = new ViewColumnsIndexes(scheduleDataGridView);
            s_planColumnsIndexes = new ViewColumnsIndexes(planningDataGridView);
            ScheduleColumnsPresenter.InitColumns(
                scheduleDataGridView,
                s_viewColumnsIndexes.FirstDateColumnIndex,
                1);
            ScheduleColumnsPresenter.InitColumns(
                planningDataGridView,
                s_planColumnsIndexes.FirstDateColumnIndex,
                3);

            m_holidays = m_config.Holidays;
            s_freeDaysCalculator.SetHolidays(m_holidays);

            UpdateHolidays();

            if (m_config.Vacations.Count > 0)
            {
                vacationsButton.Enabled = true;
                var vacationsUsers = m_config.Vacations.Select(v => v.User).ToList();
                vacationsUsers.Sort();
                workersComboBox.DataSource = vacationsUsers;
                s_freeDaysCalculator.SetVacations(m_config.Vacations);
            }

            tfsUrlTextBox.Text = m_config.TfsUrl;
            s_stateContainer.ByArea = m_config.ByArea;
            if (m_config.WorkMode != WorkMode.Query)
            {
                s_stateContainer.WorkMode = m_config.WorkMode;
                InitFirst();
                queryTextBox.Text = Resources.QueryExample;
            }
            else
            {
                queryTextBox.Text = m_config.QueryPath;
                queryTextBox.ForeColor = Color.Black;
                ParamsGroupBox.Enabled = false;
                makeScheduleButton.Enabled = true;
            }

            m_viewMenuItems = new List<ToolStripMenuItem>
            {
                toggleIterationToolStripMenuItem,
                toggleSprintToolStripMenuItem,
                toggleDevCompletedToolStripMenuItem,
                toggleLTOnlyToolStripMenuItem,
                toggleBlockersToolStripMenuItem,
            };
        }
Beispiel #4
0
        public object FillterAccionSql(Config.Config config, string jsonKeys, TableAction action)
        {
            if (!config.OperationContinue)
            {
                return(null);
            }

            switch (action)
            {
            case TableAction.I:
            case TableAction.U:
                return(Integrate.Save(jsonKeys, config.GetConfigIntegrate(), null));
            }
            return(null);
        }
Beispiel #5
0
        private void LoadSection(Config.Config cfg, String sec)
        {
            int i = 1;

            while (true)
            {
                if (!LoadAssertion(cfg, sec, sec + GetKeySuffix(i)))
                {
                    break;
                }
                else
                {
                    i++;
                }
            }
        }
Beispiel #6
0
 public Config.Config ToConfig()
 {
     Config.Config c = new Config.Config();
     c.AddToBottom(index);
     c.AddToBottom(father == null ? "0" : (father is long?father.ToString() : (((BaseFile)father).index.ToString())));
     c.AddToBottom(son == null ? "0" : (son is long?son.ToString() : (((BaseFile)son).index.ToString())));
     c.AddToBottom(left == null ? "0" : (left is long?left.ToString() : (((BaseFile)left).index.ToString())));
     c.AddToBottom(right == null ? "0" : (right is long?right.ToString() : (((BaseFile)right).index.ToString())));
     c.AddToBottom(url);
     c.AddToBottom((int)type);
     c.AddToBottom((int)state);
     c.AddToBottom(length);
     c.AddToBottom(modify);
     c.AddToBottom(score);
     return(c);
 }
Beispiel #7
0
 public bool MigrateAll(Config.Config config, DateTime?datetimeMin, int year)
 {
     if (!config.OperationContinue)
     {
         return(false);
     }
     if (year > 0)
     {
         datetimeMin = new DateTime(year, 1, 1);
     }
     else if (!datetimeMin.HasValue)
     {
         datetimeMin = new DateTime(DateTime.Now.Year - 1, 1, 1);
     }
     return(Integrate.SaveAll(config.GetConfigIntegrate(), datetimeMin.Value));
 }
Beispiel #8
0
 public CharacterService(ICrudService <ItemContract> itemCrudService,
                         ICrudService <CharacterContract> characterCrudService,
                         ICharacterRepository characterRepository,
                         IItemService itemService,
                         IdFactory idFactory,
                         ItemTable itemTable,
                         Config.Config config)
 {
     _itemCrudService      = itemCrudService;
     _itemService          = itemService;
     _idFactory            = idFactory;
     _itemTable            = itemTable;
     _config               = config;
     _characterCrudService = characterCrudService;
     _characterRepository  = characterRepository;
 }
        public void Get_wait_url()
        {
            var config = new Config.Config();

            config.BaseUrl = new Uri("http://localhost:1056/");
            var waybills = config.SyncUrl("waybills", null, null);

            Assert.AreEqual("Main?reset=true&data=waybills", waybills);
            var url = config.SyncUrl(null, null, new [] { new Address {
                                                              Id = 1
                                                          }, new Address {
                                                              Id = 2
                                                          } });

            Assert.AreEqual("Main?reset=true&data=&addressIds=1%2C2", url);
        }
Beispiel #10
0
        public void Update(Config.Config config)
        {
            Color?backColor = Config.Config.Parse(config.BackgroundColorString);
            Color?fontColor = Config.Config.Parse(config.FontColorString);

            if (backColor.HasValue == false)
            {
                backColor = Colors.Orange;
            }

            if (fontColor.HasValue == false)
            {
                fontColor = Colors.White;
            }

            _notification.Update(backColor.Value, fontColor.Value);
        }
        public void MixedFixtureSetup()
        {
            //в качестве начального значения используется время если оно совпадет то и значения будут идентичные
            //для этого тесты должны иметь общий генератор случайных чисел
            random = new Random();
            begin  = DateTime.Now;
            SystemTime.Reset();

            cleaner    = new FileCleaner();
            disposable = new CompositeDisposable();
            disposable.Add(cleaner);

            fixtureHelper = new FixtureHelper();
            disposable.Add(fixtureHelper);

            clientConfig  = Integration.IntegrationSetup.clientConfig;
            serviceConfig = Integration.IntegrationSetup.serviceConfig;

            FileHelper.InitDir(serviceConfig.RtmUpdatePath,
                               clientConfig.TmpDir,
                               Path.Combine(ConfigurationManager.AppSettings["ClientDocPath"], "АналитФАРМАЦИЯ"));

            localSession   = Integration.IntegrationSetup.Factory.OpenSession();
            localStateless = Integration.IntegrationSetup.Factory.OpenStatelessSession();

            settings = localSession.Query <Settings>().First();
            address  = localSession.Query <Address>().First();

            ViewModelFixture.StubWindowManager();

            var debugTest = Environment.GetEnvironmentVariable("DEBUG_TEST");

            if (debugTest.Match(TestContext.CurrentContext.Test.Name))
            {
                var repository = (Hierarchy)LogManager.GetRepository();
                repository.Configured = true;
                var logger = (Logger)repository.GetLogger("AnalitF.Net");
                if (logger.Level == null || logger.Level > Level.Warn)
                {
                    logger.Level = Level.Warn;
                }
                var appender = new ConsoleAppender(new PatternLayout(PatternLayout.DefaultConversionPattern));
                appender.ActivateOptions();
                logger.AddAppender(appender);
            }
        }
Beispiel #12
0
        public NewsReaderBuilder GetConcreteBuilder(AssetEnum assetEnum, Config.Config config)
        {
            switch (assetEnum)
            {
            case AssetEnum.Diagnostic:
                return(new DiagnosticNewsReaderBuilder(config));

            case AssetEnum.Fuel:
                return(new FuelNewsReaderBuilder(config));

            case AssetEnum.Event:
                return(new EventNewsReaderBuilder(config));

            default:
                throw new Exception();
            }
        }
Beispiel #13
0
        public void Setup()
        {
            tmpFiles = new FileCleaner();
            config   = FixtureSetup.Config;
            client   = TestClient.CreateNaked(session);
            session.Save(client);

            user       = session.Load <User>(client.Users[0].Id);
            controller = new MainController {
                Request     = new HttpRequestMessage(),
                Session     = session,
                CurrentUser = user,
                Config      = config,
            };
            scheduler            = new ManualScheduler();
            RequestLog.Scheduler = scheduler;
        }
Beispiel #14
0
        public static bool TryToRepair(Exception exception, Config.Config config)
        {
            //это проверка происходит при инициализации и если здесь возникло исключение то приложение не запустится
            //и у пользователя не будет возможности что либо сделать по этому лучше перебдеть чем недобдеть
            //все MySqlException трактуются как повреждение базы данных
            if (!exception.Chain().OfType <MySqlException>().Any() && !ErrorHelper.IsDbCorrupted(exception))
            {
                return(false);
            }

            using (var cmd = new RepairDb(config)) {
                cmd.Execute();
                //todo - по хорошему нужно проверить статус и если нашли проблемы, нужно известить человека о том что
                //случилась беда данные были потеряны и отправить на получение кумулятивное обновление
                return(true);
            }
        }
Beispiel #15
0
        public SQLite(Config.Config config)
        {
            this.config = config;
            this.Table  = config.Table;

            string connectionString = "Data Source =" + Environment.CurrentDirectory + "\\SpellEditor.db";;

            conn = new SQLiteConnection(connectionString);
            //conn.ConnectionString = connectionString;
            conn.Open();
            // Create DB
            var cmd = conn.CreateCommand();

            cmd.CommandText = string.Format(getTableCreateString(), config.Table);
            cmd.ExecuteNonQuery();
            cmd.Dispose();
        }
Beispiel #16
0
 private bool TryLoadConfig(string configFile, out Config.Config config)
 {
     config = null;
     if (string.IsNullOrWhiteSpace(configFile))
     {
         configFile = $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\\.oberconfig";
     }
     try
     {
         return(VerifyAndLoadConfig(configFile, out config));
     }
     catch (Exception)
     {
         Logger.Error($"Ì'm unable to load the config file at {configFile}, would you mind to verify if the file exists and is correctly configured?");
         Logger.Info(_configTemplate);
         return(false);
     }
 }
Beispiel #17
0
        public SQLite(Config.Config config)
        {
            _config = config;

            var connectionString = $"Data Source ={Environment.CurrentDirectory}\\{config.Database}.db";

            _connection = new SQLiteConnection(connectionString);
            _connection.Open();
            // Create binding tables
            foreach (var binding in BindingManager.GetInstance().GetAllBindings())
            {
                using (var cmd = _connection.CreateCommand())
                {
                    cmd.CommandText = string.Format(GetTableCreateString(binding), binding.Name);
                    cmd.ExecuteNonQuery();
                }
            }
        }
Beispiel #18
0
 private bool TryLoadConfig(string configFile, out Config.Config config)
 {
     config = null;
     if (string.IsNullOrWhiteSpace(configFile))
     {
         configFile = $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\\.oberconfig";
     }
     try
     {
         return(VerifyAndLoadConfig(configFile, out config));
     }
     catch (Exception)
     {
         Logger.Error(string.Format(StringProvider.GetString(Strings.ConfigError), configFile));
         Logger.Info(StringProvider.GetString(Strings.ConfigTemplate));
         return(false);
     }
 }
        public virtual HttpResponseMessage ToResult(HttpRequestMessage request, Config.Config config)
        {
            if (!IsCompleted)
            {
                return(new HttpResponseMessage(HttpStatusCode.Accepted)
                {
                    Headers = { { "Request-Id", Id.ToString() } },
                });
            }
            if (IsFaulted)
            {
                var message = new HttpResponseMessage(HttpStatusCode.InternalServerError);
                if (!String.IsNullOrEmpty(ErrorDescription))
                {
                    message.Content = new StringContent(ErrorDescription);
                }
#if DEBUG
                else
                {
                    throw new Exception(Error);
                }
#endif
                return(message);
            }

            //файл результата выкладывается на dfs репликация может занять до нескольких минут
            if (config.ResultTimeout > TimeSpan.Zero)
            {
                if (!File.Exists(OutputFile(config)) && DateTime.Now < (CompletedOn + config.ResultTimeout))
                {
                    return new HttpResponseMessage(HttpStatusCode.Accepted)
                           {
                               Headers = { { "Request-Id", Id.ToString() } },
                           }
                }
                ;
            }

            return(new HttpResponseMessage(HttpStatusCode.OK)
            {
                Headers = { { "Request-Id", Id.ToString() } },
                Content = GetResult(request, config)
            });
        }
Beispiel #20
0
        static void Main(string[] args)
        {
            var projectPath = "../../../Netgular.Examples.WebApi/Netgular.Examples.Webapi.csproj";
            var workspace   = MSBuildWorkspace.Create();
            var project     = workspace.OpenProjectAsync(projectPath).Result;
            var compilation = project.GetCompilationAsync().Result;

            var context = new Context.Context(compilation);
            var config  = new Config.Config(Config.NullableMode.Null);

            var symbol  = Transpiler.getType(context, "Netgular.Examples.WebApi.Book");
            var tsModel = Transpiler.transpileInterface(config, context, symbol);

            //TypeScriptEmitter.emitInterface(Console.Out, tsModel);

            var services = ServiceGeneration.generateAllServices(config, context, project);

            Console.ReadKey();
        }
Beispiel #21
0
        public Notifier(Config.Config config)
        {
            _manager = new Notifications.Wpf.NotificationManager();

            Color?backColor = Config.Config.Parse(config.BackgroundColorString);
            Color?fontColor = Config.Config.Parse(config.FontColorString);

            if (backColor.HasValue == false)
            {
                backColor = Colors.Orange;
            }

            if (fontColor.HasValue == false)
            {
                fontColor = Colors.White;
            }

            _notification = new Notification(backColor.Value, fontColor.Value);
        }
Beispiel #22
0
        internal List <string> GetReadableShares(string computer, Config.Config config)
        {
            var readableShares = new List <string>();
            var hostShareInfos = GetHostShareInfo(computer);

            foreach (var hostShareInfo in hostShareInfos)
            {
                var shareName = GetShareName(hostShareInfo, computer, config);
                if (!String.IsNullOrWhiteSpace(shareName))
                {
                    if (IsShareReadable(shareName, config))
                    {
                        readableShares.Add(shareName);
                    }
                }
            }

            return(readableShares);
        }
Beispiel #23
0
 public virtual void Configure(Settings value, Config.Config config,
                               CancellationToken token = default(CancellationToken))
 {
     Config   = config;
     Token    = token;
     Settings = value;
     Cleaner.DefaultRandomFileDir = config.TmpDir;
     if (errorMap.Count == 0)
     {
         if (!String.IsNullOrEmpty(Config.AltUri))
         {
             Config.AltUri.Split(',').Each(x => {
                 errorMap.Add(new Uri(x.Trim()).ToString(), 0);
             });
         }
         else if (Config.BaseUrl != null)
         {
             errorMap.Add(Config.BaseUrl.ToString(), 0);
         }
     }
     if (Client != null)
     {
         Client.Dispose();
         Disposable.Remove(Client);
     }
     if (HttpProgress != null)
     {
         HttpProgress.Dispose();
         Disposable.Remove(HttpProgress);
         HttpProgress.HttpReceiveProgress -= ReceiveProgress;
     }
     if (Handler != null)
     {
         Handler.Dispose();
         Disposable.Remove(Handler);
     }
     Client = Settings.GetHttpClient(Config, ref HttpProgress, ref Handler);
     Disposable.Add(Client);
     Disposable.Add(HttpProgress);
     Disposable.Add(Handler);
     HttpProgress.HttpReceiveProgress += ReceiveProgress;
 }
Beispiel #24
0
        public void Clear_ads()
        {
            var cfg = new Config.Config {
                RootDir = "test-tmp"
            };

            cleaner.WatchDir(cfg.RootDir);
            var adUpdateDir = Path.Combine(cfg.UpdateTmpDir, "ads");

            FileHelper.CreateDirectoryRecursive(adUpdateDir);
            File.WriteAllText(Path.Combine(adUpdateDir, "delete.me"), "");

            var ads = cfg.KnownDirs(new Settings()).First(d => d.Name == "ads");

            FileHelper.CreateDirectoryRecursive(ads.Dst);
            File.WriteAllText(Path.Combine(ads.Dst, "2block.gif"), "");

            new UpdateCommand().Move(ads);
            Assert.AreEqual("test-tmp\\ads\\delete.me", Directory.GetFiles(ads.Dst).Implode());
        }
Beispiel #25
0
 public ResolutionVariablePatcher(Config.Config config)
 {
     _config = new Config.Config();
     OnLocationChangeEventHandler = OnLocationChange;
     User32.SetWinEventHook(EventObjectLocationchange, EventObjectLocationchange, HINSTANCE.NULL, OnLocationChangeEventHandler, (uint)Process.GetCurrentProcess().Id, 0, User32.WINEVENT.WINEVENT_OUTOFCONTEXT);
     _draw2PViewPortHook                   = new Hook <sub_422AF0>(Draw2PViewportHook, 0x422AF0).Activate();
     _drawSpecialStageGaugeHook            = new Hook <sub_5263C0>(DrawSpecialStageGaugeImpl, 0x5263C0).Activate();
     _drawSpecialStageBarHook              = new Hook <sub_526280>(DrawSpecialStageBarImpl, 0x526280, 0xD).Activate();
     _drawSpecialStageEmeraldIndicatorHook = new Hook <sub_458920>(DrawSpecialStageEmeraldImpl, 0x458920).Activate();
     _draw2PStatusHook          = new Hook <sub_422A70>(Draw2pStatusImpl, 0x422A70).Activate();
     _renderPrimitiveHook       = new Hook <_rwD3D8Im2DRenderPrimitive>(RenderPrimitiveImpl, 0x00662B00).Activate();
     _renderVideoHook           = new Hook <sub_644450>(RenderVideoHookImpl, 0x644450).Activate();
     _drawFullVideoFrameHook    = new Hook <DrawFullVideoFrame>(DrawFullVideoFrameHookImpl, 0x0042A100).Activate();
     _drawSmallVideoFrameHook   = new Hook <DrawSmallFrame>(DrawSmallFrameImpl, 0x00429F80).Activate();
     _drawTitlecardElementsHook = new Hook <sub_442850>(DrawTitlecardElementsImpl, 0x442850).Activate();
     _drawSpecialStageLinkHook  = new Hook <sub_526F60>(DrawSpecialStageLinkImpl, 0x526F60).Activate();
     _getVertexBufferSubmission = Wrapper.Create <sub_651E20>(0x651E20);
     _drawNowLoadingHook        = new Hook <sub_44EAC0>(DrawNowLoadingImpl, 0x44EAC0).Activate();
     _executeCreditsHook        = new Hook <sub_4545F0>(ExecuteCredits, 0x4545F0).Activate();
 }
        static LablinkServiceConfig()
        {
            ServiceConfig = new Config.Config(FileName, StrLabLinkService);

            // Load config thiết bị
            // Kiểm tra xem file cấu hình có tồn tại không?
            if (!File.Exists(LablinkServiceConfigurationFile))
            {
                return;
            }

            try
            {
                // Load file thiết bị
                XElement allDevice = XElement.Load(LablinkServiceConfigurationFile);
                Devices = (from d in allDevice.Descendants("Device")
                           select new Device
                {
                    DeviceGuid = new Guid(d.Element("DeviceGuid").Value),
                    DeviceType =
                        (ConnectorType)Enum.Parse(typeof(ConnectorType), d.Element("DeviceType").Value, true),
                    Status = Boolean.Parse(d.Element("Status").Value),
                    DeviceName = d.Element("DeviceName").Value,
                    DeviceAsembly = d.Element("DeviceAsembly").Value,
                    DeviceNameSpace = d.Element("DeviceNameSpace").Value,
                    Connector = d.Element("Connector").Value,
                    BaudRate = int.Parse(d.Element("BaudRate").Value),
                    DataBits = int.Parse(d.Element("DataBits").Value),
                    StopBits = (StopBits)Enum.Parse(typeof(StopBits), d.Element("StopBits").Value, true),
                    Parity = (Parity)Enum.Parse(typeof(Parity), d.Element("Parity").Value, true),
                    Handshake = (Handshake)Enum.Parse(typeof(Handshake), d.Element("Handshake").Value, true),
                    RtsEnable = Boolean.Parse(d.Element("RTSEnable").Value),
                    DtrEnable = Boolean.Parse(d.Element("DTREnable").Value),
                    TimeInterval = int.Parse(d.Element("TimeInterval").Value)
                }).ToList();
            }
            catch (Exception ex)
            {
                //throw ex;
            }
        }
        public void Setup()
        {
            Environment.CurrentDirectory = TestContext.CurrentContext.TestDirectory;

            global::Test.Support.Setup.BuildConfiguration("local");
            var holder = ActiveRecordMediator.GetSessionFactoryHolder();

            var server = new Config.Initializers.NHibernate();

            server.Configuration = holder.GetConfiguration(typeof(ActiveRecordBase));
            server.Init();

            var factory = holder.GetSessionFactory(typeof(ActiveRecordBase));

            global::Test.Support.Setup.SessionFactory = factory;
            Factory = factory;
            Application.SessionFactory = factory;

            Config = Application.ReadConfig();
            new Development().Run(Config);
        }
Beispiel #28
0
        public string SaveAttachLocal(Stream stream, string filename)
        {
            try
            {
                _config = Resolver.Resolve <Config.Config>();
                string basePath = _config.Get <string>(Config.Config.AliyunOss_Domain);
                string dir      = _config.Get <string>(Config.Config.AliyunOss_Dir);
                string filepath = string.Empty;
                try
                {
                    string documentsPath = GetImagePath("RMMT_ORGIMAGE"); //CreateDirectoryForPictures().Path;
                    string localFilename = DateTime.Now.ToString("yyyyMMddHHmmssfffffff") + filename.Substring(filename.LastIndexOf("."));
                    string newFile       = System.IO.Path.Combine(documentsPath, localFilename);

                    if (File.Exists(filename))
                    {
                        File.Copy(filename, newFile);
                        filepath = ResizeImage(newFile);
                        File.Delete(newFile);
                    }
                }
                catch (System.Exception)
                {
                    filepath = "";
                }
                if (filepath.LastIndexOf("/") != -1)
                {
                    filepath = basePath + dir + filepath.Substring(filepath.LastIndexOf("/") + 1);
                }
                else
                {
                    filepath = "";
                }
                return(filepath);
            }
            catch (Exception)
            {
                return("");
            }
        }
        /// <summary>
        /// create service invoker for definition using the specified host
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="host"></param>
        /// <returns></returns>
        public static IInvoker CreateFrom(ServiceInterfaceDefinition sid, string host = "localhost")
        {
            Type compatibleInvoker = null;

            var attributes = sid.Type.GetCustomAttributes(typeof(CompatibleInvokerAttribute), true);

            if (attributes.Length > 0)
            {
                var att = attributes[0] as CompatibleInvokerAttribute;
                compatibleInvoker = att.Type;
            }
            else
            {
                throw new Exception("Cant find a compatible invoker for this service interface");
            }


            Config.Config config = new Config.Config(sid.Configuration);
            config.Values["host"] = host;

            return((IInvoker)Activator.CreateInstance(compatibleInvoker, config));
        }
Beispiel #30
0
 public CharacterCreate(IServiceProvider serviceProvider, Packet packet, GameClient client) : base(serviceProvider)
 {
     _client        = client;
     _config        = serviceProvider.GetService <Config.Config>();
     _itemService   = serviceProvider.GetService <IItemService>();
     _itemTable     = serviceProvider.GetService <ItemTable>();
     _idFactory     = serviceProvider.GetService <IdFactory>();
     _playerService = serviceProvider.GetService <IPlayerService>();
     _name          = packet.ReadString();
     _race          = packet.ReadInt();
     _sex           = packet.ReadInt();
     _classId       = packet.ReadInt();
     packet.ReadInt(); //INT
     packet.ReadInt(); //STR
     packet.ReadInt(); //CON
     packet.ReadInt(); //MEN
     packet.ReadInt(); //DEX
     packet.ReadInt(); //WIT
     _hairStyle = packet.ReadInt();
     _hairColor = packet.ReadInt();
     _face      = (byte)packet.ReadInt();
 }
Beispiel #31
0
        public static async Task Start(Config.Config config,
                                       Subject <object> startEvent,
                                       CancellationToken token,
                                       NotifyValue <User> user)
        {
            while (!token.IsCancellationRequested)
            {
                await TaskEx.WhenAny(TaskEx.Delay(TimeSpan.FromSeconds(30), token), startEvent.Take(1).ToTask(token));

                if (token.IsCancellationRequested)
                {
                    return;
                }
                if (user.Value?.IsStockEnabled == false)
                {
                    continue;
                }

                try {
                    using (var sync = new SyncCommand()) {
                        sync.InitSession();
                        using (var trx = sync.Session.BeginTransaction()) {
                            var settings = sync.Session.Query <Settings>().FirstOrDefault();
                            if (settings?.IsValid == true)
                            {
                                sync.Configure(settings, config, token);
                                sync.Execute();
                                Env.Current.Bus.SendMessage("stocks", "reload");
                            }
                            trx.Commit();
                        }
                    }
                } catch (Exception e) {
                    GlobalLog.Error("Синхронизация завершилась ошибкой", e);
                }
            }
        }
        public bool SyncNotifyItemErp(Config.Config config, NotificationSystimeIntegrate itemNotify)
        {
            ParamsIntegrateErp configIntegrateErp = config.GetConfigIntegrate();
            Boolean?           SupoortItem        = null;
            Object             objectResponseSync = null;

            if (Enum.TryParse(itemNotify.TableName, out TableName table) && Enum.TryParse(itemNotify.Event, out TableAction actionTable))
            {
                SupoortItem = UtilsSystimeCore.ResolverIntanceFromTable <IManager>(table).SuportItemData(config, itemNotify.JsonKeys, actionTable);
                if (SupoortItem.HasValue && SupoortItem.Value)
                {
                    objectResponseSync = UtilsSystimeCore.ResolverIntanceFromTable <IManager>(table).FillterAccionSql(config, itemNotify.JsonKeys, actionTable);
                }
            }
            else
            {
                SupoortItem = false;
            }
            if ((Enum.TryParse(configIntegrateErp.DllType, out ErpsTypes dllType) && objectResponseSync != null) || (SupoortItem.HasValue && !SupoortItem.Value))
            {
                return(DataAccesErpContract.DeleteNotificationSystime(itemNotify.IdNotification, configIntegrateErp.ConfigParamsToErp, dllType));
            }
            return(false);
        }
Beispiel #33
0
        public void Setup()
        {
            config = FixtureSetup.Config;
            client = TestClient.CreateNaked(session);
            client.Settings.IsStockEnabled = true;
            session.Save(client.Settings);
            session.Save(client);
            session.Flush();

            if (config.RegulatorRegistryPriceId == 0)
            {
                var supplier = TestSupplier.CreateNaked(session);
                supplier.CreateSampleCore(session);
                config.RegulatorRegistryPriceId = supplier.Prices[0].Id;
            }
            user = session.Load <User>(client.Users[0].Id);
            FileHelper.InitDir("data", "var/update", "var/update/rtm");
            Directory.CreateDirectory(config.LocalExportPath);
            Directory.GetFiles(config.LocalExportPath).Each(File.Delete);

            file = "data.zip";
            File.Delete(file);
            Init();
        }
Beispiel #34
0
 static ChunkFormat(  )
 {
     config = Config.Config.Instance;
     json_serializer = new JsonSerializer();
     MaxChunkSize = 1048576;
 }
Beispiel #35
0
 private void menuConfig_Click(object sender, EventArgs e)
 {
     using (var cfg = new Config.Config())
     {
         if (cfg.ShowDialog() == DialogResult.OK)
             this.Refresh();
     }
 }