Beispiel #1
0
        /// <summary>
        /// New SynchronisedText
        /// </summary>
        /// <param name="FrameID">FrameID</param>
        /// <param name="Flags">Frame Flag</param>
        /// <param name="Data">FileStream contain current frame data</param>
        internal SynchronisedText(string FrameID, FrameFlags Flags, FileStreamEx Data, int Length)
            : base(FrameID, Flags)
        {
            _Syllables = new FramesCollection<Syllable>();

            TextEncoding = (TextEncodings)Data.ReadByte();
            if (!IsValidEnumValue(TextEncoding, ValidatingErrorTypes.ID3Error))
                return;

            Length--;

            _Language = new Language(Data);
            Length -= 3;

            _TimeStamp = (TimeStamps)Data.ReadByte();
            if (!IsValidEnumValue(_TimeStamp, ValidatingErrorTypes.ID3Error))
                return;

            Length--;

            _ContentType = (ContentTypes)Data.ReadByte();
            if (!IsValidEnumValue(_ContentType, ValidatingErrorTypes.Nothing))
                _ContentType = ContentTypes.Other;
            Length--;

            // use Text variable for descriptor property
            ContentDescriptor = Data.ReadText(Length, TextEncoding, ref Length, true);

            string tempText;
            uint tempTime;
            while (Length > 5)
            {
                tempText = Data.ReadText(Length, TextEncoding, ref Length, true);
                tempTime = Data.ReadUInt(4);

                _Syllables.Add(new Syllable(tempTime, tempText));

                Length -= 4;
            }
        }
        /// <summary>
        /// Generates the necessary setter code to set a value of a document.
        /// Handles internal/private setters
        /// </summary>
        /// <param name="frames"></param>
        /// <param name="member"></param>
        /// <param name="variableName"></param>
        /// <param name="documentType"></param>
        /// <param name="generatedType"></param>
        public static void SetMemberValue(this FramesCollection frames, MemberInfo member, string variableName, Type documentType, GeneratedType generatedType)
        {
            if (member is PropertyInfo property)
            {
                if (property.CanWrite)
                {
                    if (property.SetMethod.IsPublic)
                    {
                        frames.SetPublicMemberValue(member, variableName, documentType);
                    }
                    else
                    {
                        var setterFieldName = generatedType.InitializeLambdaSetterProperty(member, documentType);
                        frames.Code($"{setterFieldName}({{0}}, {variableName});", new Use(documentType));
                    }

                    return;
                }
            }
            else if (member is FieldInfo field)
            {
                if (field.IsPublic)
                {
                    frames.SetPublicMemberValue(member, variableName, documentType);
                }
                else
                {
                    var setterFieldName = generatedType.InitializeLambdaSetterProperty(member, documentType);
                    frames.Code($"{setterFieldName}({{0}}, {variableName});", new Use(documentType));
                }

                return;
            }

            throw new ArgumentOutOfRangeException(nameof(member), $"MemberInfo {member} is not valid in this usage. ");
        }
Beispiel #3
0
 public static void StoreTracker(this FramesCollection frames)
 {
     frames.Code("StoreTracker({0}, document);", Use.Type <IMartenSession>());
 }
Beispiel #4
0
 public static void StoreInIdentityMap(this FramesCollection frames, DocumentMapping mapping)
 {
     frames.Code("_identityMap[id] = document;");
 }
Beispiel #5
0
 public static void GetIdAsync(this FramesCollection frames, DocumentMapping mapping)
 {
     frames.CodeAsync($"var id = await reader.GetFieldValueAsync<{mapping.IdType.FullNameInCode()}>(1, token);");
 }
Beispiel #6
0
 public static void GetId(this FramesCollection frames, DocumentMapping mapping)
 {
     frames.Code($"var id = reader.GetFieldValue<{mapping.IdType.FullNameInCode()}>(1);");
 }
