Example #1
0
 public AmfV3Formatter()
   {
   stream = new MemoryStream();
   writer = new FlashorbBinaryWriter( stream );
   objectSerializer = new V3ObjectSerializer();
   referenceCache = new V3ReferenceCache();
   }
Example #2
0
 public ScriptServices(
     IFileSystem fileSystem,
     IPackageAssemblyResolver packageAssemblyResolver,
     IScriptExecutor executor,
     IRepl repl,
     IScriptEngine engine,
     IFilePreProcessor filePreProcessor,
     IScriptPackResolver scriptPackResolver,
     IPackageInstaller packageInstaller,
     IObjectSerializer objectSerializer,
     ILog logger,
     IAssemblyResolver assemblyResolver,
     IEnumerable<IReplCommand> replCommands,
     IConsole console = null,
     IInstallationProvider installationProvider = null)
 {
     FileSystem = fileSystem;
     PackageAssemblyResolver = packageAssemblyResolver;
     Executor = executor;
     Repl = repl;
     Engine = engine;
     FilePreProcessor = filePreProcessor;
     ScriptPackResolver = scriptPackResolver;
     PackageInstaller = packageInstaller;
     ObjectSerializer = objectSerializer;
     Logger = logger;
     Console = console;
     AssemblyResolver = assemblyResolver;
     InstallationProvider = installationProvider;
     ReplCommands = replCommands;
 }
Example #3
0
 public ExecuteReplCommand(
     string scriptName,
     string[] scriptArgs,
     IFileSystem fileSystem,
     IScriptPackResolver scriptPackResolver,
     IScriptEngine scriptEngine,
     IFilePreProcessor filePreProcessor,
     IObjectSerializer serializer,
     ILog logger,
     IConsole console,
     IAssemblyResolver assemblyResolver,
     IEnumerable<IReplCommand> replCommands)
 {
     _scriptName = scriptName;
     _scriptArgs = scriptArgs;
     _fileSystem = fileSystem;
     _scriptPackResolver = scriptPackResolver;
     _scriptEngine = scriptEngine;
     _filePreProcessor = filePreProcessor;
     _serializer = serializer;
     _logger = logger;
     _console = console;
     _assemblyResolver = assemblyResolver;
     _replCommands = replCommands;
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CookieBasedSessions"/> class.
 /// </summary>
 /// <param name="encryptionProvider">The encryption provider.</param>
 /// <param name="hmacProvider">The hmac provider</param>
 /// <param name="objectSerializer">Session object serializer to use</param>
 public CookieBasedSessions(IEncryptionProvider encryptionProvider, IHmacProvider hmacProvider, IObjectSerializer objectSerializer)
 {
     this.currentConfiguration = new CookieBasedSessionsConfiguration
     {
         Serializer = objectSerializer,
         CryptographyConfiguration = new CryptographyConfiguration(encryptionProvider, hmacProvider)
     };
 }
        public CookieBasedSessionsFixture()
        {
            this.fakeEncryptionProvider = A.Fake<IEncryptionProvider>();
            this.fakeHmacProvider = A.Fake<IHmacProvider>();
            this.fakeObjectSerializer = new Fakes.FakeObjectSerializer();
            this.cookieStore = new CookieBasedSessions(this.fakeEncryptionProvider, this.fakeHmacProvider, this.fakeObjectSerializer);

            this.rijndaelEncryptionProvider = new RijndaelEncryptionProvider(new PassphraseKeyGenerator("password", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }, 1000));
            this.defaultHmacProvider = new DefaultHmacProvider(new PassphraseKeyGenerator("anotherpassword", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }, 1000));
            this.defaultObjectSerializer = new DefaultObjectSerializer();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisBasedSessions"/> class.
        /// </summary>
        /// <param name="encryptionProvider">The encryption provider.</param>
        /// <param name="hmacProvider">The hmac provider</param>
        /// <param name="objectSerializer">Session object serializer to use</param>
        public RedisBasedSessions(IEncryptionProvider encryptionProvider, IHmacProvider hmacProvider, IObjectSerializer objectSerializer)
        {
            _currentConfiguration = new RedisBasedSessionsConfiguration
            {
                Serializer = objectSerializer,
                CryptographyConfiguration = new CryptographyConfiguration(encryptionProvider, hmacProvider)
            };

            if (_redis == null)
                _redis = ConnectionMultiplexer.Connect(_currentConfiguration.ConnectionString);

            _db = _redis.GetDatabase();
        }
