public Authenticator(Credentials credentials, IXmlSerializer serializer)
        {
            Ensure.ArgumentNotNull(credentials, "credentials");
            Credentials = credentials;

            _valueProvider = new SignatureValueProvider(serializer);
        }
        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedList)
        {
            if (objectToSerializeType == null) throw new ArgumentNullException("objectToSerializeType");
            if (xmlSerializer == null) throw new ArgumentNullException("xmlSerializer");

            serializedList = null;
            if (objectToSerializeType != typeof(List<ConsoleMessageQueueElement>)) return false;

            List<ConsoleMessageQueueElement> queueElements = objectToSerialize as List<ConsoleMessageQueueElement>;

            serializedList = new XElement("ConsoleMessageQueueElements");

            if (queueElements != null)
            {
                foreach (ConsoleMessageQueueElement queueElement in queueElements)
                {
                    XElement serializedQueueItem = xmlSerializer.Serialize(queueElement.QueueItem.GetType(), queueElement.QueueItem);

                    XElement serializedElement = new XElement("QueueElement",
                        new XAttribute("time", queueElement.EnqueueTime),
                        new XAttribute("number", queueElement.QueueItemNumber),
                        new XAttribute("itemtype", queueElement.QueueItem.GetType()),
                        serializedQueueItem);

                    if (string.IsNullOrEmpty(queueElement.ReceiverConsoleId) == false)
                    {
                        serializedElement.Add(new XAttribute("console", queueElement.ReceiverConsoleId));
                    }

                    serializedList.Add(serializedElement);
                }
            }

            return true;
        }
        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)
        {
            if (serializedObject == null) throw new ArgumentNullException("serializedObject");

            deserializedObject = null;

            if (serializedObject.Name.LocalName != "Value") return false;

            XAttribute typeAttribute = serializedObject.Attribute("type");
            if (typeAttribute == null) return false;

            XAttribute valueAttribute = serializedObject.Attribute("value");
            if (valueAttribute == null) return true;

            Type type = TypeManager.GetType(typeAttribute.Value);

            if (type == typeof(Type))
            {
                deserializedObject = TypeManager.GetType(valueAttribute.Value);
                return true;
            }
            else
            {
                return false;
            }

            
        }
 public CobreGratisForTests(
     string clientAppIdentification, string authToken, ILogger logger, ICache cache,
     INetworkServices networkServices, IXmlSerializer xmlSerializer
     )
     : base(clientAppIdentification, authToken, logger, cache, networkServices, xmlSerializer)
 {
 }
        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)
        {
            if (objectToSerializeType == null) throw new ArgumentNullException("objectToSerializeType");

            if ((objectToSerializeType != typeof(int)) &&
                (objectToSerializeType != typeof(long)) &&
                (objectToSerializeType != typeof(bool)) &&
                (objectToSerializeType != typeof(string)) &&
                (objectToSerializeType != typeof(double)) &&
                (objectToSerializeType != typeof(decimal)) &&
                (objectToSerializeType != typeof(Guid)) &&
                (objectToSerializeType != typeof(DateTime)))
            {
                serializedObject = null;
                return false;
            }

            serializedObject = new XElement("Value");

            string serializedType = TypeManager.SerializeType(objectToSerializeType);

            serializedObject.Add(new XAttribute("type", serializedType));

            if (objectToSerialize != null)
            {
                serializedObject.Add(new XAttribute("value", objectToSerialize));
            }

            return true;
        }
        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)
        {
            if (objectToSerializeType == null) throw new ArgumentNullException("objectToSerializeType");

            if ((objectToSerializeType == typeof(Type)) ||
                (objectToSerializeType == typeof(Type).GetType()))
            {

                serializedObject = new XElement("Value");

                string serializedType = TypeManager.SerializeType(typeof(Type));
                serializedObject.Add(new XAttribute("type", serializedType));

                if (objectToSerialize != null)
                {
                    serializedObject.Add(new XAttribute("value", TypeManager.SerializeType((Type)objectToSerialize)));
                }

                return true;

            }
            else
            {
                serializedObject = null;
                return false;
            }
        }
        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)
        {
            if (serializedObject == null) throw new ArgumentNullException("serializedObject");

            deserializedObject = null;

            if (serializedObject.Name.LocalName != "SerializerHandler") return false;

            XAttribute valueAttribute = serializedObject.Attribute("value");
            if (valueAttribute == null) return false;

            try
            {
                deserializedObject = SerializerHandlerFacade.Deserialize(valueAttribute.Value);

                return true;
            }
            catch (DataSerilizationException)
            {
                throw;
            }
            catch (Exception)
            {
                return false;
            }
        }
        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)
        {
            if (serializedObject == null) throw new ArgumentNullException("serializedObject");

            deserializedObject = null;

            if (serializedObject.Name.LocalName != "Value") return false;

            XAttribute typeAttribute = serializedObject.Attribute("type");
            if (typeAttribute == null) return false;

            XAttribute valueAttribute = serializedObject.Attribute("value");
            if (valueAttribute == null) return true;

            Type type = TypeManager.GetType(typeAttribute.Value);

            if (type == typeof(int)) deserializedObject = (int)valueAttribute;
            else if (type == typeof(long)) deserializedObject = (long)valueAttribute;
            else if (type == typeof(bool)) deserializedObject = (bool)valueAttribute;
            else if (type == typeof(string)) deserializedObject = (string)valueAttribute;
            else if (type == typeof(double)) deserializedObject = (double)valueAttribute;
            else if (type == typeof(decimal)) deserializedObject = (decimal)valueAttribute;
            else if (type == typeof(Guid)) deserializedObject = (Guid)valueAttribute;
            else if (type == typeof(DateTime)) deserializedObject = (DateTime)valueAttribute;
            else
            {
                return false;
            }

            return true;
        }
        private static ItemSerializer SetupClass(IProjectLoader projectLoader = null, IXmlSerializer xmlSerializer = null)
        {
            projectLoader = projectLoader ?? new StubIProjectLoader();
            xmlSerializer = xmlSerializer ?? new StubIXmlSerializer();

            return new ItemSerializer(new StubIPathFacade(), new StubIEditorLogger(), projectLoader, xmlSerializer, new StubIFileWriter());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ServerConfigurationManager" /> class.
 /// </summary>
 /// <param name="applicationPaths">The application paths.</param>
 /// <param name="logManager">The log manager.</param>
 /// <param name="xmlSerializer">The XML serializer.</param>
 public ServerConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer)
     : base(applicationPaths, logManager, xmlSerializer)
 {
     UpdateItemsByNamePath();
     UpdateTranscodingTempPath();
     UpdateMetadataPath();
 }
