public ServiceDescriptionTable(byte[] data, int offset)
        {
            _Descs = new List <DescriptorBase>();

            int i   = 0;
            int tmp = 0;

            _Sid  = data[(i++) + offset] << 8;
            _Sid |= data[(i++) + offset];

            tmp = data[(i++) + offset];

            _EitSched = (tmp & 0x02) != 0;

            _EitPresentFollowing = (tmp & 0x01) != 0;

            _Len  = data[(i++) + offset] << 8;
            _Len |= data[(i++) + offset];

            _RunningStatus = _Len >> 13;
            _FreeCA        = (_Len & 0x1000) != 0;

            _Len &= 0x0fff;

            while (i < Length)
            {
                DescriptorBase desc = DescriptorFactory.CreateDescriptor(data, i + offset);
                _Descs.Add(desc);

                i += desc.Length;
            }
        }
        /// <summary>
        /// Показать AccessDescriptorEditor
        /// </summary>
        /// <param name="ad">Ссылка на AccessDescriptor</param>
        /// <param name="selectedItemPanelName">Имя выбранной панели</param>
        public DescriptorCommonEditor(DescriptorBase ad, string selectedItemPanelName)
        {
            InitializeComponent();
            FillPanelsList();

            _assignedAccessDescriptor       = ad;
            _accessDescriptorName.Text      = _assignedAccessDescriptor.GetName();
            _usePanelPowerFormula.IsChecked = _assignedAccessDescriptor.GetUsePanelPowerFormulaFlag();
            _powerFormula.Text = _assignedAccessDescriptor.GetPowerFormula();

            // Если в AccessDescriptor не указана панель - берём текущую, выделенную в дереве и устанавливаем её
            // в качестве панели AccessDescriptor (для ускорения заполнения полей)
            var selectedPanel = Profile.PanelStorage.GetPanelById(_assignedAccessDescriptor.GetAssignedPanelId());

            if (selectedPanel != null)
            {
                _assignedPanel.Text = selectedPanel.Name;
            }
            else
            {
                if (selectedItemPanelName != null)
                {
                    _assignedPanel.Text = selectedItemPanelName;
                }
            }

            Localize();
        }
Beispiel #3
0
        public static IElementDefinition Create(DescriptorBase descriptor, IElementConfiguration configuration)
        {
            switch (descriptor)
            {
            case AppenderDescriptor appenderDescriptor:
                return(CreateAppenderDefinition(appenderDescriptor, configuration));

            case FilterDescriptor filterDescriptor:
                return(CreateFilterDefinition(filterDescriptor));

            case LoggerDescriptor loggerDescriptor:
                return(CreateLoggerDefinition(loggerDescriptor, configuration));

            case MappingDescriptor mappingDescriptor:
                return(new MappingDefinition());

            case RendererDescriptor rendererDescriptor:
                return(new RendererDefinition());

            case ParamDescriptor paramDescriptor:
                return(new ParamDefinition(configuration));

            default:
                throw new ArgumentException($"Property definitions do not exist for {descriptor.GetType().Name}");
            }
        }
        internal static IWindowSizeLocation Create(DescriptorBase descriptor)
        {
            switch (descriptor)
            {
            case AppenderDescriptor appenderDescriptor:
                return(new AppenderWindowSizeLocation());

            case FilterDescriptor filterDescriptor:
                return(CreateFilterSizeLocation(filterDescriptor));

            case LoggerDescriptor loggerDescriptor:
                return(new LoggerWindowSizeLocation());

            case MappingDescriptor mappingDescriptor:
                return(new FilterWindowSizeLocation());

            case RendererDescriptor rendererDescriptor:
                return(new RendererWindowSizeLocation());

            case ParamDescriptor paramDescriptor:
                return(new StringMatchFilterWindowSizeLocation());

            default:
                throw new ArgumentException($"Window size & locations do not exist for {descriptor.GetType().Name}");
            }
        }
        private void AddDescriptorToList(DescriptorBase accessDescriptor)
        {
            var lbi = new ListBoxItem {
                Content = Profile.PanelStorage.GetPanelById(accessDescriptor.GetAssignedPanelId()).Name + "." + accessDescriptor.GetName(), Tag = accessDescriptor
            };

            _dependendDescriptorList.Items.Add(lbi);
        }