Beispiel #7
0
        private void Initializer()
        {
            _Filter = new FilterCollection();

            _FilterType = FilterTypes.NoFilter;
            _Errors = new ErrorCollection();

            _TextFrames = new FramesCollection<TextFrame>();
            _UserTextFrames = new FramesCollection<UserTextFrame>();
            _PrivateFrames = new FramesCollection<PrivateFrame>();
            _TermOfUseFrames = new FramesCollection<TermOfUseFrame>();
            _TextWithLangFrames = new FramesCollection<TextWithLanguageFrame>();
            _SynchronisedTextFrames = new FramesCollection<SynchronisedText>();
            _AttachedPictureFrames = new FramesCollection<AttachedPictureFrame>();
            _EncapsulatedObjectFrames = new FramesCollection<GeneralFileFrame>();
            _PopularimeterFrames = new FramesCollection<PopularimeterFrame>();
            _AudioEncryptionFrames = new FramesCollection<AudioEncryptionFrame>();
            _LinkFrames = new FramesCollection<LinkFrame>();
            _DataWithSymbolFrames = new FramesCollection<DataWithSymbolFrame>();
            _UnknownFrames = new FramesCollection<BinaryFrame>();
        }
 private static void SetPublicMemberValue(this FramesCollection frames, MemberInfo member, string variableName,
                                          Type documentType)
 {
     frames.Code($"{{0}}.{member.Name} = {variableName};", new Use(documentType));
 }
Beispiel #9
0
        public SynchronisedTempoFrame(FrameFlags Flags, TimeStamps TimeStamp)
            : base("SYTC", Flags)
        {
            _TempoCodes = new FramesCollection<TempoCode>();

            this.TimeStampFormat = TimeStamp;
        }
Beispiel #10
0
        /// <summary>
        /// New Synchronised Text
        /// </summary>
        /// <param name="Flags">Frame Flags</param>
        /// <param name="TextEncoding">TextEncoding use for texts</param>
        /// <param name="Lang">Language of texts</param>
        /// <param name="TimeStamp">TimeStamps that use for times</param>
        /// <param name="ContentType">ContentType</param>
        /// <param name="ContentDescriptor">Descriptor of Contents</param>
        public SynchronisedText(FrameFlags Flags,
            TextEncodings TextEncoding, string Lang, TimeStamps TimeStamp,
            ContentTypes ContentType, string ContentDescriptor)
            : base("SYLT", Flags)
        {
            _Syllables = new FramesCollection<Syllable>();

            this.ContentType = ContentType;
            this.TimeStamp = TimeStamp;
            this.TextEncoding = TextEncoding;
            Language = new Language(Lang);
            this.ContentDescriptor = ContentDescriptor;
        }
Beispiel #11
0
        internal EventTimingCodeFrame(string FrameID, FrameFlags Flags, FileStreamEx Data, int Length)
            : base(FrameID, Flags)
        {
            _Events = new FramesCollection<EventCode>();

            _TimeStamp = (TimeStamps)Data.ReadByte();
            if (!IsValidEnumValue(_TimeStamp, ValidatingErrorTypes.ID3Error))
            {
                _MustDrop = true;
                return;
            }
            Length--;

            while (Length >= 5)
            {
                _Events.Add(new EventCode(Data.ReadByte(), Data.ReadUInt(4)));

                Length -= 5;
            }
        }
Beispiel #12
0
        public Equalisation(FrameFlags Flags, byte AdjustmentBits)
            : base("EQUA", Flags)
        {
            this.AdjustmentLength = AdjustmentBits;

            _Frequensies = new FramesCollection<FrequencyAdjustmentFrame>();
        }
Beispiel #13
0
        /// <summary>
        /// Create new Equalisation frame
        /// </summary>
        /// <param name="FrameID"></param>
        /// <param name="Flags"></param>
        /// <param name="Data"></param>
        /// <param name="Length"></param>
        internal Equalisation(string FrameID, FrameFlags Flags, FileStreamEx Data, int Length)
            : base(FrameID, Flags)
        {
            _Frequensies = new FramesCollection<FrequencyAdjustmentFrame>();

            _AdjustmentBits = Data.ReadByte();
            Length--;

            if (_AdjustmentBits == 0)
            {
                ErrorOccur("Adjustment bit of Equalisation is zero. this frame is invalid", true);
                return;
            }

            if (_AdjustmentBits % 8 != 0 || _AdjustmentBits > 32)
            {
                ErrorOccur("AdjustmentBit of Equalisation Frame is out of supported range of this program", true);
                return;
            }

            int AdLen = _AdjustmentBits / 8;

            int FreqBuf;
            uint AdjBuf;
            while (Length > 3)
            {
                FreqBuf = Convert.ToInt32(Data.ReadUInt(2));

                AdjBuf = Data.ReadUInt(AdLen);
                _Frequensies.Add(new FrequencyAdjustmentFrame(FreqBuf, AdjBuf));

                Length -= 2 + AdLen;
            }
        }
