Ejemplo n.º 1
0
        public TagValue(ITag tag, object value)
        {
            if (tag == null) throw new ArgumentNullException("tag");

            Tag = tag;
            Value = value;
        }
Ejemplo n.º 2
0
        public override bool IsEditTag(ITag tag)
        {
            // Cache the FieldInfo/PropertyInfo since we will be using it a lot
            if (AttributeIdFieldInfo == null)
            {
                Type type = tag.GetType();
                AttributeIdFieldInfo = type.GetField("myAttributeId", BindingFlags.Instance | BindingFlags.NonPublic);
            }

            if (AttributeIdFieldInfo == null)
            {
                return false;
            }

            var value = AttributeIdFieldInfo.GetValue(tag) as string;
            if (value == null)
            {
                return false;
            }

            switch (value)
            {
                case ExternalEditAttribute1:
                case ExternalEditAttribute2:
                case ExternalEditAttribute3:
                    return true;
                default:
                    return false;
            }
        }
Ejemplo n.º 3
0
 private void GuardPresenceOfCategoriesOnTag(ITag tag)
 {
     Type tagType = tag.GetType();
     object[] categories = tagType.GetCustomAttributes(typeof(CategoryAttribute), true);
     Assert.That(categories.Length, Is.EqualTo(1));
     Console.WriteLine(((CategoryAttribute) categories[0]).Category);
 }
Ejemplo n.º 4
0
 public void Validate(ITag tag)
 {
     foreach (var validator in _validators)
     {
         validator?.Validate(tag);
     }
 }
Ejemplo n.º 5
0
 public Photo(FileInfo file, ITag parent)
 {
     this.file = file;
     this.parent = parent;
     this.id = CryptoUtil.Md5Encode(file.FullName);
     metaReader = JpegMetadataReader.RetreiveFromFile(file.FullName);
 }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="tag"></param>
		public override void VisitTag(ITag tag)
		{
			if (IsPreTag(tag))
			{
				preTagBeingProcessed = true;
			}
		}
Ejemplo n.º 7
0
        public TagViewModel(ITag tag)
        {
            if (tag == null)
                throw new ArgumentNullException("tag");

            this.tag = tag;
        }
Ejemplo n.º 8
0
    public override void Write(ITag value, NbtOptions options)
    {
      if (options.HasFlag(NbtOptions.Header) && value.Type != TagType.End)
        this.WriteHeader(value);

      switch (value.Type)
      {
        case TagType.End:
          this.WriteEnd();
          break;

        case TagType.Byte:
          this.Write((byte)value.Value);
          break;

        case TagType.Short:
          this.Write((short)value.Value);
          break;

        case TagType.Int:
          this.Write((int)value.Value);
          break;

        case TagType.Long:
          this.Write((long)value.Value);
          break;

        case TagType.Float:
          this.Write((float)value.Value);
          break;

        case TagType.Double:
          this.Write((double)value.Value);
          break;

        case TagType.ByteArray:
          this.Write((byte[])value.Value);
          break;

        case TagType.String:
          this.Write((string)value.Value);
          break;

        case TagType.List:
          this.Write((TagCollection)value.Value);
          break;

        case TagType.Compound:
          this.Write((TagDictionary)value.Value);
          break;

        case TagType.IntArray:
          this.Write((int[])value.Value);
          break;

        default:
          throw new ArgumentException("Unrecognized or unsupported tag type.", "value");
      }
    }
Ejemplo n.º 9
0
 public BasicFilter(string name, ITag tag, IOperator filterOperator, string criteria)
     : base(name)
 {
     _tag = tag;
       _operator = filterOperator;
       _tag.attachObserver(this);
       this._criteria = criteria;
 }
Ejemplo n.º 10
0
 public static PostEntity ToPostEntity(this PostViewModel postViewModel, ITag tagRepository)
 {
     var postEntity = postViewModel.Post;
     postEntity.Categories = GetSelectedCategories(postViewModel.Categories);
     if (!string.IsNullOrEmpty(postViewModel.Tags))
         postEntity.Tags = GetSelectedTags(postViewModel.Tags, tagRepository);
     return postEntity;
 }
