示例#1
0
        public void ServerWrapperConstructorTest()
        {
            Console.WriteLine(Directory.GetCurrentDirectory());
            FileInfo _defaultConfig = new FileInfo(@"Plugin\DemoConfiguration\DefaultConfig.xml");

            Assert.IsTrue(_defaultConfig.Exists);
            FileInfo _oses = new FileInfo(@"Plugin\DemoConfiguration\BoilerExample.oses");

            Assert.IsTrue(_oses.Exists);
            FileInfo _uasconfig = new FileInfo(@"Plugin\DemoConfiguration\BoilerExample.uasconfig");

            Assert.IsTrue(_uasconfig.Exists);
            Assembly       _pluginAssembly;
            IConfiguration _serverConfiguration;

            AssemblyHelpers.CreateInstance(@"CAS.CommServer.UA.ConfigurationEditor.ServerConfiguration.dll", out _pluginAssembly, out _serverConfiguration);
            Assert.AreEqual <string>("CAS.UAServer.Configuration.uasconfig", _serverConfiguration.DefaultFileName);
            bool _configurationChanged = false;

            _serverConfiguration.OnModified += (x, y) => _configurationChanged = y.ConfigurationFileChanged;
            _serverConfiguration.CreateDefaultConfiguration();
            Assert.IsTrue(_configurationChanged);
            _configurationChanged = false;
            Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>();

            _directory.SetupGet(x => x.BaseDirectory).Returns(Directory.GetCurrentDirectory());
            ServerWrapper _sw = new ServerWrapper(_serverConfiguration, _pluginAssembly, new GraphicalUserInterface(), _directory.Object, @"Plugin\DemoConfiguration\BoilerExample.uasconfig");

            Assert.IsNotNull(_sw);
            Assert.IsTrue(_configurationChanged);
        }
        public void SetUp()
        {
            wrapper = ServerWrapper.Create <Startup>(
                TestContext.CurrentContext.TestDirectory,
                services =>
            {
                services.AddSingleton(ApplicationLogging.LoggerFactory);
                services.AddLogging(item => item.AddNLog());
            },
                (context, config) =>
            {
                var env = context.HostingEnvironment;

                config.SetBasePath(env.ContentRootPath);
                config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
                config.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
                config.AddEnvironmentVariables();
                //config.AddInMemoryCollection(arrayDict);
            });
            var services = new ServiceCollection();

            services.RegisterModule(new SentimentApiModule(new Uri("http://localhost"))
            {
                Client = wrapper.Client
            });

            services.AddLogging(item => item.AddNLog());
            client = ConstructClient(services);
            services.AddSingleton(client);
            var provider = services.BuildServiceProvider();

            analysis       = provider.GetRequiredService <ISentimentAnalysis>();
            basicSentiment = provider.GetRequiredService <IBasicSentimentAnalysis>();
        }
示例#3
0
        private void InitializeAppContextComponent()
        {
            _components  = new System.ComponentModel.Container();
            _contextMenu = new ContextMenuStrip();

            _btnMainUI = new ToolStripMenuItem()
            {
                Text = "打开Web控制台"
            };
            _btnMainUI.Click += BtnMainUI_Click;
            _contextMenu.Items.Add(_btnMainUI);

            _btnExit = new ToolStripMenuItem
            {
                Text = "退出",
            };
            _btnExit.Click += BtnExit_Click;
            _contextMenu.Items.Add(_btnExit);

            _notifyIcon = new NotifyIcon(_components)
            {
                Icon             = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location),
                ContextMenuStrip = _contextMenu,
                Text             = "巨应壁纸",
                Visible          = true
            };

            _notifyIcon.MouseClick += new MouseEventHandler(NotifyIcon_MouseClick);
            WallpaperApi.Initlize(Dispatcher.CurrentDispatcher);
            Task.Run(() =>
            {
                int port = GetPort();
                ServerWrapper.Start(port);
            });
        }
