コード例 #1
0
        private SerializedList GetMainStream(MDReader Reader)
        {
            var Root       = new SerializedList(Reader.GetElement("root").ReadAll());
            var TOCElement = Reader.GetElement(Root.Items[1].ToString());

            return(new SerializedList(TOCElement.ReadAll()));
        }
コード例 #2
0
ファイル: MDBaseObject.cs プロジェクト: artamir/1SCodeAnalyze
 private void FillAttributeCollection(SerializedList AttrList)
 {
     for (int i = 2; i < AttrList.Items.Count(); ++i)
     {
         Attributes.Add(new MDAttribute((SerializedList)AttrList.Items[i]));
     }
 }
コード例 #3
0
        private static void Read(String Content, ref List <SerializedItem> Destination)
        {
            if (Content[0] != '{')
            {
                throw new ArgumentException("Wrong content. List must start with a brace '{'");
            }

            Char[] delimiters =
            {
                ',',
                '}'
            };

            for (int i = 0; i < Content.Length; ++i)
            {
                Char CurrentChar = Content[i];

                if (CurrentChar == '{')
                {
                    if (i > 0)
                    {
                        int ListEnd = RewindList(Content, i);

                        SerializedList lst = new SerializedList(Content.Substring(i, ListEnd - i));
                        Destination.Add(lst);
                        i = ListEnd;
                    }
                }
                else if (CurrentChar == '}')
                {
                }
                else if (CurrentChar != '\n' && CurrentChar != '\r')
                {
                    int delimPos = Content.IndexOfAny(delimiters, i);
                    if (delimPos < 0)
                    {
                        // элемент ничем не заканчивается.
                        throw new ArgumentException("Stream format error");
                    }
                    else if (delimPos != i)
                    {
                        if (CurrentChar == '"')
                        {
                            String initial = Content.Substring(i);
                            String Value   = ConvertQuotedString(initial, ref i);
                            Destination.Add(new SerializedItem(Value));
                        }
                        else
                        {
                            String ElementValue = Content.Substring(i, delimPos - i);
                            Destination.Add(new SerializedItem(ElementValue));
                            i = delimPos;
                        }
                    }
                }
            }
        }
コード例 #4
0
        protected MDForm(IV8MetadataContainer Container, string formID) : base()
        {
            var Header = Container.GetElement(formID);

            SerializedList StringsBlock = FindStringsBlock(Header.ReadAll(), formID);

            ReadStringsBlock(StringsBlock);
            _Container = Container;
        }
コード例 #5
0
        private static SerializedList CreateDialogDefList(SerializedList stream)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("{2,");
            sb.Append(((SerializedList)stream.Items[1]).ToString());
            sb.Append(',');
            sb.Append(((SerializedList)stream.Items[3]).ToString());
            sb.Append('}');

            return(new SerializedList(sb.ToString()));
        }
コード例 #6
0
 public HTMLTemplate(MDTemplate OwnerTemplate) : base(OwnerTemplate)
 {
     try
     {
         var            fileElem = Reader.GetElement(GetFileName());
         SerializedList content  = new SerializedList(fileElem.ReadAll());
         m_HTMLDoc = new HTMLDocument(content);
     }
     catch (System.IO.FileNotFoundException exc)
     {
         throw new MDObjectIsEmpty(OwnerTemplate.Name, exc);
     }
 }
コード例 #7
0
        public static ManagedFormAttribute CreateFromList(SerializedList attrLst)
        {
            String Name = attrLst.Items[3].ToString();
            String Syn  = null;

            if (attrLst.Items[4].Items[1].ToString() == "0")
            {
                Syn = Name;
            }
            else
            {
                Syn = attrLst.Items[4].Items[2].Items[1].ToString();
            }

            bool isBasic = attrLst.Items[10].ToString() == "1";

            var pattern = (SerializedList)attrLst.Items[5];

            ManagedFormAttributeType type = new ManagedFormAttributeType();

            type.TypeDescription = V8TypeDescription.ReadFromList(pattern);

            ManagedFormAttribute attr;

            int childCount = Int32.Parse(attrLst.Items[13].ToString());

            if (childCount > 0)
            {
                int baseIndex = 14;

                ManagedFormAttribute[] children = new ManagedFormAttribute[childCount];

                for (int i = 0; i < childCount; i++)
                {
                    SerializedList innerAttr = (SerializedList)attrLst.Items[baseIndex + i];

                    children[i] = CreateChildFromList(innerAttr);
                }

                attr = new ManagedFormAttribute(Name, Syn, type, children);
            }
            else
            {
                attr = new ManagedFormAttribute(Name, Syn, type);
            }

            attr.IsBasic = isBasic;

            return(attr);
        }
