Пример #1
0
        public async Task <TeamProject> GetSourceProjectAsync(CancellationToken cancellationToken)
        {
            if (_source == null && SourceServer != null && !String.IsNullOrEmpty(SourceProjectName))
            {
                _source = await SourceServer.FindProjectAsync(SourceProjectName, cancellationToken).ConfigureAwait(false);
            }

            return(_source);
        }
Пример #2
0
        public void RCONLongSourceServer()
        {
            SourceServer server = new SourceServer(sourceServerAddress, sourceServerPort);

            server.RconSocket.Timeout = sourceServerTimeout;
            server.RconAuth(goldSrcServerAuth);

            string rconReply = server.RconExec("cvarlist");

            Assert.IsTrue(rconReply.Contains("total convars/concommands"),
                          "Did not receive complete cvarlist.");
        }
        public ServerWindow(string StartParameter, string StartFolder)
        {
            TimePattern            = new Regex(@"\[\d{1,2}:\d{1,2}:\d{1,2}\]");
            TypePattern            = new Regex(@"\s\[(.+)/(\w+)\]");
            m_Client               = new NF.TCPClient("192.168.1.101", 1523);
            m_Client.DataReceived += new NF.TCPClient.DelegateDataReceived(OnClientDataReceived);
            InitializeComponent();

            baseServer              = new SourceServer(StartParameter, StartFolder);
            baseServer.OutPutEvent += BaseServer_OutPutEvent;
            baseServer.CloseEvent  += BaseServer_CloseEvent;
            this.Loaded            += ServerWindow_Loaded;
        }
        public static void AddSourceServer(this MainWindow mainWindow)
        {
            IServer             server     = new SourceServer();
            AddEditServerSource editWindow = new AddEditServerSource(mainWindow, server);

            editWindow.Title = Properties.Resources.aes_AddNewServerTitle;
            if (editWindow.ShowDialog() == true)
            {
                mainWindow._serversControl.Servers.Add(server);
                CreateControlsForServer(mainWindow, server);
                SaveOptions(mainWindow, mainWindow._configFileName);
            }
        }
Пример #5
0
        public void RCONShortSourceServer()
        {
            SourceServer server = new SourceServer(sourceServerAddress, sourceServerPort);

            server.RconSocket.Timeout = sourceServerTimeout;
            server.RconAuth(sourceServerAuth);

            string rconReply = server.RconExec("version");

            Assert.IsTrue(rconReply.Contains("Protocol version") &&
                          rconReply.Contains("Exe version") &&
                          rconReply.Contains("Exe build"),
                          "Did not receive correct version response.");
        }
        public UserSelectSourceDatabase()
        {
            InitializeComponent();
            SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;
            DataTable dtDatabaseSources      = instance.GetDataSources();

            int i = 0;

            foreach (DataRow dr in dtDatabaseSources.Rows)
            {
                var obj = new SourceServer();
                i                 = i + 1;
                obj.Id            = i;
                obj.ServerName    = dr["ServerName"].ToString();
                obj.InstanceName  = dr["InstanceName"].ToString();
                obj.ConnectString = obj.ServerName + @"\" + obj.InstanceName;
                lstSource.Add(obj);
            }
            cbSelectServer.DataSource = lstSource;

            cbSelectServer.DisplayMember = "ConnectString";
            cbSelectServer.ValueMember   = "Id";
        }
Пример #7
0
        /// <summary>
        /// Converts an array of COM SourceServer structures to .NET SourceServer objects.
        /// </summary>
        internal static SourceServer[] GetSourceServers(ref IntPtr pInput, int count, bool deallocate)
        {
            SourceServer[] output = null;

            if (pInput != IntPtr.Zero && count > 0)
            {
                output = new SourceServer[count];

                IntPtr pos = pInput;

                for (int ii = 0; ii < count; ii++)
                {
                    OpcRcw.Dx.SourceServer server = (OpcRcw.Dx.SourceServer)Marshal.PtrToStructure(pos, typeof(OpcRcw.Dx.SourceServer));

                    output[ii] = new SourceServer();

                    output[ii].ItemName         = server.szItemName;
                    output[ii].ItemPath         = server.szItemPath;
                    output[ii].Version          = server.szVersion;
                    output[ii].Name             = server.szName;
                    output[ii].Description      = server.szDescription;
                    output[ii].ServerType       = server.szServerType;
                    output[ii].ServerURL        = server.szServerURL;
                    output[ii].DefaultConnected = server.bDefaultSourceServerConnected != 0;

                    pos = (IntPtr)(pos.ToInt64() + Marshal.SizeOf(typeof(OpcRcw.Dx.SourceServer)));
                }

                if (deallocate)
                {
                    Marshal.FreeCoTaskMem(pInput);
                    pInput = IntPtr.Zero;
                }
            }

            return(output);
        }
