Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RMQConfigurationManager"/> class.
 /// </summary>
 /// <param name="configPath">The configuration path.</param>
 public RMQConfigurationManager(string configPath = null)
 {
     if (configPath == null)
     {
         try
         {
             var xmlConfigSection = (XmlNode)ConfigurationManager.GetSection("rmqSettings");
             if (xmlConfigSection != null)
             {
                 _configNode     = new ConfigNode(xmlConfigSection);
                 _nodeAttributes = ConfigHelper.GetNodeChildAttributes(_configNode, ".");
             }
         }
         catch (ConfigurationErrorsException)
         {
             _nodeAttributes = new NodeChildAttributes();
         }
     }
     else
     {
         using (var configContainer = new ConfigContainer(configPath, "./rmqSettings"))
         {
             _configNode     = configContainer.Node;
             _nodeAttributes = ConfigHelper.GetNodeChildAttributes(_configNode, ".");
         }
     }
 }
Пример #2
0
 public FormSettings()
 {
     InitializeComponent();
     _config               = ConfigContainer.GetConfig <ClientConfig>();
     PortTextBox.Text      = _config.ServerPort.ToString();
     IpAddressTextBox.Text = _config.ServerIp;
 }
Пример #3
0
        public static List <string> ReadConfigKeys(string keyName, string[] defaultValues, List <string> validValues)
        {
            List <string> listValues = new List <string>();

            Pointel.Logger.Core.ILog _logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType,
                                                                                        "AID");
            try
            {
                if (ConfigContainer.Instance().AllKeys.Contains(keyName) &&
                    !string.IsNullOrEmpty(ConfigContainer.Instance().GetAsString(keyName).Trim()))
                {
                    listValues = validValues.Intersect(ConfigContainer.Instance().GetAsString(keyName).Split(',').Select(x => x.Trim()).ToArray().ToList()).ToList();

                    if (listValues.Count > 1)
                    {
                        listValues = listValues.Distinct().ToList();
                    }

                    if (listValues.Count == 0)
                    {
                        listValues = new List <string>(defaultValues);
                    }
                }
                else
                {
                    listValues = new List <string>(defaultValues);
                }
            }
            catch (Exception generalException)
            {
                _logger.Error("btnAdvanceSearch_Click: Error occurred as " + generalException.ToString());
            }
            return(listValues);
        }
Пример #4
0
        public PlatoonsForm()
        {
            InitializeComponent();
            _platoonWorker = new PlatoonWorker(ConfigContainer.GetConfig <EditorConfig>().SaveFolder);

            PlatoonsListBox.Items.AddRange(_platoonWorker.GetPlatoonNamesAsObjects());
        }
Пример #5
0
        private static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                return(-1);
            }

            Thread.CurrentThread.Name = "main";

            Lumberjack.Init();

            Lumberjack.Debug("Loading configuration");
            Config = ConfigContainer.Load();

            if (Config.UnpackTextures)
            {
                Lumberjack.Debug("Unpacking textures");
                ZipFile.ExtractToDirectory("Resources/assets.zip", "Resources");
                Config.UnpackTextures = false;
                Config.Save();
            }

            Lumberjack.Debug("Loading window");
            new MainWindow(args)
            {
                VSync = VSyncMode.Off
            }.Run();

            return(0);
        }
Пример #6
0
        public void SimpleTest()
        {
            var container = new ConfigContainer();
            container.Register((Foo x) => x.Bar1)
                .Named("Bar1")
                .Described("Bar1 description")
                .WithInputType(InputType.Auto)
                .WithVisibilityConfig(all: Visibility.Show)
                .WithObjectListConfig(new ObjectListConfig(() => {
                return new GestUAB.DataAccess.DataFacade().ReadAllCursos();
            }));

            var config = container.GetConfig((Foo x) => x.Bar1);
            Assert.AreEqual(config.Name, "Bar1");
            Assert.AreEqual(config.Description, "Bar1 description");
            Assert.AreEqual(config.InputType, InputType.Auto);
            Assert.AreEqual(config.VisibilityConfig.Create, Visibility.Show);
            Assert.AreEqual(config.VisibilityConfig.Delete, Visibility.Show);
            Assert.AreEqual(config.VisibilityConfig.Read, Visibility.Show);
            Assert.AreEqual(config.VisibilityConfig.Update, Visibility.Show);
            Assert.NotNull(config.ObjectListConfig.Objects);

            container.Register((Foo x) => x.Bar2)
                .Named("Bar2")
                    .Described("Bar2 description")
                    .WithInputType(InputType.Checkbox)
                    .WithVisibilityConfig(create: Visibility.Hidden);

            config = container.GetConfig((Foo x) => x.Bar2);
            Assert.AreNotEqual(config.Name, "Bar1");
            Assert.AreNotEqual(config.Description, "Bar1 description");
            Assert.AreNotEqual(config.InputType, InputType.Auto);
            Assert.AreEqual(config.VisibilityConfig.Create, Visibility.Hidden);
        }