コード例 #8
0
        private void LoadFormContent()
        {
            var FileElem = Container.GetElement(ID + ".0");

            var stream = new SerializedList(FileElem.ReadAll());

            m_Elements = new ManagedFormElements();
            m_Elements.ReadFromList((SerializedList)stream.Items[1]);
            m_ModuleText = stream.Items[2].ToString();
            LoadAttributes((SerializedList)stream.Items[3]);

            m_DialogDef = new SimpleDialogStub(CreateDialogDefList(stream));

            m_Loaded = true;
        }
コード例 #9
0
        public System.IO.Stream GetStream()
        {
            MDFileItem     Container = Reader.GetElement(GetFileName());
            SerializedList lst       = new SerializedList(Container.ReadAll());

            var Base64 = lst.Items[1].Items[0].ToString();

            StringBuilder reader = new StringBuilder(Base64);

            reader.Remove(0, 8);
            Byte[] byteArr = System.Convert.FromBase64String(reader.ToString());

            MemoryStream MemStream = new MemoryStream(byteArr);

            return(MemStream);
        }
コード例 #10
0
ファイル: MDBaseObject.cs プロジェクト: artamir/1SCodeAnalyze
        protected void ReadStringsBlock(SerializedList StringBlock)
        {
            ID   = StringBlock.Items[1].Items[2].ToString();
            Name = StringBlock.Items[2].ToString();

            if (StringBlock.Items[3].Items.Count > 1)
            {
                Synonym = StringBlock.Items[3].Items[2].ToString();
            }
            else
            {
                Synonym = "";
            }

            Comment = StringBlock.Items[4].ToString();
        }
コード例 #11
0
ファイル: MDBaseObject.cs プロジェクト: artamir/1SCodeAnalyze
        public MDTable(SerializedList tableDescription)
        {
            m_RawContent = tableDescription;
            var StringsBlock = ((SerializedList)tableDescription).DrillDown(4);

            ReadStringsBlock(StringsBlock);

            m_Attributes = new MDObjectsCollection <MDAttribute>();

            if (tableDescription.Items.Count > 2)
            {
                var AttributeList = (SerializedList)tableDescription.Items[2];

                FillAttributeCollection(AttributeList);
            }
        }
コード例 #12
0
        public static MDDataProcessor Create(IV8MetadataContainer Container, SerializedList Content)
        {
            MDDataProcessor NewMDObject = new MDDataProcessor();

            NewMDObject.Container = Container;

            StaticMDIdentifiers ids = new StaticMDIdentifiers();

            ids.AttributesCollection = "ec6bb5e5-b7a8-4d75-bec9-658107a699cf";
            ids.TablesCollection     = "2bcef0d1-0981-11d6-b9b8-0050bae0a95d";
            ids.FormsCollection      = "d5b0e5ed-256d-401c-9c36-f630cafd8a62";
            ids.TemplatesCollection  = "3daea016-69b7-4ed4-9453-127911372fe6";

            ReadFromStream(NewMDObject, Content, ids);

            return(NewMDObject);
        }
コード例 #13
0
ファイル: MDReport.cs プロジェクト: artamir/1SCodeAnalyze
        public static MDReport Create(IV8MetadataContainer Container, SerializedList Content)
        {
            MDReport NewReport = new MDReport();

            NewReport.Container = Container;

            StaticMDIdentifiers ids = new StaticMDIdentifiers();

            ids.AttributesCollection = "7e7123e0-29e2-11d6-a3c7-0050bae0a776";
            ids.TablesCollection     = "b077d780-29e2-11d6-a3c7-0050bae0a776";
            ids.FormsCollection      = "a3b368c0-29e2-11d6-a3c7-0050bae0a776";
            ids.TemplatesCollection  = "3daea016-69b7-4ed4-9453-127911372fe6";

            ReadFromStream(NewReport, Content, ids);

            return(NewReport);
        }
コード例 #14
0
        private void LoadAttributes(SerializedList attrSection)
        {
            int count = Int32.Parse(attrSection.Items[1].ToString());

            if (count > 0)
            {
                m_Attributes = new MDObjectsCollection <ManagedFormAttribute>();
            }
            else
            {
                return;
            }

            for (int i = 0; i < count; i++)
            {
                m_Attributes.Add(ManagedFormAttribute.CreateFromList((SerializedList)attrSection.Items[i + 2]));
            }
        }