Beispiel #11
0
 public static void CreateFileCopy(object obj, string filePath, IXmlSerializer serializer)
 {
         Directory.CreateDirectory(Path.GetDirectoryName(filePath));
         if (obj != null)
         {
             serializer.SerializeToFile(obj, filePath);
         }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseConfigurationManager" /> class.
        /// </summary>
        /// <param name="applicationPaths">The application paths.</param>
        /// <param name="logManager">The log manager.</param>
        /// <param name="xmlSerializer">The XML serializer.</param>
        protected BaseConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer)
        {
            CommonApplicationPaths = applicationPaths;
            XmlSerializer = xmlSerializer;
            Logger = logManager.GetLogger(GetType().Name);

            UpdateCachePath();
        }
 public void SetUp()
 {
     fileSystem = MockRepository.GenerateStub<IFileSystem>();
     xmlSerializer = MockRepository.GenerateStub<IXmlSerializer>();
     unhandledExceptionPolicy = MockRepository.GenerateStub<IUnhandledExceptionPolicy>();
     eventAggregator = MockRepository.GenerateStub<IEventAggregator>();
     optionsController = new OptionsController(fileSystem, xmlSerializer, unhandledExceptionPolicy, eventAggregator);
 }
Beispiel #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserManager" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="userRepository">The user repository.</param>
 public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer)
 {
     _logger = logger;
     UserRepository = userRepository;
     _xmlSerializer = xmlSerializer;
     ConfigurationManager = configurationManager;
     Users = new List<User>();
 }
        public FilterSchemeManager(IXmlSerializer xmlSerializer)
        {
            Argument.IsNotNull(() => xmlSerializer);

            _xmlSerializer = xmlSerializer;

            AutoSave = true;
            FilterSchemes = new FilterSchemes();
        }
        public KeyboardMappingsService(ICommandManager commandManager, IXmlSerializer xmlSerializer)
        {
            Argument.IsNotNull(() => commandManager);
            Argument.IsNotNull(() => xmlSerializer);

            _commandManager = commandManager;
            _xmlSerializer = xmlSerializer;
            _fileName = Path.Combine(Path.GetApplicationDataDirectory(), "keyboardmappings.xml");
        }
