コード例 #1
0
        public static void UpdateOutstandingIdentifiers(XtfConsole defaultConsole, List <XtfConsole> consoles)
        {
            var identifiers = outstandingIdentifiers.Where(r => r.Target is ConsoleIdentifier).Select(r => r.Target as ConsoleIdentifier).ToArray();

            foreach (var id in identifiers)
            {
                if (string.IsNullOrEmpty(id.Alias))
                {
                    // This one no longer had an alias -- assign it a new one (if possible)
                    AssignAlias(id, consoles);
                }
                else
                {
                    // This one has an alias.  If the alias still exists, it may be the same address or a different one.  We always keep
                    // the address of outstanding console ids, so if the address is different, we clear the Alias of the outstanding id.
                    var console = consoles.FirstOrDefault(c => c.Alias == id.Alias);

                    if (console == null || console.Address != id.Address)
                    {
                        // Either the alias is gone, or its address changed.  Either way, assign a new alias
                        AssignAlias(id, consoles);
                    }
                }

                id.IsDefault = (defaultConsole != null && id.Alias == defaultConsole.Alias);
            }

            // Prune the list to the live identifiers (just re-create)
            outstandingIdentifiers = identifiers.Select(i => new WeakReference(i)).ToList();
        }
コード例 #2
0
            public ConsoleWrapper(XtfConsole console, bool isDefault)
            {
                this.RealConsole = console;
                if (console != null)
                {
                    this.Alias   = console.Alias;
                    this.Address = console.Address;
                }
                else
                {
                    this.Alias   = "New Console";
                    this.Address = "0.0.0.0";
                    this.IsNew   = true;
                }

                this.IsDefault = isDefault;
            }
コード例 #3
0
            public ConsoleWrapper(XtfConsole console, bool isDefault)
            {
                this.RealConsole = console;
                if (console != null)
                {
                    this.Alias = console.Alias;
                    this.Address = console.Address;
                }
                else
                {
                    this.Alias = "New Console";
                    this.Address = "0.0.0.0";
                    this.IsNew = true;
                }

                this.IsDefault = isDefault;
            }
コード例 #4
0
        public static void UpdateOutstandingIdentifiers(XtfConsole defaultConsole, List<XtfConsole> consoles)
        {
            var identifiers = outstandingIdentifiers.Where(r => r.Target is ConsoleIdentifier).Select(r => r.Target as ConsoleIdentifier).ToArray();

            foreach (var id in identifiers)
            {
                if (string.IsNullOrEmpty(id.Alias))
                {
                    // This one no longer had an alias -- assign it a new one (if possible)
                    AssignAlias(id, consoles);
                }
                else
                {
                    // This one has an alias.  If the alias still exists, it may be the same address or a different one.  We always keep
                    // the address of outstanding console ids, so if the address is different, we clear the Alias of the outstanding id.
                    var console = consoles.FirstOrDefault(c => c.Alias == id.Alias);

                    if (console == null || console.Address != id.Address)
                    {
                        // Either the alias is gone, or its address changed.  Either way, assign a new alias
                        AssignAlias(id, consoles);
                    }
                }

                id.IsDefault = (defaultConsole != null && id.Alias == defaultConsole.Alias);
            }

            // Prune the list to the live identifiers (just re-create)
            outstandingIdentifiers = identifiers.Select(i => new WeakReference(i)).ToList();
        }