public StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace)
        {
            var msg        = new ExecuteMessage();
            var serializer = new Dev2JsonSerializer();

            try
            {
                Dev2Logger.Info("Test connection Service", GlobalConstants.WarewolfInfo);

                values.TryGetValue("ServerSource", out StringBuilder resourceDefinition);

                IServerSource src = serializer.Deserialize <ServerSource>(resourceDefinition);

                var connection = new Connection
                {
                    Address            = src.Address,
                    AuthenticationType = src.AuthenticationType,
                    UserName           = src.UserName,
                    Password           = src.Password
                };
                var result = _connections.CanConnectToServer(connection);

                msg.HasError = false;
                msg.Message  = new StringBuilder(result.IsValid ? "" : result.ErrorMessage);
                msg.HasError = !result.IsValid;
            }
            catch (Exception err)
            {
                msg.HasError = true;
                msg.Message  = new StringBuilder(err.Message);
                Dev2Logger.Error(err, GlobalConstants.WarewolfError);
            }

            return(serializer.SerializeToBuilder(msg));
        }
        private ServerSelectionItem Insert(int index, IServerSource item)
        {
            ServerSelectionItem result = new ServerSelectionItem(item);

            comboBox.Items.Insert(index, result);
            return(result);
        }
Example #3
0
        public void AssignFrom(TabViewModel opt)
        {
            this.MasterServer           = opt.MasterServer;
            this.InitialGameID          = opt.InitialGameID;
            this.FilterMod              = opt.FilterMod;
            this.FilterMap              = opt.FilterMap;
            this.TagsIncludeServer      = opt.TagsIncludeServer;
            this.TagsExcludeServer      = opt.TagsExcludeServer;
            this.GetEmptyServers        = opt.GetEmptyServers;
            this.GetFullServers         = opt.GetFullServers;
            this.MasterServerQueryLimit = opt.MasterServerQueryLimit;

            this.Source             = opt.Source;
            this.serverSource       = opt.serverSource;
            this.Servers            = new List <ServerRow>(opt.Servers);
            this.gameExtension      = opt.gameExtension;
            this.GridFilter         = opt.GridFilter;
            this.MinPlayers         = opt.MinPlayers;
            this.MinPlayersInclBots = opt.MinPlayersInclBots;
            this.MaxPing            = opt.MaxPing;
            this.TagsIncludeClient  = opt.TagsIncludeClient;
            this.TagsExcludeClient  = opt.TagsExcludeClient;
            this.ServerGridLayout   = opt.ServerGridLayout;
            this.VersionMatch       = opt.VersionMatch;
            this.CustomDetailColumns.AddRange(opt.CustomDetailColumns);
            this.CustomRuleColumns.AddRange(opt.CustomRuleColumns);
            this.HideColumns.AddRange(opt.HideColumns);
        }
Example #4
0
 public bool Equals(IServerSource other)
 {
     if (other == null)
     {
         return(false);
     }
     if (!string.Equals(Address, other.Address, StringComparison.InvariantCultureIgnoreCase))
     {
         return(false);
     }
     if (AuthenticationType != other.AuthenticationType)
     {
         return(false);
     }
     if (!string.Equals(UserName, other.UserName, StringComparison.InvariantCultureIgnoreCase))
     {
         return(false);
     }
     if (!string.Equals(Password, other.Password))
     {
         return(false);
     }
     if (!string.Equals(Name, other.Name, StringComparison.InvariantCultureIgnoreCase))
     {
         return(false);
     }
     return(true);
 }
        public LoadBalancerConfig(Func <ILoadBalancerRule> ruleFactory, IPing ping, IServerSource serverSource)
        {
            ParameterChecker.NotNull(serverSource, "serverSource");

            this.RuleFactory  = ruleFactory;
            this.Ping         = ping;
            this.ServerSource = serverSource;
        }
