private void MapSequence(ISequence sequence, ElementMap elementMap)
        {
            List <EffectNode> effectsToRemove = new List <EffectNode>();

            foreach (var unmappedEffect in sequence.SequenceData.EffectData.Cast <EffectNode>())
            {
                if (elementMap.GetBySourceId(unmappedEffect.Effect.TargetNodes.First().Id, out Guid targetId))
                {
                    var node = VixenSystem.Nodes.GetElementNode(targetId);
                    if (node != null)
                    {
                        unmappedEffect.Effect.TargetNodes = new[] { node };
                    }
                    else
                    {
                        effectsToRemove.Add(unmappedEffect);
                    }
                }
                else
                {
                    effectsToRemove.Add(unmappedEffect);
                }
            }

            sequence.SequenceData.EffectData.RemoveRangeData(effectsToRemove);
        }
예제 #2
0
 /// <summary>
 /// Constructor for the <c>ElementMapParameter</c> object.
 /// This is used to create a parameter that can be used to
 /// determine a consistent name using the provided XML annotation.
 /// </summary>
 /// <param name="factory">
 /// this is the constructor the parameter is in
 /// </param>
 /// <param name="value">
 /// this is the annotation used for the parameter
 /// </param>
 /// <param name="index">
 /// this is the index the parameter appears at
 /// </param>
 public ElementMapParameter(Constructor factory, ElementMap value, int index) {
    this.contact = new Contact(value, factory, index);
    this.label = new ElementMapLabel(contact, value);
    this.name = label.GetName();
    this.factory = factory;
    this.index = index;
 }
예제 #3
0
 /// <inheritdoc />
 public ElementMap InitializeMap(string name)
 {
     ElementMap = new ElementMap {
         Name = name
     };
     BeginEdit();
     MapMessage.SendWith(MapMessageType.New);
     return(ElementMap);
 }
예제 #4
0
 /// <summary>
 /// Constructor for the <c>ElementMapLabel</c> object. This
 /// creates a label object, which can be used to convert an XML
 /// node to a <c>Map</c> of XML serializable objects.
 /// </summary>
 /// <param name="contact">
 /// this is the contact that this label represents
 /// </param>
 /// <param name="label">
 /// the annotation that contains the schema details
 /// </param>
 public ElementMapLabel(Contact contact, ElementMap label)
 {
     this.detail    = new Signature(contact, this);
     this.decorator = new Qualifier(contact);
     this.entry     = new Entry(contact, label);
     this.type      = contact.Type;
     this.name      = label.name();
     this.label     = label;
 }
예제 #5
0
파일: Entry.cs 프로젝트: restlet/simplexml
 /// <summary>
 /// Constructor for the <c>Entry</c> object. This takes the
 /// element map annotation that provides configuration as to how
 /// the map is serialized and deserialized from the XML document.
 /// The entry object provides a convenient means to access the XML
 /// schema configuration using defaults where necessary.
 /// </summary>
 /// <param name="contact">
 /// this is the point of contact to the map object
 /// </param>
 /// <param name="label">
 /// the annotation the map method or field uses
 /// </param>
 public Entry(Contact contact, ElementMap label)
 {
     this.attribute = label.attribute();
     this.entry     = label.entry();
     this.value     = label.value();
     this.key       = label.key();
     this.key       = label.key();
     this.contact   = contact;
     this.label     = label;
 }
예제 #6
0
 /// <inheritdoc />
 public ElementMap InitializeMap(Dictionary <Guid, string> elementSources, string name)
 {
     ElementMap = new ElementMap(elementSources)
     {
         Name = name
     };
     BeginEdit();
     MapMessage.SendWith(MapMessageType.New);
     return(ElementMap);
 }
예제 #7
0
        public virtual dynamic GetNextEntry(int index)
        {
            if (index < 1)
            {
                throw new IndexOutOfRangeException("Index is 1-based. Expect index to be greater than 0.  Got index value of: " + index);
            }

            var obj = new ExpandoObject();

            return(ElementMap.Aggregate(obj as IDictionary <string, object>, (current, e) => AddProperty(current, index, e.Value, e.Key)));
        }
예제 #8
0
 public ElementNodeProxyViewModel(ElementNodeProxy proxy, IElementMapService elementMapService)
 {
     _elementMapService = elementMapService;
     ElementNodeProxy   = proxy;
     _map           = elementMapService.ElementMap;
     ElementMapping = _map.GetBySourceId(proxy.Id);
     elementMapService.RegisterMapMessages(this, OnElementMapChanged);
     if (ElementMapping == null)
     {
         _elementMapService.ElementMap.ElementMappings.CollectionChanged += ElementMappings_CollectionChanged;
     }
 }