Пример #7
0
        static void Main(string[] args)
        {
            var consulHost = "localhost";
            var consulPort = 8500;
            var token      = "";
            var config     = new ConsulRegistryConfiguration(consulHost, consulPort, "Adou.ConfigCenter.ClientTest", token);

            ConfigContainer.Init(config)
            .Monitor <TestConfig>();


            Task.Run(async() =>
            {
                do
                {
                    var testConfig = ConfigContainer.Current.Get <TestConfig>().Result;

                    Console.WriteLine(JsonConvert.SerializeObject(testConfig));

                    Thread.Sleep(5000);
                } while (true);
            });


            do
            {
                Console.ReadKey();
            } while (true);
        }
 public void UpdateSelectedWorkbin()
 {
     try
     {
         if (ConfigContainer.Instance().AllKeys.Contains("CfgPerson"))
         {
             CfgPerson person = ConfigContainer.Instance().GetValue("CfgPerson") as CfgPerson;
             if (!person.UserProperties.ContainsKey("agent.ixn.desktop"))
             {
                 person.UserProperties.Add("agent.ixn.desktop", new KeyValueCollection());
             }
             KeyValueCollection option = person.UserProperties["agent.ixn.desktop"] as KeyValueCollection;
             if (!string.IsNullOrEmpty(WorkbinUtility.Instance().SelectedWorkbinName))
             {
                 if (!option.ContainsKey("workbins.workbin-selected"))
                 {
                     option.Add("workbins.workbin-selected", WorkbinUtility.Instance().SelectedWorkbinName);
                 }
                 else
                 {
                     option["workbins.workbin-selected"] = WorkbinUtility.Instance().SelectedWorkbinName;
                 }
             }
             person.UserProperties["agent.ixn.desktop"] = option;
             person.Save();
             person = null;
         }
     }
     catch (Exception ex)
     {
         logger.Error("Error when updating selected workbin " + ex.ToString());
     }
 }
        public FontAwesomeInterop(string configYaml)
        {
            var deserializer = new Deserializer(namingConvention: new CamelCaseNamingConvention(), ignoreUnmatched: true);

            _config = deserializer.Deserialize <ConfigContainer>(new StreamReader(configYaml));

            if (string.IsNullOrEmpty(_config.IconMeta))
            {
                throw new Exception("icon meta");
            }

            var iconPath = Path.Combine(Path.GetDirectoryName(configYaml), _config.IconMeta);

            if (!File.Exists(iconPath))
            {
                throw new FileNotFoundException("icon.yaml file specified in _config.yaml could not be found", iconPath);
            }
            try
            {
                var temp = deserializer.Deserialize <Dictionary <string, IconEntry> >(new StreamReader(iconPath));
                foreach (var entry in temp)
                {
                    entry.Value.Id = entry.Key;
                }

                _iconContainer = new IconContainer();
                _iconContainer.Icons.AddRange(temp.Values);
            }
            catch (Exception ex)
            {
                Debugger.Break();
                Trace.WriteLine(ex.Message);
            }
        }