Example #6
0
		public ConfigureViewModel(IAppSettings settings, IServerSource source, WinRTContainer container, INavigationService service, IEventAggregator eventAggregator) : base(container, service, eventAggregator)
		{
			this.settings = settings;
			serverUrl = settings.ServerUrl;
			username = settings.Username;
			password = settings.Password;
			server = source;
		}
 private void UpdateServerSource(IServerSource source)
 {
     if (watcher != null)
     {
         watcher.Dispose();
     }
     watcher = source.CreateWatcher(Poll, this);
     Poll();
 }
        // reload server list

        #region ReloadServerList()
        public void ReloadServerList(IServerSource serverSource, int timeout, int maxResults, Region region, IpFilter filter)
        {
            this.currentRequest.IsCancelled = true;

            var extension = this.gameExtensions.Get(filter.App);
            var request   = new UpdateRequest(filter.App, maxResults, timeout, extension, false); // use local var for thread safety

            this.currentRequest = request;
            serverSource.GetAddresses(region, filter, maxResults, (endpoints, error, partial) => OnMasterServerReceive(request, endpoints, error, partial));
        }
Example #9
0
        public Server_SourceConnectionTreeNode(IServerSource conn, ITreeNode parent, IFileHandler fhandler, IStoredConnection stored)
            : base(parent, fhandler, stored, false)
        {
            m_conn = conn.ChangeConnection(ConnPack);
            SetConnection(m_conn.Connection);
            var appobj = new ServerAppObject();

            appobj.FillFromUsage(conn);
            SetAppObject(appobj);

            m_infoappobj = new ServerAppObject();
            m_infoappobj.FillFromUsage(m_conn);
            m_infoappobj.DisableAutoConnect = true;
        }
        public void SaveToFilename(string filename)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(SavedServers));

            using (TextWriter writer = new StreamWriter(filename))
            {
                SavedServers servers = new SavedServers();
                for (int index = SAVED_SERVER_INDEX; index < Count; index++)
                {
                    IServerSource item = this[index].GetSource();
                    servers.Servers.Add(item.Save());
                }
                serializer.Serialize(writer, servers);
            }
        }
Example #11
0
        public StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace)
        {
            var msg        = new ExecuteMessage();
            var serializer = new Dev2JsonSerializer();

            try
            {
                Dev2Logger.Info("Save Resource Service", GlobalConstants.WarewolfInfo);

                values.TryGetValue("ServerSource", out StringBuilder resourceDefinition);

                IServerSource src = serializer.Deserialize <ServerSource>(resourceDefinition);
                var           con = new Connection();

                var portIndex = GetSpecifiedIndexOf(src.Address, ':', 2);
                var port      = src.Address.Substring(portIndex + 1);

                con.Address            = src.Address;
                con.AuthenticationType = src.AuthenticationType;
                con.UserName           = src.UserName;
                con.Password           = src.Password;
                con.ResourceName       = src.Name;
                con.ResourceID         = src.ID;
                con.WebServerPort      = int.Parse(port);
                var tester = new Connections();
                var res    = tester.CanConnectToServer(con);
                if (res.IsValid)
                {
                    ResourceCatalog.Instance.SaveResource(GlobalConstants.ServerWorkspaceID, con, src.ResourcePath);
                    ServerExplorerRepo.UpdateItem(con);
                    msg.HasError = false;
                    msg.Message  = new StringBuilder();
                }
                else
                {
                    msg.HasError = true;
                    msg.Message  = new StringBuilder(res.ErrorMessage);
                }
            }
            catch (Exception err)
            {
                msg.HasError = true;
                msg.Message  = new StringBuilder(err.Message);
                Dev2Logger.Error(err, GlobalConstants.WarewolfError);
            }

            return(serializer.SerializeToBuilder(msg));
        }
Example #12
0
        public IDatabaseSource MergeToConnection(IPhysicalConnection conn)
        {
            if (conn.GetConnKey() != m_conn.GetConnKey())
            {
                throw new InternalError("DAE-00031 Cannot merge connections with different groups");
            }
            IServerSource ressrv = null;

            if (Server != null)
            {
                ressrv = Server.MergeToConnection(conn);
            }
            GenericDatabaseSource res = new GenericDatabaseSource(ressrv, conn, m_dbname);

            return(res);
        }