コード例 #15
0
ファイル: HTMLDocument.cs プロジェクト: artamir/1SCodeAnalyze
        private void ExtractImages()
        {
            const int    Base   = 4;
            const int    len    = 3;
            const String Prefix = "038b5c85-fb1c-4082-9c4c-e69f8928bf3a_files";

            Directory.CreateDirectory(m_WorkDir + "\\" + Prefix);

            int imgCount = Int32.Parse(m_Content.Items[Base].ToString());

            if (imgCount > 0)
            {
                for (int i = 0; i < imgCount; ++i)
                {
                    var ImgName = Prefix + "\\" + SerializedList.StripQuotes(m_Content.Items[Base + 1 + (i * len)].ToString());
                    var Base64  = m_Content.Items[Base + 3 + (i * len)].Items[0].ToString();

                    WriteBase64(m_WorkDir + ImgName, Base64);
                }
            }
        }
コード例 #16
0
        private static ManagedFormAttribute CreateChildFromList(SerializedList childAttr)
        {
            String Name = childAttr.Items[3].ToString();
            String Syn  = null;

            if (childAttr.Items[4].Items.Count < 3 || childAttr.Items[4].Items[2].ToString() == "0")
            {
                Syn = Name;
            }
            else
            {
                Syn = childAttr.Items[4].Items[2].Items[1].ToString();
            }

            var pattern = (SerializedList)childAttr.Items[5];

            ManagedFormAttributeType type = new ManagedFormAttributeType();

            type.TypeDescription = V8TypeDescription.ReadFromList(pattern);

            return(new ManagedFormAttribute(Name, Syn, type));
        }
コード例 #17
0
        protected static void ReadFromStream(MDObjectClass NewMDObject, SerializedList ProcData, StaticMDIdentifiers ids)
        {
            SerializedList Content = ProcData.DrillDown(3);

            NewMDObject.ReadStringsBlock(Content.DrillDown(3));

            const int start      = 3;
            int       ChildCount = Int32.Parse(Content.Items[2].ToString());

            for (int i = 0; i < ChildCount; ++i)
            {
                SerializedList Collection = (SerializedList)Content.Items[start + i];

                String CollectionID = Collection.Items[0].ToString();
                int    ItemsCount   = Int32.Parse(Collection.Items[1].ToString());

                for (int itemIndex = 2; itemIndex < (2 + ItemsCount); ++itemIndex)
                {
                    if (CollectionID == ids.AttributesCollection)
                    {
                        NewMDObject.Attributes.Add(new MDAttribute((SerializedList)Collection.Items[itemIndex]));
                    }
                    else if (CollectionID == ids.TablesCollection)
                    {
                        NewMDObject.Tables.Add(new MDTable((SerializedList)Collection.Items[itemIndex]));
                    }
                    else if (CollectionID == ids.FormsCollection)
                    {
                        NewMDObject.Forms.Add(MDForm.Create(NewMDObject.Container, Collection.Items[itemIndex].ToString()));
                    }
                    else if (CollectionID == ids.TemplatesCollection)
                    {
                        NewMDObject.Templates.Add(new MDTemplate(NewMDObject.Container, Collection.Items[itemIndex].ToString()));
                    }
                }
            }
        }
コード例 #18
0
        public MDObjectBase RaiseObject()
        {
            SerializedList procData = GetMainStream(_reader);

            string classID = procData.Items[3].Items[0].ToString();

            MDObjectBase newObj;

            switch (classID)
            {
            case kExtProccessing:
                newObj = MDDataProcessor.Create(new NonDisposableContainer(this), procData);
                break;

            case kExtReport:
                newObj = MDReport.Create(new NonDisposableContainer(this), procData);
                break;

            default:
                throw new InvalidOperationException("Unknown container");
            }

            return(newObj);
        }
コード例 #19
0
        public void ReadFromList(SerializedList elementsList)
        {
            if (m_InitPerformed)
            {
                throw new InvalidOperationException("Collection can not be reloaded");
            }

            bool   uuidFound = false;
            string uuid      = null;
            int    idIndex   = 0;

            System.Text.RegularExpressions.Regex RegExp = new System.Text.RegularExpressions.Regex(@"\w{8}-\w{4}-\w{4}-\w{4}-\w{12}");

            for (int i = 0; i < elementsList.Items.Count; ++i)
            {
                var curElem = elementsList.Items[i];
                if (curElem.GetType() == typeof(SerializedItem))
                {
                    String content = curElem.ToString();
                    if (content.Length == 36 && content != "00000000-0000-0000-0000-000000000000" && RegExp.IsMatch(content))
                    {
                        uuid      = content;
                        uuidFound = true;
                        idIndex   = i;
                        break;
                    }
                }
            }

            if (uuidFound)
            {
                LoadElements(elementsList, m_Items, idIndex, uuid);
            }

            m_InitPerformed = true;
        }