Example #7
0
 public Repl(
     string[] scriptArgs,
     IFileSystem fileSystem,
     IScriptEngine scriptEngine,
     IObjectSerializer serializer,
     ILog logger,
     IConsole console,
     IFilePreProcessor filePreProcessor)
     : base(fileSystem, filePreProcessor, scriptEngine, logger)
 {
     _scriptArgs = scriptArgs;
     _serializer = serializer;
     Console = console;
 }
        public When_an_Lrap1_attachment_is_submitted()
        {
            //Arrange
            _fakeObjectSerializer = A.Fake<IObjectSerializer>();
            _fakeRequestSender = A.Fake<IRequestSender>();

            _lrap1AttachmentRequest = new Lrap1AttachmentRequest()
            {
                Payload = "payload data"
            };

            _sut = new EdrsCommunicator(_fakeObjectSerializer);
            _sut.RequestSender = _fakeRequestSender;
        }
Example #9
0
 public Repl(
     string[] scriptArgs,
     IFileSystem fileSystem,
     IScriptEngine scriptEngine,
     IObjectSerializer serializer,
     ILog logger,
     IConsole console,
     IFilePreProcessor filePreProcessor,
     IEnumerable<IReplCommand> replCommands)
     : base(fileSystem, filePreProcessor, scriptEngine, logger)
 {
     _scriptArgs = scriptArgs;
     _serializer = serializer;
     Console = console;
     Commands = replCommands != null ? replCommands.ToList() : new List<IReplCommand>();
 }
Example #10
0
 public Repl(
     string[] scriptArgs,
     IFileSystem fileSystem,
     IScriptEngine scriptEngine,
     IObjectSerializer serializer,
     ILog logger,
     IConsole console,
     IFilePreProcessor filePreProcessor,
     IEnumerable<IReplCommand> replCommands)
     : base(fileSystem, filePreProcessor, scriptEngine, logger)
 {
     _scriptArgs = scriptArgs;
     _serializer = serializer;
     Console = console;
     Commands = replCommands != null ? replCommands.Where(x => x.CommandName != null).ToDictionary(x => x.CommandName, x => x) : new Dictionary<string, IReplCommand>();
 }
 public LoadWorkflowAsyncResult
     (
     InstancePersistenceContext context, 
     InstancePersistenceCommand command, 
     SqlWorkflowInstanceStore store,
     SqlWorkflowInstanceStoreLock storeLock,
     Transaction currentTransaction,
     TimeSpan timeout, 
     AsyncCallback callback, 
     object state
     ) :
     base(context, command, store, storeLock, currentTransaction, timeout, callback, state)
 {
     this.associatedInstanceKeys = new Dictionary<Guid, IDictionary<XName, InstanceValue>>();
     this.completedInstanceKeys = new Dictionary<Guid, IDictionary<XName, InstanceValue>>();
     this.objectSerializer = ObjectSerializerFactory.GetDefaultObjectSerializer();
 }
        public XmlDataStoreRepository()
        {
            dataStoreRepositoryPath = ConfigurationItem<string>.ReadSetting("XmlDataStoreRepositoryPath").GetValue();

            serializer = new XmlObjectSerializer();

            if (!File.Exists(dataStoreRepositoryPath))
            {
                dataStores = new XmlDataStoreCollection();

                File.WriteAllText(dataStoreRepositoryPath, serializer.Serialize(dataStores));

                return;
            }

            dataStores = serializer.Deserialize<XmlDataStoreCollection>(File.ReadAllText(dataStoreRepositoryPath));
        }
Example #13
0
        public void RegisterSerializer(IObjectSerializer serializer)
        {
            if (serializer.TypeID < 0) throw new InvalidDataException("serializers cannot have TypeIDs less than 0");
            IObjectSerializer existingSer;
            if (_serializers.TryGetValue(serializer.Type, out existingSer))
            {
                Debug.LogWarning(string.Format("Overwriting existing serializer {0} with {1}", existingSer, serializer));
            }
            _serializers[serializer.Type] = serializer;

            Type existingType;
            if (_typeMap.TryGetValue(serializer.TypeID, out existingType))
            {
                Debug.LogWarning(string.Format("Overwriting existing serializer for type {0} with {1}", existingType.Name, serializer));
            }
            _typeMap[serializer.TypeID] = serializer.Type;
        }
        public SecureXmlDataStoreRepository()
        {
            key = ConfigurationItem<string>.ReadSetting("SecureXmlDataStoreRepositoryKey").GetValue();
            dataStoreRepositoryPath = ConfigurationItem<string>.ReadSetting("SecureXmlDataStoreRepositoryPath").GetValue();

            serializer = new XmlObjectSerializer();

            if (!File.Exists(dataStoreRepositoryPath))
            {
                dataStores = new XmlDataStoreCollection();

                File.WriteAllText(dataStoreRepositoryPath, serializer.Serialize(dataStores));

                return;
            }

            dataStores = serializer.Deserialize<XmlDataStoreCollection>(File.ReadAllText(dataStoreRepositoryPath));

            PersistStore(); // force encryption for any insecure connection strings
        }
