Beispiel #1
0
        public static XblockX LoadFromFile(string xblockFile)
        {
            XblockX xmlXblock = null;

            using (var reader = new StreamReader(xblockFile))
            {
                var serializer = new XmlSerializer(typeof(XblockX));
                xmlXblock = (XblockX)serializer.Deserialize(reader);
            }

            return(xmlXblock);
        }
        // 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;
        }