コード例 #20
0
ファイル: MDBaseObject.cs プロジェクト: artamir/1SCodeAnalyze
        public MDAttribute(SerializedList attrDestription)
        {
            m_RawContent = attrDestription;

            var attrObj = (SerializedList)(attrDestription.Items[0].Items[1]);
            var test    = attrObj.Items[0].ToString();

            SerializedList StringsBlock;
            SerializedList Pattern;

            if (test == "2")
            {
                StringsBlock = (SerializedList)attrObj.Items[1];
                Pattern      = (SerializedList)attrObj.Items[2];
            }
            else
            {
                StringsBlock = (SerializedList)(attrObj.Items[1].Items[1]);
                Pattern      = (SerializedList)(attrObj.Items[1].Items[2]);
            }

            ReadStringsBlock(StringsBlock);
            m_typeDef = V8TypeDescription.ReadFromList(Pattern);
        }
コード例 #21
0
        public MDTemplate(IV8MetadataContainer MDContainer, String ObjID)
        {
            _Container = MDContainer;

            SerializedList header = new SerializedList(_Container.GetElement(ObjID).ReadAll());

            Kind = (TemplateKind)Enum.Parse(typeof(TemplateKind), header.Items[1].Items[1].ToString());

            ReadStringsBlock((SerializedList)header.Items[1].Items[2]);

            switch (Kind)
            {
            case MDTemplate.TemplateKind.Moxel:
            case MDTemplate.TemplateKind.Text:
            case MDTemplate.TemplateKind.GEOSchema:
            case MDTemplate.TemplateKind.GraphicChart:
            case MDTemplate.TemplateKind.DCSAppearanceTemplate:
                m_Document = new PersistedTemplateStub(this);
                break;

            case MDTemplate.TemplateKind.BinaryData:
                m_Document = new BinaryDataDocument(this);
                break;

            case MDTemplate.TemplateKind.HTMLDocument:
                m_Document = new HTMLTemplate(this);
                break;

            case MDTemplate.TemplateKind.DataCompositionSchema:
                m_Document = new DCSSchemaDocument(this);
                break;

            default:
                break;
            }
        }
コード例 #22
0
ファイル: V8Types.cs プロジェクト: artamir/1SCodeAnalyze
        public static V8TypeDescription ReadFromList(SerializedList pattern)
        {
            if (pattern.Items[0].ToString() != "Pattern")
            {
                throw new ArgumentException("Wrong pattern stream");
            }

            V8Type[]          types = new V8Type[pattern.Items.Count - 1];
            V8NumberQualifier numQ  = null;
            V8StringQualifier strQ  = null;
            V8DateQualifier   dateQ = null;

            for (int i = 1; i < pattern.Items.Count; i++)
            {
                SerializedList item = (SerializedList)pattern.Items[i];

                if (item.Items[0].ToString() == "#")
                {
                    V8Type newType = new V8Type(item.Items[1].ToString(), item.Items[1].ToString()); // пока статичные id разбирать не будем
                    types[i - 1] = newType;
                }
                else
                {
                    String typeToken = item.Items[0].ToString();

                    switch (typeToken)
                    {
                    case "N":
                        types[i - 1] = V8BasicTypes.Number;

                        if (item.Items.Count > 1)
                        {
                            // указан квалификатор
                            numQ = new V8NumberQualifier(Int32.Parse(item.Items[1].ToString()),
                                                         Int32.Parse(item.Items[2].ToString()), item.Items[3].ToString() == "1");
                        }

                        break;

                    case "S":

                        types[i - 1] = V8BasicTypes.String;

                        if (item.Items.Count > 1)
                        {
                            // указан квалификатор
                            strQ = new V8StringQualifier(Int32.Parse(item.Items[1].ToString()),
                                                         (item.Items[2].ToString() == "0") ? V8StringQualifier.AvailableLengthType.Fixed : V8StringQualifier.AvailableLengthType.Variable);
                        }

                        break;

                    case "D":

                        types[i - 1] = V8BasicTypes.Date;

                        if (item.Items.Count > 1)
                        {
                            // указан квалификатор
                            dateQ = new V8DateQualifier((item.Items[1].ToString() == "T") ? V8DateQualifier.DateFractionsType.Time : V8DateQualifier.DateFractionsType.Date);
                        }
                        else
                        {
                            dateQ = new V8DateQualifier(V8DateQualifier.DateFractionsType.DateAndTime);
                        }

                        break;

                    case "B":

                        types[i - 1] = V8BasicTypes.Boolean;
                        break;

                    default:

                        V8Type newType = new V8Type("Unknown", "U");     // пока не знаю про U
                        types[i - 1] = newType;

                        break;
                    }
                }
            }

            V8TypeDescription result = new V8TypeDescription(types, numQ, strQ, dateQ);

            return(result);
        }