Ejemplo n.º 11
0
 public void SaveCommit( ITag tag, out bool success )
 {
     using ( IUnitOfWork u = UnitOfWork.Begin() ) {
         Save( tag, out success );
         if ( success )
             u.Commit();
     }
 }
		public FourthGenResourceLayoutTable(ITag playTag, FileSegmentGroup metaArea, MetaAllocator allocator,
			EngineDescription buildInfo)
		{
			_tag = playTag;
			_metaArea = metaArea;
			_allocator = allocator;
			_buildInfo = buildInfo;
		}
Ejemplo n.º 13
0
 public Post(IUser userRepository, ICategory categoryRepository, ITag tagRepository, IComment commentRepository)
 {
     _postsTable = context.GetTable<PostEntity>();
     _commentRepository = commentRepository;
     _tagRepository = tagRepository;
     _categoryRepository = categoryRepository;
     _userRepository = userRepository;
 }
Ejemplo n.º 14
0
 public Tag(string id, string name, Tag parentTag)
 {
     this.Id = id;
     this.Name = name;
     childTags = new List<Tag>();
     photos = new List<Photo>();
     this.parentTag = parentTag;
 }
Ejemplo n.º 15
0
 internal EditBasicFilter(BasicFilter target, string newName, ITag newTag, IOperator newOperator, string newCriteria)
 {
     _newName = newName;
       _newTag = newTag;
       _newCriteria = newCriteria;
       _target = target;
       _newOperator = newOperator;
 }
Ejemplo n.º 16
0
 public CreativeController(ITag tag, ICreative creative, IChapter chapter, IUser user, ILike like)
 {
     this.tagRepository = tag;
     this.creativeRepository = creative;
     this.chapterRepository = chapter;
     this.userRepository = user;
     this.likeRepository = like;
 }
Ejemplo n.º 17
0
 public MockPost()
 {
     _postsTable = GetMockPosts();
     _commentRepository = new MockComment();
     _tagRepository = new MockTag();
     _categoryRepository = new MockCategory();
     _userRepository = new MockUser();
 }
Ejemplo n.º 18
0
 public HomeController(IPost postRepository, IUser userRepository, ICategory categoryRepository, ITag tagRepository, ISettings settingsRepository, ICacheService cacheService)
     : base (settingsRepository)
 {
     _postRepository = postRepository;
     _userRepository = userRepository;
     _categoryRepository = categoryRepository;
     _tagRepository = tagRepository;
     _cacheService = cacheService;
 }
Ejemplo n.º 19
0
        public ExternalEditMarker? TryCreateExternalEditMarker(ITag tag, SnapshotSpan tagSpan)
        {
            if (IsVsAdornmentTagType(tag.GetType()) && IsEditTag(tag))
            {
                return  new ExternalEditMarker(ExternalEditKind.Resharper, tagSpan);
            }

            return null;
        }
Ejemplo n.º 20
0
        public void Delete( ITag tag )
        {
            Checks.Argument.IsNotNull( tag, "tag" );

            using ( IUnitOfWork u = UnitOfWork.Begin() ) {
                _repo.Remove( tag );
                u.Commit();
            }
        }
Ejemplo n.º 21
0
    protected virtual object ReadTagValue(ITag tag)
    {
      object result;

      switch (tag.Type)
      {
        case TagType.Byte:
          result = this.ReadByte();
          break;

        case TagType.Short:
          result = this.ReadShort();
          break;

        case TagType.Int:
          result = this.ReadInt();
          break;

        case TagType.Long:
          result = this.ReadLong();
          break;

        case TagType.Float:
          result = this.ReadFloat();
          break;

        case TagType.Double:
          result = this.ReadDouble();
          break;

        case TagType.ByteArray:
          result = this.ReadByteArray();
          break;

        case TagType.String:
          result = this.ReadString();
          break;

        case TagType.List:
          result = this.ReadCollection((TagList)tag);
          break;

        case TagType.Compound:
          result = this.ReadDictionary((TagCompound)tag);
          break;

        case TagType.IntArray:
          result = this.ReadIntArray();
          break;

        default:
          throw new InvalidDataException($"Unrecognized tag type: {tag.Type}");
      }

      return result;
    }