Пример #10
0
        public void ReadTransaction(ConfService configProtocol, string transactionName)
        {
            try
            {
                // application = new CfgApplication(.Instance().ComObject);
                //CfgTransactionQuery trasactionQuery = new CfgTransactionQuery();
                //trasactionQuery.Name = transactionName;
                //CfgTransaction transaction = configProtocol.RetrieveObject<CfgTransaction>(trasactionQuery);
                //if (transaction != null)
                //{
                //    if (transaction.UserProperties.ContainsKey("voice.case-data-filter"))
                //    {
                KeyValueCollection keys = ConfigContainer.Instance().GetValue("VoiceAttachDataFilterKey") as KeyValueCollection;
                //(KeyValueCollection)transaction.UserProperties["voice.case-data-filter"];
                if (keys != null)
                {
                    foreach (object value in keys.Values)
                    {
                        setting.VoiceFilterKey.Add(value.ToString());
                    }
                }
                //    }

                //}
            }
            catch (Exception ex)
            {
                logger.Error("Error occurred as " + ex.Message);
            }
        }
Пример #11
0
 public DomaSqlParserTest()
 {
     ConfigContainer.AddDefault(
         DbConnectionKind.SqlServer,
         () => new SqlParameter()
         );
 }
Пример #12
0
        public static void SerializeConfig(string path)
        {
            try
            {
                FileStream file = new FileStream(path, FileMode.Open);

                ConfigContainer ser = new ConfigContainer();
                ser = null;
                XmlSerializer serializer = new XmlSerializer(typeof(ConfigContainer));
                ser = (ConfigContainer)serializer.Deserialize(file);
                file.Close();

                // ser.n == ser.JDSUCiscoArray.Count()
                if (ser.JDSUIP == null)
                {
                    MessageBox.Show("Загружена некорректная конфигурация");
                }
                else
                {
                    StaticValues.JDSUIP         = ser.JDSUIP;
                    StaticValues.JDSUCiscoArray = ser.JDSUCiscoArray;
                    StaticValues.CiscoList      = new List <IPCom>(ser.CiscoList);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }
Пример #13
0
        //  private CfgPerson _person = null;
        #endregion Field Declaration

        public void ReadApplicationValue(ConfService configProtocol, string applicationName)
        {
            try
            {
                // application = new CfgApplication(.Instance().ComObject);
                //CfgApplicationQuery appQuery = new CfgApplicationQuery();
                //appQuery.Name = applicationName;
                //CfgApplication application = configProtocol.RetrieveObject<CfgApplication>(appQuery);
                //if (application.Options.ContainsKey("agent.ixn.desktop"))
                //{
                //    KeyValueCollection keyValue = (KeyValueCollection)application.Options["agent.ixn.desktop"];
                if (ConfigContainer.Instance().AllKeys.Contains("interaction.case-data.transaction-object"))
                {
                    ReadTransaction(configProtocol, ConfigContainer.Instance().GetAsString("interaction.case-data.transaction-object"));
                }
                if (ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name"))
                {
                    setting.VoiceDispositionKeyName = ConfigContainer.Instance().GetAsString("interaction.disposition.key-name");
                }
                if (ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name"))
                {
                    setting.VoiceDispositionCollectionName = ConfigContainer.Instance().GetAsString("interaction.disposition-collection.key-name");
                }

                //}
            }
            catch (Exception ex)
            {
                logger.Error("Error occurred as " + ex.Message);
            }
        }
 /// <summary>
 /// Inserts the agent login activity.
 /// </summary>
 public void InsertAgentLoginActivity()
 {
     try
     {
         if (ConfigContainer.Instance().AllKeys.Contains("tblAgentLogin") &&
             !string.IsNullOrEmpty(ConfigContainer.Instance().GetValue("tblAgentLogin")) && !string.IsNullOrEmpty(settings.AgentLoginID))
         {
             logger.Info("InsertAgentLoginActivity : Entry");
             string time  = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();
             string query = "Insert into " + ConfigContainer.Instance().GetValue("tblAgentLogin") +
                            "(Date,AgentLoginID,TimeStamp) values('" + DateTime.Now.Date.ToString() + "','" + settings.AgentLoginID + "','" + time + "')";
             db                  = new Database();
             db.Provider         = "System.Data.SqlClient";
             db.ConnectionString = connectionString;
             db.CreateConnection(true);
             logger.Info("InsertAgentLoginActivity: Connection Created");
             db.ExecuteNonQuery(query);
             logger.Info("InsertAgentLoginActivity: Query Executed : " + query);
             db.CloseConnection();
             logger.Info("InsertAgentLoginActivity: Connection Closed");
             GetLoginDBID(ConfigContainer.Instance().GetValue("tblAgentLogin"), DateTime.Now.Date.ToString(), settings.AgentLoginID, time);
             logger.Info("InsertAgentLoginActivity : Exit");
         }
     }
     catch (Exception ex)
     {
         logger.Error("Exception During Inserting AgentLoginActivity: " + ex.Message);
     }
 }
Пример #15
0
 private bool CheckPlcaeTaken(string agentLoginId, out string Name)
 {
     Name = "";
     try
     {
         if (!string.IsNullOrEmpty(agentLoginId) && agentLoginId != Settings.GetInstance().AgentLoginID)
         {
             Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgSwitch cfgswich = ConfigContainer.Instance().ConfServiceObject.RetrieveObject <Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgSwitch>
                                                                                                                (new Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.Queries.CfgSwitchQuery()
             {
                 Name = Settings.GetInstance().Switch.Name
             });
             Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgAgentLogin agentLoginID =
                 ConfigContainer.Instance().ConfServiceObject.RetrieveObject <Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgAgentLogin>
                     (new Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.Queries.CfgAgentLoginQuery()
             {
                 LoginCode = agentLoginId, SwitchDbid = cfgswich.DBID
             });
             Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgPerson person = ConfigContainer.Instance().ConfServiceObject.RetrieveObject <Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgPerson>(new Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.Queries.CfgPersonQuery()
             {
                 LoginDbid = agentLoginID.DBID, SwitchDbid = cfgswich.DBID
             });
             Name = person.LastName + " " + person.FirstName;
             return(true);
         }
     }
     catch (Exception ex)
     { }
     return(false);
 }
 /// <summary>
 /// Updates the agent ready activity in the Database.
 /// </summary>
 public void UpdateAgentReadyActivity()
 {
     try
     {
         if (ConfigContainer.Instance().AllKeys.Contains("tblAgentNotReady") &&
             !string.IsNullOrEmpty(ConfigContainer.Instance().GetValue("tblAgentNotReady")) && !string.IsNullOrEmpty(notreadyDBID))
         {
             string time  = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();
             string query = "Update " + ConfigContainer.Instance().GetValue("tblAgentNotReady") + " set EndTime='" + time + "' where DBID=" + notreadyDBID;
             db                  = new Database();
             db.Provider         = "System.Data.SqlClient";
             db.ConnectionString = connectionString;
             db.CreateConnection(true);
             logger.Info("UpdateAgentReadyActivity: Connection Created");
             db.ExecuteNonQuery(query);
             logger.Info("UpdateAgentReadyActivity: Query Executed : " + query);
             db.CloseConnection();
             logger.Info("UpdateAgentReadyActivity: Connection Closed");
             logger.Info("UpdateAgentReadyActivity : Exit");
         }
     }
     catch (Exception ex)
     {
         logger.Error("Exception Occured during UpdateAgentReadyActivity : " + ex.Message);
     }
 }
        private string GetValue(string KeyName)
        {
            var value = string.Empty;

            value = ConfigContainer.Instance().AllKeys.Contains(KeyName) ? ConfigContainer.Instance().GetValue(KeyName) : string.Empty;
            return(value);
        }
Пример #18
0
        private static void Listen()
        {
            TcpListener listener = null;

            try
            {
                var config = ConfigContainer.GetConfig <ServerConfig>();

                listener = new TcpListener(IPAddress.Parse(config.ServerIp), config.ServerPort);

                listener.Start();

                while (true)
                {
                    var client = listener.AcceptTcpClient();

                    var connectionHandler = new ConnectionHandler(client);
                    var thread            = new Thread(connectionHandler.Handle)
                    {
                        IsBackground = true
                    };
                    thread.Start();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                listener?.Stop();
            }
        }
Пример #19
0
    /*private VigObject FUN_2BF44(ConfigContainer container, Type component)
     * {
     *  obj[currentID].flags = (uint)((configContainers[container].flag & 0x800) != 0 ? 1 : 0) << 4;
     *  obj[currentID].vr = configContainers[container].v3_2;
     *  obj[currentID].screen = configContainers[container].v3_1;
     *  obj[currentID].vData = this;
     *
     *  if ((configContainers[container].flag & 0x7FF) < 0x7FF)
     *  {
     *      //apply 3d model; not necessery since it's been applied from the inspector
     *  }
     *
     *  if (-1 < configContainers[container].colliderID)
     *  {
     *      //apply collider; not necessery since it's been applied from the inspector
     *  }
     *
     *  return obj[currentID];
     * }*/

    public VigObject FUN_2BF44(ConfigContainer container, Type component)
    {
        ushort    uVar2;
        VigObject oVar3;
        VigMesh   mVar4;

        GameObject obj = new GameObject();

        oVar3        = obj.AddComponent(component) as VigObject;
        uVar2        = container.flag;
        oVar3.flags  = (uint)((uVar2 & 0x800) != 0 ? 1 : 0) << 4;
        oVar3.vr     = container.v3_2;
        oVar3.screen = container.v3_1;
        oVar3.vData  = xobf;

        if ((uVar2 & 0x7ff) < 0x7ff)
        {
            mVar4       = xobf.FUN_1FD18(obj, (uint)(uVar2 & 0x7ff), true);
            oVar3.vMesh = mVar4;
        }

        if (-1 < container.colliderID)
        {
            VigCollider vCollider = xobf.cbbList[container.colliderID];
            oVar3.vCollider = new VigCollider(vCollider.buffer);
        }

        return(oVar3);
    }
Пример #20
0
 public void Init(string token)
 {
     this.cache     = ConfigContainer.Container().GetInstance <ICache>();
     this.repPessoa = ConfigContainer.Container().GetInstance <IRepository <Pessoa> >();
     this.Pessoa    = new Pessoa(this.repPessoa, cache);
     this.Pessoa.SetToken(token);
 }
 public AbstractBoltClient()
 {
     options         = new BoltOptions();
     configType      = ConfigType.CLIENT_SIDE;
     globalSwitch    = new GlobalSwitch();
     configContainer = new DefaultConfigContainer();
 }
Пример #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DialPad"/> class.
        /// </summary>
        public DialPad(ChatUtil chatUtil)
        {
            InitializeComponent();
            _chatUtil        = chatUtil;
            this.DataContext = _chatUtil;
            txtNumbers.Focus();
            _chatUtil.Contacts.Clear();
            _chatUtil.ContactsFilter.Clear();
            _chatUtil.DialedNumbers = string.Empty;
            MenuItem mnuItem = new MenuItem();

            mnuItem.Header = "Dial";
            mnuItem.VerticalContentAlignment = VerticalAlignment.Center;
            mnuItem.Height     = 18;
            mnuItem.Background = System.Windows.Media.Brushes.Transparent;
            mnuItem.Icon       = new System.Windows.Controls.Image {
                Height = 12, Width = 12, Source = _chatDataContext.GetBitmapImage(new Uri("/Agent.Interaction.Desktop;component/Images/Voice.Short.png", UriKind.Relative))
            };
            mnuItem.Click += new RoutedEventHandler(mnuItem_Click);
            _phoneBookMenu.Items.Add(mnuItem);
            if (_chatUtil.DialedNumbers.Length >= 9 && _chatUtil.ModifiedTextSize != 0)
            {
                txtNumbers.FontSize = _chatUtil.ModifiedTextSize;
            }
            Loaded += (s, e) =>
            {
                Window.GetWindow(this)
                .Closing += (s1, e1) => Somewhere();
            };

            if (ConfigContainer.Instance().AllKeys.Contains("voice.enable.phonebook.double-click-to-call") && ((string)ConfigContainer.Instance().GetValue("voice.enable.phonebook.double-click-to-call")).ToLower().Equals("true"))
            {
                dgvContact.MouseDoubleClick += new MouseButtonEventHandler(dgvContact_MouseDoubleClick);
            }
        }
 private void tabDataUC_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         var item     = sender as TabControl;
         var selected = item.SelectedItem as TabItem;
         if (selected.Header.ToString() == "_Dispositions" && _dispositionUC != null)
         {
             Dictionary <string, string> dispositionCode = new Dictionary <string, string>();
             if (!string.IsNullOrEmpty(CurrentData[(ConfigContainer.Instance().GetValue("interaction.disposition.key-name"))]))
             {
                 dispositionCode.Add(ConfigContainer.Instance().GetValue("interaction.disposition.key-name"),
                                     CurrentData[(ConfigContainer.Instance().GetValue("interaction.disposition.key-name"))]);
             }
             else
             {
                 dispositionCode.Add(ConfigContainer.Instance().GetValue("interaction.disposition.key-name"),
                                     "None");
             }
             _dispositionUC.ReLoadDispositionCodes(dispositionCode, interactionId);
         }
     }
     catch (Exception ex)
     {
         logger.Error("Error occurred at tabDataUC_SelectionChanged" + ex.Message);
     }
 }
Пример #24
0
 /// <summary>
 /// Mouses the left button down.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="MouseButtonEventArgs"/> instance containing the event data.</param>
 private void MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         this.DragMove();
         if (!(ConfigContainer.Instance().AllKeys.Contains("allow.system-draggable") &&
               ((string)ConfigContainer.Instance().GetValue("allow.system-draggable")).ToLower().Equals("true")))
         {
             if (Left < 0)
             {
                 Left = 0;
             }
             if (Top < 0)
             {
                 Top = 0;
             }
             if (Left > SystemParameters.WorkArea.Right - Width)
             {
                 Left = SystemParameters.WorkArea.Right - Width;
             }
             if (Top > SystemParameters.WorkArea.Bottom - Height)
             {
                 Top = SystemParameters.WorkArea.Bottom - Height;
             }
             ;
         }
     }
     catch { }
 }
Пример #25
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string input = value as string;

            if (input.StartsWith("www"))
            {
                input = "http://" + input;
            }
            Uri  uriResult;
            bool result = Uri.TryCreate(input, UriKind.Absolute, out uriResult) &&
                          (uriResult.Scheme == Uri.UriSchemeHttp ||
                           uriResult.Scheme == Uri.UriSchemeHttps ||
                           uriResult.Scheme == Uri.UriSchemeFtp ||
                           uriResult.Scheme == Uri.UriSchemeFile);

            if (result &&
                (ConfigContainer.Instance().AllKeys.Contains("voice.enable.attach-data-popup-url") &&
                 ((string)ConfigContainer.Instance().GetValue("voice.enable.attach-data-popup-url")).ToLower().Equals("true")))
            {
                return(Cursors.Hand);
            }
            else
            {
                return(DependencyProperty.UnsetValue);
            }
        }