示例#4
0
        public ServerInstance()
        {
            m_launchedTime = DateTime.MinValue;

            m_serverThread   = null;
            m_serverInstance = this;

            string gameExePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "HELLION_Dedicated.exe");

            if (System.IO.File.Exists(gameExePath))
            {
                m_assembly      = Assembly.LoadFile(gameExePath);
                m_serverWrapper = new ServerWrapper(m_assembly);
            }
            else
            {
                Console.WriteLine($"HELLION_Dedicated.exe not detected at {gameExePath}.\r\n Press any key to close.");
            }

            //m_gameServerProperties = new GameServerProperties();
            //m_gameServerProperties.Load();

            m_gameServerIni = new GameServerIni();
            m_gameServerIni.Load();
        }
示例#5
0
        public SettingsViewModel(bool needRestart)
        {
            ServerWrapper             = new ServerWrapper();
            ServerWrapper.NeedRestart = needRestart;

            CloseCommand   = new RelayCommand(Close);
            ConfirmCommand = new RelayCommand(Confirm);
        }
示例#6
0
        static ServerManager()
        {
            Server = new ServerWrapper(IPAddress.Any, Port);
            Server.ClientConnected    += ServerClientConnected;
            Server.ClientDisconnected += ServerClientDisconnected;
            Server.ErrorOccured       += ServerErrorOccured;

            ClientManagers = new ConcurrentDictionary <int, ClientManager>();
        }
        public ServerInstance()
        {
            m_launchedTime = DateTime.MinValue;

            m_serverThread   = null;
            m_serverInstance = this;

            m_assembly      = Assembly.LoadFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "HELLION_Dedicated.exe"));
            m_serverWrapper = new ServerWrapper(m_assembly);
        }
示例#8
0
        /// <summary>
        /// setup publishing from sample server
        /// </summary>
        private static async Task PublishAsync(IIoTHubConfig config, ILogger logger,
                                               string deviceId, string moduleId, bool listNodes, string[] args)
        {
            try {
                using (var cts = new CancellationTokenSource())
                    using (var server = new ServerWrapper(logger)) { // Start test server
                        // Start publisher module
                        var host = Task.Run(() => HostAsync(config, logger, deviceId,
                                                            moduleId, args, true), cts.Token);

                        // Wait a bit
                        await Task.Delay(TimeSpan.FromSeconds(5), cts.Token);

                        // Nodes to publish
                        var nodes = new string[] {
                            "i=2258", // Server time
                            "ns=12;s=0:Boiler #1?Drum/Level/Measurement"
                            // ...
                        };

                        foreach (var node in nodes)
                        {
                            await PublishNodesAsync(config, logger, deviceId, moduleId,
                                                    server.EndpointUrl, node, true, cts.Token);
                        }

                        var lister = Task.CompletedTask;
                        if (listNodes)
                        {
                            lister = Task.Run(() => ListNodesAsync(config, logger,
                                                                   deviceId, moduleId, server.EndpointUrl, cts.Token), cts.Token);
                        }

                        Console.WriteLine("Press key to cancel...");
                        Console.ReadKey();

                        foreach (var node in nodes)
                        {
                            await PublishNodesAsync(config, logger, deviceId, moduleId,
                                                    server.EndpointUrl, node, false, CancellationToken.None);
                        }

                        logger.Information("Server exiting - tear down publisher...");
                        cts.Cancel();

                        await lister;
                        await host;
                    }
            }
            catch (OperationCanceledException) { }
            finally {
                Try.Op(() => File.Delete("publishednodes.json"));
            }
        }
示例#9
0
        public void Disconnect()
        {
            if (!_socket.Connected)
            {
                return;
            }

            Console.WriteLine($"Disconnecting {_socket.RemoteEndPoint}");

            ServerWrapper.Log(Encoding.ASCII.GetBytes($"{_socket.RemoteEndPoint} disconnected."));

            _socket.Shutdown(SocketShutdown.Both);
            _socket.Close();
        }