Пример #8
0
        /// <summary>
        /// Handles the Load event of the FrmCreateNewDatabase control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void FrmConvertDatabase_Load(object sender, EventArgs e)
        {
            try
            {
                txtDatabaseName.EditValue = @"KETOAN_" + DateTime.Now.Year;
                var dataPath = RegistryHelperTransform.GetValueByRegistryKey("DatabasePath");
                btnDatabasePath.EditValue = dataPath.Substring(0, dataPath.LastIndexOf("\\", StringComparison.Ordinal));
                memoDescription.EditValue = @"Cơ sở dữ liệu kế toán cho các cơ quan đại diện";
                dtStartDate.EditValue     = DateTime.Parse("01/01/" + DateTime.Now.Year);
                LoadServerConnection();


                SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;
                DataTable dtDatabaseSources      = instance.GetDataSources();

                int i = 0;
                foreach (DataRow dr in dtDatabaseSources.Rows)
                {
                    var obj = new SourceServer();
                    i                 = i + 1;
                    obj.Id            = i;
                    obj.ServerName    = dr["ServerName"].ToString();
                    obj.InstanceName  = dr["InstanceName"].ToString();
                    obj.ConnectString = obj.ServerName + @"\" + obj.InstanceName;
                    lstSource.Add(obj);
                }
                cbSelectServer.DataSource = lstSource;

                cbSelectServer.DisplayMember = "ConnectString";
                cbSelectServer.ValueMember   = "Id";
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.ToString(), "",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #9
0
 public MigrationContext()
 {
     _sourceProject = new Lazy <TeamProject>(() => SourceServer?.FindProjectAsync(SourceProjectName, CancellationToken.None).Result);
     _targetProject = new Lazy <TeamProject>(() => TargetServer?.FindProjectAsync(TargetProjectName, CancellationToken.None).Result);
 }
Пример #10
0
 /// <summary>
 ///  Constructeur récupérant les valeurs du serveur et se connectant a celui-ci
 /// </summary>
 /// <param name="serveur">Adresse IP du serveur</param>
 /// <param name="port">Port du serveur</param>
 /// <param name="servertype">Nom du serveur</param>
 public CounterStrikePinger(string server, uint port, string servertype) : base(server, port, servertype)
 {
     this.CounterStrikeServer = new SourceServer(new IPEndPoint(IPAddress.Parse(this.ServerIP), (int)this.Port), String.Empty); // Connection au serveur CSGO
 }
Пример #11
0
        public void InvalidSourceServer()
        {
            SourceServer server = new SourceServer("10.0.0.1");

            Assert.AreEqual(server.Ping, -1, "Exception should have been thrown");
        }
        public static void ImportServers(this MainWindow mainWindow)
        {
            string         oldConfigFileName = "servers.xml";
            OpenFileDialog dialog            = new OpenFileDialog();

            dialog.DefaultExt = oldConfigFileName;
            dialog.Filter     = string.Format("{0}|{1}", Properties.Resources.mw_OldHldslOptionsFile, oldConfigFileName);
            if (dialog.ShowDialog() == true)
            {
                XElement oldConfig    = XElement.Load(dialog.FileName);
                int      serversAdded = 0;
                foreach (XElement xServer in oldConfig.XPathSelectElements("Servers/Server"))
                {
                    IServer server = null;
                    switch (xServer.XPathSelectElement("Game").Value)
                    {
                    case "cstrike":
                    {
                        server = new GoldSourceServer();
                        (server.Options as GoldSourceServerOptions).Game = GoldSourceGame.cstrike;

                        if (xServer.XPathSelectElement("Ip") != null)
                        {
                            (server.Options as GoldSourceServerOptions).Ip = xServer.XPathSelectElement("Ip").Value;
                        }
                        if (xServer.XPathSelectElement("Port") != null)
                        {
                            (server.Options as GoldSourceServerOptions).Port = xServer.XPathSelectElement("Port").Value;
                        }
                        if (xServer.XPathSelectElement("Map") != null)
                        {
                            (server.Options as GoldSourceServerOptions).Map = xServer.XPathSelectElement("Map").Value;
                        }
                        if (xServer.XPathSelectElement("MaxPlayers") != null)
                        {
                            (server.Options as GoldSourceServerOptions).MaxPlayers = int.Parse(xServer.XPathSelectElement("MaxPlayers").Value);
                        }
                        if (xServer.XPathSelectElement("RconPassword") != null)
                        {
                            (server.Options as GoldSourceServerOptions).RconPassword = xServer.XPathSelectElement("RconPassword").Value;
                        }
                        if (xServer.XPathSelectElement("HostName") != null)
                        {
                            (server.Options as GoldSourceServerOptions).HostName = xServer.XPathSelectElement("HostName").Value;
                        }
                        if (xServer.XPathSelectElement("DopArgs") != null)
                        {
                            (server.Options as GoldSourceServerOptions).AdditionalCommandLineArgs = xServer.XPathSelectElement("DopArgs").Value;
                        }
                        if (xServer.XPathSelectElement("HldsExe") != null)
                        {
                            (server.Options as GoldSourceServerOptions).ExecutablePath = xServer.XPathSelectElement("HldsExe").Value;
                        }
                        if (xServer.XPathSelectElement("ConsolePosX") != null)
                        {
                            (server.Options as GoldSourceServerOptions).ConsolePositionX = int.Parse(xServer.XPathSelectElement("ConsolePosX").Value);
                        }
                        if (xServer.XPathSelectElement("ConsolePosY") != null)
                        {
                            (server.Options as GoldSourceServerOptions).ConsolePositionY = int.Parse(xServer.XPathSelectElement("ConsolePosY").Value);
                        }
                        if (xServer.XPathSelectElement("AutoRestart") != null)
                        {
                            (server.Options as GoldSourceServerOptions).AutoRestart = bool.Parse(xServer.XPathSelectElement("AutoRestart").Value);
                        }
                        if (xServer.XPathSelectElement("ActiveServer") != null)
                        {
                            (server.Options as GoldSourceServerOptions).ActiveServer = bool.Parse(xServer.XPathSelectElement("ActiveServer").Value);
                        }
                        if (xServer.XPathSelectElement("IntegratedConsole") != null)
                        {
                            (server.Options as GoldSourceServerOptions).ConsoleType = (bool.Parse(xServer.XPathSelectElement("IntegratedConsole").Value) ? ConsoleType.Integrated : ConsoleType.Native);
                        }

                        break;
                    }

                    case "cstrikesource":
                    {
                        server = new SourceServer();
                        (server.Options as SourceServerOptions).Game = SourceGame.cstrike;

                        if (xServer.XPathSelectElement("Ip") != null)
                        {
                            (server.Options as SourceServerOptions).Ip = xServer.XPathSelectElement("Ip").Value;
                        }
                        if (xServer.XPathSelectElement("Port") != null)
                        {
                            (server.Options as SourceServerOptions).Port = xServer.XPathSelectElement("Port").Value;
                        }
                        if (xServer.XPathSelectElement("Map") != null)
                        {
                            (server.Options as SourceServerOptions).Map = xServer.XPathSelectElement("Map").Value;
                        }
                        if (xServer.XPathSelectElement("MaxPlayers") != null)
                        {
                            (server.Options as SourceServerOptions).MaxPlayers = int.Parse(xServer.XPathSelectElement("MaxPlayers").Value);
                        }
                        if (xServer.XPathSelectElement("RconPassword") != null)
                        {
                            (server.Options as SourceServerOptions).RconPassword = xServer.XPathSelectElement("RconPassword").Value;
                        }
                        if (xServer.XPathSelectElement("HostName") != null)
                        {
                            (server.Options as SourceServerOptions).HostName = xServer.XPathSelectElement("HostName").Value;
                        }
                        if (xServer.XPathSelectElement("DopArgs") != null)
                        {
                            (server.Options as SourceServerOptions).AdditionalCommandLineArgs = xServer.XPathSelectElement("DopArgs").Value;
                        }
                        if (xServer.XPathSelectElement("HldsExe") != null)
                        {
                            (server.Options as SourceServerOptions).ExecutablePath = xServer.XPathSelectElement("HldsExe").Value;
                        }
                        if (xServer.XPathSelectElement("ConsolePosX") != null)
                        {
                            (server.Options as SourceServerOptions).ConsolePositionX = int.Parse(xServer.XPathSelectElement("ConsolePosX").Value);
                        }
                        if (xServer.XPathSelectElement("ConsolePosY") != null)
                        {
                            (server.Options as SourceServerOptions).ConsolePositionY = int.Parse(xServer.XPathSelectElement("ConsolePosY").Value);
                        }
                        if (xServer.XPathSelectElement("AutoRestart") != null)
                        {
                            (server.Options as SourceServerOptions).AutoRestart = bool.Parse(xServer.XPathSelectElement("AutoRestart").Value);
                        }
                        if (xServer.XPathSelectElement("ActiveServer") != null)
                        {
                            (server.Options as SourceServerOptions).ActiveServer = bool.Parse(xServer.XPathSelectElement("ActiveServer").Value);
                        }
                        if (xServer.XPathSelectElement("IntegratedConsole") != null)
                        {
                            (server.Options as SourceServerOptions).ConsoleType = (bool.Parse(xServer.XPathSelectElement("IntegratedConsole").Value) ? ConsoleType.Integrated : ConsoleType.Native);
                        }

                        break;
                    }

                    case "hltv":
                    {
                        server = new ValveHltvServer();

                        if (xServer.XPathSelectElement("Ip") != null)
                        {
                            (server.Options as ValveHltvServerOptions).Ip = xServer.XPathSelectElement("Ip").Value;
                        }
                        if (xServer.XPathSelectElement("Port") != null)
                        {
                            (server.Options as ValveHltvServerOptions).Port = xServer.XPathSelectElement("Port").Value;
                        }
                        if (xServer.XPathSelectElement("Map") != null)
                        {
                            (server.Options as ValveHltvServerOptions).HostName = xServer.XPathSelectElement("HostName").Value;
                        }
                        if (xServer.XPathSelectElement("DopArgs") != null)
                        {
                            (server.Options as ValveHltvServerOptions).AdditionalCommandLineArgs = xServer.XPathSelectElement("DopArgs").Value;
                        }
                        if (xServer.XPathSelectElement("HldsExe") != null)
                        {
                            (server.Options as ValveHltvServerOptions).ExecutablePath = xServer.XPathSelectElement("HldsExe").Value;
                        }
                        if (xServer.XPathSelectElement("ConsolePosX") != null)
                        {
                            (server.Options as ValveHltvServerOptions).ConsolePositionX = int.Parse(xServer.XPathSelectElement("ConsolePosX").Value);
                        }
                        if (xServer.XPathSelectElement("ConsolePosY") != null)
                        {
                            (server.Options as ValveHltvServerOptions).ConsolePositionY = int.Parse(xServer.XPathSelectElement("ConsolePosY").Value);
                        }
                        if (xServer.XPathSelectElement("AutoRestart") != null)
                        {
                            (server.Options as ValveHltvServerOptions).AutoRestart = bool.Parse(xServer.XPathSelectElement("AutoRestart").Value);
                        }
                        if (xServer.XPathSelectElement("ActiveServer") != null)
                        {
                            (server.Options as ValveHltvServerOptions).ActiveServer = bool.Parse(xServer.XPathSelectElement("ActiveServer").Value);
                        }

                        break;
                    }
                    }
                    if (server != null)
                    {
                        mainWindow._serversControl.Servers.Add(server);
                        CreateControlsForServer(mainWindow, server);
                        serversAdded++;
                        _logger.Info(string.Format(Properties.Resources.mw_ServerImported, server.Options.HostName));
                    }
                }
                if (serversAdded > 0)
                {
                    SaveOptions(mainWindow, mainWindow._configFileName);
                }
            }
        }