Ejemplo n.º 22
0
        public void AddTag(ITag tag)
        {
            if (tag == null)
                throw new ArgumentNullException("tag");

            if (tags.Contains(tag))
                return;

            tags.Add(tag);
        }
Ejemplo n.º 23
0
        public TagAdminController(ITag tagRepository, ISettings settingsRepository)
            : base(settingsRepository)
        {
            _tagRepository = tagRepository;
            ExpectedMasterName = string.Empty;

            _itemsPerPage = settingsRepository.ManageItemsPerPage;

            IsAdminController = true;
        }
Ejemplo n.º 24
0
        public void RemoveTag(ITag tag)
        {
            if (tag == null)
                throw new ArgumentNullException("tag");

            if (!tags.Contains(tag))
                return;

            tags.Remove(tag);
        }
Ejemplo n.º 25
0
 public static void Check(ITag tag)
 {
     IDictionary<PropertyInfo, RequiredAttribute> requiredProperties = GetRequiredProperties(tag);
     List<string> missingProperties = CollectMissingProperties(requiredProperties, tag);
     if (missingProperties.Count > 0)
     {
         throw TagException.MissingRequiredAttribute(tag.GetType(), missingProperties.ToArray()).Decorate(
             tag.Context);
     }
 }
		public FourthGenSimulationDefinitionTable(ITag scenario, TagTable tags, IReader reader, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo)
		{
			_scenario = scenario;
			_tags = tags;
			_metaArea = metaArea;
			_allocator = allocator;
			_buildInfo = buildInfo;

			Load(reader);
		}
        public ThirdGenScenarioScriptFile(ITag scenarioTag, string scenarioName, FileSegmentGroup metaArea, StringIDSource stringIDs, BuildInformation buildInfo)
        {
            _tag = scenarioTag;
            _stringIDs = stringIDs;
            _metaArea = metaArea;
            _buildInfo = buildInfo;
            Name = scenarioName.Substring(scenarioName.LastIndexOf('\\') + 1) + ".hsc";

            DefineScriptObjectReflexives();
        }
Ejemplo n.º 28
0
 public static void InitContext()
 {
     if (InitEvent != null)
     {
             CategoryService = InitEvent(typeof(ICategory)) as ICategory;         
             PostService = InitEvent(typeof(IPost)) as IPost;         
             PostTagMapService = InitEvent(typeof(IPostTagMap)) as IPostTagMap;         
             TagService = InitEvent(typeof(ITag)) as ITag;         
     }
 }
Ejemplo n.º 29
0
        public ThirdGenResourceGestalt(IReader reader, ITag zoneTag, FileSegmentGroup metaArea, MetaAllocator allocator,
			StringIDSource stringIDs, EngineDescription buildInfo)
        {
            _tag = zoneTag;
            _metaArea = metaArea;
            _allocator = allocator;
            _buildInfo = buildInfo;

            Load(reader, stringIDs);
        }
Ejemplo n.º 30
0
 private void AddAuthorTag(ITag tag)
 {
     AddValue <ITag>(() => authorTags.Add(tag), tag, x => x.AuthorTags);
 }