Beispiel #17
0
        public DlnaManager(IXmlSerializer xmlSerializer, IFileSystem fileSystem, IApplicationPaths appPaths, ILogger logger, IJsonSerializer jsonSerializer)
        {
            _xmlSerializer = xmlSerializer;
            _fileSystem = fileSystem;
            _appPaths = appPaths;
            _logger = logger;
            _jsonSerializer = jsonSerializer;

            //DumpProfiles();
        }
        public TemplateEmailSender(IEmailSender emailSender, ITemplateCompiler templateCompiler, IXmlSerializer xmlSerializer)
        {
            if (emailSender == null) throw new ArgumentNullException("emailSender");
            if (templateCompiler == null) throw new ArgumentNullException("templateCompiler");
            if (xmlSerializer == null) throw new ArgumentNullException("xmlSerializer");

            _emailSender = emailSender;
            _templateCompiler = templateCompiler;
            _xmlSerializer = xmlSerializer;
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="xmlSerializer">The Xml serializer.</param>
        public DefaultTestProjectManager(IFileSystem fileSystem, IXmlSerializer xmlSerializer)
        {
            if (fileSystem == null)
                throw new ArgumentNullException("fileSystem");
            if (xmlSerializer == null)
                throw new ArgumentNullException("xmlSerializer");

            this.fileSystem = fileSystem;
            this.xmlSerializer = xmlSerializer;
        }
 public void SetUp()
 {
     eventAggregator = MockRepository.GenerateStub<IEventAggregator>();
     fileSystem = MockRepository.GenerateStub<IFileSystem>();
     xmlSerializer = MockRepository.GenerateStub<IXmlSerializer>();
     unhandledExceptionPolicy = MockRepository.GenerateStub<IUnhandledExceptionPolicy>();
     
     controller = new ProjectUserOptionsController(eventAggregator, fileSystem, 
         xmlSerializer, unhandledExceptionPolicy);
 }
Beispiel #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserManager" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="userRepository">The user repository.</param>
 public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func<IImageProcessor> imageProcessorFactory, Func<IDtoService> dtoServiceFactory)
 {
     _logger = logger;
     UserRepository = userRepository;
     _xmlSerializer = xmlSerializer;
     _networkManager = networkManager;
     _imageProcessorFactory = imageProcessorFactory;
     _dtoServiceFactory = dtoServiceFactory;
     ConfigurationManager = configurationManager;
     Users = new List<User>();
 }
 internal CobreGratis(
     string clientAppIdentification,
     string authToken,
     ILogger logger,
     ICache cache,
     INetworkServices networkServices,
     IXmlSerializer xmlSerializer
     )
 {
     Initialize(clientAppIdentification, authToken, logger, cache, networkServices, xmlSerializer);
 }
Beispiel #23
0
        private ServiceProxy CreateServiceProxy()
        {
            _serializer = MockRepository.GenerateStub<IXmlSerializer>();
            _serializer.Stub(s => s.Serialize<Request>(null)).IgnoreArguments().Return(String.Empty);
            _serializer.Stub(s => s.Deserialize<Response>(String.Empty)).IgnoreArguments().Return(null);

            _poster = MockRepository.GenerateStub<IWebPoster>();
            _poster.Stub(p => p.Post(String.Empty)).IgnoreArguments().Return(String.Empty);

            return new ServiceProxy(_serializer, _poster);
        }
        public ItemSerializer(IPathFacade pathFacade, IEditorLogger logger, IProjectLoader projectLoader,
            IXmlSerializer xmlSerializer,
            IFileWriter fileWriter)
            : base(pathFacade, logger, projectLoader)
        {
            Check.IfIsNull(xmlSerializer).Throw<ArgumentNullException>(() => xmlSerializer);
            Check.IfIsNull(fileWriter).Throw<ArgumentNullException>(() => fileWriter);

            this.xmlSerializer = xmlSerializer;
            this.fileWriter = fileWriter;
        }
        public RecentlyUsedItemsService(IXmlSerializer xmlSerializer)
        {
            Argument.IsNotNull(() => xmlSerializer);

            _xmlSerializer = xmlSerializer;

            _fileName = Path.Combine(Path.GetApplicationDataDirectory(), "recentlyused.xml");
            _items = new RecentlyUsedItems();

            MaximumItemCount = 10;

            Load();
        }
        public SearchHistoryService(ISearchService searchService, IXmlSerializer xmlSerializer)
        {
            Argument.IsNotNull(() => searchService);
            Argument.IsNotNull(() => xmlSerializer);

            _searchService = searchService;
            _xmlSerializer = xmlSerializer;
            _searchService.Searched += OnSearchServiceSearched;

            _fileName = Path.Combine(PathHelper.GetRootDirectory(), "history.xml");

            LoadSearchHistory();
        }
