Exemple #1
0
        public static MediaMap Generate(MainConfig config)
        {
            // получаем список всех mp3
            // получаем список всех mp4
            // пытаемся сопоставить имена
            var mp3 = GetMFiles(config.Mp3Root, "*.mp3")
                      .Select(x =>
            {
                x.ImageFile = FindImage(x.FullPath);
                return(x);
            });
            var mp4    = GetMFiles(config.VideoRoot, "*.mp4");
            var result = new MediaMap();

            foreach (var audio in mp3)
            {
                var video = mp4.FirstOrDefault(vid => vid.IsSame(audio));
                if (video == null)
                {
                    result.UnmappedMp3.Add(audio);
                    continue;
                }

                result.Mapped.Add(audio, video);
            }

            result.UnmappedMp4.AddRange(mp4.Where(vid => !result.Mapped.Values.Contains(vid)));
            return(result);
        }
Exemple #2
0
        private void LoadSettigs(DiscordSocketClient client, MainConfig config)
        {
            foreach (var guild in client.Guilds)
            {
                try
                {
                    var newConfig = new GuildConfigSettings(guild.Id + "/config.json");
                    config.GuildsSettings.Add(guild.Id, newConfig);
                }
                catch (NullReferenceException)
                {
                    ErrorEvent?.Invoke(new LogMessage(LogSeverity.Error, "LoadSettings", $"Unable to load server settings for {guild.Name} ({guild.Id})"));
                };
                try
                {
                    var newFollows = new FollowsSettings(guild.Id + "/follows.json");
                    config.GuildsFollows.Add(guild.Id, newFollows);
                }
                catch (NullReferenceException)
                {
                    ErrorEvent?.Invoke(new LogMessage(LogSeverity.Error, "LoadSettings", $"Unable to load follows for {guild.Name} ({guild.Id})"));
                }
            }

            //TODO move this away from here
            Dictionary <ulong, Timer> timers = new Dictionary <ulong, Timer>();

            foreach (var setts in MainConfig.Instance.GuildsSettings)
            {
                timers.Add(setts.Key, YoutubeCheckTimer.Create(setts.Key));
            }
        }
        /// <summary>
        /// 重载配置
        /// </summary>
        public static void Reload()
        {
            if (Directory.Exists(Path) == false)
            {
                Directory.CreateDirectory(Path);
            }
            if (!File.Exists(Path + Logs.log))
            {
                try
                {
                    File.WriteAllText(Path + Logs.log, "正在尝试创建日志文件" + Environment.NewLine);
                }
                catch
                {
                    Console.WriteLine("[Minecraft_QQ]日志文件创建失败");
                    return;
                }
            }

            ConfigRead read = new ConfigRead();

            ConfigFile.主要配置文件 = new FileInfo(Path + "Mainconfig.json");

            //读取主配置文件
            if (ConfigFile.主要配置文件.Exists == false)
            {
                Logs.LogWrite("[Info][Config]新建主配置");
                MainConfig = new MainConfig();
                File.WriteAllText(ConfigFile.主要配置文件.FullName, JsonConvert.SerializeObject(MainConfig, Formatting.Indented));
            }
            else
            {
                MainConfig = read.ReadConfig();
            }
        }
Exemple #4
0
        public async Task Prefix(string customprefix)
        {
            if (SQLiteHandler.NoServer(Context.Guild.Id))
            {
                SQLiteHandler.NewServer(Context.Guild.Id);
            }

            if (customprefix == "null" || customprefix.ToLower().Contains("wex"))
            {
                await ReplyAsync("Sorry, I can't set it to this specific one.");

                return;
            }
            else if (customprefix.Length > 5)
            {
                await ReplyAsync("Custom prefix can't be longer than 5 characters.");

                return;
            }

            MainConfig config = SQLiteHandler.GetMessage(Context.Guild.Id);

            config.prefix = customprefix;
            SQLiteHandler.Update(config);

            await Context.Channel.SendMessageAsync("New prefix has been set.");
        }