Example #13
0
        /// <summary>
        /// Tests if a valid connection to a server can be made
        /// </summary>
        /// <param name="resource"></param>
        /// <returns></returns>
        public void TestConnection(IServerSource resource)
        {
            var con                       = Connection;
            var comsController            = CommunicationControllerFactory.CreateController("TestConnectionService");
            Dev2JsonSerializer serialiser = new Dev2JsonSerializer();

            comsController.AddPayloadArgument("ServerSource", serialiser.SerializeToBuilder(resource));
            var output = comsController.ExecuteCommand <IExecuteMessage>(con, GlobalConstants.ServerWorkspaceID);

            if (output == null)
            {
                throw new WarewolfTestException(ErrorResource.UnableToContactServer, null);
            }
            if (output.HasError)
            {
                throw new WarewolfTestException(output.Message.ToString(), null);
            }
        }
 public ServerSelectionItem(IServerSource source)
 {
     this.source = source;
 }
 public LoadBalancerConfig(IPing ping, IServerSource serverSource)
     : this(null, ping, serverSource)
 {
 }
 public LoadBalancerConfig(IServerSource serverSource)
     : this(null, serverSource)
 {
 }
Example #17
0
 public DatabasesTreeNode(IServerSource conn, ITreeNode parent)
     : base(conn, parent, "databases")
 {
     m_conn = conn;
 }
        public void AssignFrom(IViewModel opt)
        {
            this.MasterServer = opt.MasterServer;
              this.InitialGameID = opt.InitialGameID;
              this.FilterMod = opt.FilterMod;
              this.FilterMap = opt.FilterMap;
              this.TagsInclude = opt.TagsInclude;
              this.TagsExclude = opt.TagsExclude;
              this.GetEmptyServers = opt.GetEmptyServers;
              this.GetFullServers = opt.GetFullServers;
              this.MasterServerQueryLimit = opt.MasterServerQueryLimit;

              var vm = opt as TabViewModel;
              if (vm == null)
            return;

              this.Source = vm.Source;
              this.serverSource = vm.serverSource;
              this.servers = vm.servers;
              this.gameExtension = vm.gameExtension;
              this.GridFilter = vm.GridFilter;
              this.ServerGridLayout = vm.ServerGridLayout;
        }
Example #19
0
 public GenericDatabaseSource(IServerSource server, IPhysicalConnection conn, string dbname)
     : base(conn)
 {
     m_dbname = dbname;
     m_server = server;
 }
 public void Save(IServerSource toDbSource) => _updateRepository.Save(toDbSource);
 public void TestConnection(IServerSource resource) => _updateRepository.TestConnection(resource);
Example #22
0
		/// <summary>
		/// Initializes a new instance of the <see cref="SyncService"/> class.
		/// </summary>
		/// <param name="settings">The settings.</param>
		/// <param name="context">The context.</param>
		public SyncService(IAppSettings settings, IServerSource server, IDataContext context)
		{
			this.settings = settings;
			this.server = server;
			this.context = context;
		}
 public void Save(IServerSource serverSource)
 {
     UpdateManagerProxy.SaveServerSource(serverSource, GlobalConstants.ServerWorkspaceID);
     ConnectControlSingleton.Instance.ReloadServer();
     FireServerSaved(serverSource.ID);
 }
Example #24
0
 public void Save(IServerSource resource)
 {
     _updateRepository.Save(resource);
 }
Example #25
0
 public PhantomDatabaseSource(IServerSource server, string directory)
     : base(server.Connection)
 {
     m_directory = directory;
     m_server    = server;
 }
Example #26
0
 public bool Equals(IServerSource other) => string.Equals(Address, other.Address, StringComparison.InvariantCultureIgnoreCase) && AuthenticationType == other.AuthenticationType && string.Equals(UserName, other.UserName, StringComparison.InvariantCultureIgnoreCase) && string.Equals(Password, other.Password) && string.Equals(Name, other.Name, StringComparison.InvariantCultureIgnoreCase);
Example #27
0
 public bool Equals(IServerSource other) => Equals(other as ServerSource);
        public void ReloadServerList(IServerSource serverSource, int timeout, int maxResults, Region region, IpFilter filter)
        {
            this.currentRequest.IsCancelled = true;

              var extension = this.gameExtensions.Get(filter.App);
              var request = new UpdateRequest(filter.App, maxResults, timeout, extension); // use local var for thread safety
              this.currentRequest = request;
              serverSource.GetAddresses(region, filter, maxResults, endpoints => OnMasterServerReceive(request, endpoints));
        }
 public void TestConnection(IServerSource serverSource) => UpdateManagerProxy.TestConnection(serverSource);
Example #30
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public bool Equals(IServerSource other)
 {
     return(Equals(other as ServerSource));
 }