コード例 #1
0
        Element MakeDevice(MidiDevice dev)
        {
            var entities = new Section("Entities");

            foreach (var ex in Enumerable.Range(0, (int)dev.EntityCount))
            {
                var entity        = dev.GetEntity(ex);
                var sourceSection = new Section("Sources");
                sourceSection.AddAll(
                    from sx in Enumerable.Range(0, (int)entity.Sources)
                    let endpoint = entity.GetSource(sx)
                                   select MakeEndpoint(endpoint)
                    );
                var destinationSection = new Section("Destinations");
                destinationSection.AddAll(
                    from sx in Enumerable.Range(0, (int)entity.Destinations)
                    let endpoint = entity.GetDestination(sx)
                                   select MakeEndpoint(endpoint)
                    );
                entities.Add(new RootElement(entity.Name)
                {
                    sourceSection,
                    destinationSection
                });
            }

            return(new RootElement(String.Format("{2} {0} {1}", dev.Manufacturer, dev.Model, dev.EntityCount))
            {
                entities
            });
        }
コード例 #2
0
 Element MakeDevice(MidiDevice dev)
 {
     return(new RootElement(String.Format("{2} {0} {1}", dev.Manufacturer, dev.Model, dev.EntityCount))
     {
         new Section("Entities")
         {
             from ex in Enumerable.Range(0, dev.EntityCount)
             let entity = dev.GetEntity(ex)
                          select(Element) new RootElement(entity.Name)
             {
                 new Section("Sources")
                 {
                     from sx in Enumerable.Range(0, entity.Sources)
                     let endpoint = entity.GetSource(sx)
                                    select MakeEndpoint(endpoint)
                 },
                 new Section("Destinations")
                 {
                     from sx in Enumerable.Range(0, entity.Destinations)
                     let endpoint = entity.GetDestination(sx)
                                    select MakeEndpoint(endpoint)
                 }
             }
         }
     });
 }
コード例 #3
0
		Element MakeDevice (MidiDevice dev)
		{
			return new RootElement (String.Format ("{2} {0} {1}", dev.Manufacturer, dev.Model, dev.EntityCount)){
				new Section ("Entities") {
					from ex in Enumerable.Range (0, dev.EntityCount)
						let entity = dev.GetEntity (ex)
						select (Element) new RootElement (entity.Name) {
							new Section ("Sources"){
								from sx in Enumerable.Range (0, entity.Sources)
									let endpoint = entity.GetSource (sx)
									select MakeEndpoint (endpoint)
							},
							new Section ("Destinations"){
								from sx in Enumerable.Range (0, entity.Destinations)
									let endpoint = entity.GetDestination (sx)
									select MakeEndpoint (endpoint)
							}
						}
				}
			};
		}
コード例 #4
0
		Element MakeDevice (MidiDevice dev)
		{
			var entities = new Section ("Entities");
			foreach (var ex in Enumerable.Range(0, (int)dev.EntityCount)) {
				var entity = dev.GetEntity (ex);
				var sourceSection = new Section ("Sources");
				sourceSection.AddAll (
					from sx in Enumerable.Range (0, (int)entity.Sources)
					let endpoint = entity.GetSource (sx)
					select MakeEndpoint (endpoint)
				);
				var destinationSection = new Section ("Destinations");
				destinationSection.AddAll (
					from sx in Enumerable.Range (0, (int)entity.Destinations)
					let endpoint = entity.GetDestination (sx)
					select MakeEndpoint (endpoint)
				);
				entities.Add(new RootElement (entity.Name) {
					sourceSection,
					destinationSection
				});
			}

			return new RootElement (String.Format ("{2} {0} {1}", dev.Manufacturer, dev.Model, dev.EntityCount)) {
				entities
			};
		}
コード例 #5
0
 MidiDeviceDetails CreateMidiDeviceDetails(MidiDevice midiDevice)
 {
     return(new MidiDeviceDetails(midiDevice.Name, midiDevice.DisplayName,
                                  Enumerable.Range(0, (int)midiDevice.EntityCount).SelectMany(i => CreatePortDetailsList(midiDevice.GetEntity(i)))));
 }