Exemple #5
0
        public async Task UnMute(IGuildUser user)
        {
            if (SQLiteHandler.NoServer(Context.Guild.Id))
            {
                SQLiteHandler.NewServer(Context.Guild.Id);
            }

            MainConfig main = SQLiteHandler.GetMessage(Context.Guild.Id);

            if (main.muteroleid == 0)
            {
                await Context.Channel.SendMessageAsync("You have to set firstly muterole by using 'wex setmute'");

                return;
            }

            SocketRole role;

            try
            {
                role = Context.Guild.GetRole(main.muteroleid);
                await user.RemoveRoleAsync(role);
            }
            catch (Exception)
            {
                await Context.Channel.SendMessageAsync("Something went wrong. Posibly I don't have permision to take that role.");

                return;
            }
            await Context.Channel.SendMessageAsync("Done.");
        }
Exemple #6
0
    protected override void OnCreate()
    {
        base.OnCreate();
        _appConfig    = ClientBootstrapper.Container.Resolve <AppConfig>();
        _config       = ClientBootstrapper.Container.Resolve <MainConfig>();
        _fxData       = ClientBootstrapper.Container.Resolve <FXData>();
        _uiController = ClientBootstrapper.Container.Resolve <UIController>();

        _group = GetEntityQuery(
            ComponentType.ReadWrite <CharacterPresenter>(),
            ComponentType.ReadOnly <GameObject>(),
            ComponentType.ReadOnly <CharactersBindData>(),
            ComponentType.ReadOnly <Translation>(),
            ComponentType.ReadOnly <Attack>(),
            ComponentType.ReadOnly <Damage>(),
            ComponentType.ReadOnly <PlayerData>(),
            ComponentType.Exclude <DEAD>()
            );

        _otherPlayers = GetEntityQuery(
            ComponentType.ReadWrite <PlayerData>(),
            ComponentType.ReadOnly <Damage>(),
            ComponentType.ReadOnly <Translation>(),
            ComponentType.Exclude <PlayerInput>(),
            ComponentType.Exclude <DEAD>()
            );
    }
Exemple #7
0
        void ReadName()
        {
            const String input  = @"name: Test";
            var          result = MainConfig.FromYaml(input);

            result.Name.Should().Be("Test");
        }
Exemple #8
0
        public ConfigForm(Config config)
        {
            InitializeComponent();

            this.config = config;

            mainconfig = new MainConfig(config);
            createPanel("MainNode", mainconfig);

            editorconfig = new EditorConfig(config);
            createPanel("EditorNode", editorconfig);

            ConfigTreeView.NodeMouseClick += (sender, e) => {
                if (configpanels.ContainsKey(e.Node.Name))
                {
                    var cp = configpanels[e.Node.Name];
                    cp.BringToFront();
                }
            };

            this.OKButton.Click += (s, e) => {
                editorconfig.Accept();

                DialogResult = DialogResult.OK;
                this.Close();
            };
            this.CancelButton.Click += (s, e) => {
                DialogResult = DialogResult.Cancel;
                this.Close();
            };
        }
