/// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Filepattern != null)
         {
             hashCode = hashCode * 59 + Filepattern.GetHashCode();
         }
         if (DeviceGroups != null)
         {
             hashCode = hashCode * 59 + DeviceGroups.GetHashCode();
         }
         if (BuildPageNodes != null)
         {
             hashCode = hashCode * 59 + BuildPageNodes.GetHashCode();
         }
         if (BuildClientLibs != null)
         {
             hashCode = hashCode * 59 + BuildClientLibs.GetHashCode();
         }
         if (BuildCanvasComponent != null)
         {
             hashCode = hashCode * 59 + BuildCanvasComponent.GetHashCode();
         }
         return(hashCode);
     }
 }
Esempio n. 2
0
        private async Task PopulateViewModel()
        {
            CurrentUser = await _userManager.FindByEmailAsync(User.Identity.Name);

            Organization          = _dataService.GetOrganizationById(CurrentUser.OrganizationID);
            OrganizationName      = Organization.OrganizationName;
            IsDefaultOrganization = Organization.IsDefaultOrganization;
            var deviceGroups = _dataService.GetDeviceGroups(User.Identity.Name).OrderBy(x => x.Name);

            DeviceGroups.AddRange(deviceGroups);
            DeviceGroupSelectItems.AddRange(DeviceGroups.Select(x => new SelectListItem(x.Name, x.ID)));

            Users = _dataService.GetAllUsers(User.Identity.Name)
                    .Select(x => new OrganizationUser()
            {
                ID       = x.Id,
                IsAdmin  = x.IsAdministrator,
                UserName = x.UserName
            }).ToList();

            Invites = _dataService.GetAllInviteLinks(User.Identity.Name).Select(x => new Invite()
            {
                ID          = x.ID,
                InvitedUser = x.InvitedUser,
                IsAdmin     = x.IsAdmin,
                DateSent    = x.DateSent
            }).ToList();
        }
Esempio n. 3
0
        public async Task <IActionResult> OnGet()
        {
            if (User?.Identity?.IsAuthenticated == true)
            {
                var user = DataService.GetUserByName(User.Identity.Name);
                if (user is null)
                {
                    await SignInManager.SignOutAsync();

                    return(RedirectToPage());
                }

                if (AppConfig.Require2FA && !user.TwoFactorEnabled)
                {
                    return(RedirectToPage("TwoFactorRequired"));
                }

                DefaultPrompt = DataService.GetDefaultPrompt(User.Identity.Name);
                var groups = DataService.GetDeviceGroups(User.Identity.Name);
                if (groups?.Any() == true)
                {
                    DeviceGroups.AddRange(groups.Select(x => new SelectListItem(x.Name, x.ID)));
                }
            }
            else
            {
                DefaultPrompt = DataService.GetDefaultPrompt();
            }

            return(Page());
        }
Esempio n. 4
0
        public void OnGet()
        {
            OrganizationName = DataService.GetOrganizationName(User.Identity.Name);

            var groups = DataService.GetDeviceGroupsForUserName(User.Identity.Name);

            DeviceGroups.AddRange(groups.Select(x => new SelectListItem(x.Name, x.ID)));

            Users = DataService.GetAllUsers(User.Identity.Name)
                    .Select(x => new OrganizationUser()
            {
                ID       = x.Id,
                IsAdmin  = x.IsAdministrator,
                UserName = x.UserName
            }).ToList();

            Invites = DataService.GetAllInviteLinks(User.Identity.Name).Select(x => new Invite()
            {
                ID          = x.ID,
                InvitedUser = x.InvitedUser,
                IsAdmin     = x.IsAdmin,
                DateSent    = x.DateSent,
                ResetUrl    = x.ResetUrl
            }).ToList();
        }
Esempio n. 5
0
 public DeviceGroupsTest()
 {
     deviceGroups = new DeviceGroups(
         logger,
         mockHttpClient.Object,
         mockDevices.Object,
         config);
 }
Esempio n. 6
0
        public DeviceGroup(string name, IEnumerable <IDevice> devices, IEnumerable <IDeviceGroup> deviceGroups)
        {
            _name = name;
            foreach (var deviceGroup in deviceGroups)
            {
                DeviceGroups.Add(deviceGroup);
            }

            foreach (var device in devices)
            {
                Devices.Add(device);
            }
        }
