示例#1
0
        /// <summary>
        /// Read a group of stream tags (which all come in order) from the BBeB reader.
        /// </summary>
        /// <param name="tagReader">The reader to do the reading with</param>
        /// <returns>A new tag representing the uncompressed data in the stream.</returns>
        public static StreamTagGroup Deserialize(BBeBinaryReader tagReader, ObjectType eObjectType)
        {
            ushort wFlags = tagReader.ReadUInt16();

            StreamFormatFlags eStreamFlags = (StreamFormatFlags)(wFlags & 0xff00);
            StreamContents    eContents    = (StreamContents)(wFlags & 0x00ff);

            TagId eTagId = tagReader.ReadTag();

            if (eTagId != TagId.StreamSize)
            {
                throw new UnexpectedTagException("Expected a StreamSize tag: " + eTagId.ToString());
            }

            uint dwStreamSize = tagReader.ReadUInt32();

            eTagId = tagReader.ReadTag();
            if (eTagId != TagId.StreamStart)
            {
                throw new UnexpectedTagException("Expected a StreamStart tag: " + eTagId.ToString());
            }

            byte[] streamData = tagReader.ReadBytes((int)dwStreamSize);

            try
            {
                eTagId = tagReader.ReadTag();
            }
            catch (InvalidTagException ex)
            {
                Debug.WriteLineIf(s_bDebugMode, "Not a tag at end of stream: 0x" + ex.Value.ToString("x"));
                // dataTag.AppendShort(ex.Value);

                // Temporarily
                eTagId = TagId.StreamEnd;
            }
            if (eTagId != TagId.StreamEnd)
            {
                throw new UnexpectedTagException("Expected a StreamEnd tag: " + eTagId.ToString());
            }

            StreamTagGroup tag = new StreamTagGroup();

            tag.Contents = eContents;

            StreamTagSerializer streamTagSerializer = new StreamTagSerializer();

            tag.Data = streamTagSerializer.Convert(streamData, eStreamFlags,
                                                   StreamFormatFlags.None, eObjectType);

            return(tag);
        }
示例#2
0
        private void CreateMappedFile()
        {
            if (!File.Exists(FileName))
            {
                throw new InvalidOperationException("Invalid file name.",
                                                    new FileNotFoundException("System cannot find the file specified.", FileName));
            }

            _mapped = MemoryMappedFile.CreateFromFile(FileName, FileMode.Open, TagId.ToString());
        }
示例#3
0
        private void NewTagButton_Click(object sender, EventArgs e)
        {
            TagId id = TagId.Null;

            if (Map.CreateTag("bitm", @"dev\test_bitmap\test", 4, 108, out id))
            {
                System.Windows.Forms.MessageBox.Show(id.ToString());
                Host.Request(this, "ReloadMap");
            }
        }
示例#4
0
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
    case "sessionid": // Int
     return SessionId.ToString(strFormat, formatProvider);
    case "tagid": // Int
     return TagId.ToString(strFormat, formatProvider);
                default:
                    propertyNotFound = true;
                    break;
            }

            return Null.NullString;
        }
示例#5
0
        public void VisitLockedContent(ILockedContent lockedContent)
        {
            if (IgnoreTags)
            {
                return;
            }

            TagId++;
            var tag = new Tag(
                TagType.LockedContent, TagId.ToString(), TagId)
            {
                TextEquivalent = lockedContent.Content.ToString()
            };

            Segment?.Add(tag);
        }
        public string Format(byte[] rawdata)
        {
            switch (TagId)
            {
            case TagId.ObjectIdentifier:
                return(CalculaOid(rawdata, StartContents, LengthOctets));

            case TagId.Ia5String:
            case TagId.T61String:
            case TagId.PrintableString:
            case TagId.UtcTime:
            case TagId.OctetString:
            case TagId.Utf8String:
            case TagId.Rfc822Name:
                return((new ASCIIEncoding()).GetString(rawdata, StartContents, LengthOctets));

            default:
                return(TagId.ToString());
            }
        }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "tagid": // Int
                return(TagId.ToString(strFormat, formatProvider));

            case "conferenceid": // Int
                return(ConferenceId.ToString(strFormat, formatProvider));

            case "tagname": // NVarChar
                return(PropertyAccess.FormatString(TagName, strFormat));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