Exemple #9
0
        public static void Load()
        {
            string config = "";

            try
            {
                config = File.ReadAllText("appsettings.json");
            }
            catch (Exception ex)
            {
                CloseApp("File of configuration is not found or error opening");
            }

            try
            {
                SerializeMainConfig serConf = JsonConvert.DeserializeObject <SerializeMainConfig>(config);
                DeserializeObject.IsValid(serConf);

                MainConfig.Mapping(serConf);
                CheckDB();
            }
            catch (Exception ex)
            {
                CloseApp(ex.Message);
            }
        }
        private void LoadConfiguration()
        {
            if (File.Exists(MainConfig.FullPath))
            {
                _configuration = MainConfig.Load();
            }
            else
            {
                Console.WriteLine("Could not load {0}, creating new config file.", MainConfig.FullPath);
                _configuration = new MainConfig();

                _configuration.Servers.Add(new ServerConfig
                {
                    Address  = "irc.mmoirc.com",
                    Channels = new List <string>
                    {
                        "#bot",
                    },
                    NickName = "BetaSpider",
                    RealName = "PatternSpider"
                });

                _configuration.Save();
            }
        }
        /// <summary>
        ///  Preenche um objeto proposta com todas as informações contidas na base de dados da Proposta e de todos os seus itens.
        /// </summary>
        /// <returns> Objeto Proposta </returns>
        private Proposta fillProposta()
        {
            Proposta proposta = null;

            objTransacoes = new BaseMobile();
            daoProposta   = new DaoProposta();
            daoEmbalagem  = new DaoEmbalagem();

            try
            {
                //Carrega um list com informações gerais sobre a proposta atual na base Mobile.
                listInfoProposta = daoProposta.fillInformacoesProposta();

                //carrega um obj Proposta com a atual proposta na base mobile
                //e com o item top 1 da proposta que ainda não esteja separado.
                proposta = daoProposta.fillPropostaWithTop1Item();

                //Set o total de peças e o total de Itens para o objeto proposta
                proposta.setTotalValoresProposta(Convert.ToDouble(listInfoProposta[4]), Convert.ToDouble(listInfoProposta[3]));

                //Carrega informações de Embalagem para o produto que será trabalhado.
                proposta.ListObjItemProposta[0].Embalagens = daoEmbalagem.carregarEmbalagensProduto(proposta);

                //Set os valores para os atributos auxiliares.
                ProcedimentosLiberacao.inicializarProcedimentos(Convert.ToDouble(listInfoProposta[4]), Convert.ToDouble(listInfoProposta[3]), proposta.ListObjItemProposta[0].Quantidade, proposta.Volumes);

                //Carrega o formulário com as informações que serão manusueadas para a proposta e o item da proposta
                //this.fillCamposForm(proposta.Numero, (string)proposta.RazaoCliente, proposta.Totalpecas, proposta.TotalItens, (string)proposta.ListObjItemProposta[0].Partnumber, (string)proposta.ListObjItemProposta[0].Descricao, (string)proposta.ListObjItemProposta[0].NomeLocalLote, proposta.ListObjItemProposta[0].Quantidade.ToString());
                this.fillCamposForm(proposta);

                //Retorna o objeto proposta o qual terá suas informações trabalhadas do processo de conferencia do item.
                return(proposta);
            }
            catch (ArithmeticException ex)
            {
                StringBuilder sbMsg = new StringBuilder();
                sbMsg.Append("Problemas durante o processamento de informações sobre a proposta.\n");
                sbMsg.AppendFormat("Error : {0}", ex.Message);
                MainConfig.errorMessage(sbMsg.ToString(), "Operação Inválida!");
                throw;
                //return null;
            }
            catch (Exception ex)
            {
                StringBuilder sbMsg = new StringBuilder();
                sbMsg.Append("Problemas durante o processamento de informações sobre a proposta \n");
                sbMsg.AppendFormat("Error : {0}", ex.Message);
                sbMsg.Append("Contate o Administrador do sistema.");
                MainConfig.errorMessage(sbMsg.ToString(), "Sistem Error!");
                throw;
                //return null;
            }
            finally
            {
                //zera o obj transações
                objTransacoes = null;
                daoProposta   = null;
                proposta      = null;
            }
        }