Beispiel #27
0
 public DlnaManager(IXmlSerializer xmlSerializer,
     IFileSystem fileSystem,
     IApplicationPaths appPaths,
     ILogger logger,
     IJsonSerializer jsonSerializer, IServerApplicationHost appHost)
 {
     _xmlSerializer = xmlSerializer;
     _fileSystem = fileSystem;
     _appPaths = appPaths;
     _logger = logger;
     _jsonSerializer = jsonSerializer;
     _appHost = appHost;
 }
 public SettingsSerializer(IApplication application,
     IFileFacade fileFacade,
     IPathFacade pathFacade,
     IXmlSerializer xmlSerializer, IXmlDeserializer xmlDeserializer,
     IFileWriter fileWriter, IFileReader fileReader)
 {
     this.application = application;
     this.fileFacade = fileFacade;
     this.pathFacade = pathFacade;
     this.xmlSerializer = xmlSerializer;
     this.xmlDeserializer = xmlDeserializer;
     this.fileWriter = fileWriter;
     this.fileReader = fileReader;
 }
Beispiel #29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UserManager" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="configurationManager">The configuration manager.</param>
        /// <param name="userRepository">The user repository.</param>
        public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func<IImageProcessor> imageProcessorFactory, Func<IDtoService> dtoServiceFactory, Func<IConnectManager> connectFactory, IServerApplicationHost appHost)
        {
            _logger = logger;
            UserRepository = userRepository;
            _xmlSerializer = xmlSerializer;
            _networkManager = networkManager;
            _imageProcessorFactory = imageProcessorFactory;
            _dtoServiceFactory = dtoServiceFactory;
            _connectFactory = connectFactory;
            _appHost = appHost;
            ConfigurationManager = configurationManager;
            Users = new List<User>();

            DeletePinFile();
        }
        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)
        {
            if (objectToSerializeType == null) throw new ArgumentNullException("objectToSerializeType");

            string serializedResult;
            bool result = SerializerHandlerFacade.TrySerialize(objectToSerialize, out serializedResult);
            if (result == false)
            {
                serializedObject = null;
                return false;
            }

            serializedObject = new XElement("SerializerHandler", new XAttribute("value", serializedResult));

            return true;
        }
Beispiel #31
0
 public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer, ILogManager logManager) : base(applicationPaths, xmlSerializer)
 {
     Logger   = logManager.GetLogger(Name);
     Instance = this;
 }
 public PinGroupXmlSerializer(IXmlSerializer <DialoguePin> dialoguePinFactory, IXmlSerializer <QuizPin> quizPinFactory)
 {
     DialoguePinFactory = dialoguePinFactory;
     QuizPinFactory     = quizPinFactory;
 }
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="reader"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static List <T> MapToList <T>(this IDataReader reader, IJsonSerializer jsonSerializer = null, IXmlSerializer xmlSerializer = null, ICsvSerializer csvSerializer = null) where T : class
        {
            if (reader == null || reader.IsClosed)
            {
                return(new List <T>()
                {
                });
            }



            var accessor = TypeAccessor.Create(typeof(T), true);


            var pocoList = new List <T>();

            // Cache the field names in the reader for use in our while loop for efficiency.
            var readerFieldLookup = new Dictionary <string, int>(StringComparer.OrdinalIgnoreCase); // store name and ordinal

            for (var i = 0; i < reader.FieldCount; i++)
            {
                readerFieldLookup.Add(reader.GetName(i), i);
            }
            if (typeof(T) == typeof(string))
            {
                while (reader.Read())
                {
                    pocoList.Add(reader.GetString(0) as T);
                }
                reader.Close();
                reader.Dispose();
                return(pocoList);
            }

            while (reader.Read())
            {
                var clonedPoco = TypeExtension.New <T> .Instance();

                var advanceMembers = ExtFastMember.GetAdvanceMembers(clonedPoco);

                if (advanceMembers.IsNullOrEmpty() && typeof(IDynamicMetaObjectProvider).IsAssignableFrom(typeof(T)))
                {
                    readerFieldLookup.ForEach(delegate(KeyValuePair <string, int> pair)
                    {
                        advanceMembers.Add(new AdvanceMember()
                        {
                            Member = new DynamicMember()
                            {
                                Name = pair.Key
                            }
                        });
                    });
                }
                advanceMembers.Where(p => readerFieldLookup.ContainsKey(p.GetActualMemberName())).ToList().ForEach(delegate(AdvanceMember p)
                {
                    SetPocoProperteyValue(clonedPoco, reader, p, accessor, jsonSerializer, xmlSerializer, csvSerializer);
                });
                pocoList.Add(clonedPoco);
            }
            reader.Close();
            reader.Dispose();
            return(pocoList);
        }