Ejemplo n.º 31
0
        private void WriteDataBlock(DataBlock block, SegmentPointer location, IStream stream, ITag tag = null)
        {
            if (tag == null && _dataBlockAddresses.ContainsKey(block))             // Don't write anything if the block has already been written
            {
                return;
            }

            // Associate the location with the block
            _dataBlockAddresses[block] = location.AsPointer();

            // Create a MemoryStream and write the block data to it (so fixups can be performed before writing it to the file)
            using (var buffer = new MemoryStream(block.Data.Length))
            {
                var bufferWriter = new EndianWriter(buffer, stream.Endianness);
                bufferWriter.WriteBlock(block.Data);

                // Apply fixups
                FixBlockReferences(block, bufferWriter, stream);
                FixTagReferences(block, bufferWriter, stream);
                FixResourceReferences(block, bufferWriter, stream);
                FixStringIdReferences(block, bufferWriter);
                if (tag != null)
                {
                    FixUnicListReferences(block, tag, bufferWriter, stream);
                }
                FixInteropReferences(block, bufferWriter, stream, location);
                FixEffectReferences(block, bufferWriter);
                if (!_dupeReuseSoundGestalt)
                {
                    FixSoundReferences(block, bufferWriter, stream);
                }

                // sort after fixups
                if (block.Sortable && block.EntrySize >= 4)
                {
                    var entries      = new List <Tuple <uint, byte[]> >();
                    var bufferReader = new EndianReader(buffer, stream.Endianness);

                    for (int i = 0; i < block.EntryCount; i++)
                    {
                        buffer.Position = i * block.EntrySize;
                        uint   sid  = bufferReader.ReadUInt32();
                        byte[] rest = bufferReader.ReadBlock(block.EntrySize - 4);
                        entries.Add(new Tuple <uint, byte[]>(sid, rest));
                    }
                    buffer.Position = 0;
                    foreach (var entry in entries.OrderBy(e => e.Item1))
                    {
                        bufferWriter.WriteUInt32(entry.Item1);
                        bufferWriter.WriteBlock(entry.Item2);
                    }
                }

                // Write the buffer to the file
                stream.SeekTo(location.AsOffset());
                stream.WriteBlock(buffer.ToArray(), 0, (int)buffer.Length);
            }

            // Write shader fixups (they can't be done in-memory because they require cache file expansion)
            FixShaderReferences(block, stream, location);
        }
Ejemplo n.º 32
0
        public ITag ReadTag()
        {
            lock (this._syncLock)
            {
                if (this._firstFrame)
                {
                    this._firstFrame = false;
                    return(this._fileMeta);
                }
                Mp3Header header = this.ReadHeader();
                if (header == null)
                {
                    return(null);
                }
                int frameSize = header.FrameSize;
                if (frameSize == 0)
                {
                    return(null);
                }
                if (((this._fileStream.Position + frameSize) - 4L) > this._fileStream.Length)
                {
                    this._fileStream.Position = this._fileStream.Length;
                    return(null);
                }
                this._tag          = new Tag(IOConstants.TYPE_AUDIO, (int)this._currentTime, frameSize + 1, null, this._prevSize);
                this._prevSize     = frameSize + 1;
                this._currentTime += header.FrameDuration;
                byte[] buffer     = new byte[this._tag.BodySize];
                byte   num2       = (byte)((IOConstants.FLAG_FORMAT_MP3 << 4) | (IOConstants.FLAG_SIZE_16_BIT << 1));
                int    sampleRate = header.SampleRate;
                if (sampleRate == 0x2b11)
                {
                    num2 = (byte)(num2 | ((byte)(IOConstants.FLAG_RATE_11_KHZ << 2)));
                }
                else if (sampleRate != 0x5622)
                {
                    if (sampleRate != 0xac44)
                    {
                        goto Label_0163;
                    }
                    num2 = (byte)(num2 | ((byte)(IOConstants.FLAG_RATE_44_KHZ << 2)));
                }
                else
                {
                    num2 = (byte)(num2 | ((byte)(IOConstants.FLAG_RATE_22_KHZ << 2)));
                }
                goto Label_0171;
Label_0163:
                num2 = (byte)(num2 | ((byte)(IOConstants.FLAG_RATE_5_5_KHZ << 2)));
Label_0171:
                num2      = (byte)(num2 | (header.IsStereo ? IOConstants.FLAG_TYPE_STEREO : IOConstants.FLAG_TYPE_MONO));
                buffer[0] = num2;
                int data = header.Data;
                buffer[1] = (byte)(0xff & (data >> 0x18));
                buffer[2] = (byte)(0xff & (data >> 0x10));
                buffer[3] = (byte)(0xff & (data >> 8));
                buffer[4] = (byte)(0xff & data);
                this._fileStream.Read(buffer, 5, frameSize - 4);
                this._tag.Body = buffer;
                return(this._tag);
            }
        }
