예제 #1
0
        private bool LoadServerInfo()
        {
            ClearServerInfo();

            PARemoteProc proxy = GetPARpc();

            pa_section[] sections = proxy.GetSections();
            if (sections != null)
            {
                foreach (pa_section section in sections)
                {
                    PASection se = new PASection(section.pa_section_id,
                                                 section.pa_section_name);
                    _sections.Add(se);

                    GetSectionZones(proxy, se);

                    GetSectionMusic(proxy, se);

                    GetSectionCDMusic(proxy, se);

                    GetSectionMusicChannel(proxy, se);
                }
            }

            DialRule.SectionLength     = proxy.GetPASectionIdLength();
            DialRule.ZoneLength        = proxy.GetPAZoneIdLength();
            DialRule.MusicFolderLength = proxy.GetMusicFolderIdLength();
            DialRule.MusicFileLength   = proxy.GetMusicFileIdLength();

            return(true);
        }
예제 #2
0
        public bool PlayFileMusic(List <PASection> targets, BKMusicFolder foler)
        {
            if (targets == null)
            {
                return(false);
            }

            DialRule rule = new DialRule();

            rule.Sections = targets;
            rule.BuildDialString();

            int sectionIds;

            if (!int.TryParse(rule.SectionsId, out sectionIds))
            {
                return(false);
            }

            int folderId = 0, filesId = 0;

            rule.GetFileMusicIds(foler, ref folderId, ref filesId);

            PARemoteProc proxy = _system.GetPARpc();

            proxy.StartFileMusic("111", sectionIds, rule.Zones, 1, folderId, filesId);
            return(true);
        }
예제 #3
0
        private void GetFolderMusic(PARemoteProc proxy, PASection section, BKMusicFolder folder)
        {
            music_file[] files = proxy.GetMusicFiles(section.Id, folder.Id);
            if (files == null)
            {
                return;
            }

            foreach (music_file file in files)
            {
                BKMusicFile fi = new BKMusicFile(file.music_file_id,
                                                 file.music_file_name);
                folder.AddMusicFile(fi);
            }
        }
예제 #4
0
        private void GetSectionMusicChannel(PARemoteProc proxy, PASection section)
        {
            music_channel[] channels = proxy.getMusicChannels(section.Id);
            if (channels == null)
            {
                return;
            }

            foreach (music_channel channel in channels)
            {
                BKMusicRadioChannel ch = new BKMusicRadioChannel(channel.radio_channel_id,
                                                                 channel.radio_channel_name);
                section.MusicRadioChannels.Add(ch);
            }
        }
예제 #5
0
        private void GetSectionCDMusic(PARemoteProc proxy, PASection section)
        {
            cd_music_file[] files = proxy.GetMusicCDFiles(section.Id);
            if (files == null)
            {
                return;
            }

            foreach (cd_music_file file in files)
            {
                BKMusicCDFile fi = new BKMusicCDFile(file.cd_music_id,
                                                     file.cd_music_name);
                section.MusicCDFiles.Add(fi);
            }
        }
예제 #6
0
        private void GetSectionZones(PARemoteProc proxy, PASection section)
        {
            pa_zone[] zones = proxy.GetZones(section.Id);
            if (zones == null)
            {
                Log.Error(string.Format("no zone found in PA section {0}", section.Name));
                return;
            }

            foreach (pa_zone zone in zones)
            {
                PAZone zo = new PAZone(zone.pa_zone_id,
                                       zone.pa_zone_name);
                section.AddPAZone(zo);
            }
        }
예제 #7
0
        private void GetSectionMusic(PARemoteProc proxy, PASection section)
        {
            music_folder[] folders = proxy.GetMusicFolders(section.Id);
            if (folders == null)
            {
                return;
            }

            foreach (music_folder folder in folders)
            {
                BKMusicFolder fo = new BKMusicFolder(folder.music_folder_id,
                                                     folder.music_folder_name);

                section.AddBKMusic(fo);

                GetFolderMusic(proxy, section, fo);
            }
        }
예제 #8
0
        public PARemoteProc GetPARpc()
        {
            PARemoteProc proxy = new PARemoteProc("192.168.0.226", 7085);

            return(proxy);
        }