Beispiel #34
0
 public WpsClient(HttpClient httpClient, IXmlSerializer serializationService)
 {
     _httpClient           = httpClient;
     _serializationService = serializationService;
 }
Beispiel #35
0
 public StudyController(IQueryExecutorFactory queryExecutorFactory, IXmlSerializer xmlSerializer, IJsonSerializer jsonSerializer)
 {
     this.queryExecutorFactory = queryExecutorFactory;
     this.xmlSerializer        = xmlSerializer;
     this.jsonSerializer       = jsonSerializer;
 }
Beispiel #36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServerConfigurationManager" /> class.
 /// </summary>
 /// <param name="applicationPaths">The application paths.</param>
 /// <param name="logManager">The log manager.</param>
 /// <param name="xmlSerializer">The XML serializer.</param>
 public ServerConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer)
     : base(applicationPaths, logManager, xmlSerializer)
 {
     UpdateItemsByNamePath();
     UpdateTranscodingTempPath();
     UpdateMetadataPath();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseConfigurationManager" /> class.
        /// </summary>
        /// <param name="applicationPaths">The application paths.</param>
        /// <param name="loggerFactory">The logger factory.</param>
        /// <param name="xmlSerializer">The XML serializer.</param>
        /// <param name="fileSystem">The file system.</param>
        protected BaseConfigurationManager(IApplicationPaths applicationPaths, ILoggerFactory loggerFactory, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
        {
            CommonApplicationPaths = applicationPaths;
            XmlSerializer          = xmlSerializer;
            _fileSystem            = fileSystem;
            Logger = loggerFactory.CreateLogger <BaseConfigurationManager>();

            UpdateCachePath();
        }
Beispiel #38
0
        public AnthemResultPdfDownloadPollingAgent(IEventCustomerResultRepository eventCustomerResultRepository, ISettings settings, ILogManager logManager,
                                                   IMediaRepository mediaRepository, ICustomSettingManager customSettingManager, IUniqueItemRepository <CorporateAccount> corporateAccountRepository,
                                                   IResultPdfDownloadPollingAgentHelper resultPdfDownloaderHelper, IPgpFileEncryptionHelper pgpFileEncryptionHelper, ICustomerRepository customerRepository,
                                                   IEventRepository eventRepository, ICorporateTagRepository corporateTagRepository, IXmlSerializer <ResultPdfPostedXml> resultPdfPostedSerializer,
                                                   IResultPdfFileHelper resultPdfFileHelper, IXmlSerializer <ResultPdfNotPosted> resultPdfNotPostedSerializer,
                                                   IResultPdfEmailNotificationHelper resultPdfEmailNotificationHelper, ICustomerResultPosedService customerResultPosedService,
                                                   IMedicareApiService medicareApiService, IEventCustomerRepository eventCustomerRepository)
        {
            _cutOfDate = settings.AnthemDownloadCutOfDate;
            _eventCustomerResultRepository = eventCustomerResultRepository;
            _settings                   = settings;
            _mediaRepository            = mediaRepository;
            _customSettingManager       = customSettingManager;
            _corporateAccountRepository = corporateAccountRepository;

            _resultPdfDownloaderHelper = resultPdfDownloaderHelper;
            _pgpFileEncryptionHelper   = pgpFileEncryptionHelper;
            _customerRepository        = customerRepository;
            _eventRepository           = eventRepository;
            _corporateTagRepository    = corporateTagRepository;
            _resultPdfPostedSerializer = resultPdfPostedSerializer;
            _resultPostedToPlanPath    = settings.ResultPostedToPlanPath;
            _resultPdfFileHelper       = resultPdfFileHelper;

            _logger = logManager.GetLogger("Anthem_ResultPdf");

            _accountIds = settings.AnthemAccountIds;

            _customSettingFile                = settings.PcpResultPdfDownloadSettings;
            _resultPdfNotPostedSerializer     = resultPdfNotPostedSerializer;
            _resultPdfEmailNotificationHelper = resultPdfEmailNotificationHelper;

            _customerResultPosedService = customerResultPosedService;

            _medicareApiService      = medicareApiService;
            _eventCustomerRepository = eventCustomerRepository;

            _cutOfDateForSendingReport = settings.AnthemCutOfDateForSendingReport;

            _maxPagesinBatch = settings.BatchPageSize;

            _crosswalkFilePath = settings.CrosswalkFilePath;
            _crosswalkFileYear = settings.CrosswalkFileYear;
        }
 /// <summary>
 /// Reads an xml configuration file from the file system
 /// It will immediately save the configuration after loading it, just
 /// in case there are new serializable properties
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="path">The path.</param>
 /// <param name="xmlSerializer">The XML serializer.</param>
 /// <returns>``0.</returns>
 public static T GetXmlConfiguration <T>(string path, IXmlSerializer xmlSerializer)
     where T : class
 {
     return(GetXmlConfiguration(typeof(T), path, xmlSerializer) as T);
 }
Beispiel #40
0
        public void SerializeThrowsGivenNullArguments(MockXmlWriter writer, object source, Type exception)
        {
            IXmlSerializer serializer = XmlSerializer.GetBuilder(typeof(MockSource)).Build();

            Assert.Throws(exception, () => serializer.Serialize(writer, source));
        }
Beispiel #41
0
 /// <summary>
 /// Serialize this object to the given serializer.
 /// </summary>
 public override void WriteTo(IXmlSerializer serializer)
 {
     serializer.Text(value);
 }
Beispiel #42
0
 public TVServiceProxy(IHttpClient httpClient, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer, StreamingServiceProxy wssProxy)
     : base(httpClient, jsonSerializer, xmlSerializer)
 {
     _wssProxy = wssProxy;
 }
Beispiel #43
0
 public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer)
 {
 }
Beispiel #44
0
 public DlnaProfileEntryPoint(IApplicationPaths appPaths, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
 {
     _appPaths      = appPaths;
     _xmlSerializer = xmlSerializer;
     _fileSystem    = fileSystem;
 }
 public YyyyServiceAgent(IXmlSerializer xmlSerializer, IYyyyClient yyyyClient)
 {
     _xmlSerializer = xmlSerializer ?? throw new ArgumentNullException(nameof(xmlSerializer));
     _yyyyClient    = yyyyClient ?? throw new ArgumentNullException(nameof(yyyyClient));
 }
Beispiel #46
0
        public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func <IImageProcessor> imageProcessorFactory, Func <IDtoService> dtoServiceFactory, Func <IConnectManager> connectFactory, IServerApplicationHost appHost, IJsonSerializer jsonSerializer, IFileSystem fileSystem)
        {
            _logger                = logger;
            UserRepository         = userRepository;
            _xmlSerializer         = xmlSerializer;
            _networkManager        = networkManager;
            _imageProcessorFactory = imageProcessorFactory;
            _dtoServiceFactory     = dtoServiceFactory;
            _connectFactory        = connectFactory;
            _appHost               = appHost;
            _jsonSerializer        = jsonSerializer;
            _fileSystem            = fileSystem;
            ConfigurationManager   = configurationManager;
            Users = new List <User>();

            DeletePinFile();
        }
Beispiel #47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProxyBase" /> class.
 /// </summary>
 /// <param name="httpClient">The HTTP client.</param>
 /// <param name="serializer">The serializer.</param>
 protected ProxyBase(IHttpClient httpClient, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer)
 {
     HttpClient     = httpClient;
     JsonSerializer = jsonSerializer;
     XmlSerializer  = xmlSerializer;
 }
Beispiel #48
0
        public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func <IImageProcessor> imageProcessorFactory, Func <IDtoService> dtoServiceFactory, IServerApplicationHost appHost, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ICryptoProvider cryptographyProvider)
        {
            _logger                = logger;
            UserRepository         = userRepository;
            _xmlSerializer         = xmlSerializer;
            _networkManager        = networkManager;
            _imageProcessorFactory = imageProcessorFactory;
            _dtoServiceFactory     = dtoServiceFactory;
            _appHost               = appHost;
            _jsonSerializer        = jsonSerializer;
            _fileSystem            = fileSystem;
            _cryptographyProvider  = cryptographyProvider;
            ConfigurationManager   = configurationManager;
            _users = Array.Empty <User>();

            DeletePinFile();
        }
 public StreamingServiceProxy(IHttpClient httpClient, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer, INetworkManager networkManager)
     : base(httpClient, jsonSerializer, xmlSerializer)
 {
     _networkManager = networkManager;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ServerConfigurationManager" /> class.
 /// </summary>
 /// <param name="applicationPaths">The application paths.</param>
 /// <param name="logManager">The log manager.</param>
 /// <param name="xmlSerializer">The XML serializer.</param>
 public ServerConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer)
     : base(applicationPaths, logManager, xmlSerializer)
 {
 }