Esempio n. 7
0
        public void AddDeviceGroup(ArduinoDeviceGroup dg)
        {
            if (dg == null)
            {
                throw new Exception("No device group to add");
            }

            dg.ADM = this;
            foreach (var dev in dg.Devices)
            {
                AddDevice(dev);
            }
            if (!DeviceGroups.Contains(dg))
            {
                DeviceGroups.Add(dg);
            }
        }
Esempio n. 8
0
        private void PopulateViewModel(string deviceID)
        {
            var user = DataService.GetUserByName(User.Identity.Name);

            if (user != null)
            {
                var device = DataService.GetDeviceForUser(user.Id, deviceID);
                DeviceName          = device?.DeviceName;
                AgentVersion        = device.AgentVersion;
                Input.Alias         = device?.Alias;
                Input.DeviceGroupID = device?.DeviceGroupID;
                Input.Tags          = device?.Tags;
            }
            var groups = DataService.GetDeviceGroupsForUserName(User.Identity.Name);

            DeviceGroups.AddRange(groups.Select(x => new SelectListItem(x.Name, x.ID)));
        }
Esempio n. 9
0
        public async Task <IActionResult> OnGet()
        {
            if (User?.Identity?.IsAuthenticated == true)
            {
                var user = _dataService.GetUserByName(User.Identity.Name);
                if (user is null)
                {
                    await _signInManager.SignOutAsync();

                    return(RedirectToPage());
                }

                if (_appConfig.Require2FA && !user.TwoFactorEnabled)
                {
                    return(RedirectToPage("TwoFactorRequired"));
                }

                var organizationCount = _dataService.GetOrganizationCount();
                RegistrationAvailable = _appConfig.MaxOrganizationCount < 0 || organizationCount < _appConfig.MaxOrganizationCount;

                var org = _dataService.GetOrganizationById(user.OrganizationID);
                IsNewVersionAvailable = await _upgradeService.IsNewVersionAvailable();

                DefaultPrompt = _dataService.GetDefaultPrompt(User.Identity.Name);
                var groups = _dataService.GetDeviceGroups(User.Identity.Name);
                if (groups?.Any() == true)
                {
                    DeviceGroups.AddRange(groups.Select(x => new SelectListItem(x.Name, x.ID)));
                }
                var alerts = _dataService.GetAlerts(user.Id);
                if (alerts.Any())
                {
                    Alerts.AddRange(alerts);
                }

                Motd = _appConfig.MessageOfTheDay;
            }
            else
            {
                DefaultPrompt = _dataService.GetDefaultPrompt();
            }

            return(Page());
        }
Esempio n. 10
0
        private void PopulateViewModel(string deviceID)
        {
            var user = DataService.GetUserByName(User.Identity.Name);

            if (user != null)
            {
                var device = DataService.GetDevice(user.OrganizationID, deviceID);
                DeviceName          = device?.DeviceName;
                DeviceID            = device?.ID;
                AgentVersion        = device?.AgentVersion;
                Input.Alias         = device?.Alias;
                Input.DeviceGroupID = device?.DeviceGroupID;
                Input.Tags          = device?.Tags;
                Input.Notes         = device?.Notes;
                Input.WebRtcSetting = device?.WebRtcSetting ?? default;
            }
            var groups = DataService.GetDeviceGroups(User.Identity.Name);

            DeviceGroups.AddRange(groups.Select(x => new SelectListItem(x.Name, x.ID)));
        }
        /// <summary>
        /// Returns true if ComDayCqWcmDesignimporterImplMobileCanvasBuilderImplProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComDayCqWcmDesignimporterImplMobileCanvasBuilderImplProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComDayCqWcmDesignimporterImplMobileCanvasBuilderImplProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Filepattern == other.Filepattern ||
                     Filepattern != null &&
                     Filepattern.Equals(other.Filepattern)
                     ) &&
                 (
                     DeviceGroups == other.DeviceGroups ||
                     DeviceGroups != null &&
                     DeviceGroups.Equals(other.DeviceGroups)
                 ) &&
                 (
                     BuildPageNodes == other.BuildPageNodes ||
                     BuildPageNodes != null &&
                     BuildPageNodes.Equals(other.BuildPageNodes)
                 ) &&
                 (
                     BuildClientLibs == other.BuildClientLibs ||
                     BuildClientLibs != null &&
                     BuildClientLibs.Equals(other.BuildClientLibs)
                 ) &&
                 (
                     BuildCanvasComponent == other.BuildCanvasComponent ||
                     BuildCanvasComponent != null &&
                     BuildCanvasComponent.Equals(other.BuildCanvasComponent)
                 ));
        }