示例#8
0
        /// <summary>
        /// 重写ToString以输出Json
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string language = string.Empty;

            switch (Language)
            {
            case MenuMatchLanguage.简体中文:
                language = "zh_CN";
                break;

            case MenuMatchLanguage.繁体中文TW:
                language = "zh_TW";
                break;

            case MenuMatchLanguage.繁体中文HK:
                language = "zh_HK";
                break;

            case MenuMatchLanguage.英文:
                language = "en";
                break;

            case MenuMatchLanguage.印尼:
                language = "id";
                break;

            case MenuMatchLanguage.马来:
                language = "ms";
                break;

            case MenuMatchLanguage.西班牙:
                language = "es";
                break;

            case MenuMatchLanguage.韩国:
                language = "ko";
                break;

            case MenuMatchLanguage.意大利:
                language = "it";
                break;

            case MenuMatchLanguage.日本:
                language = "ja";
                break;

            case MenuMatchLanguage.波兰:
                language = "pl";
                break;

            case MenuMatchLanguage.葡萄牙:
                language = "pt";
                break;

            case MenuMatchLanguage.俄国:
                language = "ru";
                break;

            case MenuMatchLanguage.泰文:
                language = "th";
                break;

            case MenuMatchLanguage.越南:
                language = "vi";
                break;

            case MenuMatchLanguage.阿拉伯语:
                language = "ar";
                break;

            case MenuMatchLanguage.北印度:
                language = "hi";
                break;

            case MenuMatchLanguage.伯来:
                language = "he";
                break;

            case MenuMatchLanguage.土耳其:
                language = "tr";
                break;

            case MenuMatchLanguage.德语:
                language = "de";
                break;

            case MenuMatchLanguage.法语:
                language = "fr";
                break;

            case MenuMatchLanguage.匹配:
            default:
                language = "";
                break;
            }
            return("\"matchrule\":{\"tag_id\":\"" + (TagId == 0 ? "" : TagId.ToString()) + "\",\"sex\":\"" +
                   (Sex == MenuMatchSex.匹配 ? "" : ((int)Sex).ToString()) +
                   "\",\"country\":\"" + Country + "\",\"province\":\"" + Province +
                   "\",\"city\":\"" + City + "\",\"client_platform_type\":\"" +
                   (ClientPlatformType == MenuMatchPlatform.匹配 ? "" : ((int)ClientPlatformType).ToString()) +
                   "\",\"language\":\"" + language + "\"}");
        }
 public override string ToString()
 {
     return(TagId.ToString());
 }
示例#10
0
 public override string ToString()
 {
     return(TagId.ToString() + (!string.IsNullOrEmpty(Color) ? Color.ToString() : string.Empty) + (!string.IsNullOrEmpty(Title) ? Title.ToString() : string.Empty));
 }