Beispiel #14
0
 public static void CheckExistingFirst(this FramesCollection frames)
 {
     frames.Code("if (_identityMap.TryGetValue(id, out var existing)) return existing;");
 }
Beispiel #15
0
 private string[] GetRFFYDInfo()
 {
     string[] strArray = new string[3];
     try
     {
         HTMLDocument document = (HTMLDocument)this.axWebBrowser1.Document;
         if (!document.url.ToLower().Contains("default.aspx"))
         {
             return(null);
         }
         FramesCollection frames = document.parentWindow.frames;
         for (int i = 0; i < frames.length; i++)
         {
             object pvarIndex             = i;
             mshtml.IHTMLWindow2 window2  = (mshtml.IHTMLWindow2)frames.item(ref pvarIndex);
             FramesCollection    framess2 = window2.frames;
             string tagName = "";
             for (int j = 0; j < framess2.length; j++)
             {
                 object obj3 = j;
                 mshtml.IHTMLWindow2 window3   = (mshtml.IHTMLWindow2)framess2.item(ref obj3);
                 HTMLDocument        document2 = window3.document as HTMLDocument;
                 if (document2.url.Contains("InDoor.aspx"))
                 {
                     HTMLTextAreaElement element = document2.getElementById("txtCPH") as HTMLTextAreaElement;
                     HTMLTable           table   = document2.getElementById("GridView1") as HTMLTable;
                     bool flag = false;
                     foreach (HTMLTableRow row in table.rows)
                     {
                         foreach (HTMLTableCell cell in row.cells)
                         {
                             foreach (mshtml.IHTMLElement element2 in cell.getElementsByTagName("INPUT"))
                             {
                                 if ((element2.getAttribute("type", 0).ToString() == "checkbox") && (element2.getAttribute("checked", 0).ToString().ToUpper() == "TRUE"))
                                 {
                                     tagName = cell.tagName;
                                     flag    = true;
                                 }
                             }
                             if (flag)
                             {
                                 if (cell.cellIndex == 3)
                                 {
                                     strArray[0] = cell.innerText;
                                 }
                                 if (cell.cellIndex == 1)
                                 {
                                     strArray[1] = cell.innerText;
                                 }
                                 if (cell.cellIndex == 4)
                                 {
                                     strArray[2] = cell.innerText;
                                 }
                             }
                         }
                         if (flag)
                         {
                             break;
                         }
                     }
                 }
             }
         }
         return(strArray);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Beispiel #16
0
 public static void MarkAsLoaded(this FramesCollection frames)
 {
     frames.Code($"{{0}}.{nameof(IMartenSession.MarkAsDocumentLoaded)}(id, document);", Use.Type <IMartenSession>());
 }
Beispiel #17
0
        /// <summary>
        /// Create new STempoCodes
        /// </summary>
        /// <param name="FrameID">4 Characters tag identifier</param>
        /// <param name="Flags">2 Bytes flags identifier</param>
        /// <param name="Data">Contain Data for this frame</param>
        /// <param name="Length"></param>
        internal SynchronisedTempoFrame(string FrameID, FrameFlags Flags, FileStreamEx Data, int Length)
            : base(FrameID, Flags)
        {
            _TempoCodes = new FramesCollection<TempoCode>();

            _TimeStamp = (TimeStamps)Data.ReadByte();
            if (IsValidEnumValue(_TimeStamp, ValidatingErrorTypes.ID3Error))
            {
                _MustDrop = true;
                return;
            }
            int Tempo;
            uint Time;

            while (Length > 4)
            {
                Tempo = Data.ReadByte();
                Length--;

                if (Tempo == 0xFF)
                {
                    Tempo += Data.ReadByte();
                    Length--;
                }

                Time = Data.ReadUInt(4);
                Length -= 4;

                _TempoCodes.Add(new TempoCode(Tempo, Time));
            }
        }