示例#1
0
        /// <summary>
        /// Resets all changes to basic template of XML configuration.
        /// </summary>
        public void Reset()
        {
            _result = new ConfigurationXml
            {
                ShellConfig = new ShellConfig
                {
                    MessageHandler    = new MessageHandlerConfig(),
                    InputManager      = new InputManagerConfig(),
                    CrawlersManager   = new CrawlersManagerConfig(),
                    AppraisersManager = new AppraisersManagerConfig(),
                    OutputManager     = new OutputManagerConfig(),
                    DataBaseManager   = new DataBaseManagerConfig()
                }
            };

            _messageHandlerParameters.Clear();

            _inputManagerParameters.Clear();
            _inputters.Clear();

            _crawlersManagerParameters.Clear();
            _crawlers.Clear();

            _appraisersManagerParameters.Clear();
            _appraisers.Clear();

            _outputManagerParameters.Clear();
            _outputters.Clear();

            _dataBaseManagerParameters.Clear();
            _repositories.Clear();
        }
示例#2
0
        public ConfigurationXml CreateConfigBasedOnRequirements(
            ConfigRequirements configRequirements)
        {
            ConfigurationXml configurationXml =
                XmlConfigCreator.CreateXmlConfigBasedOnRequirements(configRequirements);

            return(configurationXml);
        }