Esempio n. 12
0
        public override DeviceBase Clone()
        {
            var deviceBase = new DeviceFactory
            {
                id           = Guid.NewGuid(),
                index        = index,
                name         = name,
                state        = state,
                DeviceGroups = new Collection <DeviceGroup>()
            };

            DeviceGroups.ForEach(m =>
            {
                var element = m.Clone() as DeviceGroup;
                if (element != null)
                {
                    element.parentId      = deviceBase.id;
                    element.DeviceFactory = deviceBase;
                }
                deviceBase.DeviceGroups.Add(element);
            });
            return(deviceBase);
        }
Esempio n. 13
0
        private void PopulateViewModel()
        {
            OrganizationName = DataService.GetOrganizationName(User.Identity.Name);
            var deviceGroups = DataService.GetDeviceGroups(User.Identity.Name).OrderBy(x => x.Name);

            DeviceGroups.AddRange(deviceGroups);
            DeviceGroupSelectItems.AddRange(DeviceGroups.Select(x => new SelectListItem(x.Name, x.ID)));

            Users = DataService.GetAllUsers(User.Identity.Name)
                    .Select(x => new OrganizationUser()
            {
                ID       = x.Id,
                IsAdmin  = x.IsAdministrator,
                UserName = x.UserName
            }).ToList();

            Invites = DataService.GetAllInviteLinks(User.Identity.Name).Select(x => new Invite()
            {
                ID          = x.ID,
                InvitedUser = x.InvitedUser,
                IsAdmin     = x.IsAdmin,
                DateSent    = x.DateSent
            }).ToList();
        }