Exemple #12
0
        public static void decrementaQtdEmbalagem(int codigoEmbalagem)
        {
            try
            {
                if (!podeDecremetar())
                {
                    throw new invalidArgumentException("A quantidade de volumes não pode ser menoor que 1!");
                }

                foreach (var item in ListEmbalagensSeparacao)
                {
                    if (item.Codigo == codigoEmbalagem)
                    {
                        if (item.remover())
                        {
                            ProcedimentosLiberacao.TotalVolumes--;
                            ProcedimentosLiberacao.PesoTotalEmbalagens -= item.Peso;
                        }
                        return;
                    }
                }
            }
            catch (invalidArgumentException ex)
            {
                MainConfig.errorMessage(ex.Message, "Gerenciar Volumes");
            }
            catch (InvalidOperationException ex)
            {
                MainConfig.errorMessage(ex.Message, "Gerenciar Volumes");
            }
        }
        public static void Main(string[] args)
        {
            MainConfig app = JsonFileParser.DeserializeFile <MainConfig> ("Config/MainConfig.json");

            var cfg     = new LoggingConfiguration();
            var console = new ConsoleTarget();

            console.Layout = @"${level} [${logger}] - ${message}";
            cfg.AddTarget("console", console);
            LogLevel level = DetermineLogLevel(app.LogLevel);

            cfg.LoggingRules.Add(new LoggingRule("*", level, console));
            LogManager.Configuration = cfg;
            Logger logger = LogManager.GetCurrentClassLogger();

            var uri  = String.Format("http://localhost:{0}", app.Port);
            var host = new NancyHost(new Uri(uri));

            logger.Info("Listening on {0}", uri);
            host.Start();

            logger.Info("Connecting to zookeeper and registering service...");
            ZookeeperAccessor accessor = new ZookeeperAccessor(app.ZookeeperHost, app.ZookeeperPort);

            accessor.RegisterService("1.0", "location", app.Port, "/location");
            accessor.RegisterService("1.0", "time", app.Port, "/time");
            logger.Info("Service registration complete");

            while (true)
            {
            }
        }
Exemple #14
0
        protected override string MiningCreateCommandLine()
        {
            // API port function might be blocking
            _apiPort = GetAvaliablePort();
            // instant non blocking
            var urlWithPort = StratumServiceHelpers.GetLocationUrl(_algorithmType, _miningLocation, NhmConectionType.NONE);

            var binPathBinCwdPair = GetBinAndCwdPaths();
            var binCwd            = binPathBinCwdPair.Item2;
            var algo = AlgorithmName(_algorithmType);
            // prepare configs
            var folder = _algorithmType.ToString().ToLower();
            // run in new task so we don't deadlock main thread
            var deviceConfigParams    = Task.Run(() => PrepareDeviceConfigs(CancellationToken.None)).Result;
            var generalConfigFilePath = Path.Combine(binCwd, folder, "config.txt");
            var generalConfig         = new MainConfig {
                httpd_port = _apiPort
            };

            ConfigHelpers.WriteConfigFile(generalConfigFilePath, generalConfig);
            var poolsConfigFilePath = Path.Combine(binCwd, folder, "pools.txt");
            var poolsConfig         = new PoolsConfig(urlWithPort, _username, algo);

            ConfigHelpers.WriteConfigFile(poolsConfigFilePath, poolsConfig);

            var disableDeviceTypes = CommandLineHelpers.DisableDevCmd(_miningDeviceTypes);
            var commandLine        = $@"--config {folder}\config.txt --poolconf {folder}\pools.txt {deviceConfigParams} {disableDeviceTypes} {_extraLaunchParameters}";

            return(commandLine);
        }
Exemple #15
0
        public async Task Mute()
        {
            if (SQLiteHandler.NoServer(Context.Guild.Id))
            {
                SQLiteHandler.NewServer(Context.Guild.Id);
            }

            MainConfig main = SQLiteHandler.GetMessage(Context.Guild.Id);

            if (main.muteroleid == 0)
            {
                await Context.Channel.SendMessageAsync("There is no mute role.");

                return;
            }

            SocketRole role;

            try
            {
                role = Context.Guild.GetRole(main.muteroleid);
            }
            catch (Exception)
            {
                await Context.Channel.SendMessageAsync("There is no mute role");

                return;
            }

            await Context.Channel.SendMessageAsync("Muterole: " + role.ToString());
        }