Beispiel #51
0
 public TwitChannel(IHttpClient httpClient, IXmlSerializer xmlSerializer, ILogManager logManager)
 {
     _httpClient    = httpClient;
     _logger        = logManager.GetLogger(GetType().Name);
     _xmlSerializer = xmlSerializer;
 }
Beispiel #52
0
 public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
     : base(applicationPaths, xmlSerializer)
 {
     Instance = this;
 }
        private static void SetPocoProperteyValue <T>(T poco, IDataReader reader, AdvanceMember p, TypeAccessor accessor, IJsonSerializer jsonSerializer = null, IXmlSerializer xmlSerializer = null, ICsvSerializer csvSerializer = null)
        {
            var isDynamic = (typeof(IDynamicMetaObjectProvider).IsAssignableFrom(typeof(T)));



            var value = reader.GetValue(reader.GetOrdinal(p.GetActualMemberName()));

            if (isDynamic)
            {
                DynamicObjectHelper.AddProperty(poco as ExpandoObject, p.GetActualMemberName(), value);
                return;
            }

            if (value.GetType().Name != p.Member.Type.Name && value.GetType() != typeof(DBNull))
            {
                var type = p.Member.Type;
                if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable <>))
                {
                    type = Nullable.GetUnderlyingType(type);
                }
                if (type == null)
                {
                    type = p.Member.Type;
                }


                if (p?.SqlCustomAttritube?.SerializableType != null && p?.SqlCustomAttritube?.SerializableType != SerializableType.NONE)
                {
                    switch (p.SqlCustomAttritube.SerializableType)
                    {
                    case SerializableType.XML:
                        value = xmlSerializer?.DeserializeFromString(value.ToString(), type);
                        break;

                    case SerializableType.JSON:
                        value = jsonSerializer?.DeserializeFromString(value.ToString(), type);
                        break;

                    case SerializableType.CSV:
                        value = csvSerializer?.DeserializeFromString(value.ToString(), type);
                        break;

                    case SerializableType.NONE:
                        value = !type.IsEnum ? Convert.ChangeType(value, type, null) : System.Enum.Parse(type, value.ToString(), true);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    value = !type.IsEnum ? Convert.ChangeType(value, type, null) : System.Enum.Parse(type, value.ToString(), true);
                }
            }
            try
            {
                accessor[poco, p.Member.Name] = value is DBNull ? null : value;
            }
            catch (Exception error)
            {
                // this property may not be settable
                Console.WriteLine(error.Message);
            }
        }