Ejemplo n.º 33
0
 public MainWindow()
 {
     InitializeComponent();
     tag = TagFactory.Load(flac);
     InitControler();
 }
Ejemplo n.º 34
0
        public Template Compile(string source)
        {
            Stack <CompilerContext> stack = new Stack <CompilerContext> ();
            Tokenizer tokenizer           = new Tokenizer(source);
            Template  template            = new Template(InternalTags [@"template"]);

            CompilerContext context = new CompilerContext
            {
                CurrentElement    = template,
                InConditionalPath = false
            };

            bool   inPartial      = false;
            string currentPartial = String.Empty;

            foreach (var token in tokenizer.Tokens.Where(token => !token.IsEmpty))
            {
                if (token.Type == TokenTypes.StaticText)
                {
                    // Static content.
                    context.AddStatement(new StaticElement(token.Data, InternalTags [@"static"]));
                }
                else
                {
                    // A moustache ...
                    if (token.Subtype == TokenSubtypes.BeginTag)
                    {
                        // A begin tag can be a conditional separator (#if -> #else).
                        bool isConditionalPath = false;
                        ITag tag = GetBestTag(token.TagName, out isConditionalPath);

                        if (isConditionalPath)
                        {
                            if (context.Tag == tag)
                            {
                                // We're switching to the conditional brach.
                                context.InConditionalPath = true;
                            }
                            else
                            {
                                throw new Exception(@"Syntax error. Unexpected conditional branch.");
                            }
                        }
                        else
                        {
                            // We're creating a new element.
                            IRenderable statement = InstantiateTag(tag, token.Arguments);

                            if (tag is IInlineTag)
                            {
                                context.AddStatement(statement);
                            }
                            else
                            {
                                stack.Push(context);
                                context = new CompilerContext
                                {
                                    CurrentElement    = statement,
                                    InConditionalPath = false
                                };
                            }
                        }
                    }
                    else if (token.Subtype == TokenSubtypes.EndTag)
                    {
                        if (inPartial && token.TagName == currentPartial)
                        {
                            var element = context.CurrentElement as BlockElement;
                            context = stack.Pop();

                            template.Partials.Add(currentPartial, element);

                            inPartial      = false;
                            currentPartial = String.Empty;
                        }
                        else
                        {
                            // We're closing a tag.
                            bool isConditionalPath = false;
                            ITag tag = GetBestTag(token.TagName, out isConditionalPath);

                            // It can't be a conditional branch.
                            if (isConditionalPath)
                            {
                                throw new Exception(@"Syntax error. Unexpected conditional branch.");
                            }

                            if (context.Tag == tag)
                            {
                                var element = context.CurrentElement;
                                context = stack.Pop();

                                context.AddStatement(element);
                            }
                            else
                            {
                                throw new Exception(@"Syntax error. Unexpected ending tag.");
                            }
                        }
                    }
                    else if (token.Subtype == TokenSubtypes.DeclarePartialTag)
                    {
                        if (inPartial)
                        {
                            throw new Exception(@"Syntax error. Nested partials are not allowed.");
                        }

                        stack.Push(context);
                        context = new CompilerContext
                        {
                            CurrentElement    = new Template(InternalTags [@"template"]),
                            InConditionalPath = false
                        };

                        currentPartial = token.TagName;
                        inPartial      = true;
                    }
                    else if (token.Subtype == TokenSubtypes.RenderPartialTag)
                    {
                        context.AddStatement(InstantiateTag(InternalTags [@"renderpartial"], token.Arguments.Prepend("partial", new StringArgument(token.TagName))));
                    }
                    else if (token.Subtype == TokenSubtypes.Variable)
                    {
                        context.AddStatement(new VariableElement(InternalTags [@"variable"], token.Type == TokenTypes.DoubleMustache)
                        {
                            Arguments = token.Arguments
                        });
                    }
                }
            }

            // Validation.
            if (stack.Count > 0 || context.Tag != InternalTags [@"template"])
            {
                throw new Exception(@"Syntax error. Unexpected end of template.");
            }

            return(template);
        }