Пример #26
0
        /// <summary>
        /// Puts the specified container into the DB.
        /// </summary>
        /// <param name="container"></param>
        /// <param name="numTries"></param>
        /// <returns></returns>
        public static async Task PutConfigAsync(ConfigContainer container, int numTries = 3)
        {
            Config     = container;
            Config._id = "config";
            //Config._rev = null;
            string doc     = ControlStore.Serializer.Serialize(Config);
            bool   success = await TryAsync(async() =>
            {
                Log.Minor("Storing simulation configuration on " + Host + " ...");
                var newCfg = await TryForceReplace(ControlStore, Config);
                if (newCfg == null)
                {
                    return(false);                      //retry
                }
                Config = newCfg;
                return(true);
            }, numTries);

            if (success)
            {
                Log.Minor("Done");
            }
            else
            {
                Log.Error("Failed to upload config to server");
            }
        }
Пример #27
0
        /// <summary>
        /// Reads the integration decision key collections.
        /// </summary>
        /// <param name="configProtocol">The configuration protocol.</param>
        /// <param name="applicationName">Name of the application.</param>
        /// <returns></returns>

        #region ReadIntegrationDecisionKeyCollections

        public void ReadIntegrationDecisionKeyCollections()
        {
            if (ConfigContainer.Instance().AllKeys.Contains("screen.pop.enable.port-integration"))
            {
                Settings.GetInstance().EnablePortCommunication = ConfigContainer.Instance().GetAsBoolean("screen.pop.enable.port-integration");
            }
            if (ConfigContainer.Instance().AllKeys.Contains("screen.pop.enable.file-integration"))
            {
                Settings.GetInstance().EnableFileCommunication = ConfigContainer.Instance().GetAsBoolean("screen.pop.enable.file-integration");
            }

            if (ConfigContainer.Instance().AllKeys.Contains("screen.pop.enable.url-integration"))
            {
                Settings.GetInstance().EnableURLCommunication = ConfigContainer.Instance().GetAsBoolean("screen.pop.enable.url-integration");
            }
            if (ConfigContainer.Instance().AllKeys.Contains("screen.pop.enable.pipe-integration"))
            {
                Settings.GetInstance().EnablePipeCommunication = ConfigContainer.Instance().GetAsBoolean("screen.pop.enable.pipe-integration");
            }
            if (ConfigContainer.Instance().AllKeys.Contains("screen.pop.enable.db-integration"))
            {
                Settings.GetInstance().EnableCrmDbCommunication = ConfigContainer.Instance().GetAsBoolean("screen.pop.enable.db-integration");
            }
            if (ConfigContainer.Instance().AllKeys.Contains("screen.pop.enable.ws.integration"))
            {
                Settings.GetInstance().EnableDualCommunication = ConfigContainer.Instance().GetAsBoolean("screen.pop.enable.ws.integration");
            }
            if (ConfigContainer.Instance().AllKeys.Contains("voice.enable.facet-all-property"))
            {
                Settings.GetInstance().EnablePortCommunication = ConfigContainer.Instance().GetAsBoolean("voice.enable.facet-all-property");
            }
        }