예제 #9
0
파일: Atom.cs 프로젝트: frke/genome-tools
 public Atom(int protons, int neutrons)
 {
     Protons           = protons;
     Neutrons          = neutrons;
     Element           = ElementMap.FromProtonCount(Protons);
     Period            = PeriodicTable.GetPeriod(Element);
     Mass              = AtomPropertyCalculator.CalculateMass(Protons, Neutrons);
     Radius            = PeriodicTable.GetCovalentRadius(Element);
     ElectroNegativity = PeriodicTable.ElectroNegativity(Element);
     FormalCharge      = 0 * PhysicalConstants.ElementaryCharge;
     EffectiveCharge   = FormalCharge;
 }
예제 #10
0
 private void OnElementMapChanged(ElementMapService.MapMessage obj)
 {
     if (obj.Data.Equals(ElementMapService.MapMessageType.New))
     {
         _map.ElementMappings.CollectionChanged -= ElementMappings_CollectionChanged;
         _map = _elementMapService.ElementMap;
     }
     ElementMapping = _map.GetBySourceId(ElementNodeProxy.Id);
     if (ElementMapping == null)
     {
         _elementMapService.ElementMap.ElementMappings.CollectionChanged += ElementMappings_CollectionChanged;
     }
 }
예제 #11
0
        public override object GetPropertyValue(ExcelSheet sheet, int rowIndex, IExcelDataReader reader)
        {
            var values   = ColumnsReader.GetValues(sheet, rowIndex, reader).ToArray();
            var elements = new List <T>(values.Length);

            foreach (var value in values)
            {
                var elementValue = (T)ElementMap.GetPropertyValue(sheet, rowIndex, reader, value);
                elements.Add(elementValue);
            }

            return(CreateFromElements(elements));
        }
예제 #12
0
        /// <inheritdoc />
        public override void ChannelRead(
            IChannelHandlerContext context,
            object message)
        {
            base.ChannelRead(context, message);

            if (message is LoginResponse)
            {
                Log.Information("Logged in!");
            }
            else if (message is SceneDiffEvent diff)
            {
                Log.Information("Received scene diff event.");

                Map = diff.Map;
            }
            else if (message is SceneMapUpdateEvent mapUpdate)
            {
                Log.Information($"Received scene map update event.");

                var elements = Map.Elements.ToList();
                elements.AddRange(mapUpdate.ElementsAdded);

                var props = Map.Props.ToList();
                props.AddRange(mapUpdate.PropsAdded);

                Map.Elements = elements.ToArray();
                Map.Props    = props.ToArray();
            }
            else if (message is RoomResponse res)
            {
                TaskCompletionSource <RoomResponse> source;
                lock (_sources)
                {
                    _sources.TryGetValue(res.RequestId, out source);
                }

                if (null == source)
                {
                    Log.Warning($"Received a response for a request we are not tracking: {res.RequestId}.");
                }
                else
                {
                    source.SetResult(res);
                }
            }
            else
            {
                Log.Warning($"Received unhandled message: {message}.");
            }
        }
예제 #13
0
        public static IElement CreateElementFromDescriptor(ElementDescriptor elementDescriptor)
        {
            IElement element;

            if (elementDescriptor is ElementDescriptorChild)
            {
                element = new ElementChild();
            }
            else if (elementDescriptor is ElementDescriptorInput)
            {
                element = new ElementInput();
            }
            else if (elementDescriptor is ElementDescriptorButton)
            {
                element = new ElementButton();
            }
            else if (elementDescriptor is ElementDescriptorOutput)
            {
                element = new ElementOutput();
            }
            else if (elementDescriptor is ElementDescriptorInfo)
            {
                element = new ElementInfo();
            }
            else if (elementDescriptor is ElementDescriptorMap)
            {
                element = new ElementMap();
            }
            else if (elementDescriptor is ElementDescriptorBrowser)
            {
                element = new ElementBrowser();
            }
            else
            {
                throw new Exception("Invalid descriptor");
            }

            SetSharedAttributes(element, elementDescriptor);
            element.ElementDescriptor = elementDescriptor;

            return(element);
        }
예제 #14
0
        /// <summary>
        /// Controller.
        /// </summary>
        /// <param name="token">The token to login with.</param>
        public MyceliumClientHandler(string token)
        {
            _token = token;

            Map = new ElementMap();
        }