Ejemplo n.º 35
0
 public void RegisterInternalTag(ITag tag)
 {
     InternalTags.Add(tag.Name, tag);
 }
Ejemplo n.º 36
0
 public TClose(ITag origin)
 {
     _origin = origin;
 }
Ejemplo n.º 37
0
 public abstract bool IsEditTag(ITag tag);
Ejemplo n.º 38
0
 bool IReSharperEditTagDetector.IsEditTag(ITag tag)
 {
     return(false);
 }
 public int AddCategory(string key, string username, string password, ITag <Blog, BlogPost, PostTag> category)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 40
0
 private void RemoveAuthorTag(ITag tag)
 {
     RemoveValue <ITag>(() => authorTags.Remove(tag), tag, x => x.AuthorTags);
 }
Ejemplo n.º 41
0
 internal bool IsExternalEditTag(ITag tag)
 {
     return(IsVsAdornmentTagType(tag.GetType()) && IsEditTag(tag));
 }
Ejemplo n.º 42
0
 public TagTest()
 {
     _tag       = MockTagStore.Create();
     _tagParser = new TagParser((name, parent) => new Tag(_tag, name, parent));
 }
Ejemplo n.º 43
0
 public ExternalEditMarker?TryCreateExternalEditMarker(ITag tag, SnapshotSpan tagSpan)
 {
     return(null);
 }
Ejemplo n.º 44
0
 public void RegisterTag(ITag tag)
 {
     RegisteredTags.Add(tag.Name, tag);
 }
Ejemplo n.º 45
0
 public virtual void Add(ITag entity)
 {
     _innerRepository.Add(entity);
 }
Ejemplo n.º 46
0
 /// <summary> Set the end tag for this tag.</summary>
 /// <param name="tag">The new end tag for this tag.
 /// Note: no checking is perfromed so you can generate bad HTML by setting
 /// the end tag with a name not equal to the name of the start tag,
 /// i.e. {@.html <LABEL>The label</TITLE>}
 /// </param>
 public override void SetEndTag(ITag tag)
 {
     mEndTag = tag;
 }
Ejemplo n.º 47
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="obTag"></param>
 public AbstractData(ITag obTag)
 {
     this.m_Tag = obTag;
 }
Ejemplo n.º 48
0
 public void Tag(ITag tag)
 {
     _tags.Add(tag);
 }
Ejemplo n.º 49
0
 private void AddTitleTag(ITag tag)
 {
     AddValue <ITag>(() => titleTags.Add(tag), tag, x => x.TitleTags);
 }