Exemple #16
0
        public static List <Product> GetProductsData()
        {
            // Product product = new Product();
            var     productList   = new List <Product>();
            DataSet productReport = new DataSet();

            //Get the demographics from database but get the connection string details from web.Config file
            //2rd Assignment
            productReport = MainConfig.GetProducts();
            //3rd Assignment
            //dsGetDemographicsReport = testService.GetDemographicsUsingDBWithConfig();

            //Get the demographics from database but define the connection string in this method
            //dsGetDemographicsReport = DADemographicsInformation.GetDemographicsUsingDBWithOutConfig();
            //dsGetDemographicsReport = testService.GetDemographicsUsingDBWithOutConfig();

            if (productReport.Tables.Count > 0)
            {
                productList = productReport.Tables[0].AsEnumerable().Select(m => new Product
                {
                    ProductName = Convert.ToString(m["ProductName"]),
                    Unit        = Convert.ToString(m["Unit"]),
                    Price       = Convert.ToDecimal(m["Price"])
                }).ToList();
            }

            //Build the Business Logic here based on the requirements from the client

            return(productList);
        }
Exemple #17
0
    /// <summary>
    /// login to account
    /// </summary>
    /// <param name="_name">username</param>
    /// <param name="_password">password</param>
    /// <param name="_autologin">autologin</param>
    /// <param name="_callback">on login callback</param>
    /// <returns></returns>
    public static bool login(string _name, string _password, bool _autologin, Action _callback)
    {
        if (MemoryDatabase.exist() && MemoryDatabase.database.CheckTableExistence("users"))
        {
            if (_autologin)
            {
                MainConfig.GetGroup("account").GetEntry("autologin").SetValue("1");
                MainConfig.GetGroup("account").GetEntry("name").SetValue(_name);
                MainConfig.GetGroup("account").GetEntry("password").SetValue(_password);
                MainConfig.Save();
            }

            string   compactData = MemoryDatabase.database.GetDataFromTableFilter("users", "name='" + _name + "' && password='******'");
            string[] data        = compactData.Split(',');

            id    = int.Parse(data[0]);
            name  = Regex.Replace(data[1], @"\s+", "");
            score = new Score()
            {
                wins = int.Parse(data[3]), losses = int.Parse(data[4])
            };

            isActivate = true;
            _callback?.Invoke();
            return(true);
        }

        return(false);
    }
        public static async Task ProduceMessage(MainConfig cfg, KafkaMessage kafkaMessage, ILogger logger)
        {
            var config = new ProducerConfig
            {
                BootstrapServers = cfg.Kafka.BootstrapServers,
                ClientId         = cfg.Kafka.ClientId
            };

            using (var producer = new ProducerBuilder <Null, string>(config).Build())
            {
                var produceAsync =
                    producer.ProduceAsync(cfg.Kafka.Topic, new Message <Null, string>
                {
                    Value = JsonConvert.SerializeObject(kafkaMessage, Formatting.Indented)
                });
                await produceAsync.ContinueWith(task =>
                {
                    if (task.IsFaulted)
                    {
                        logger.Error("Producing message faulted");
                        throw new Exception("FileGenerator was unable to send the message to Kafka");
                    }

                    logger.Information($"Wrote to offset: {task.Result.Offset}");
                });
            }
        }
        public PlanetWarsHandler(string host, int port, AutoHost autoHost, TasClient tas, MainConfig config)
        {
            this.autoHost = autoHost;
            this.tas = tas;
            this.host = host;
            account = new AuthInfo(config.AccountName, config.PlanetWarsServerPassword);

            server = (ISpringieServer) Activator.GetObject(typeof (ISpringieServer), String.Format("tcp://{0}:{1}/IServer", host, port));
            // fill factions for channel monitoring and join channels
            planetWarsChannels = new List<string>();
            var factions = server.GetFactions(account);
            foreach (var fact in factions) {
                string name = fact.Name.ToLower();
                planetWarsChannels.Add(name);
                if (!config.JoinChannels.Contains(name)) {
                    var list = new List<string>(config.JoinChannels);
                    list.Add(name);
                    config.JoinChannels = list.ToArray();
                    if (tas != null && tas.IsConnected && tas.IsLoggedIn) tas.JoinChannel(name);
                }
            }
            timer.Interval = 2000;
            timer.Elapsed += timer_Elapsed;
            timer.AutoReset = true;
            timer.Start();
        }
        private void GunshotWoundInit()
        {
            _ecsWorld = new EcsWorld();

            _mainConfig = EcsFilterSingle <MainConfig> .Create(_ecsWorld);

            LoadConfigsFromXml();

            _updateSystems = new EcsSystems(_ecsWorld);

            LastSystem = "AddNpcSystem";
            if (_mainConfig.NpcConfig.AddingPedRange > 1f)
            {
                _updateSystems
                .Add(new NpcSystem());
            }

            LastSystem = "AddPlayerSystem";
            if (_mainConfig.PlayerConfig.WoundedPlayerEnabled)
            {
                _updateSystems
                .Add(new PlayerSystem());
            }

            LastSystem = "AddAdrenalineSystem";
            if (_mainConfig.PlayerConfig.AdrenalineSlowMotion)
            {
                _updateSystems
                .Add(new AdrenalineSystem());
            }

            LastSystem = "AddOtherSystems";
            _updateSystems
            .Add(new InstantHealSystem())
            .AddHitSystems()
            .AddDamageSystems()
            .AddWoundSystems()
            .AddPainSystems()
            .Add(new HitCleanSystem())
            .Add(new HelmetRequestSystem())
            .Add(new DebugInfoSystem())
            .Add(new CheckSystem())
            .Add(new NotificationSystem())
            .Add(new ArmorSystem())
            .Add(new RagdollSystem())
            .Add(new SwitchAnimationSystem());

            LastSystem = "OnInit";
            _updateSystems.Initialize();

            Tick  += OnTick;
            KeyUp += OnKeyUp;

            Function.Call(Hash.SET_PLAYER_WEAPON_DAMAGE_MODIFIER, Game.Player, 0.00001f);
            Function.Call(Hash.SET_PLAYER_HEALTH_RECHARGE_MULTIPLIER, Game.Player, 0f);

            LastSystem      = "Stopwatch";
            _debugStopwatch = new Stopwatch();
        }
 /// <summary>
 /// método para fechar o form durante execptions
 /// </summary>
 /// <param name="mensagem"></param>
 /// <param name="headForm"></param>
 private void exitOnError(String mensagem, String headForm)
 {
     this.Dispose();
     this.Close();
     MainConfig.errorMessage(mensagem, headForm);
     Cursor.Current = Cursors.Default;
     this.newLogin(new FrmAcao());
 }
