Example #1
0
        // this may hurt your brain
        public static List <AgGraphMap> ProjectMap(List <AgGraphNt> agGraphNt, XblockX songsXblock, Manifest.Tone.Manifest toneManifest)
        {
            List <AgGraphMap> agGraphRef = new List <AgGraphMap>();

            foreach (var xmlFile in agGraphNt)
            {
                if (xmlFile.AgType.ToLower() != "logpath")
                {
                    continue;
                }

                var valueXmlFile = xmlFile.AgValue;
                var valueUuid    = xmlFile.AgUrn;

                foreach (var id in agGraphNt) // aggregateGraph
                {
                    if (id.AgType == "llid" && id.AgUrn == valueUuid)
                    {
                        var tonesList    = new List <string>();
                        var expandedLLID = String.Format("{0}{1}", "urn:llid:", id.AgValue);

                        foreach (var entity in songsXblock.entitySet) // songsXblock
                        {
                            string songXmlLLID     = String.Empty;
                            string effectChainName = String.Empty;

                            foreach (var property in entity.property) // songsXblock
                            {
                                if (property.name == "SongXml")
                                {
                                    songXmlLLID = property.set.value;
                                }
                                if (property.name == "EffectChainName")
                                {
                                    effectChainName = property.set.value;
                                }
                                if (String.IsNullOrEmpty(effectChainName) || String.IsNullOrEmpty(songXmlLLID))
                                {
                                    continue;
                                }

                                if (songXmlLLID == expandedLLID)
                                {
                                    foreach (var entry in toneManifest.Entries) // toneManifest
                                    {
                                        if (entry.Key == effectChainName)
                                        {
                                            tonesList.Add(entry.Key);
                                        }
                                    }

                                    if (!tonesList.Any())
                                    {
                                        // tonesList.Add("Default"); // this is not a good thing so throw an exception
                                        throw new DataException("<ERROR> Tone list is empty ..." + Environment.NewLine);
                                    }

                                    agGraphRef.Add(new AgGraphMap()
                                    {
                                        UUID        = id.AgUrn,
                                        LLID        = id.AgValue.Split(new Char[] { '-' })[0],
                                        SongXmlPath = valueXmlFile,
                                        Tones       = tonesList // newer RS1 may have multiple tones
                                    });

                                    break;
                                }
                            }
                        }
                    }
                }
            }

            if (agGraphRef == null)
            {
                Console.WriteLine("<ERROR> Did not find AgType 'logpath' ...");
            }

            return(agGraphRef);
        }
        // this may hurt your brain
        public static List <AgGraphMap> ProjectMap(List <AgGraphNt> agGraphNt, XblockX songsXblock, Manifest.Tone.Manifest toneManifest)
        {
            List <AgGraphMap> agGraphRef = new List <AgGraphMap>();

            foreach (var xmlFile in agGraphNt)
            {
                if (xmlFile.AgType.ToLower() != "logpath")
                {
                    continue;
                }

                var valueXmlFile = xmlFile.AgValue;
                var valueUuid    = xmlFile.AgUrn;

                foreach (var id in agGraphNt) // aggregateGraph
                {
                    if (id.AgType == "llid" && id.AgUrn == valueUuid)
                    {
                        var tonesList    = new List <string>();
                        var expandedLLID = String.Format("{0}{1}", "urn:llid:", id.AgValue);

                        foreach (var entity in songsXblock.entitySet) // songsXblock
                        {
                            string songXmlLLID     = String.Empty;
                            string effectChainName = String.Empty;

                            foreach (var property in entity.property) // songsXblock
                            {
                                if (property.name == "SongXml")
                                {
                                    songXmlLLID = property.set.value;
                                }
                                if (property.name == "EffectChainName")
                                {
                                    effectChainName = property.set.value;
                                }
                                if (String.IsNullOrEmpty(effectChainName) || String.IsNullOrEmpty(songXmlLLID))
                                {
                                    continue;
                                }

                                if (songXmlLLID == expandedLLID)
                                {
                                    foreach (var entry in toneManifest.Entries) // toneManifest
                                    {
                                        if (entry.Key == effectChainName)
                                        {
                                            tonesList.Add(entry.Key);
                                        }
                                    }

                                    if (!tonesList.Any())
                                    {
                                        tonesList.Add("Default");
                                    }

                                    agGraphRef.Add(new AgGraphMap()
                                    {
                                        UUID        = id.AgUrn,
                                        LLID        = id.AgValue.Split(new Char[] { '-' })[0],
                                        SongXmlPath = valueXmlFile,
                                        Tones       = tonesList // RS1 should only have one tone
                                    });
                                    break;
                                }
                            }
                        }
                    }
                }
            }


            return(agGraphRef);
        }