Ejemplo n.º 50
0
        public DatumIndex InjectTag(ExtractedTag tag, IStream stream)
        {
            string tagnameuniqifier = "";

            if (tag == null)
            {
                throw new ArgumentNullException("tag is null");
            }

            // Don't inject the tag if it's already been injected
            DatumIndex newIndex;

            if (_tagIndices.TryGetValue(tag, out newIndex))
            {
                return(newIndex);
            }

            // Make sure there isn't already a tag with the given name
            ITag existingTag = _cacheFile.Tags.FindTagByName(tag.Name, tag.Group, _cacheFile.FileNames);

            if (existingTag != null)
            {
                //check if we are doing shader tweaks
                if (_renameShaders && _shaderGroups.Contains(CharConstant.ToString(tag.Group)))
                {
                    //append old tagid to make it unique
                    tagnameuniqifier = "_" + tag.OriginalIndex.ToString();

                    //make sure the tag didnt come from this exact map
                    if (existingTag.Index == tag.OriginalIndex)
                    {
                        return(existingTag.Index);
                    }

                    //make sure the appended name isn't already present
                    existingTag = _cacheFile.Tags.FindTagByName(tag.Name + tagnameuniqifier, tag.Group, _cacheFile.FileNames);

                    if (existingTag != null)
                    {
                        return(existingTag.Index);
                    }
                }
                else
                {
                    return(existingTag.Index);
                }
            }

            if (!_keepSound && tag.Group == SoundGroup)
            {
                return(DatumIndex.Null);
            }

            //PCA resource type is not always present, so get rid of 'em for now
            if (tag.Group == PCAGroup)
            {
                return(DatumIndex.Null);
            }

            // Look up the tag's datablock to get its size and allocate a tag for it
            DataBlock tagData = _container.FindDataBlock(tag.OriginalAddress);

            if (_resources == null && BlockNeedsResources(tagData))
            {
                // If the tag relies on resources and that info isn't available, throw it out
                LoadResourceTable(stream);
                if (_resources == null)
                {
                    return(DatumIndex.Null);
                }
            }
            if (_soundResources == null && BlockNeedsSounds(tagData))
            {
                // If the tag relies on sound resources and that info isn't available, throw it out
                LoadSoundResourceTable(stream);
                if (_soundResources == null)
                {
                    return(DatumIndex.Null);
                }
            }

            ITag newTag = _cacheFile.Tags.AddTag(tag.Group, tagData.Data.Length, stream);

            _tagIndices[tag] = newTag.Index;
            _cacheFile.FileNames.SetTagName(newTag, tag.Name + tagnameuniqifier);

            // Write the data
            WriteDataBlock(tagData, newTag.MetaLocation, stream, newTag);

            // Make the tag load
            LoadZoneSets(stream);
            if (_zoneSets != null)
            {
                _zoneSets.ExpandAllTags(newTag.Index.Index);
                if (_zoneSets.GlobalZoneSet != null)
                {
                    _zoneSets.GlobalZoneSet.ActivateTag(newTag, true);
                }
            }

            // If its group matches one of the valid simulation group names, add it to the simulation definition table
            if (_cacheFile.SimulationDefinitions != null && _simulationGroups.Contains(CharConstant.ToString(newTag.Group.Magic)))
            {
                _cacheFile.SimulationDefinitions.Add(newTag);
            }

            return(newTag.Index);
        }
Ejemplo n.º 51
0
 public LogixTagReqHdlr(ILoggerFactory loggerFactory, IDatabaseUnitOfWork unitOfWork, ITag tagRepository)
 {
     _loggerFactory = loggerFactory;
     _logger        = _loggerFactory.CreateLogger <LogixTagReqHdlr>();
     _unitOfWork    = unitOfWork;
     _tagRepository = tagRepository;
 }
Ejemplo n.º 52
0
 public virtual void Remove(ITag entity)
 {
     _innerRepository.Remove(entity);
 }
Ejemplo n.º 53
0
 private void RemoveTitleTag(ITag tag)
 {
     RemoveValue <ITag>(() => titleTags.Remove(tag), tag, x => x.TitleTags);
 }
Ejemplo n.º 54
0
 public HashtagController(ITag hashtag)
 {
     _hashtag = hashtag;
 }
Ejemplo n.º 55
0
        /// <summary> Scan the tag.
        /// For this implementation, the only operation is to perform the tag's
        /// semantic action.
        /// </summary>
        /// <param name="tag">The tag to scan.
        /// </param>
        /// <param name="lexer">Provides html page access.
        /// </param>
        /// <param name="stack">The parse stack. May contain pending tags that enclose
        /// this tag.
        /// </param>
        /// <returns> The resultant tag (may be unchanged).
        /// </returns>
        public virtual ITag Scan(ITag tag, Winista.Text.HtmlParser.Lex.Lexer lexer, NodeList stack)
        {
            tag.DoSemanticAction();

            return(tag);
        }
Ejemplo n.º 56
0
 internal virtual void ConvertFromTag(ITag obTag)
 {
     this.m_strId   = obTag.GetAttribute("ID");
     this.m_strName = obTag.GetAttribute("NAME");
 }