Exemple #22
0
 public static void Run()
 {
     MainConfig.Load();
     LoadAccounts();
     LoadMaFiles();
     SetMaFiles();
     Start();
 }
Exemple #23
0
        public HueService(IConfigHandler configHandler)
        {
            this.configHandler = configHandler;
            config             = configHandler.LoadFromFile();
            baseUrl            = config.HueConfig.BridgeUrl;
            client             = new RestClient(baseUrl);

            TryLoadUser();
        }
Exemple #24
0
        private async void buttonGetConfig_Click(object sender, EventArgs e)
        {
            this._config = await this._panTiltControl.GetConfigAsync();

            this.ViewIpAddress(this._config.Ip);


            this.propertyGrid1.SelectedObject = this._config;
        }
Exemple #25
0
        /// <summary>
        /// Preenche um objeto list com objetos da classe Produto
        /// </summary>
        /// <param name="codigoProposta"></param>
        /// <returns>Lista de Produtos</returns>
        public IEnumerable <Produto> fillListProduto(Int32 codigoProposta)
        {
            Produto        objProd     = new Produto();
            List <Produto> listProduto = new List <Produto>();

            try
            {
                sql01 = new StringBuilder();
                sql01.Append("SELECT codigoPRODUTO,partnumberPRODUTO,nomePRODUTO,ean13PRODUTO,codigolotePRODUTO,identificacaolotePRODUTO,dbo.fn1211_LocaisLoteProduto(codigoPRODUTO,codigolotePRODUTO) AS nomelocalPRODUTO,pesobrutoPRODUTO");
                sql01.AppendFormat(" FROM dbo.fn0003_informacoesProdutos({0})", codigoProposta);
                sql01.Append(" GROUP BY codigoPRODUTO,partnumberPRODUTO,nomePRODUTO,ean13PRODUTO,codigolotePRODUTO,identificacaolotePRODUTO,dbo.fn1211_LocaisLoteProduto(codigoPRODUTO,codigolotePRODUTO),pesobrutoPRODUTO");
                sql01.Append(" ORDER BY nomelocalPRODUTO ASC");

                SqlDataReader dr = SqlServerConn.fillDataReader(sql01.ToString());

                while ((dr.Read()))
                {
                    objProd = new Produto(Convert.ToInt32(dr["codigoPRODUTO"]),
                                          (String)dr["ean13PRODUTO"],
                                          (String)dr["partnumberPRODUTO"],
                                          (String)dr["nomePRODUTO"],
                                          (String)dr["nomelocalPRODUTO"],
                                          Convert.ToInt64(dr["codigolotePRODUTO"]),
                                          (String)dr["identificacaolotePRODUTO"],
                                          Convert.ToDouble(dr["pesobrutoPRODUTO"])
                                          );

                    //Carrega a lista de itens que será retornada ao fim do procedimento.
                    listProduto.Add(objProd);
                }

                if (listProduto == null || listProduto.Count == 0)
                {
                    throw new TitaniumColector.Classes.Exceptions.SqlQueryExceptions("Query não retornou Valor.");
                }

                dr.Close();
                SqlServerConn.closeConn();

                return(listProduto);
            }
            catch (SqlQueryExceptions queryEx)
            {
                SqlServerConn.closeConn();
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("Não foi possível obter informações sobre a proposta {0}", codigoProposta);
                sb.Append("\nError :" + queryEx.Message);
                sb.Append("\nFavor contate o administrador do sistema.");
                MainConfig.errorMessage(sb.ToString(), "Carga Base Mobile.");
                return(listProduto = null);
            }
            catch (Exception)
            {
                throw;
            }
        }
 public AccountController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     //IEmailSender emailSender,
     ILogger <AccountController> logger, MainConfig mainConfig)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _mainConfig    = mainConfig;
 }