Example #15
0
        public ReplExecutor(
            IRepl repl,
            IObjectSerializer serializer,
            IFileSystem fileSystem,
            IFilePreProcessor filePreProcessor,
            IScriptEngine scriptEngine,
            ILog logger,
            IEnumerable<IReplCommand> replCommands)
            : base(fileSystem, filePreProcessor, scriptEngine, logger)
        {
            this.repl = repl;
            this.serializer = serializer;
            this.replCommands = replCommands;

            replCompletion = new CSharpCompletion(true);
            replCompletion.AddReferences(GetReferencesAsPaths());

            //since it's quite expensive to initialize the "System." references we clone the REPL code completion
            documentCompletion = replCompletion.Clone();
        }
Example #16
0
 public Repl(
     string[] scriptArgs,
     IFileSystem fileSystem,
     IScriptEngine scriptEngine,
     IObjectSerializer serializer,
     Common.Logging.ILog logger,
     IScriptLibraryComposer composer,
     IConsole console,
     IFilePreProcessor filePreProcessor,
     IEnumerable<IReplCommand> replCommands)
     : this(
         scriptArgs,
         fileSystem,
         scriptEngine,
         serializer,
         new CommonLoggingLogProvider(logger),
         composer,
         console,
         filePreProcessor,
         replCommands)
 {
 }
Example #17
0
        public ReplExecutor(
            IRepl repl,
            IObjectSerializer serializer,
            IFileSystem fileSystem,
            IFilePreProcessor filePreProcessor,
            IScriptEngine scriptEngine,
            IPackageInstaller packageInstaller,
            IPackageAssemblyResolver resolver,
            ILog logger)
            : base(fileSystem, filePreProcessor, scriptEngine, logger)
        {
            this.repl = repl;
            this.serializer = serializer;
            this.packageInstaller = packageInstaller;
            this.resolver = resolver;

            replCompletion = new CSharpCompletion(true);
            replCompletion.AddReferences(GetReferencesAsPaths());

            //since it's quite expensive to initialize the "System." references we clone the REPL code completion
            documentCompletion = replCompletion.Clone();
        }
Example #18
0
        public Repl(
            string[] scriptArgs,
            IFileSystem fileSystem,
            IScriptEngine scriptEngine,
            IObjectSerializer serializer,
            ILogProvider logProvider,
            IScriptLibraryComposer composer,
            IConsole console,
            IFilePreProcessor filePreProcessor,
            IEnumerable<IReplCommand> replCommands)
            : base(fileSystem, filePreProcessor, scriptEngine, logProvider, composer)
        {
            Guard.AgainstNullArgument("serializer", serializer);
            Guard.AgainstNullArgument("logProvider", logProvider);
            Guard.AgainstNullArgument("console", console);

            _scriptArgs = scriptArgs;
            _serializer = serializer;
            _log = logProvider.ForCurrentType();
            Console = console;
            Commands = replCommands != null ? replCommands.Where(x => x.CommandName != null).ToDictionary(x => x.CommandName, x => x) : new Dictionary<string, IReplCommand>();
        }