示例#3
0
        public void GetNamesTest()
        {
            string     aspectXml  = @"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\ExinScada.Aop\TestXml\bin\Debug\configuration\aspect.xml"; // TODO: 初始化为适当的值
            string     aspectName = "LogAOP";                                                                                                                                     // TODO: 初始化为适当的值
            AdviceType type       = AdviceType.After;                                                                                                                             // TODO: 初始化为适当的值

            string[] expected = null;                                                                                                                                             // TODO: 初始化为适当的值
            string[] actual;
            actual = ConfigurationXml.GetNames(aspectXml, aspectName, type);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
示例#4
0
        public void SetUp()
        {
            mToastService = Substitute.For <IToastService>();

            mXmlDoc = new XmlDocumentWrap();
            mXmlDoc.Load(GetTestConfigXml());

            mLoadAndSave = Substitute.For <ICanLoadAndSaveXml>();
            mLoadAndSave.Load().Returns(mXmlDoc);

            mSut = new ConfigurationXml(mToastService,
                                        mLoadAndSave);
        }
        /// <summary>
        /// Serializes config class to XML as string value.
        /// </summary>
        /// <param name="xmlConfig">Config class instance to serialize.</param>
        /// <returns>Serialized value of passed config class.</returns>
        private static string SerializeToStringXml(ConfigurationXml xmlConfig)
        {
            var xmlSerializer = new XmlSerializer(typeof(ConfigurationXml));

            string stringXml = string.Empty;

            using (var sww = new StringWriter())
                using (XmlWriter writer = XmlWriter.Create(sww))
                {
                    xmlSerializer.Serialize(writer, xmlConfig);
                    stringXml = sww.ToString();
                }
            return(stringXml);
        }
 public ActionResult <ConfigurationXml> PostConfiguration(
     ConfigRequirements configRequirements)
 {
     try
     {
         ConfigurationXml configuration = _configCreator.CreateConfigBasedOnRequirements(
             configRequirements
             );
         return(configuration);
     }
     catch (Exception ex)
     {
         _logger.Error(ex, "Exception occurred during configuration creating.");
     }
     return(BadRequest(configRequirements));
 }
        public override void ReadAspect(string aspectXml, string aspectName)
        {
            IBeforeAdvice before = (IBeforeAdvice)ConfigurationXml.GetAdvice(aspectXml, aspectName, AdviceType.Before);

            string[] methodNames = ConfigurationXml.GetNames(aspectXml, aspectName, AdviceType.Before);
            foreach (string name in methodNames)
            {
                AddBeforeAdvice(name, before);
            }
            IAfterAdvice after = (IAfterAdvice)ConfigurationXml.GetAdvice(aspectXml, aspectName, AdviceType.After);

            methodNames = ConfigurationXml.GetNames(aspectXml, aspectName, AdviceType.After);
            foreach (string name in methodNames)
            {
                AddAfterAdvice(name, after);
            }
        }
        private void LoadConfigurationXml()
        {
            if (_xmlDoc.DocumentElement == null)
            {
                throw (new Exception("Document Element Missing"));
            }

            ConfigurationXml = new ConfigurationXml();

            LoadAdds();

            LoadRemoves();

            LoadUpdates();

            LoadDisplay();

            LoadLogging();

            LoadProperties();
        }
示例#9
0
    void Start()
    {
        var configuration = ConfigurationXml.Load();

        manager = GameObject.Find("GameManager");
        manager.GetComponent <MazeBuilder>().ChargeMaze();
        int c = 0;

        foreach (GameObject tile in manager.GetComponent <MazeBuilder>().m_Maze)
        {
            m_Tiles[c] = manager.GetComponent <MazeBuilder>().m_Maze[c].GetComponent <TileManager>();
            c++;
        }

        m_StartWait = new WaitForSeconds(m_StartDelay);
        m_EndWait   = new WaitForSeconds(m_EndDelay);

        /*prueba.color = Color.red;
        *  prueba.text = "" + turno;*/
        puntosRaton        = 0;
        puntuacion.text    = "" + puntosRaton;
        duracionTurno.text = "" + segundosTurno.ToString("f0");
    }
示例#10
0
        /// <summary>
        /// Transforms config to <see cref="XDocument" /> variable.
        /// </summary>
        /// <returns>XML config of service as instance of <see cref="XDocument" />.</returns>
        /// <remarks>
        /// This method uses serialization to perform transformation.
        /// </remarks>
        public static XDocument TransformConfigToXDocument(ConfigurationXml xmlConfig)
        {
            var stringXml = XmlHelper.SerializeToStringXml(xmlConfig);

            return(XDocument.Parse(stringXml));
        }
示例#11
0
        /// <summary>
        /// Creates default configuration of the service. If you want to customize components, use
        /// other methods to define what you want.
        /// </summary>
        /// <returns>Default XML config of service as serialized set of classes.</returns>
        public static ConfigurationXml CreateDefaultXmlConfig()
        {
            var xmlConfig = new ConfigurationXml
            {
                ShellConfig = new ShellConfig
                {
                    MessageHandler = new MessageHandlerConfig
                    {
                        MessageHandlerType       = "ConsoleMessageHandler",
                        MessageHandlerParameters = new[]
                        {
                            ConfigModule.GetConfigForMessageHandlerParameter(
                                ConfigNames.MessageHandlerParameters
                                .ConsoleMessageHandlerSetUnicodeName
                                )
                        }
                    },
                    InputManager = new InputManagerConfig
                    {
                        DefaultInStorageName = "thing_names.csv",
                        Inputters            = new[]
                        {
                            ConfigModule.GetConfigForInputter(
                                ConfigNames.Inputters.LocalFileReaderSimpleName
                                ),
                        }
                    },
                    CrawlersManager = new CrawlersManagerConfig
                    {
                        CrawlersOutputFlag = false,
                        Crawlers           = new[]
                        {
                            ConfigModule.GetConfigForCrawler(ConfigNames.Crawlers.TmdbCrawlerName),
                            ConfigModule.GetConfigForCrawler(ConfigNames.Crawlers.OmdbCrawlerName)
                        }
                    },
                    AppraisersManager = new AppraisersManagerConfig
                    {
                        AppraisersOutputFlag = false,
                        Appraisers           = new[]
                        {
                            ConfigModule.GetConfigForAppraiser(
                                ConfigNames.Appraisers.TmdbAppraiserCommonName
                                ),
                            ConfigModule.GetConfigForAppraiser(
                                ConfigNames.Appraisers.OmdbAppraiserCommonName
                                )
                        }
                    },
                    OutputManager = new OutputManagerConfig
                    {
                        DefaultOutStorageName = "appraised_thing.csv",
                        Outputters            = new[]
                        {
                            ConfigModule.GetConfigForOutputter(
                                ConfigNames.Outputters.LocalFileWriterName
                                ),
                        }
                    },
                    DataBaseManager = new DataBaseManagerConfig
                    {
                        Repositories = new[]
                        {
                            ConfigModule.GetConfigForRepository(
                                ConfigNames.Repositories.TmdbMovieRepositoryName
                                )
                        }
                    }
                },
                ServiceType = ServiceType.TplDataflow
            };

            return(xmlConfig);
        }
        /// <summary>
        /// Creates default configuration of the service. If you want to customize components, use
        /// other methods to define what you want.
        /// </summary>
        /// <returns>Default XML config of service as serialized set of classes.</returns>
        public static ConfigurationXml CreateDefaultXmlConfig()
        {
            var xmlConfig = new ConfigurationXml
            {
                ShellConfig = new ShellConfig
                {
                    MessageHandler = new MessageHandlerConfig
                    {
                        MessageHandlerType       = "ConsoleMessageHandler",
                        MessageHandlerParameters = new[]
                        {
                            ConfigModule.GetConfigForMessageHandlerParameter(
                                "ConsoleMessageHandlerSetUnicode"
                                )
                        }
                    },
                    InputManager = new InputManagerConfig
                    {
                        DefaultInStorageName = "thing_names.csv",
                        Inputters            = new[]
                        {
                            ConfigModule.GetConfigForInputter("LocalFileReaderSimple"),
                        }
                    },
                    CrawlersManager = new CrawlersManagerConfig
                    {
                        CrawlersOutputFlag = false,
                        Crawlers           = new[]
                        {
                            ConfigModule.GetConfigForCrawler("Tmdb")
                        }
                    },
                    AppraisersManager = new AppraisersManagerConfig
                    {
                        AppraisersOutputFlag = false,
                        Appraisers           = new[]
                        {
                            ConfigModule.GetConfigForAppraiser("TmdbCommon")
                        }
                    },
                    OutputManager = new OutputManagerConfig
                    {
                        DefaultOutStorageName = "appraised_thing.csv",
                        Outputters            = new[]
                        {
                            ConfigModule.GetConfigForOutputter("LocalFileWriter"),
                        }
                    },
                    DataBaseManager = new DataBaseManagerConfig
                    {
                        ConnectionString = ConfigurationManager.AppSettings["ConnectionString"],
                        Repositories     = new[]
                        {
                            ConfigModule.GetConfigForRepository("Tmdb")
                        }
                    }
                },
                ServiceType = ServiceType.TplDataflow
            };

            return(xmlConfig);
        }