Exemple #27
0
        public MainWindow()
        {
            InitializeComponent();

            config = new MainConfig();

            config.configChanged += Config_ConfigChanged;
            config.configBackup  += Config_Backup;
            drawingBox.Strokes.StrokesChanged += Strokes_StrokesChanged;
        }
Exemple #28
0
        public void SaveToFile(MainConfig config)
        {
            using StreamWriter file = File.CreateText(configPath);
            JsonSerializer serializer = new JsonSerializer()
            {
                Formatting = Formatting.Indented
            };

            serializer.Serialize(file, config);
        }
Exemple #29
0
        /// <summary>
        /// Realiza os procedimentos nescessários de termino de conferência
        /// de um item de modo que não seja perdido nenhuma informação útil.
        /// </summary>
        /// <param name="formulario">Interface responsável por abrir um próximo formulário</param>
        /// <param name="retorno">Se o usuário terá ou não um mesnsagem de informativa após a conclusão do método.</param>
        /// <param name="showQuestion">Mostrar ou não a pergunta de confirmação ao usuário.</param>
        /// <returns>resposta do Dialog Result</returns>
        private DialogResult exitForm(ICall formulario, bool retorno, bool showQuestion)
        {
            try
            {
                DialogResult resp;

                //Verifica se irá ou não apresentar a pergunta ao usuário.
                if (showQuestion)
                {
                    resp = MessageBox.Show("Deseja salvar as altereções realizadas", "Exit", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                }
                else
                {
                    resp = DialogResult.Yes;
                }

                //Modifica o estado do cursor
                Cursor.Current = Cursors.WaitCursor;

                //realiza procedimentos nescessário para terminar a conferência do item
                if (resp == DialogResult.Yes)
                {
                    //Classes para trabalhar com as bases de dados.
                    var daoItemProposta = new DaoProdutoProposta();
                    var daoProposta     = new DaoProposta();
                    var daoEmbalagem    = new DaoEmbalagem();

                    ProcedimentosLiberacao.interromperLiberacao(objProposta);
                    daoProposta.updatePropostaTbPickingMobile(objProposta, Proposta.StatusLiberacao.NAOFINALIZADO, true, true);
                    daoItemProposta.updateItemPropostaRetorno();
                    daoEmbalagem.salvarEmbalagensSeparacao(objProposta);
                    this.Dispose();
                    this.Close();
                }
                else if (resp == DialogResult.No)
                {
                    var daoProposta = new DaoProposta();
                    ProcedimentosLiberacao.interromperLiberacao(objProposta);
                    daoProposta.updatePropostaTbPickingMobile(objProposta, Proposta.StatusLiberacao.NAOFINALIZADO, true, false);
                    this.Dispose();
                    this.Close();
                }
                return(resp);
            }
            catch (Exception ex)
            {
                MainConfig.errorMessage("Não foi possível executar o comando solicitado.\n" + ex.Message, "Form Propostas");
                return(DialogResult.Yes);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                formulario.call();
            }
        }
Exemple #30
0
        public void Init(MainConfig config)
        {
            _mainConfig = config;
            _map        = MediaMap.Generate(config);
            if (IsInitialized)
            {
                return;
            }

            InternalInit();
        }
Exemple #31
0
        public UpgradeMgr()
        {
            mUpgradeConfig = TinaX.Config.GetTinaXConfig <UpgradeConfig>(TinaX.Conf.ConfigPath.upgrade);
            mMainConfig    = Config.GetTinaXConfig <MainConfig>(Conf.ConfigPath.main);

            mPatchDownloadTempDir = Path.Combine(XCore.I.LocalStorage_TinaX, "patch", "download");
            if (!Directory.Exists(mPatchDownloadTempDir))
            {
                Directory.CreateDirectory(mPatchDownloadTempDir);
            }
            mPatchUnzipTemp = Path.Combine(XCore.I.LocalStorage_TinaX, "patch", "temp");
            if (!Directory.Exists(mPatchUnzipTemp))
            {
                Directory.CreateDirectory(mPatchUnzipTemp);
            }

            //检索本地版本信息
            var local_version_file_path = Path.Combine(XCore.I.LocalStorage_TinaX, "version.json");

            if (!File.Exists(local_version_file_path))
            {
                //文件不存在
                mLocalVersion = new LocalVersionInfo();
                //母包版本
                int platform_base_version;
                if (mUpgradeConfig.GetBaseVersion_IfOverride(out platform_base_version))
                {
                    mLocalVersion.base_version = platform_base_version;
                }
                else
                {
                    mLocalVersion.base_version = mMainConfig.Version_Code;
                }

                mLocalVersion.patch_version = -1;

                var json_str = JsonUtility.ToJson(mLocalVersion);
                Directory.CreateDirectory(Directory.GetParent(local_version_file_path).ToString());
                File.WriteAllText(local_version_file_path, json_str, Encoding.UTF8);
            }
            else
            {
                var json_str = File.ReadAllText(local_version_file_path);
                mLocalVersion = JsonUtility.FromJson <LocalVersionInfo>(json_str);
                if (mUpgradeConfig.GetBaseVersion_IfOverride(out int platform_base_version))
                {
                    mLocalVersion.base_version = platform_base_version;
                }
                else
                {
                    mLocalVersion.base_version = mMainConfig.Version_Code;
                }
            }
        }