Beispiel #6
0
        protected ModelBase(XmlNode node, DescriptorBase descriptor)
        {
            Node       = node;
            Descriptor = descriptor ?? throw new ArgumentNullException(nameof(descriptor));

            if (Node != null && Node.Name != descriptor.ElementName)
            {
                throw new ArgumentException($"Specified node has incorrect element name ({Node.Name}) for {GetType().Name} ({descriptor.ElementName}).");
            }
        }
        public void Create_ShouldCreateTheCorrectSizeLocation(DescriptorBase descriptorBase, string retentionKey, ResizeMode mode, SizeToContent sizeToContent, Size width, Size height)
        {
            IWindowSizeLocation windowSizeLocation = WindowSizeLocationFactory.Create(descriptorBase);

            Assert.AreEqual(retentionKey, windowSizeLocation.RetentionKey);
            Assert.AreEqual(mode, windowSizeLocation.ResizeMode);
            Assert.AreEqual(sizeToContent, windowSizeLocation.SizeToContent);
            Assert.AreEqual(width, windowSizeLocation.Width);
            Assert.AreEqual(height, windowSizeLocation.Height);
        }
        private void FillConnectors(DescriptorBase accessDescriptor)
        {
            var conn = accessDescriptor.GetConnectors(this);

            foreach (var c in conn)
            {
                var assignment = (IAssignment)Activator.CreateInstance(GetAssignmentsType());
                assignment.SetConnector(c);
                Connections.Add(assignment);
            }
        }
 private GraphiteApiParameter(DescriptorBase descriptor,
                              string name, TypeDescriptor type, MethodDescriptor method,
                              bool urlParameter = false, bool querystring = false)
 {
     _descriptor    = descriptor;
     Name           = name;
     Type           = type.Type;
     ActionMethod   = method.MethodInfo;
     IsUrlParameter = urlParameter;
     IsQuerystring  = querystring;
     IsOptional     = querystring;
 }
Beispiel #10
0
        private void Parse()
        {
            // ISO IEC 13818 seite 58 (pdf)

            _Descs.Clear();
            _Streams.Clear();
            _PcrPid = 0;

            int len = SectionSize - 4; // 4 byte CRC am Ende abziehen.
            int i   = 8;               // start der Daten.

            _PcrPid |= SectionData[i++] << 8;
            _PcrPid |= SectionData[i++];
            _PcrPid &= 0x1fff;

            int piLen = 0;

            piLen |= SectionData[i++] << 8;
            piLen |= SectionData[i++];
            piLen &= 0x0fff;
            // Ende der Daten:
            piLen += i;

            while (i < piLen)
            {
                DescriptorBase desc = DescriptorFactory.CreateDescriptor(SectionData, i);
                _Descs.Add(desc);

                i += desc.Length;
            }

            while (i < len)
            {
                ElementaryStream es = new ElementaryStream(SectionData, i);
                _Streams.Add(es);

                i += es.Length;
            }
        }
Beispiel #11
0
 public LoggerModel(XmlNode node, bool isEnabled, DescriptorBase descriptor)
     : base(node, descriptor)
 {
     IsEnabled = isEnabled;
 }
 public Guid RegisterAccessDescriptor(DescriptorBase ad)
 {
     _storage[ad.GetId()] = ad;
     return(ad.GetId());
 }
Beispiel #13
0
 public override void ImplementDeclaration(DescriptorBase container, System.Reflection.MemberInfo declSite)
 {
 }
Beispiel #14
0
 public LampProcessor(DescriptorBase accessDescriptor) : base(accessDescriptor)
 {
 }
 public ButtonPlusMinusProcessor(DescriptorBase accessDescriptor) : base(accessDescriptor)
 {
 }
        public override void ImplementDeclaration(DescriptorBase container, PropertyInfo declSite)
        {
            ComponentDescriptor cd = container as ComponentDescriptor;
            if (cd == null)
                throw new ArgumentException("Cannot implement property " + declSite.Name + " as port because it is not declared inside a component!");

            Channel boundChannel = (Channel)declSite.GetValue(cd.Instance, new object[0]);

            // Ignore unbound ports
            if (boundChannel == null)
            {
                AttributeInjector.InjectOnce(
                    declSite.GetGetMethod(true), cd.Instance, new AssumeNotCalled());
                return;
            }

            if (boundChannel is SignalBase)
            {
                SignalBase boundSignal = (SignalBase)boundChannel;
                SignalDescriptor boundSignalDesc = boundSignal.Descriptor;
                TypeDescriptor elType = boundSignalDesc.ElementType;
                Descriptor = new PortDescriptor(
                    declSite,
                    boundSignalDesc,
                    elType,
                    Direction);
                CreateChildPDs(Descriptor, boundSignalDesc);
                container.AddChild(Descriptor, Descriptor.DeclarationSite.Name);
                IPackageOrComponentDescriptor pcd = container as IPackageOrComponentDescriptor;
                if (pcd != null && elType.Package != null)
                    pcd.AddDependency(elType.Package);

                IPortDescriptor port = cd.FindPort(declSite.Name);

                // Accesses to port-like properties are statically evaluated
                AttributeInjector.InjectOnce(
                    declSite.GetGetMethod(true),
                    cd.Instance,
                    new StaticEvaluation(x => new SignalRef(port, SignalRef.EReferencedProperty.Instance)));
            }
            else
            {
                throw new NotImplementedException("Non-signal ports are not yet supported");
            }
        }
 public RootLoggerModel(XmlNode node, bool isEnabled, DescriptorBase descriptor)
     : base(node, isEnabled, descriptor)
 {
 }
 protected NamedModel(XmlNode node, DescriptorBase descriptor)
     : base(node, descriptor)
 {
 }