Пример #28
0
        private object ExecuteAggregateQuery(QueryContextsEntry queryContextsEntry, string field, AggregateType aggregateType)
        {
            Type            t = queryContextsEntry.Type;
            IQueryGenerator queryGenerator = ConfigContainer.Resolve <IQueryGenerator>();
            string          generatedQuery = queryGenerator.GenerateAggregateQueryString(field, queryContextsEntry, this.expressionTree, this.queryContextsForTypes.Count > 1, aggregateType);

            using (IPersistenceHandler persistenceHandler = this.pm.PersistenceHandlerManager.GetPersistenceHandler(t))
            {
                persistenceHandler.VerboseMode = this.pm.VerboseMode;
                persistenceHandler.LogAdapter  = this.pm.LogAdapter;
                this.pm.CheckTransaction(persistenceHandler, t);

                // Note, that we can't execute all subQueries in one batch, because
                // the subqueries could be executed against different connections.
                // TODO: This could be optimized, if we made clear whether the involved tables
                // can be reached with the same connection.
                var l = persistenceHandler.ExecuteBatch(new string[] { generatedQuery }, this.parameters);
                if (l.Count == 0)
                {
                    return(null);
                }

                return((l[0])["AggrResult"]);
            }
        }
Пример #29
0
 /// <summary>
 /// Does the email accept.
 /// </summary>
 public void DoEmailAccept()
 {
     try
     {
         Dispatcher.Invoke(new Action(() =>
         {
             //if (!EmailNotifier.needPerformAccept)
             //    return;
             //EmailNotifier.needPerformAccept = false;
             InteractionService interactionService = new InteractionService();
             Pointel.Interactions.Core.Common.OutputValues acceptInteraction = interactionService.AcceptInteraction(eventInvite.TicketId, eventInvite.Interaction.InteractionId, eventInvite.ProxyClientId);
             if (acceptInteraction.MessageCode == "200")
             {
                 EmailMainWindow emailMainWindow = new EmailMainWindow(eventInvite, FirstName, LastName);
                 emailMainWindow.Show();
                 if (!ConfigContainer.Instance().AllKeys.Contains("email.enable.auto-answer") ||
                     (ConfigContainer.Instance().AllKeys.Contains("email.enable.auto-answer") &&
                      ((string)ConfigContainer.Instance().GetValue("email.enable.auto-answer")).ToLower().Equals("false")))
                 {
                     HideWidow();
                 }
             }
         }));
     }
     catch (Exception ex)
     {
         logger.Error("Error occurred as " + ex.ToString());
     }
 }
