Exemple #1
0
        protected virtual void Commit(int id,
                                      RegMemElem mem,
                                      RegRtElem rtxOrRtf)
        {
            // TODO: Rtf
            var member = Members.SafeGet(id);

            try
            {
                if (member == null)
                {
                    Members[id] = member = Create(id,
                                                  mem,
                                                  rtxOrRtf);
                    return;
                }

                member.Update(mem,
                              rtxOrRtf);
            }
            finally
            {
                OnMemberAddedOrUpdated(member);
            }
        }
Exemple #2
0
        //
        // Native format parsing

        protected static RegRtElem ParseRtStream(Stream rtxStream,
                                                 RegMemElem mem)
        {
            if (mem.rtxOffset == 0)
            {
                return new RegRtElem()
                       {
                           value   = null,
                           no      = 0,
                           unknown = 2,
                       }
            }
            ;

            using (BinaryReader binStream = new BinaryReader(rtxStream,
                                                             Encoding.Default,
                                                             true))
            {
                rtxStream.Seek(mem.rtxOffset - 1,
                               SeekOrigin.Begin);

                RegRtElem rtx = new RegRtElem
                {
                    value   = binStream.ReadBytes(mem.rtxLength - sizeof(int) - sizeof(byte)),
                    no      = binStream.ReadInt32(),
                    unknown = binStream.ReadByte()
                };

                return(rtx);
            }
        }
Exemple #3
0
 protected override Image Create(int id,
                                 RegMemElem mem,
                                 RegRtElem rtxOrRtf)
 {
     return(new Image(id,
                      mem,
                      rtxOrRtf));
 }
Exemple #4
0
 public Template(int id,
                 RegMemElem mem,
                 RegRtElem rt)
     : base(id,
            mem,
            rt)
 {
 }
Exemple #5
0
 public Video(int id,
              RegMemElem mem,
              RegRtElem rt)
     : base(id,
            mem,
            rt)
 {
 }
Exemple #6
0
 public Binary(int id,
               RegMemElem mem,
               RegRtElem rt)
     : base(id,
            mem,
            rt)
 {
 }
 public Sound(int id,
              RegMemElem mem,
              RegRtElem rt)
     : base(id,
            mem,
            rt)
 {
 }
Exemple #8
0
 public Concept(int id,
                RegMemElem mem,
                RegRtElem rt)
     : base(id,
            mem,
            rt)
 {
 }
Exemple #9
0
 public Image(int id,
              RegMemElem mem,
              RegRtElem rt)
     : base(id,
            mem,
            rt)
 {
 }
Exemple #10
0
 protected override Binary Create(int id,
                                  RegMemElem mem,
                                  RegRtElem rtxOrRtf)
 {
     return(new Binary(id,
                       mem,
                       rtxOrRtf));
 }
        public void Update(RegMemElem mem,
                           RegRtElem rt)
        {
#if DEBUG && !DEBUG_IN_PROD
            LogTo.Debug("[{0} {1}] Updating",
                        GetType().Name,
                        Id);
#endif

            if (mem.rtxOffset == 0)
            {
                Empty = SetDbg(Empty,
                               true,
                               nameof(Empty));

                return;
            }

            UseCount = SetDbg(UseCount,
                              mem.useCount,
                              nameof(UseCount));

            LinkType = SetDbg(LinkType,
                              (RegistryLinkType)mem.linkType,
                              nameof(LinkType));

            RtxOffset = SetDbg(RtxOffset,
                               mem.rtxOffset,
                               nameof(RtxOffset));
            RtxLength = SetDbg(RtxLength,
                               mem.rtxLength,
                               nameof(RtxLength));

            if (rt != null)
            {
                RtxId = SetDbg(RtxId,
                               rt.no,
                               nameof(RtxId));
                RtxValue = SetDbg(RtxValue,
                                  Encoding.UTF8.GetString(rt.value),
                                  nameof(RtxValue));
            }

            SlotIdOrOffset = SetDbg(SlotIdOrOffset,
                                    mem.slotIdOrOffset,
                                    nameof(SlotIdOrOffset));
            SlotLengthOrConceptGroupId = SetDbg(SlotLengthOrConceptGroupId,
                                                mem.slotLengthOrConceptGroup,
                                                nameof(SlotLengthOrConceptGroupId));
        }
        protected RegistryMemberBase(int id,
                                     RegMemElem mem,
                                     RegRtElem rt)
        {
            Id = id;

#if DEBUG && !DEBUG_IN_PROD
            LogTo.Debug("[{0} {1}] Creating",
                        GetType().Name,
                        Id);
#endif

            UseCount = SetDbg(mem.useCount,
                              nameof(UseCount));

            LinkType = SetDbg((RegistryLinkType)mem.linkType,
                              nameof(LinkType));

            RtxId = SetDbg(rt.no,
                           nameof(RtxId));
            RtxOffset = SetDbg(mem.rtxOffset,
                               nameof(RtxOffset));
            RtxLength = SetDbg(mem.rtxLength,
                               nameof(RtxLength));

            if (rt.value != null)
            {
                RtxValue = SetDbg(Encoding.UTF8.GetString(rt.value),
                                  nameof(RtxValue));
            }

            SlotIdOrOffset = SetDbg(mem.slotIdOrOffset,
                                    nameof(SlotIdOrOffset));
            SlotLengthOrConceptGroupId = SetDbg(mem.slotLengthOrConceptGroup,
                                                nameof(SlotLengthOrConceptGroupId));

            Empty = SetDbg(RtxValue == null,
                           nameof(Empty));
        }
 protected override Template Create(int id,
                                    RegMemElem mem,
                                    RegRtElem rtxOrRtf)
 {
     return(new Template(id, mem, rtxOrRtf));
 }
 protected override Video Create(int id, RegMemElem mem, RegRtElem rtxOrRtf)
 {
     return(new Video(id, mem, rtxOrRtf));
 }
Exemple #15
0
 protected abstract TMember Create(int id,
                                   RegMemElem mem,
                                   RegRtElem rtxOrRtf);
 protected override Sound Create(int id, RegMemElem mem, RegRtElem rtxOrRtf)
 {
     return(new Sound(id, mem, rtxOrRtf));
 }
Exemple #17
0
 protected override Concept Create(int id,
                                   RegMemElem mem,
                                   RegRtElem rtxOrRtf)
 {
     return(new Concept(id, mem, rtxOrRtf));
 }