Exemplo n.º 1
0
        public void StartWCFStreamingServer(string ipAddress, int port, string storageFolder)
        {
            try
            {
                NetTcpBinding binding = new NetTcpBinding();
                binding.TransferMode  = TransferMode.Streamed;
                binding.Security.Mode = SecurityMode.Transport;
                binding.SendTimeout   = new TimeSpan(0, 0, 10);
                binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None;
                var myEndpointAddress = new EndpointAddress("net.tcp://" + ipAddress + ":" + port);
                m_service = new FileRepositoryService("FileRepositoryService", myEndpointAddress);


                if (Directory.Exists(storageFolder) == false)
                {
                    Directory.CreateDirectory(storageFolder);
                }

                m_service.RepositoryDirectory = storageFolder;

                m_service.FileRequested += new FileEventHandler(Service_FileRequested);
                m_service.FileUploaded  += new FileEventHandler(Service_FileUploaded);
                m_service.FileDeleted   += new FileEventHandler(Service_FileDeleted);

                m_wcfStreamingServerHost          = new ServiceHost(m_service);
                m_wcfStreamingServerHost.Faulted += new EventHandler(Host_Faulted);
                m_wcfStreamingServerHost.Open();
                Console.WriteLine("Service started at address: " + ipAddress);
            }
            catch (Exception err)
            {
                throw (new SystemException(err.Message));
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            service = new FileRepositoryService();

            if (Directory.Exists("c:\\Goji") == false)
            {
                Directory.CreateDirectory("c:\\Goji");
            }
            if (Directory.Exists("c:\\Goji\\Storage") == false)
            {
                Directory.CreateDirectory("c:\\Goji\\Storage");
            }

            service.RepositoryDirectory = "c:\\Goji\\Storage";

            service.FileRequested += new FileEventHandler(Service_FileRequested);
            service.FileUploaded  += new FileEventHandler(Service_FileUploaded);
            service.FileDeleted   += new FileEventHandler(Service_FileDeleted);

            host          = new ServiceHost(service);
            host.Faulted += new EventHandler(Host_Faulted);

            try
            {
                host.Open();
                Console.WriteLine("Press a key to close the service");
                Console.ReadKey();
            }
            finally
            {
                host.Close();
            }
        }
Exemplo n.º 3
0
        public void MyTestInitialize()
        {
            TestTarget = new FileRepositoryService();

            LoanSettings = new LoanSettings
            {
                Lånebeøb        = 50000m,
                Løbetid         = 5 * 12,
                PålydendeRente  = 0.08m,
                Startomkostning = 500m
            };
        }
Exemplo n.º 4
0
        public static void Main(string[] args)
        {
            try
            {
                //get required args from command line
                var options = new Options();
                if (!Parser.Default.ParseArguments(args, options))
                {
                    Console.WriteLine("Use --help for help with the command line arguments.");
                    throw new ArgumentException("Some arguments could not be parsed.");
                }

                //Get the highest committedUSN for an Incremental or Full sync
                IRepositoryService repoService = new FileRepositoryService(@"AdSyncHighestCommittedUSN.txt");

                //Load configuration parameters
                NameValueCollection configValues = ConfigurationManager.AppSettings;
                AdSyncConfig        dca          = AdSyncConfig.FromConfig(configValues, options);

                //Create NPrinting Rest Client
                ApiClient npclient = NPrintingApiFactory.GetNPrintingApiClient(dca.GetNpUrl());

                //Run the sync operation
                ActiveDirectorySyncService syncService = new ActiveDirectorySyncService(dca, new ActiveDirectoryProcessor(npclient));
                AdSync adSync = new AdSync(repoService, syncService);

                adSync.Sync();
            }
            catch (ApiException e)
            {
                Console.WriteLine("API Error: " + e);
            }
            catch (IOException e)
            {
                Console.WriteLine(e);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            service = new FileRepositoryService();
            service.RepositoryDirectory = "storage";



            host = new ServiceHost(service);


            try
            {
                host.Open();
                Console.WriteLine("Press a key to close the service:");
                Console.ReadKey();
            }

            finally
            {
                host.Close();
            }
        }