Пример #30
0
        private IList ExecuteSubQuery(Type t, QueryContextsEntry queryContextsEntry)
        {
            IQueryGenerator queryGenerator  = ConfigContainer.Resolve <IQueryGenerator>();
            bool            hasBeenPrepared = PrepareParameters();
            string          generatedQuery;

            if (this.queryLanguage == QueryLanguage.NDOql)
            {
                generatedQuery = queryGenerator.GenerateQueryString(queryContextsEntry, this.expressionTree, this.hollowResults, this.queryContextsForTypes.Count > 1, this.orderings, this.skip, this.take);
            }
            else
            {
                generatedQuery = (string)this.expressionTree.Value;
            }

            if (hasBeenPrepared)
            {
                WriteBackParameters();
            }

            using (IPersistenceHandler persistenceHandler = this.pm.PersistenceHandlerManager.GetPersistenceHandler(t))
            {
                persistenceHandler.VerboseMode = this.pm.VerboseMode;
                persistenceHandler.LogAdapter  = this.pm.LogAdapter;
                this.pm.CheckTransaction(persistenceHandler, t);

                DataTable table = persistenceHandler.PerformQuery(generatedQuery, this.parameters, this.pm.DataSet);
                return(pm.DataTableToIList(t, table.Rows, this.hollowResults));
            }
        }