示例#10
0
        public AppContext()
        {
            _uiDispatcher = Dispatcher.CurrentDispatcher;
            InitializeUI();

            WallpaperApi.Initlize(_uiDispatcher);
            AppManager.CultureChanged += LanService_CultureChanged;
            SetMenuText();
            _ = Task.Run(() =>
            {
                int port = GetPort();
                ServerWrapper.Start(port);
            });
            CheckMutex();
        }
示例#11
0
        private bool CheckConnection()
        {
            var connectionString = ServerWrapper.GetConnectionString();

            try
            {
                SqlConnection testConnection = new SqlConnection(connectionString);
                testConnection.Open();
                testConnection.Close();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#12
0
        private static int Main(string[] args)
        {
            var options = ParseCommandLineArguments(args);

            if (options == null)
            {
                return(ExitCodes.InvalidArguments);
            }

            using (var logger = new Logger())
                using (var logSink = new RollingFileLogSink(new RollingFileSettings(options.LogFolder, "SQL Scripter")))
                {
                    logger.AddLogSink(logSink);

                    try
                    {
                        LogHeader(logger, options);

                        SetupFolders(options.LogFolder, options.OutputFolder);

                        var scriptFileManager = new ScriptFileManager(Path.Combine(options.OutputFolder, options.Server));
                        var server            = new ServerWrapper(new Server(options.Server));

                        var scripter =
                            new Scripter(server, scriptFileManager, logger)
                            .IncludeTheseDatabases(options.IncludeDatabases.ToArray())
                            .ExcludedTheseDatabases(options.ExcludeDatabases.ToArray());

                        ConfigureScriptingSources(options, scripter);

                        scripter.DumpScripts();

                        logger.PostEntry("DONE");
                    }
                    catch (Exception ex)
                    {
                        logger.PostException(ex);
                        Console.WriteLine(ex);
                        return(ExitCodes.UnexpectedException);
                    }

                    logger.CompleteAllAsync().Wait(new TimeSpan(0, 0, 3));
                }

            return(ExitCodes.Ok);
        }
示例#13
0
        public ServerInstance()
        {
            m_serverInstance = this;

            mainLog = NLog.LogManager.GetCurrentClassLogger();

            m_launchedTime = DateTime.MinValue;
            m_serverThread = null;


            // Wrap IR.exe
            m_assembly = Assembly.LoadFrom(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "IR.exe"));

            // Wrap Aluna Framework as GameState was moved here.
            m_frameworkAssembly = Assembly.LoadFrom(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AlunaNetFramework.dll"));

            // Wrap both assemblies
            m_serverWrapper = new ServerWrapper(m_assembly, m_frameworkAssembly);
        }
示例#14
0
        public void UAOOIDataBindingsTestMethod()
        {
            Assembly       _pluginAssembly      = Assembly.GetExecutingAssembly();
            IConfiguration _serverConfiguration = AssemblyHelpers.CreateInstance(_pluginAssembly);

            Assert.IsNotNull(_serverConfiguration);
            Assert.AreEqual <string>("DefaultFileName.xxl", _serverConfiguration.DefaultFileName);
            bool _configurationChanged = false;

            _serverConfiguration.OnModified += (x, y) => _configurationChanged = y.ConfigurationFileChanged;
            _serverConfiguration.CreateDefaultConfiguration();
            Assert.IsTrue(_configurationChanged);
            _configurationChanged = false;
            //TODO UANetworkingConfiguration[T].ReadConfiguration shows popup if file has errors #73
            ServerWrapper _sw = new ServerWrapper(_serverConfiguration, _pluginAssembly, new GraphicalUserInterface(), m_ConfigurationBaseFileName);

            Assert.IsNotNull(_sw);
            Assert.IsTrue(_configurationChanged);
        }
示例#15
0
        public void ConstructorTest()
        {
            const string          _defaultConfigurationFileName = "DefaultFileName.tst";
            Mock <IConfiguration> _IConfigurationMock           = new Mock <IConfiguration>();

            _IConfigurationMock.SetupGet <string>(x => x.DefaultFileName).Returns(_defaultConfigurationFileName);
            _IConfigurationMock.Setup(x => x.SaveConfiguration(It.IsAny <string>(), It.IsAny <FileInfo>()));
            Mock <IDataProviderDescription> _IDataProviderDescriptionMock = new Mock <IDataProviderDescription>();
            Mock <IGraphicalUserInterface>  _guiMock = new Mock <IGraphicalUserInterface>();

            Mock <IFileDialog>          _openFileDialogMock   = new Mock <IFileDialog>();
            Mock <IFolderBrowserDialog> _IFolderBrowserDialog = new Mock <IFolderBrowserDialog>();
            List <string> _message = new List <string>();
            List <string> _caption = new List <string>();

            _guiMock.Setup(x => x.MessageBoxShowWarning);
            _guiMock.SetupGet(x => x.MessageBoxShowExclamation).Returns(() => (message, caption) => { _message.Add(message); _caption.Add(caption); });
            _guiMock.SetupGet(x => x.OpenFileDialogFunc).Returns(() => () => _openFileDialogMock.Object);
            _guiMock.SetupGet(x => x.OpenFolderBrowserDialogFunc).Returns(() => () => _IFolderBrowserDialog.Object);
            _guiMock.SetupGet(x => x.MessageBoxShowError).Returns(() => (message, caption) => { _message.Add(message); _caption.Add(caption); });

            ServerWrapper _instanceUnderTest = new ServerWrapper(_IConfigurationMock.Object, _IDataProviderDescriptionMock.Object, _guiMock.Object);

            _IConfigurationMock.Verify(x => x.SaveConfiguration("", It.IsAny <FileInfo>()), Times.Once);
            _guiMock.VerifyGet(x => x.MessageBoxShowError, Times.Never);
            Assert.AreEqual <int>(2, _message.Count);
            CollectionAssert.AreEqual(
                new string[] { "You did not choose the configuration file. Please select a location of the default configuration file.", "Folder is not selected, configuration will be created in the default location." },
                _message.ToArray());

            //Configuration
            Assert.IsNotNull(_instanceUnderTest.Configuration);
            Assert.IsNotNull(_instanceUnderTest.Configuration.ConfigurationFile);
            Assert.AreEqual <string>(Path.Combine(Directory.GetCurrentDirectory(), _defaultConfigurationFileName), _instanceUnderTest.Configuration.ConfigurationFile.FullName);
            //PluginDescription
            Assert.IsNotNull(_instanceUnderTest.PluginDescription);
            Assert.AreSame(_IDataProviderDescriptionMock.Object, _instanceUnderTest.PluginDescription);
            IConfiguration _configurationEditor = _instanceUnderTest.GetServerConfiguration;

            Assert.IsNotNull(_configurationEditor);
            Assert.AreEqual(_IConfigurationMock.Object, _configurationEditor);
        }
示例#16
0
 /// <summary>
 /// Test model archiver
 /// </summary>
 private static async Task TestOpcUaModelArchiveAsync(EndpointModel endpoint)
 {
     using (var logger = StackLogger.Create(ConsoleLogger.Create())) {
         var storage  = new ZipArchiveStorage();
         var fileName = "tmp.zip";
         using (var client = new ClientServices(logger.Logger, new TestClientServicesConfig()))
             using (var server = new ServerWrapper(endpoint, logger)) {
                 var sw = Stopwatch.StartNew();
                 using (var archive = await storage.OpenAsync(fileName, FileMode.Create, FileAccess.Write))
                     using (var archiver = new AddressSpaceArchiver(client, endpoint, archive, logger.Logger)) {
                         await archiver.ArchiveAsync(CancellationToken.None);
                     }
                 var elapsed = sw.Elapsed;
                 using (var file = File.Open(fileName, FileMode.OpenOrCreate)) {
                     Console.WriteLine($"Encode as to {fileName} took " +
                                       $"{elapsed}, and produced {file.Length} bytes.");
                 }
             }
     }
 }
示例#17
0
        /// <summary>
        /// Test model browse encoder to file
        /// </summary>
        private static async Task TestOpcUaModelExportToFileAsync(EndpointModel endpoint)
        {
            using (var logger = StackLogger.Create(ConsoleLogger.Create())) {
                // Run both encodings twice to prime server and get realistic timings the
                // second time around
                var runs = new Dictionary <string, string> {
                    ["json1.zip"] = ContentMimeType.UaJson,
                    //  ["bin1.zip"] = ContentEncodings.MimeTypeUaBinary,
                    ["json2.zip"] = ContentMimeType.UaJson,
                    //  ["bin2.zip"] = ContentEncodings.MimeTypeUaBinary,
                    ["json1.gzip"] = ContentMimeType.UaJson,
                    //  ["bin1.gzip"] = ContentEncodings.MimeTypeUaBinary,
                    ["json2.gzip"] = ContentMimeType.UaJson,
                    // ["bin2.gzip"] = ContentEncodings.MimeTypeUaBinary
                };

                using (var client = new ClientServices(logger.Logger, new TestClientServicesConfig()))
                    using (var server = new ServerWrapper(endpoint, logger)) {
                        foreach (var run in runs)
                        {
                            var zip = Path.GetExtension(run.Key) == ".zip";
                            Console.WriteLine($"Writing {run.Key}...");
                            var sw = Stopwatch.StartNew();
                            using (var stream = new FileStream(run.Key, FileMode.Create)) {
                                using (var zipped = zip ?
                                                    new DeflateStream(stream, CompressionLevel.Optimal) :
                                                    (Stream) new GZipStream(stream, CompressionLevel.Optimal))
                                    using (var browser = new BrowseStreamEncoder(client, endpoint, zipped,
                                                                                 run.Value, null, logger.Logger, null)) {
                                        await browser.EncodeAsync(CancellationToken.None);
                                    }
                            }
                            var elapsed = sw.Elapsed;
                            using (var file = File.Open(run.Key, FileMode.OpenOrCreate)) {
                                Console.WriteLine($"Encode as {run.Value} to {run.Key} took " +
                                                  $"{elapsed}, and produced {file.Length} bytes.");
                            }
                        }
                    }
            }
        }
示例#18
0
        /// <summary>
        /// setup publishing from sample server
        /// </summary>
        private static async Task WithServerAsync(IIoTHubConfig config, ILogger logger,
                                                  string deviceId, string moduleId, string[] args, bool verbose = false)
        {
            try {
                using (var cts = new CancellationTokenSource())
                    using (var server = new ServerWrapper(logger)) { // Start test server
                        // Start publisher module
                        var host = Task.Run(() => HostAsync(config, logger, deviceId,
                                                            moduleId, args, verbose, true), cts.Token);

                        Console.WriteLine("Press key to cancel...");
                        Console.ReadKey();

                        logger.Information("Server exiting - tear down publisher...");
                        cts.Cancel();

                        await host;
                    }
            }
            catch (OperationCanceledException) { }
        }
示例#19
0
 public void Parse(string str)
 {
     if (str.StartsWith($"{Name}:/nick "))
     {
         str = ServerWrapper.RemoveWhiteSpace(Encoding.ASCII.GetBytes(str));
         ServerWrapper.Log($"{Name} has changed their name to {str.Substring($"{Name}:/nick ".Length)}");
         Console.WriteLine($"{Name} has changed their name to {str.Substring($"{Name}:/nick ".Length)}");
         Name = str.Substring($"{Name}:/nick ".Length);
     }
     else if (str.Trim() == "/disconnect")
     {
         ServerWrapper.Log($"{Name} has disconnected.");
         Console.WriteLine($"{Name} has disconnected.");
         Disconnect();
         ServerWrapper.ConnectedUsers.Remove(this);
     }
     else
     {
         Console.WriteLine(ServerWrapper.RemoveWhiteSpace(Encoding.ASCII.GetBytes(str)));
         ServerWrapper.Log(ServerWrapper.RemoveWhiteSpace(Encoding.ASCII.GetBytes(str)));
     }
 }
示例#20
0
 /// <summary>
 /// Test model export and import
 /// </summary>
 private static async Task TestOpcUaModelWriterAsync(EndpointModel endpoint)
 {
     using (var logger = StackLogger.Create(ConsoleLogger.Create())) {
         var filename = "model.zip";
         using (var server = new ServerWrapper(endpoint, logger)) {
             using (var client = new ClientServices(logger.Logger, new TestClientServicesConfig())) {
                 Console.WriteLine($"Reading into {filename}...");
                 using (var stream = new FileStream(filename, FileMode.Create)) {
                     using (var zipped = new DeflateStream(stream, CompressionLevel.Optimal))
                         using (var browser = new BrowseStreamEncoder(client, endpoint, zipped,
                                                                      ContentMimeType.UaJson, null, logger.Logger, null)) {
                             await browser.EncodeAsync(CancellationToken.None);
                         }
                 }
             }
         }
         GC.Collect();
         GC.WaitForPendingFinalizers();
         var             serializer = new NewtonSoftJsonSerializer();
         IDatabaseServer database   = new MemoryDatabase(logger.Logger, serializer);
         for (var i = 0; ; i++)
         {
             Console.WriteLine($"{i}: Writing from {filename}...");
             var sw = Stopwatch.StartNew();
             using (var file = File.Open(filename, FileMode.OpenOrCreate)) {
                 using (var unzipped = new DeflateStream(file, CompressionMode.Decompress)) {
                     // TODO
                     // var writer = new SourceStreamImporter(new ItemContainerFactory(database),
                     //     new VariantEncoderFactory(), logger.Logger);
                     // await writer.ImportAsync(unzipped, Path.GetFullPath(filename + i),
                     //     ContentMimeType.UaJson, null, CancellationToken.None);
                 }
             }
             var elapsed = sw.Elapsed;
             Console.WriteLine($"{i}: Writing took {elapsed}.");
         }
     }
 }
示例#21
0
 /// <summary>
 /// Test model browse encoder
 /// </summary>
 private static async Task TestOpcUaModelExportServiceAsync(EndpointModel endpoint)
 {
     using (var logger = StackLogger.Create(ConsoleLogger.Create()))
         using (var client = new ClientServices(logger.Logger, new TestClientServicesConfig()))
             using (var server = new ServerWrapper(endpoint, logger))
                 using (var stream = Console.OpenStandardOutput())
                     using (var writer = new StreamWriter(stream))
                         using (var json = new JsonTextWriter(writer)
                         {
                             AutoCompleteOnClose = true,
                             Formatting = Formatting.Indented,
                             DateFormatHandling = DateFormatHandling.IsoDateFormat
                         })
                             using (var encoder = new JsonEncoderEx(json, null,
                                                                    JsonEncoderEx.JsonEncoding.Array)
                             {
                                 IgnoreDefaultValues = true,
                                 UseAdvancedEncoding = true
                             })
                                 using (var browser = new BrowseStreamEncoder(client, endpoint, encoder,
                                                                              null, logger.Logger, null)) {
                                     await browser.EncodeAsync(CancellationToken.None);
                                 }
 }
示例#22
0
 /// <summary>
 /// Test client
 /// </summary>
 private static async Task TestOpcUaServerClientAsync(EndpointModel endpoint)
 {
     using (var logger = StackLogger.Create(ConsoleLogger.Create()))
         using (var client = new ClientServices(logger.Logger, new TestClientServicesConfig()))
             using (var server = new ServerWrapper(endpoint, logger)) {
                 await client.ExecuteServiceAsync(endpoint, null, session => {
                     Console.WriteLine("Browse the OPC UA server namespace.");
                     var w     = Stopwatch.StartNew();
                     var stack = new Stack <Tuple <string, ReferenceDescription> >();
                     session.Browse(null, null, ObjectIds.RootFolder,
                                    0u, Opc.Ua.BrowseDirection.Forward, ReferenceTypeIds.HierarchicalReferences,
                                    true, 0, out var continuationPoint, out var references);
                     Console.WriteLine(" DisplayName, BrowseName, NodeClass");
                     references.Reverse();
                     foreach (var rd in references)
                     {
                         stack.Push(Tuple.Create("", rd));
                     }
                     while (stack.Count > 0)
                     {
                         var browsed = stack.Pop();
                         session.Browse(null, null,
                                        ExpandedNodeId.ToNodeId(browsed.Item2.NodeId, session.NamespaceUris),
                                        0u, Opc.Ua.BrowseDirection.Forward, ReferenceTypeIds.HierarchicalReferences,
                                        true, 0, out continuationPoint, out references);
                         references.Reverse();
                         foreach (var rd in references)
                         {
                             stack.Push(Tuple.Create(browsed.Item1 + "   ", rd));
                         }
                         Console.WriteLine($"{browsed.Item1}{(references.Count == 0 ? "-" : "+")} " +
                                           $"{browsed.Item2.DisplayName}, {browsed.Item2.BrowseName}, {browsed.Item2.NodeClass}");
                     }
                     Console.WriteLine($"   ....        took {w.ElapsedMilliseconds} ms...");
                     return(Task.FromResult(true));
                 });
 public void SetUp()
 {
     wrapper = ServerWrapper.Create <Startup>(TestContext.CurrentContext.TestDirectory, services => { });
 }
示例#24
0
 public void SetUp()
 {
     System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
     wrapper = ServerWrapper.Create <Startup>(TestContext.CurrentContext.TestDirectory, services => { });
 }
示例#25
0
文件: Ban.cs 项目: xorle/MineEdit
 public Ban(ServerWrapper w)
 {
     wrap              = w;
     wrap.ChatCommand += new ChatCommandHandler(wrap_ChatCommand);
     Proxy.AddDelegate(false, 1, CheckLogin);
 }
示例#26
0
 public void SetUp()
 {
     wrapper  = ServerWrapper.Create <Startup>(TestContext.CurrentContext.TestDirectory, services => { });
     analysis = new SentimentTracking(new ApiClientFactory(wrapper.Client, wrapper.Client.BaseAddress));
 }
示例#27
0
 public Who(ServerWrapper w)
 {
     wrap              = w;
     wrap.ChatCommand += new ChatCommandHandler(wrap_ChatCommand);
 }
示例#28
0
文件: Who.cs 项目: N3X15/MineEdit
 public Who(ServerWrapper w)
 {
     wrap = w;
     wrap.ChatCommand += new ChatCommandHandler(wrap_ChatCommand);
 }
示例#29
0
        private static int Main(string[] args)
        {
            var options = ParseCommandLineArguments(args);
            if (options == null)
                return ExitCodes.InvalidArguments;

            using (var logger = new Logger())
            using(var logSink = new RollingFileLogSink(new RollingFileSettings(options.LogFolder, "SQL Scripter")))
            {
                logger.AddLogSink(logSink);

                try
                {
                    LogHeader(logger, options);

                    SetupFolders(options.LogFolder, options.OutputFolder);

                    var scriptFileManager = new ScriptFileManager(Path.Combine(options.OutputFolder, options.Server));
                    var server = new ServerWrapper(new Server(options.Server));

                    var scripter =
                        new Scripter(server, scriptFileManager, logger)
                            .IncludeTheseDatabases(options.IncludeDatabases.ToArray())
                            .ExcludedTheseDatabases(options.ExcludeDatabases.ToArray());

                    ConfigureScriptingSources(options, scripter);

                    scripter.DumpScripts();

                    logger.PostEntry("DONE");
                }
                catch (Exception ex)
                {
                    logger.PostException(ex);
                    Console.WriteLine(ex);
                    return ExitCodes.UnexpectedException;
                }

                logger.CompleteAllAsync().Wait(new TimeSpan(0, 0, 3));
            }

            return ExitCodes.Ok;
        }
示例#30
0
 public Give(ServerWrapper w)
 {
     wrap              = w;
     wrap.Join        += new JoinPartHandler(wrap_Join);
     wrap.ChatCommand += new ChatCommandHandler(wrap_ChatCommand);
 }
示例#31
0
 public ApplicationDbContext() : base(ServerWrapper.GetConnectionString())
 {
 }