Ejemplo n.º 57
0
        public static void SetSourceMapping(this ObservableDataSource <HistoryData> source, ITag currentTag)
        {
            if (currentTag != null)
            {
                switch (currentTag.Address.VarType)
                {
                case DataType.BOOL:
                    source.SetYMapping(Y => Y.Value.Boolean ? 1 : 0);
                    break;

                case DataType.BYTE:
                    source.SetYMapping(Y => Y.Value.Byte);
                    break;

                case DataType.WORD:
                    source.SetYMapping(Y => Y.Value.Word);
                    break;

                case DataType.SHORT:
                    source.SetYMapping(Y => Y.Value.Int16);
                    break;

                case DataType.DWORD:
                    source.SetYMapping(Y => Y.Value.DWord);
                    break;

                case DataType.INT:
                    source.SetYMapping(Y => Y.Value.Int32);
                    break;

                case DataType.FLOAT:
                    source.SetYMapping(Y => Y.Value.Single);
                    break;
                }
            }
        }
Ejemplo n.º 58
0
Archivo: Form1.cs Proyecto: mtyh/Analog
        private void RecursionHtmlNode(IList list, TreeNode treeNode, INode htmlNode, bool siblingRequired)
        {
            if (htmlNode == null || treeNode == null)
            {
                return;
            }

            TreeNode current = treeNode;
            TreeNode content;

            //current node
            if (htmlNode is ITag)
            {
                ITag tag = (htmlNode as ITag);
                if (!tag.IsEndTag())
                {
                    string    nodeString = tag.TagName;
                    Hashtable hash       = new Hashtable();
                    if (tag.Attributes != null && tag.Attributes.Count > 0)
                    {
                        hash.Add(tag.TagName, tag.Attributes);
                        if (tag.Attributes["ID"] != null)
                        {
                            nodeString = nodeString + " { id=\"" + tag.Attributes["ID"].ToString() + "\" }";

                            if (tag.Attributes["ID"].ToString() == "Label1")
                            {
                                string s = "";
                            }
                        }
                        if (tag.Attributes["HREF"] != null)
                        {
                            nodeString = nodeString + " { href=\"" + tag.Attributes["HREF"].ToString() + "\" }";
                        }
                        if (tag.Attributes["NAME"] != null)
                        {
                            nodeString = nodeString + " { NAME=\"" + tag.Attributes["NAME"].ToString() + "\" }";
                        }
                        if (tag.Attributes["VALUE"] != null)
                        {
                            nodeString = nodeString + " { VALUE=\"" + tag.Attributes["VALUE"].ToString() + "\" }";
                        }
                    }

                    current = new TreeNode(nodeString);
                    treeNode.Nodes.Add(current);
                }
            }

            //获取节点间的内容
            if (htmlNode.Children != null && htmlNode.Children.Count > 0)
            {
                this.RecursionHtmlNode(list, current, htmlNode.FirstChild, true);
                content = new TreeNode(htmlNode.FirstChild.GetText());
                treeNode.Nodes.Add(content);
            }

            //the sibling nodes
            if (siblingRequired)
            {
                INode sibling = htmlNode.NextSibling;
                while (sibling != null)
                {
                    this.RecursionHtmlNode(list, treeNode, sibling, false);
                    sibling = sibling.NextSibling;
                }
            }
        }
Ejemplo n.º 59
0
 bool IExternalEditAdapter.IsExternalEditTag(ITag tag)
 {
     return(IsExternalEditTag(tag));
 }
Ejemplo n.º 60
-1
        protected override void ValidateProperty(ITag tag, PropertyInfo propertyInfo)
        {
            if (tag == null || propertyInfo == null)
                return;

            var enumType = propertyInfo.GetCustomAttribute<EnumProperyTypeAttribute>();
            if (enumType == null)
                return;

            var value = propertyInfo.GetValue(tag) as ITagAttribute;
            if (!(value?.IsConstant ?? false))
                return;

            var enumValues = enumType.EnumValues.Cast<object>().Select(v => v.ToString().ToLowerInvariant()).ToList();

            var text = value.ConstantValue.ToString();
            var names = enumType.Multiple ? text.Split(enumType.Separator) : new[] { text };
            foreach (var name in names.Select(n => n?.Trim()))
            {
                if (name == enumType.Wildcard)
                    continue;

                if (!enumValues.Contains(name.ToLowerInvariant()))
                    throw InvalidValueException(name, enumType.EnumValues);
            }
        }