Beispiel #19
0
 public EncoderProcessor(DescriptorBase accessDescriptor) : base(accessDescriptor)
 {
 }
 public AxisRangeProcessor(DescriptorBase accessDescriptor) : base(accessDescriptor)
 {
 }
 public sealed override void ImplementDeclaration(DescriptorBase container, MemberInfo declSite)
 {
     ImplementDeclaration(container, (PropertyInfo)declSite);
 }
 /// <summary>
 /// Implements the special treatment of a particular field or property.
 /// </summary>
 /// <param name="container">descriptor of containing component</param>
 /// <param name="declSite">found property</param>
 public abstract void ImplementDeclaration(DescriptorBase container, PropertyInfo declSite);
 /// <summary>
 /// Implements the special treatment of a particular field or property.
 /// </summary>
 /// <param name="container">descriptor of containing component</param>
 /// <param name="declSite">found field or property</param>
 public virtual void ImplementDeclaration(DescriptorBase container, MemberInfo declSite)
 {
     throw new NotSupportedException("Declaration as member is not allowed");
 }
 private static bool IsSuitable(DescriptorBase accessDescriptor)
 {
     return(accessDescriptor is T);
 }
Beispiel #25
0
        private void GenerateTypeDecls(DescriptorBase desc, IndentedTextWriter tw)
        {
            var types = desc.GetTypes().Where(t => (!t.IsConstrained || !t.IsComplete) && !t.CILType.IsPrimitive);
            var synthTypes = types.Where(t => !IsNotSynthesizable(t));
            var nonSynthTypes = types.Where(t => IsNotSynthesizable(t));

            foreach (var td in synthTypes)
            {
                tw.WriteLine("-- " + td.Name);
                GenerateTypeDecl(td, tw);
            }
            if (nonSynthTypes.Any())
            {
                SwitchOffSynthesis(tw);
                foreach (var td in nonSynthTypes)
                {
                    tw.WriteLine("-- " + td.Name);
                    GenerateTypeDecl(td, tw);
                }
                SwitchOnSynthesis(tw);
            }
        }
 bool IControlProcessor.IsAccessDesctiptorSuitable(DescriptorBase accessDescriptor)
 {
     return(IsSuitable(accessDescriptor));
 }
Beispiel #27
0
 public ButtonBinaryInputProcessor(DescriptorBase accessDescriptor)
     : base(accessDescriptor)
 {
 }
 protected ControlProcessorBase(DescriptorBase accessDescriptor)
 {
     AccessDescriptor           = accessDescriptor as T;
     AssignedAccessDescriptorId = accessDescriptor.GetId();
     FillConnectors(accessDescriptor);
 }
 public IndicatorProcessor(DescriptorBase accessDescriptor) : base(accessDescriptor)
 {
 }
 public void Create_ShouldReturnTheCorrectDefinition(DescriptorBase descriptorBase, Type expectedDefinitionType)
 {
     Assert.IsInstanceOf(expectedDefinitionType, DefinitionFactory.Create(descriptorBase, Substitute.For <IElementConfiguration>()));
 }
 public LedMatrixIndicatorProcessor(DescriptorBase accessDescriptor) : base(accessDescriptor)
 {
     FillSymbolLightedSegments();
     LoadSegmentToPinMapping();
 }
Beispiel #32
0
 public SteppingMotorProcessor(DescriptorBase accessDescriptor) : base(accessDescriptor)
 {
 }
Beispiel #33
0
 protected CollectorBase(DescriptorBase accessDescriptor) : base(accessDescriptor)
 {
 }