コード例 #23
0
        private void LoadElements(SerializedList elementsList, MDObjectsCollection <ManagedFormElement> itemsPrototype, int idIndex, string uuid = null)
        {
            int itemCount = Int32.Parse(elementsList.Items[idIndex - 1].ToString());

            int iterationCount = itemCount * 2;

            for (int i = 0; i < iterationCount; ++i)
            {
                int index = idIndex + i;
                if (index >= elementsList.Items.Count)
                {
                    break;
                }

                SerializedItem item = elementsList.Items[index];

                if (item.GetType() == typeof(SerializedItem))
                {
                    uuid = item.ToString();
                }
                else
                {
                    int            offset;
                    SerializedList lst = (SerializedList)item;
                    if (lst.Items[4].ToString() == "0")
                    {
                        offset = 0;
                    }
                    else
                    {
                        offset = 1;
                    }

                    String ElementName;
                    String ElementSubtype;

                    if (uuid == "143c00f7-a42d-4cd7-9189-88e4467dc768" || uuid == "a9f3b1ac-f51b-431e-b102-55a69acdecad")
                    {
                        ElementName    = lst.Items[6].ToString();
                        ElementSubtype = (uuid == "a9f3b1ac-f51b-431e-b102-55a69acdecad") ? lst.Items[5].ToString() : lst.Items[7].ToString();
                    }
                    else
                    {
                        ElementName    = lst.Items[6 + offset].ToString();
                        ElementSubtype = lst.Items[5 + offset].ToString();
                    }

                    var ElementClass = ManagedFormElementType.ParseTypeID(uuid);

                    MDObjectsCollection <ManagedFormElement> ChildrenPrototype = null;

                    if (lst.Items.Count > 22 && (ElementClass == FormElementClass.Group || ElementClass == FormElementClass.Grid))
                    {
                        System.Text.RegularExpressions.Regex RegExp = new System.Text.RegularExpressions.Regex(@"\w{8}-\w{4}-\w{4}-\w{4}-\w{12}");

                        for (int j = 22; j < lst.Items.Count; ++j)
                        {
                            String content = lst.Items[j].ToString();
                            if (content.Length == 36 && content != "00000000-0000-0000-0000-000000000000" && RegExp.IsMatch(content))
                            {
                                // load children

                                ChildrenPrototype = new MDObjectsCollection <ManagedFormElement>();

                                LoadElements(lst, ChildrenPrototype, j);
                                break;
                            }
                        }
                    }

                    ManagedFormElement element;
                    var ElementType = new ManagedFormElementType(ElementClass, Int32.Parse(ElementSubtype));
                    if (ChildrenPrototype == null)
                    {
                        element = new ManagedFormElement(ElementName, ElementName, ElementType);
                    }
                    else
                    {
                        ManagedFormElements Children = new ManagedFormElements(ChildrenPrototype);
                        element = new ManagedFormElement(ElementName, ElementName, ElementType, Children);
                    }

                    itemsPrototype.Add(element);
                }
            }
        }
コード例 #24
0
 public SimpleDialogStub(SerializedList content) : base(content)
 {
 }
コード例 #25
0
 public MDUserDialogBase(SerializedList content)
 {
     m_Content = content;
 }
コード例 #26
0
ファイル: MDBaseObject.cs プロジェクト: artamir/1SCodeAnalyze
 public MDObjectBase(SerializedList lst)
 {
     ReadStringsBlock(lst);
 }
コード例 #27
0
        static public String Convert(SerializedList List)
        {
            String Content = List.ToString();

            return(Convert(Content));
        }
コード例 #28
0
ファイル: HTMLDocument.cs プロジェクト: artamir/1SCodeAnalyze
 public HTMLDocument(SerializedList lstContent)
 {
     m_Content   = lstContent;
     m_Extracted = false;
     m_Disposed  = false;
 }