Esempio n. 14
0
        static void Main(string[] args)
        {
            MergedLineups merged_lineups = new MergedLineups(ChannelEditing.object_store);
            MergedLineup main_lineup = merged_lineups.ToArray()[1];
            Lineup[] lineups = ChannelEditing.GetLineups();
            foreach (Lineup lineup in lineups)
            {
                if ((lineup.Name == "Scanned (Digital Cable (ClearQAM))") && lineup.ScanDevices.Empty) {
                    foreach (Channel ch in lineup.GetChannels())
                    {
                        lineup.RemoveChannel(ch);
                    }
                    lineup.Unlock();
                }
                if (!lineup.ScanDevices.Empty)
                {
                    lineup.PrimaryProvider = main_lineup;
                }
            }
            foreach (MergedLineup mergedlineup in merged_lineups)
            {
                if (mergedlineup.GetChannels().Count() == 0)
                {
                    mergedlineup.Unlock();
                    //merged_lineups.RemoveAllMatching(mergedlineup);
                }
            }
            Service[] services = new Services(ChannelEditing.object_store).ToArray();
            DeviceGroup[] device_groups = new DeviceGroups(ChannelEditing.object_store).ToArray();
            foreach (DeviceGroup device_group in device_groups)
            {
                Console.WriteLine("DeviceGroup: {0}", device_group.Name);
            }
            Device[] devices = new Devices(ChannelEditing.object_store).ToArray();
            foreach (Device d in devices)
            {
                Console.WriteLine("Device: {0}", d.Name);
            }
            DeviceType[] device_types = new DeviceTypes(ChannelEditing.object_store).ToArray();
            foreach (DeviceType dt in device_types)
            {
                Console.WriteLine("DeviceType: {0} DisplayName: {1} HeadendType: {2} Id: {3} IsSetTopBox: {4} NetworkType: {5} TuningSpaceName: {6} VideoSource: {7} ViewPriority: {8}",
                    dt.Name, dt.DisplayName, dt.HeadendType, dt.Id, dt.IsSetTopBox, dt.NetworkType, dt.TuningSpaceName, dt.VideoSource, dt.ViewPriority);
                Microsoft.MediaCenter.TV.Tuning.TuningSpace tuning_space = dt.TuningSpace;
                if (tuning_space != null)
                {
                    Console.WriteLine("Tuning space CLSID: {0} FriendlyName: {1} UniqueName: {2}", tuning_space.CLSID, tuning_space.FriendlyName, tuning_space.UniqueName);
                }
            }
            foreach (Service service in services)
            {
                Console.WriteLine("Service: {0} IsCached: {1} IsMerged: {2}", service.Name, service.IsCached, service.IsMergedService);
            }
            if (false)
                foreach (Lineup lineup in lineups)
            {
                Console.WriteLine("Lineup: {0} ", lineup.Name);
                if (lineup.DeviceGroup != null)
                {
                    Console.WriteLine("DeviceGroup: {0}", lineup.DeviceGroup.Name);
                    if (lineup.DeviceGroup.Devices != null)
                        foreach(Device d in lineup.DeviceGroup.Devices)
                            Console.WriteLine(d.Name);
                }
                if (lineup.ScanDevices != null)
                    foreach (Device d in lineup.ScanDevices)
                        Console.WriteLine("ScanDevice: {0}", d);
                if (lineup.WmisDevices != null)
                {
                    foreach (Device d in lineup.WmisDevices)
                        Console.WriteLine("WmiDevice: {0}", d);
                    //if (lineup.WmisDevices.Empty && lineup.ScanDevices.Empty)
                        foreach (Channel ch in lineup.GetChannels())
                        {
                            if (ch.Service != null)
                            {
                                Console.WriteLine("Callsign: {0}, CHannelNumber {1}, Service Callsign {2}, Service Name {3}",
                                    ch.CallSign, ch.ChannelNumber, ch.Service.CallSign, ch.Service.Name);
                                if (!ch.Service.ScheduleEntries.Empty)
                                {
                                    foreach (ScheduleEntry entry in ch.Service.ScheduleEntries)
                                    {
                                        if (entry.Program != null)
                                        Console.WriteLine(entry.Program.Title);
                                    }
                                }
                            }
                        }
                }

             /*   foreach (Channel ch in lineup.GetChannels())
                {
                    Console.WriteLine("Channel: {0} Service: {1}", ch.Number, ch.Service);
                } */
            }
            MergedLineup merged_lineup = lineups[0].PrimaryProvider;
            Console.WriteLine("MergedLineup: {0}", merged_lineup);
            if (merged_lineup.SecondaryLineups != null)
                foreach (Lineup lineup in merged_lineup.SecondaryLineups)
                    Console.WriteLine("Secondary Lineup: {0}", lineup.Name);
            Console.ReadLine();
            FavoriteLineups favorite_lineups = new FavoriteLineups(ChannelEditing.object_store);
            foreach (FavoriteLineup favorite in favorite_lineups)
            {
                Console.WriteLine(favorite.Name);
            }
            PackageSubscriptions subscriptions = new PackageSubscriptions(ChannelEditing.object_store);
            foreach (PackageSubscription sub in subscriptions) {
                Console.WriteLine(sub.Package.Description);
            }
        }