Пример #31
0
        private static ConfigContainer InitConfig(ExecutionContext context)
        {
            var config = new ConfigurationBuilder()
                         .SetBasePath(context.FunctionAppDirectory)
                         .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
                         .AddEnvironmentVariables()
                         .Build();

            var configContainer = new ConfigContainer();

            configContainer.PersonalAccessToken      = config[nameof(configContainer.PersonalAccessToken)];
            configContainer.OrganisationName         = config[nameof(configContainer.OrganisationName)];
            configContainer.AzureDevopsApiVersion    = config[nameof(configContainer.AzureDevopsApiVersion)];
            configContainer.ProjectName              = config[nameof(configContainer.ProjectName)];
            configContainer.TeamNames                = config.GetSection(nameof(configContainer.TeamNames)).Get <List <string> >() ?? new List <string>();
            configContainer.CountDaysOff             = bool.Parse(config[nameof(configContainer.CountDaysOff)]);
            configContainer.ExclusionList            = config.GetSection(nameof(configContainer.ExclusionList)).Get <List <string> >() ?? new List <string>();
            configContainer.ExclusionList            = configContainer.ExclusionList.Select(x => x.ToLower()).ToList();
            configContainer.AlertLastDayOnly         = config.GetSection(nameof(configContainer.AlertLastDayOnly)).Get <List <string> >() ?? new List <string>();
            configContainer.AlertLastDayOnly         = configContainer.AlertLastDayOnly.Select(x => x.ToLower()).ToList();
            configContainer.EmailCredentialsUserName = config[nameof(configContainer.EmailCredentialsUserName)];
            configContainer.EmailCredentialsPassword = config[nameof(configContainer.EmailCredentialsPassword)];
            configContainer.EmailHost                = config[nameof(configContainer.EmailHost)];
            configContainer.EmailPort                = int.Parse(config[nameof(configContainer.EmailPort)]);
            configContainer.EmailEnableSsl           = bool.Parse(config[nameof(configContainer.EmailEnableSsl)]);
            return(configContainer);
        }
        public FontAwesomeInterop(string configYaml)
        {
            var deserializer = new Deserializer(namingConvention: new CamelCaseNamingConvention(), ignoreUnmatched: true);
            _config = deserializer.Deserialize<ConfigContainer>(new StreamReader(configYaml));

            if(string.IsNullOrEmpty(_config.IconMeta)) throw new Exception("icon meta");

            var iconPath = Path.Combine(Path.GetDirectoryName(configYaml), _config.IconMeta);

            if(!File.Exists(iconPath))
                throw new FileNotFoundException("icon.yaml file specified in _config.yaml could not be found", iconPath);

            _iconContainer = deserializer.Deserialize<IconContainer>(new StreamReader(iconPath));
        }