Example #19
0
        public ScriptServices(
            IFileSystem fileSystem,
            IPackageAssemblyResolver packageAssemblyResolver,
            IScriptExecutor executor,
            IRepl repl,
            IScriptEngine engine,
            IFilePreProcessor filePreProcessor,
            IScriptPackResolver scriptPackResolver,
            IPackageInstaller packageInstaller,
            IObjectSerializer objectSerializer,
            ILogProvider logProvider,
            IAssemblyResolver assemblyResolver,
            IEnumerable<IReplCommand> replCommands,
            IFileSystemMigrator fileSystemMigrator,
            IConsole console = null,
            IInstallationProvider installationProvider = null,
            IScriptLibraryComposer scriptLibraryComposer = null
            )
        {
            FileSystem = fileSystem;
            PackageAssemblyResolver = packageAssemblyResolver;
            Executor = executor;
            Repl = repl;
            Engine = engine;
            FilePreProcessor = filePreProcessor;
            ScriptPackResolver = scriptPackResolver;
            PackageInstaller = packageInstaller;
            ObjectSerializer = objectSerializer;
            LogProvider = logProvider;
#pragma warning disable 618
            Logger = new ScriptCsLogger(logProvider.ForCurrentType());
#pragma warning restore 618
            Console = console;
            AssemblyResolver = assemblyResolver;
            InstallationProvider = installationProvider;
            ReplCommands = replCommands;
            FileSystemMigrator = fileSystemMigrator;
            ScriptLibraryComposer = scriptLibraryComposer;
        }
Example #20
0
 public ScriptServices(
     IFileSystem fileSystem,
     IPackageAssemblyResolver packageAssemblyResolver,
     IScriptExecutor executor,
     IRepl repl,
     IScriptEngine engine,
     IFilePreProcessor filePreProcessor,
     IScriptPackResolver scriptPackResolver,
     IPackageInstaller packageInstaller,
     IObjectSerializer objectSerializer,
     Common.Logging.ILog logger,
     IAssemblyResolver assemblyResolver,
     IEnumerable<IReplCommand> replCommands,
     IFileSystemMigrator fileSystemMigrator,
     IConsole console = null,
     IInstallationProvider installationProvider = null,
     IScriptLibraryComposer scriptLibraryComposer = null
     )
     : this(
         fileSystem,
         packageAssemblyResolver,
         executor,
         repl,
         engine,
         filePreProcessor,
         scriptPackResolver,
         packageInstaller,
         objectSerializer,
         new CommonLoggingLogProvider(logger),
         assemblyResolver,
         replCommands,
         fileSystemMigrator,
         console,
         installationProvider,
         scriptLibraryComposer
     )
 {
 }
 public CustomInteractiveDiagnosticsHookFixture()
 {
     this.cryptoConfig = CryptographyConfiguration.Default;
     this.objectSerializer = new DefaultObjectSerializer();
 }
Example #22
0
 public CsrfStartup(CryptographyConfiguration cryptographyConfiguration, IObjectSerializer objectSerializer, ICsrfTokenValidator tokenValidator)
 {
     CryptographyConfiguration = cryptographyConfiguration;
     ObjectSerializer = objectSerializer;
     TokenValidator = tokenValidator;
 }
 public void SetUp()
 {
     _subject = new ObjectSerializer();
 }
 public EdrsCommunicator(IObjectSerializer objectSerializer)
 {
     _objectSerializer = objectSerializer;
     RequestSender = new RequestSender();
 }
 public void WithSerializer(IObjectSerializer newSerializer)
 {
 }
 public SqlPersistenceProvider(IObjectSerializer objectSerializer, ISessionFactory sessionFactory)
 {
     this.sessionFactory = sessionFactory;
     workflowDefinitionTransformer = new WorkflowDefinitionTransformer();
     executionTransformer = new ExecutionDefinitionTransformer(objectSerializer);
 }
 public Neo4jPersistenceProvider(IGraphClient graphClient, IObjectSerializer objectSerializer)
 {
     this.graphClient = graphClient;
     this.objectSerializer = objectSerializer;
 }
Example #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CookieBasedSessions"/> class.
 /// </summary>
 /// <param name="encryptionProvider">The encryption provider.</param>
 /// <param name="hmacProvider">The hmac provider</param>
 /// <param name="objectSerializer">Session object serializer to use</param>
 public CookieBasedSessions(IEncryptionProvider encryptionProvider, IHmacProvider hmacProvider, IObjectSerializer objectSerializer)
 {
     this.encryptionProvider = encryptionProvider;
     this.hmacProvider = hmacProvider;
     this.serializer = objectSerializer;
 }
Example #29
0
 /// <summary>
 /// Using the specified serializer
 /// </summary>
 /// <param name="newSerializer">Formatter to use</param>
 public void WithSerializer(IObjectSerializer newSerializer)
 {
     this.serializer = newSerializer;
 }
Example #30
0
 /// <summary>
 /// Using the specified serializer
 /// </summary>
 /// <param name="newSerializer">Formatter to use</param>
 public void WithSerializer(IObjectSerializer newSerializer)
 {
     this.currentConfiguration.Serializer = newSerializer;
 }