Beispiel #54
0
 public SectionXmlSerializer(IXmlSerializer <Tab> tabFactory)
 {
     TabFactory = tabFactory;
 }
        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)
        {
            if (objectToSerializeType == null)
            {
                throw new ArgumentNullException("objectToSerializeType");
            }

            serializedObject = null;

            if (objectToSerializeType != typeof(DataFieldDescriptor))
            {
                return(false);
            }

            if (objectToSerialize == null)
            {
                serializedObject = new XElement("DataFieldDescriptor");
            }
            else
            {
                DataFieldDescriptor dataFieldDescriptor = (DataFieldDescriptor)objectToSerialize;

                serializedObject = dataFieldDescriptor.ToXml();
            }

            return(true);
        }
        public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer, ILogger logger) : base(applicationPaths, xmlSerializer)
        {
            Instance = this;

            AniDbTitleMatcher.DefaultInstance = new AniDbTitleMatcher(logger, new AniDbTitleDownloader(logger, applicationPaths));
        }
Beispiel #57
0
        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)
        {
            if (objectToSerializeType == null)
            {
                throw new ArgumentNullException("objectToSerializeType");
            }

            serializedObject = null;

            int attributeCount = objectToSerializeType.GetCustomAttributes(typeof(SerializableAttribute), false).Length;

            if (attributeCount > 0)
            {
                serializedObject = new XElement("Serializable");

                if (objectToSerialize != null)
                {
                    using (MemoryStream ms = new MemoryStream())
                    {
                        BinaryFormatter binaryFormatter = new BinaryFormatter();
                        binaryFormatter.Serialize(ms, objectToSerialize);

                        ms.Seek(0, SeekOrigin.Begin);

                        using (BinaryReader br = new BinaryReader(ms))
                        {
                            byte[] bytes = br.ReadBytes((int)ms.Length);

                            string result = Convert.ToBase64String(bytes);

                            serializedObject.Add(new XAttribute("value", result));
                        }
                    }
                }
                else
                {
                    serializedObject.Add(new XAttribute("type", TypeManager.SerializeType(objectToSerializeType)));
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #58
0
        public HttpListenerHost(IServerApplicationHost applicationHost,
                                ILogger logger,
                                IServerConfigurationManager config,
                                string defaultRedirectPath, INetworkManager networkManager, ITextEncoding textEncoding, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer, Func <Type, Func <string, object> > funcParseFn)
        {
            Instance = this;

            _appHost            = applicationHost;
            DefaultRedirectPath = defaultRedirectPath;
            _networkManager     = networkManager;
            _textEncoding       = textEncoding;
            _jsonSerializer     = jsonSerializer;
            _xmlSerializer      = xmlSerializer;
            _config             = config;

            _logger      = logger;
            _funcParseFn = funcParseFn;

            ResponseFilters = new Action <IRequest, IResponse, object>[] { };
        }
 public ResponseVendorReportService(IResponseVendorReportFactory responseVendorReportFactory, ICustomerRepository customerRepository, IEventCustomerRepository eventCustomerRepository, IUniqueItemRepository <Event> eventRepository,
                                    ILanguageRepository languageRepository, IAppointmentRepository appointmentRepository, ICallCenterCallRepository callRepository, IPcpDispositionRepository pcpDispositionRepository, IPcpAppointmentRepository pcpAppointmentRepository,
                                    IBarrierRepository barrierRepository, IChaseOutboundRepository chaseOutboundRepository, IChaseCampaignRepository chaseCampaignRepository, IChaseCampaignTypeRepository chaseCampaignTypeRepository,
                                    IUniqueItemRepository <CorporateAccount> corporateAccountRepository, IEventAppointmentCancellationLogRepository eventAppointmentCancellationLogRepository, ISettings settings, IXmlSerializer <ResultPdfPostedXml> resultPdfPostedSerializer,
                                    ICustomerEligibilityRepository customerEligibilityRepository)
 {
     _responseVendorReportFactory = responseVendorReportFactory;
     _customerRepository          = customerRepository;
     _eventCustomerRepository     = eventCustomerRepository;
     _eventRepository             = eventRepository;
     _languageRepository          = languageRepository;
     _appointmentRepository       = appointmentRepository;
     _callRepository              = callRepository;
     _pcpDispositionRepository    = pcpDispositionRepository;
     _pcpAppointmentRepository    = pcpAppointmentRepository;
     _barrierRepository           = barrierRepository;
     _chaseOutboundRepository     = chaseOutboundRepository;
     _chaseCampaignRepository     = chaseCampaignRepository;
     _chaseCampaignTypeRepository = chaseCampaignTypeRepository;
     _corporateAccountRepository  = corporateAccountRepository;
     _eventAppointmentCancellationLogRepository = eventAppointmentCancellationLogRepository;
     _settings = settings;
     _resultPdfPostedSerializer     = resultPdfPostedSerializer;
     _customerEligibilityRepository = customerEligibilityRepository;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseConfigurationManager" /> class.
        /// </summary>
        /// <param name="applicationPaths">The application paths.</param>
        /// <param name="logManager">The log manager.</param>
        /// <param name="xmlSerializer">The XML serializer.</param>
        protected BaseConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer)
        {
            CommonApplicationPaths = applicationPaths;
            XmlSerializer          = xmlSerializer;
            Logger = logManager.GetLogger(GetType().Name);

            UpdateCachePath();
        }