示例#11
0
        public static BBeBTag ReadTag(TagId eTagId, BBeBinaryReader tagReader,
                                      ref List <BBeBTag> parsedTags, ObjectType eObjectType)
        {
            Debug.WriteLineIf(s_bDebugMode, " Tag: " + eTagId.ToString());

            BBeBTag tag = null;

            switch (eTagId)
            {
            case TagId.BeginPage:
                ushort[] sdata = new ushort[2];
                sdata[0] = tagReader.ReadUInt16();
                sdata[1] = tagReader.ReadUInt16();
                tag      = new UInt16ArrayTag(eTagId, sdata);
                break;


            // Tags with no data
            case TagId.EndPage:
            case TagId.EOL:
            case TagId.EndButton:
            case TagId.BeginSup:
            case TagId.EndSup:
            case TagId.BeginSub:
            case TagId.EndSub:
            case TagId.ItalicBegin:
            case TagId.ItalicEnd:
            case TagId.BeginEmpLine:
            case TagId.EndEmpLine:
                tag = new BBeBTag(eTagId);
                break;

            case TagId.PageObjectIds:
                uint[] objIds = new uint[tagReader.ReadUInt16()];
                for (ushort i = 0; i < objIds.Length; i++)
                {
                    objIds[i] = tagReader.ReadUInt32();
                }
                tag = new UInt32ArrayTag(eTagId, objIds);
                break;

            case TagId.StreamFlags:

                tag = StreamTagSerializer.Deserialize(tagReader, eObjectType);
                break;

            case TagId.PageList:
                uint[] pages = new uint[tagReader.ReadUInt16()];
                for (ushort i = 0; i < pages.Length; i++)
                {
                    pages[i] = tagReader.ReadUInt32();
                }
                tag = new UInt32ArrayTag(eTagId, pages);
                // TODO - Add a description to the Wiki
                break;

            case TagId.EmpDotsPosition:
            case TagId.EmpLinePosition:
            case TagId.EmpLineMode:
            case TagId.RubyOverhang:
            case TagId.RubyAlign:
            case TagId.SetWaitProp:
            case TagId.BlockRule:
            case TagId.BlockWidth:
            case TagId.BlockHeight:
            case TagId.FontUnknownZero:
            case TagId.BlockAlignment:
            case TagId.FontUnknownTwo:
            case TagId.FontUnknownThree:
            case TagId.FontSize:
            case TagId.FontWidth:
            case TagId.FontWeight:
            case TagId.TextHeight:
            case TagId.FontEscapement:
            case TagId.FontOrientation:
            case TagId.TextWidth:
            case TagId.TopMargin:
            case TagId.HeadHeight:
            case TagId.HeadSep:
            case TagId.OddSideMargin:
            case TagId.EvenSideMargin:
            case TagId.FootSpace:
            case TagId.FootHeight:
            case TagId.SetEmptyView:
            case TagId.PagePosition:
            case TagId.BlockAttrUnknown0:
            case TagId.Layout:
            case TagId.BlockAttrUnknown3:
            case TagId.BlockAttrUnknown5:
            case TagId.BlockAttrUnknown6:
            case TagId.WordSpace:
            case TagId.LetterSpace:
            case TagId.CharSpace:
            case TagId.BaseLineSkip:
            case TagId.LineSpace:
            case TagId.LineWidth:
            case TagId.ParIndent:
            case TagId.ParSkip:
            case TagId.ButtonFlags:
            case TagId.LocationX:
            case TagId.LocationY:
            case TagId.Space:
                tag = new UInt16Tag(eTagId, tagReader.ReadUInt16());
                break;

            case TagId.RuledLine:
                tag = new ByteArrayTag(eTagId, tagReader.ReadBytes(10));
                break;

            case TagId.BGImageName:
                tag = new ByteArrayTag(eTagId, tagReader.ReadBytes(6));
                break;

            case TagId.EmpDotsCode:
            {
                EmpDotsCodeTag emDotsTag = new EmpDotsCodeTag(eTagId);
                tag = emDotsTag;

                emDotsTag.Value = tagReader.ReadUInt32();
                if (emDotsTag.Value != 0x0)
                {
                    Debug.WriteLineIf(s_bDebugMode, "Got EmpDotsCode val = 0x" + emDotsTag.Value.ToString("x"));
                }

                // The font name tag always follows
                eTagId = tagReader.ReadTag();
                if (TagId.FontFacename != eTagId)
                {
                    throw new InvalidTagException("Expected font: " + eTagId.ToString(), 0x0);
                }
                emDotsTag.FontFace = new StringTag(eTagId, tagReader.ReadString());

                // And the EmpDotsCode value
                emDotsTag.DotsCode = tagReader.ReadUInt16();

                // TODO - Add a description to the Wiki
            }
            break;

            case TagId.ImageRect:
                ushort[] bounds = new ushort[4];
                bounds[0] = tagReader.ReadUInt16();
                bounds[1] = tagReader.ReadUInt16();
                bounds[2] = tagReader.ReadUInt16();
                bounds[3] = tagReader.ReadUInt16();

                tag = new UInt16ArrayTag(eTagId, bounds);
                break;

            case TagId.ImageSize:
            {
                ushort[] size = new ushort[2];
                size[0] = tagReader.ReadUInt16();
                size[1] = tagReader.ReadUInt16();

                tag = new UInt16ArrayTag(eTagId, size);
                break;
            }

            case TagId.ObjectInfoLink:
            case TagId.Link:
            case TagId.ParentPageTree:
            case TagId.ChildPageTree:
            case TagId.BlockAttrUnknown1:
            case TagId.BlockAttrUnknown4:
            case TagId.ImageStream:
            case TagId.TextColor:
            case TagId.TextBgColor:
            case TagId.LineColor:
            case TagId.FillColor:
            case TagId.BeginButton:
            case TagId.OddHeaderId:
            case TagId.EvenHeaderId:
            case TagId.OddFooterId:
            case TagId.EvenFooterId:
                tag = new UInt32Tag(eTagId, tagReader.ReadUInt32());
                break;

            case TagId.FontFacename:
            case TagId.UnknownStr1:
            case TagId.FontFileName:
            case TagId.UnknownStr3:
            case TagId.UnknownStr4:
                tag = new StringTag(eTagId, tagReader.ReadString());
                break;


            // Button Tags
            case TagId.BaseButtonStart:
                tag = new UInt32Tag(eTagId, 0);
                break;

            case TagId.FocusinButtonStart:
                tag = new UInt32Tag(eTagId, 1);
                break;

            case TagId.PushButtonStart:
                tag = new UInt32Tag(eTagId, 2);
                break;

            case TagId.UpButtonStart:
                tag = new UInt32Tag(eTagId, 0);
                break;

            case TagId.BaseButtonEnd:
            case TagId.FocusinButtonEnd:
            case TagId.PushButtonEnd:
            case TagId.UpButtonEnd:
                tag = new IDOnlyTag(eTagId);
                break;

            case TagId.StartActionsStart:
            case TagId.StartActionsEnd:
                tag = new IDOnlyTag(eTagId);
                break;

            case TagId.JumpTo:
            {
                uint[] size = new uint[2];
                size[0] = tagReader.ReadUInt32();
                size[1] = tagReader.ReadUInt32();

                tag = new UInt32ArrayTag(eTagId, size);
                break;
            }

            case TagId.KomaPlot:
                ushort width   = tagReader.ReadUInt16();
                ushort height  = tagReader.ReadUInt16();
                uint   refobj  = tagReader.ReadUInt32();
                uint   unknown = tagReader.ReadUInt32();
                tag = new KomaPlotTag(width, height, refobj, unknown);
                break;

            case TagId.SendMessage:
                ushort parms = tagReader.ReadUInt16();
                ushort ssize = tagReader.ReadUInt16();
                byte[] data  = tagReader.ReadBytes(ssize);
                string s1    = System.Text.Encoding.Unicode.GetString(data);
                ssize = tagReader.ReadUInt16();
                data  = tagReader.ReadBytes(ssize);
                string s2 = System.Text.Encoding.Unicode.GetString(data);

                tag = new MessageTag(eTagId, parms, s1, s2);

                break;

            case TagId.ObjectEnd:
//                    tag = new IDOnlyTag(eTagId);
                break;

            default:
                throw new InvalidTagException("Unsupported tag: " + eTagId.ToString(), (ushort)eTagId);
            }

            if (tag != null)
            {
                parsedTags.Add(tag);
            }
            return(tag);
        }
示例#12
0
 public override string ToString()
 {
     return(String.Format("{0} ({3}): count {1} with value {2}", TagId.ToString("X"), Count, ValuePointer, TagType));
 }