Esempio n. 15
0
        static void Main(string[] args)
        {
            MergedLineups merged_lineups = new MergedLineups(ChannelEditing.object_store);
            MergedLineup  main_lineup    = merged_lineups.ToArray()[1];

            Lineup[] lineups = ChannelEditing.GetLineups();
            foreach (Lineup lineup in lineups)
            {
                if ((lineup.Name == "Scanned (Digital Cable (ClearQAM))") && lineup.ScanDevices.Empty)
                {
                    foreach (Channel ch in lineup.GetChannels())
                    {
                        lineup.RemoveChannel(ch);
                    }
                    lineup.Unlock();
                }
                if (!lineup.ScanDevices.Empty)
                {
                    lineup.PrimaryProvider = main_lineup;
                }
            }
            foreach (MergedLineup mergedlineup in merged_lineups)
            {
                if (mergedlineup.GetChannels().Count() == 0)
                {
                    mergedlineup.Unlock();
                    //merged_lineups.RemoveAllMatching(mergedlineup);
                }
            }
            Service[]     services      = new Services(ChannelEditing.object_store).ToArray();
            DeviceGroup[] device_groups = new DeviceGroups(ChannelEditing.object_store).ToArray();
            foreach (DeviceGroup device_group in device_groups)
            {
                Console.WriteLine("DeviceGroup: {0}", device_group.Name);
            }
            Device[] devices = new Devices(ChannelEditing.object_store).ToArray();
            foreach (Device d in devices)
            {
                Console.WriteLine("Device: {0}", d.Name);
            }
            DeviceType[] device_types = new DeviceTypes(ChannelEditing.object_store).ToArray();
            foreach (DeviceType dt in device_types)
            {
                Console.WriteLine("DeviceType: {0} DisplayName: {1} HeadendType: {2} Id: {3} IsSetTopBox: {4} NetworkType: {5} TuningSpaceName: {6} VideoSource: {7} ViewPriority: {8}",
                                  dt.Name, dt.DisplayName, dt.HeadendType, dt.Id, dt.IsSetTopBox, dt.NetworkType, dt.TuningSpaceName, dt.VideoSource, dt.ViewPriority);
                Microsoft.MediaCenter.TV.Tuning.TuningSpace tuning_space = dt.TuningSpace;
                if (tuning_space != null)
                {
                    Console.WriteLine("Tuning space CLSID: {0} FriendlyName: {1} UniqueName: {2}", tuning_space.CLSID, tuning_space.FriendlyName, tuning_space.UniqueName);
                }
            }
            foreach (Service service in services)
            {
                Console.WriteLine("Service: {0} IsCached: {1} IsMerged: {2}", service.Name, service.IsCached, service.IsMergedService);
            }
            if (false)
            {
                foreach (Lineup lineup in lineups)
                {
                    Console.WriteLine("Lineup: {0} ", lineup.Name);
                    if (lineup.DeviceGroup != null)
                    {
                        Console.WriteLine("DeviceGroup: {0}", lineup.DeviceGroup.Name);
                        if (lineup.DeviceGroup.Devices != null)
                        {
                            foreach (Device d in lineup.DeviceGroup.Devices)
                            {
                                Console.WriteLine(d.Name);
                            }
                        }
                    }
                    if (lineup.ScanDevices != null)
                    {
                        foreach (Device d in lineup.ScanDevices)
                        {
                            Console.WriteLine("ScanDevice: {0}", d);
                        }
                    }
                    if (lineup.WmisDevices != null)
                    {
                        foreach (Device d in lineup.WmisDevices)
                        {
                            Console.WriteLine("WmiDevice: {0}", d);
                        }
                        //if (lineup.WmisDevices.Empty && lineup.ScanDevices.Empty)
                        foreach (Channel ch in lineup.GetChannels())
                        {
                            if (ch.Service != null)
                            {
                                Console.WriteLine("Callsign: {0}, CHannelNumber {1}, Service Callsign {2}, Service Name {3}",
                                                  ch.CallSign, ch.ChannelNumber, ch.Service.CallSign, ch.Service.Name);
                                if (!ch.Service.ScheduleEntries.Empty)
                                {
                                    foreach (ScheduleEntry entry in ch.Service.ScheduleEntries)
                                    {
                                        if (entry.Program != null)
                                        {
                                            Console.WriteLine(entry.Program.Title);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    /*   foreach (Channel ch in lineup.GetChannels())
                     * {
                     *     Console.WriteLine("Channel: {0} Service: {1}", ch.Number, ch.Service);
                     * } */
                }
            }
            MergedLineup merged_lineup = lineups[0].PrimaryProvider;

            Console.WriteLine("MergedLineup: {0}", merged_lineup);
            if (merged_lineup.SecondaryLineups != null)
            {
                foreach (Lineup lineup in merged_lineup.SecondaryLineups)
                {
                    Console.WriteLine("Secondary Lineup: {0}", lineup.Name);
                }
            }
            Console.ReadLine();
            FavoriteLineups favorite_lineups = new FavoriteLineups(ChannelEditing.object_store);

            foreach (FavoriteLineup favorite in favorite_lineups)
            {
                Console.WriteLine(favorite.Name);
            }
            PackageSubscriptions subscriptions = new PackageSubscriptions(ChannelEditing.object_store);

            foreach (PackageSubscription sub in subscriptions)
            {
                Console.WriteLine(sub.Package.Description);
            }
        }