public POIFSDocument(string name, POIFSBigBlockSize bigBlockSize, Stream stream)
        {
            List <DocumentBlock> blocks = new List <DocumentBlock>();

            _size            = 0;
            _bigBigBlockSize = bigBlockSize;
            while (true)
            {
                DocumentBlock block     = new DocumentBlock(stream, bigBlockSize);
                int           blockSize = block.Size;

                if (blockSize > 0)
                {
                    blocks.Add(block);
                    _size += blockSize;
                }
                if (block.PartiallyRead)
                {
                    break;
                }
            }

            DocumentBlock[] bigBlocks = blocks.ToArray();
            _big_store         = new BigBlockStore(bigBlockSize, bigBlocks);
            _property          = new DocumentProperty(name, _size);
            _property.Document = this;

            if (_property.ShouldUseSmallBlocks)
            {
                _small_store = new SmallBlockStore(bigBlockSize, SmallDocumentBlock.Convert(bigBlockSize, bigBlocks, _size));
                _big_store   = new BigBlockStore(bigBlockSize, new DocumentBlock[0]);
            }
            else
            {
                _small_store = new SmallBlockStore(bigBlockSize, EMPTY_SMALL_BLOCK_ARRAY);
            }
        }
Beispiel #2
0
        public static void Run()
        {
            // ExStart:1
            WordsApi   wordsApi   = new WordsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);
            StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            String fileName     = "SampleWordDocument.docx";
            String propertyName = "Author";
            String storage      = null;
            String folder       = null;

            DocumentProperty body = new DocumentProperty();

            body.Name  = "Author";
            body.Value = "Naeem Akram";

            try
            {
                // Upload the file
                storageApi.PutCreate(fileName, "", storage, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
                // Invoke Aspose.Words Cloud SDK API to set single property
                DocumentPropertyResponse apiResponse = wordsApi.PutUpdateDocumentProperty(fileName, propertyName, fileName, storage, folder, body);

                if (apiResponse != null && apiResponse.Status.Equals("OK"))
                {
                    DocumentProperty docProperty = apiResponse.DocumentProperty;
                    Console.WriteLine(docProperty.Name + "  :  " + docProperty.Value);
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }
Beispiel #3
0
        public void TestConstructor()
        {
            DirectoryProperty property1 = new DirectoryProperty("directory");

            RawDataBlock[] rawBlocks = new RawDataBlock[4];
            MemoryStream   stream    =
                new MemoryStream(new byte[2048]);

            for (int j = 0; j < 4; j++)
            {
                rawBlocks[j] = new RawDataBlock(stream);
            }
            OPOIFSDocument document = new OPOIFSDocument("document", rawBlocks,
                                                         2000);
            DocumentProperty property2 = document.DocumentProperty;
            DirectoryNode    parent    = new DirectoryNode(property1, (POIFSFileSystem)null, null);
            DocumentNode     node      = new DocumentNode(property2, parent);

            // Verify we can retrieve the document
            Assert.AreEqual(property2.Document, node.Document);

            // Verify we can Get the size
            Assert.AreEqual(property2.Size, node.Size);

            // Verify isDocumentEntry returns true
            Assert.IsTrue(node.IsDocumentEntry);

            // Verify isDirectoryEntry returns false
            Assert.IsTrue(!node.IsDirectoryEntry);

            // Verify GetName behaves correctly
            Assert.AreEqual(property2.Name, node.Name);

            // Verify GetParent behaves correctly
            Assert.AreEqual(parent, node.Parent);
        }
        public void ConfiguringLinkToContent()
        {
            //ExStart:ConfiguringLinkToContent
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.StartBookmark("MyBookmark");
            builder.Writeln("Text inside a bookmark.");
            builder.EndBookmark("MyBookmark");

            // Retrieve a list of all custom document properties from the file.
            CustomDocumentProperties customProperties = doc.CustomDocumentProperties;
            // Add linked to content property.
            DocumentProperty customProperty = customProperties.AddLinkToContent("Bookmark", "MyBookmark");

            customProperty = customProperties["Bookmark"];

            bool isLinkedToContent = customProperty.IsLinkToContent;

            string linkSource = customProperty.LinkSource;

            string customPropertyValue = customProperty.Value.ToString();
            //ExEnd:ConfiguringLinkToContent
        }
Beispiel #5
0
    private void method_5(Class566 A_0)
    {
        int       num        = 0x11;
        Hashtable hashtable  = new Hashtable();
        Hashtable hashtable2 = new Hashtable();

        for (int i = 0; i < A_0.method_2(); i++)
        {
            Class521 class2 = A_0.method_0(i);
            if (class2.string_0 == BookmarkStart.b("栶椸爺礼怾ീੂୄెୈ੊Ṍ੎", num))
            {
                if (class2.object_0 is byte[])
                {
                }
            }
            else if ((class2.int_0 & 0x1000000) != 0)
            {
                int num4 = class2.int_0 & -16777217;
                hashtable2[num4] = class2.object_0;
            }
            else if (Class567.smethod_16(class2.string_0) && (class2.string_0 != BookmarkStart.b("栶椸爺礼怾ीགౄॆɈᡊ", num)))
            {
                DocumentProperty property = this.customDocumentProperties_0.Add(class2.string_0, class2.object_0);
                hashtable[class2.int_0] = property;
            }
        }
        foreach (DictionaryEntry entry in hashtable2)
        {
            int key = (int)entry.Key;
            DocumentProperty property2 = (DocumentProperty)hashtable[key];
            if (property2 != null)
            {
                property2.LinkSource = (string)entry.Value;
            }
        }
    }
        public static void ConfiguringLinkToContent(string dataDir)
        {
            // ExStart:ConfiguringLinkToContent
            Document doc = new Document(dataDir + "test.docx");

            // Retrieve a list of all custom document properties from the file.
            CustomDocumentProperties customProperties = doc.CustomDocumentProperties;

            // Add linked to content property.
            DocumentProperty customProperty = customProperties.AddLinkToContent("PropertyName", "BookmarkName");

            // Also, accessing the custom document property can be performed by using the property name.
            customProperty = customProperties["PropertyName"];

            // Check whether the property is linked to content.
            bool isLinkedToContent = customProperty.IsLinkToContent;

            // Get the source of the property.
            string source = customProperty.LinkSource;

            // Get the value of the property.
            string value = customProperty.Value.ToString();
            // ExEnd:ConfiguringLinkToContent
        }
Beispiel #7
0
    internal static void smethod_1(Class582 A_0)
    {
        int num = 4;
        CustomDocumentProperties customDocumentProperties = A_0.Interface50.imethod_0().CustomDocumentProperties;
        Class394 class2 = A_0.imethod_1();

        while (class2.method_9(BookmarkStart.b("椩夫崭䐯崱夳爵圷夹䤻匽┿ⱁぃᙅ㩇╉㱋⭍≏♑㵓㍕⭗", num)))
        {
            string name = smethod_2(class2.method_1());
            string str5 = null;
            string str6 = null;
            while (class2.method_19())
            {
                string str3 = class2.method_1();
                if (str3 != null)
                {
                    if (!(str3 == BookmarkStart.b("丩堫", num)))
                    {
                        if (str3 == BookmarkStart.b("䘩䔫䀭嬯", num))
                        {
                            str5 = class2.method_3();
                        }
                    }
                    else
                    {
                        str6 = class2.method_3();
                    }
                }
            }
            string str4 = class2.method_21();
            string str  = str6;
            if (str != null)
            {
                if (str != BookmarkStart.b("天堫尭夯就匳", num))
                {
                    if (str != BookmarkStart.b("䰩䀫䄭儯䘱", num))
                    {
                        if (str != BookmarkStart.b("䠩䌫䄭尯圱唳堵", num))
                        {
                            if ((str == BookmarkStart.b("丩䴫娭唯昱崳嬵崷", num)) || (str == BookmarkStart.b("丩䴫娭唯昱崳嬵崷ᐹ䠻䐽", num)))
                            {
                                customDocumentProperties.Add(name, Class1041.smethod_3(str4));
                            }
                        }
                        else
                        {
                            customDocumentProperties.Add(name, class2.method_70(str4));
                        }
                    }
                    else
                    {
                        double num2 = Class1041.smethod_12(str4);
                        if (((int)num2) == num2)
                        {
                            customDocumentProperties.Add(name, (int)num2);
                        }
                        else
                        {
                            customDocumentProperties.Add(name, num2);
                        }
                    }
                }
                else
                {
                    DocumentProperty property = customDocumentProperties.Add(name, str4);
                    if (Class567.smethod_16(str5))
                    {
                        property.LinkSource = str5;
                    }
                }
            }
        }
    }
Beispiel #8
0
        public void TestWriterPropertyTable()
        {
            HeaderBlock   headerBlock = new HeaderBlock(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
            PropertyTable table       = new PropertyTable(headerBlock);

            DocumentProperty workbook = new DocumentProperty("Workbook", 0x00046777);

            workbook.StartBlock = 0;

            DocumentProperty summary1 = new DocumentProperty("\x0005SummaryInformation", 0x00001000);

            summary1.StartBlock = 0x00000234;

            DocumentProperty summary2 = new DocumentProperty("\x0005DocumentSummaryInformation", 0x00001000);

            summary2.StartBlock = 0x0000023C;
            table.AddProperty(workbook);
            RootProperty root = table.Root;

            root.AddChild(workbook);
            table.AddProperty(summary1);
            root = table.Root;
            root.AddChild(summary1);
            table.AddProperty(summary2);
            root = table.Root;
            root.AddChild(summary2);
            table.PreWrite();

            string[] testblock =
            {
                "52 00 6F 00 6F 00 74 00 20 00 45 00 6E 00 74 00 72 00 79 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "16 00 05 01 FF FF FF FF FF FF FF FF 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FE FF FF FF 00 00 00 00 00 00 00 00",
                "57 00 6F 00 72 00 6B 00 62 00 6F 00 6F 00 6B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "12 00 02 01 FF FF FF FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 77 67 04 00 00 00 00 00",
                "05 00 53 00 75 00 6D 00 6D 00 61 00 72 00 79 00 49 00 6E 00 66 00 6F 00 72 00 6D 00 61 00 74 00",
                "69 00 6F 00 6E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "28 00 02 01 01 00 00 00 03 00 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 02 00 00 00 10 00 00 00 00 00 00",
                "05 00 44 00 6F 00 63 00 75 00 6D 00 65 00 6E 00 74 00 53 00 75 00 6D 00 6D 00 61 00 72 00 79 00",
                "49 00 6E 00 66 00 6F 00 72 00 6D 00 61 00 74 00 69 00 6F 00 6E 00 00 00 00 00 00 00 00 00 00 00",
                "38 00 02 01 FF FF FF FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3C 02 00 00 00 10 00 00 00 00 00 00",
            };

            ConfirmBlockEncoding(testblock, table);

            table.RemoveProperty(summary1);
            root = table.Root;
            root.DeleteChild(summary1);
            table.PreWrite();

            string[] testblock2 =
            {
                "52 00 6F 00 6F 00 74 00 20 00 45 00 6E 00 74 00 72 00 79 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "16 00 05 01 FF FF FF FF FF FF FF FF 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FE FF FF FF 00 00 00 00 00 00 00 00",
                "57 00 6F 00 72 00 6B 00 62 00 6F 00 6F 00 6B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "12 00 02 01 FF FF FF FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 77 67 04 00 00 00 00 00",
                "05 00 44 00 6F 00 63 00 75 00 6D 00 65 00 6E 00 74 00 53 00 75 00 6D 00 6D 00 61 00 72 00 79 00",
                "49 00 6E 00 66 00 6F 00 72 00 6D 00 61 00 74 00 69 00 6F 00 6E 00 00 00 00 00 00 00 00 00 00 00",
                "38 00 02 01 01 00 00 00 FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3C 02 00 00 00 10 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "02 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
            };
            ConfirmBlockEncoding(testblock2, table);

            table.AddProperty(summary1);
            root = table.Root;
            root.AddChild(summary1);
            table.PreWrite();

            string[] testblock3 =
            {
                "52 00 6F 00 6F 00 74 00 20 00 45 00 6E 00 74 00 72 00 79 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "16 00 05 01 FF FF FF FF FF FF FF FF 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FE FF FF FF 00 00 00 00 00 00 00 00",
                "57 00 6F 00 72 00 6B 00 62 00 6F 00 6F 00 6B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "12 00 02 01 FF FF FF FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 77 67 04 00 00 00 00 00",
                "05 00 44 00 6F 00 63 00 75 00 6D 00 65 00 6E 00 74 00 53 00 75 00 6D 00 6D 00 61 00 72 00 79 00",
                "49 00 6E 00 66 00 6F 00 72 00 6D 00 61 00 74 00 69 00 6F 00 6E 00 00 00 00 00 00 00 00 00 00 00",
                "38 00 02 01 FF FF FF FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3C 02 00 00 00 10 00 00 00 00 00 00",
                "05 00 53 00 75 00 6D 00 6D 00 61 00 72 00 79 00 49 00 6E 00 66 00 6F 00 72 00 6D 00 61 00 74 00",
                "69 00 6F 00 6E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "28 00 02 01 01 00 00 00 02 00 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
                "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 02 00 00 00 10 00 00 00 00 00 00",
            };
            ConfirmBlockEncoding(testblock3, table);
        }
Beispiel #9
0
 set => this.SetValue(DocumentProperty, value);
Beispiel #10
0
        private void VerifyProperty(string name, int size)
        {
            DocumentProperty property = new DocumentProperty(name, size);

            if (size >= 4096)
            {
                Assert.IsTrue(!property.ShouldUseSmallBlocks);
            }
            else
            {
                Assert.IsTrue(property.ShouldUseSmallBlocks);
            }
            byte[] Testblock = new byte[128];
            int    index     = 0;

            for (; index < 0x40; index++)
            {
                Testblock[index] = (byte)0;
            }
            int limit = Math.Min(31, name.Length);

            Testblock[index++] = (byte)(2 * (limit + 1));
            Testblock[index++] = (byte)0;
            Testblock[index++] = (byte)2;
            Testblock[index++] = (byte)1;
            for (; index < 0x50; index++)
            {
                Testblock[index] = (byte)0xFF;
            }
            for (; index < 0x78; index++)
            {
                Testblock[index] = (byte)0;
            }
            int sz = size;

            Testblock[index++] = (byte)sz;
            sz /= 256;
            Testblock[index++] = (byte)sz;
            sz /= 256;
            Testblock[index++] = (byte)sz;
            sz /= 256;
            Testblock[index++] = (byte)sz;
            for (; index < 0x80; index++)
            {
                Testblock[index] = (byte)0x0;
            }
            byte[] name_bytes = Encoding.UTF8.GetBytes(name);

            for (index = 0; index < limit; index++)
            {
                Testblock[index * 2] = name_bytes[index];
            }
            MemoryStream stream = new MemoryStream(512);

            property.WriteData(stream);
            byte[] output = stream.ToArray();

            Assert.AreEqual(Testblock.Length, output.Length);
            for (int j = 0; j < Testblock.Length; j++)
            {
                Assert.AreEqual(Testblock[j],
                                output[j], "mismatch at offset " + j);
            }
        }
Beispiel #11
0
 private void method_8(DocumentProperty A_0)
 {
     this.method_9(A_0, false);
 }
Beispiel #12
0
    private void method_4(string A_0, object A_1, PropertyValueType A_2)
    {
        int num = 0x10;

        if (DocumentProperty.smethod_1(A_1) == A_2)
        {
            Class567.smethod_19(A_0, BookmarkStart.b("堵夷圹夻", num));
            Class567.smethod_20(A_1, BookmarkStart.b("䀵夷嘹䤻嬽", num));
            DocumentProperty property = new DocumentProperty(A_0, A_1);
            string           key      = A_0;
            if (key != null)
            {
                int num2;
                if (Class1160.dictionary_125 == null)
                {
                    Dictionary <string, int> dictionary1 = new Dictionary <string, int>(0x1d);
                    dictionary1.Add(BookmarkStart.b("搵崷䰹唻䴽⤿ⵁ⩃ࡅ㵇❉⹋⭍≏", num), 0);
                    dictionary1.Add(BookmarkStart.b("戵儷丹倻嬽", num), 1);
                    dictionary1.Add(BookmarkStart.b("攵䴷堹嘻嬽⌿㙁", num), 2);
                    dictionary1.Add(BookmarkStart.b("眵䴷丹吻儽㈿", num), 3);
                    dictionary1.Add(BookmarkStart.b("紵崷䌹䬻儽㈿♁㝃", num), 4);
                    dictionary1.Add(BookmarkStart.b("电圷圹儻嬽⸿㙁㝃", num), 5);
                    dictionary1.Add(BookmarkStart.b("戵崷圹䰻刽ℿ㙁⅃", num), 6);
                    dictionary1.Add(BookmarkStart.b("稵夷䤹䠻缽㔿㙁ⱃ⥅㩇", num), 7);
                    dictionary1.Add(BookmarkStart.b("稵夷䤹䠻洽ℿ㑁⅃≅ੇ㍉", num), 8);
                    dictionary1.Add(BookmarkStart.b("稵夷䤹䠻渽㈿⭁⩃㉅ⵇ⹉", num), 9);
                    dictionary1.Add(BookmarkStart.b("电䨷弹崻䨽⤿ⵁ⩃Ʌ⥇㹉⥋", num), 10);
                    dictionary1.Add(BookmarkStart.b("电䨷弹崻䨽┿ف╃㉅ⵇ", num), 11);
                    dictionary1.Add(BookmarkStart.b("稵夷䤹䠻洽ℿ㑁⅃Ʌ⥇㹉⥋", num), 12);
                    dictionary1.Add(BookmarkStart.b("昵夷崹夻紽⼿㝁⩃㉅", num), 13);
                    dictionary1.Add(BookmarkStart.b("愵圷䠹堻紽⼿㝁⩃㉅", num), 14);
                    dictionary1.Add(BookmarkStart.b("戵倷伹儻尽⸿⍁ⵃ⩅", num), 15);
                    dictionary1.Add(BookmarkStart.b("电倷嬹主紽⼿㝁⩃㉅", num), 0x10);
                    dictionary1.Add(BookmarkStart.b("攵崷夹䤻䰽⤿㙁㵃", num), 0x11);
                    dictionary1.Add(BookmarkStart.b("眵䠷䨹倻圽⌿⍁ぃ⽅❇⑉ɋ⽍㵏㝑", num), 0x12);
                    dictionary1.Add(BookmarkStart.b("猵尷匹䠻樽⤿⽁⅃", num), 0x13);
                    dictionary1.Add(BookmarkStart.b("戵圷丹崻刽Կ♁ⵃ㉅ⅇ⑉⭋ᩍ㥏㽑ㅓ", num), 20);
                    dictionary1.Add(BookmarkStart.b("电倷嬹主弽⌿㙁⅃㑅㭇ᵉ╋㩍㡏ő⑓㝕㭗㽙⽛", num), 0x15);
                    dictionary1.Add(BookmarkStart.b("縵崷嬹堻圽⸿╁ᑃ❅ⅇ㡉㽋", num), 0x16);
                    dictionary1.Add(BookmarkStart.b("电夷丹夻夽⼿ぁ㵃", num), 0x17);
                    dictionary1.Add(BookmarkStart.b("笵夷吹崻夽┿ぁ", num), 0x18);
                    dictionary1.Add(BookmarkStart.b("电圷圹䰻弽⸿㭁", num), 0x19);
                    dictionary1.Add(BookmarkStart.b("琵䄷丹夻紽⼿㝁⩃㉅", num), 0x1a);
                    dictionary1.Add(BookmarkStart.b("稵儷吹夻紽⼿㝁⩃㉅", num), 0x1b);
                    dictionary1.Add(BookmarkStart.b("昵夷䠹崻夽㈿⍁㑃⹅େ╉㥋⁍⑏", num), 0x1c);
                    Class1160.dictionary_125 = dictionary1;
                }
                if (Class1160.dictionary_125.TryGetValue(key, out num2))
                {
                    switch (num2)
                    {
                    case 0:
                        this.builtinDocumentProperties_0.RevisionNumber = (string)A_1;
                        return;

                    case 1:
                        this.builtinDocumentProperties_0.Title = (string)A_1;
                        return;

                    case 2:
                        this.builtinDocumentProperties_0.Subject = (string)A_1;
                        return;

                    case 3:
                        this.builtinDocumentProperties_0.Author = (string)A_1;
                        return;

                    case 4:
                        this.builtinDocumentProperties_0.Keywords = (string)A_1;
                        return;

                    case 5:
                        this.builtinDocumentProperties_0.Comments = (string)A_1;
                        return;

                    case 6:
                        this.builtinDocumentProperties_0.Template = (string)A_1;
                        return;

                    case 7:
                    case 8:
                        this.builtinDocumentProperties_0.LastAuthor = (string)A_1;
                        return;

                    case 9:
                        this.builtinDocumentProperties_0.LastPrinted = (DateTime)A_1;
                        return;

                    case 10:
                    case 11:
                        this.builtinDocumentProperties_0.CreateDate = (DateTime)A_1;
                        return;

                    case 12:
                        this.builtinDocumentProperties_0.LastSaveDate = (DateTime)A_1;
                        return;

                    case 13:
                        this.builtinDocumentProperties_0.PageCount = (int)A_1;
                        return;

                    case 14:
                        this.builtinDocumentProperties_0.WordCount = (int)A_1;
                        return;

                    case 15:
                        this.builtinDocumentProperties_0.Thumbnail = (string)A_1;
                        return;

                    case 0x10:
                        this.builtinDocumentProperties_0.CharCount = (int)A_1;
                        return;

                    case 0x11:
                        this.builtinDocumentProperties_0.DocSecurity = (int)A_1;
                        return;

                    case 0x12:
                        this.builtinDocumentProperties_0.ApplicationName = (string)A_1;
                        return;

                    case 0x13:
                    case 20:
                        this.builtinDocumentProperties_0.TotalEditingTime = (TimeSpan)A_1;
                        return;

                    case 0x15:
                        this.builtinDocumentProperties_0.CharCountWithSpace = (int)A_1;
                        return;

                    case 0x16:
                        this.builtinDocumentProperties_0.DocumentHash.Add(12, property);
                        return;

                    case 0x17:
                        this.builtinDocumentProperties_0.Category = (string)A_1;
                        return;

                    case 0x18:
                        this.builtinDocumentProperties_0.Manager = (string)A_1;
                        return;

                    case 0x19:
                        this.builtinDocumentProperties_0.Company = (string)A_1;
                        return;

                    case 0x1a:
                        this.builtinDocumentProperties_0.BytesCount = (int)A_1;
                        return;

                    case 0x1b:
                        this.builtinDocumentProperties_0.LinesCount = (int)A_1;
                        return;

                    case 0x1c:
                        this.builtinDocumentProperties_0.ParagraphCount = (int)A_1;
                        break;

                    default:
                        return;
                    }
                }
            }
        }
    }
Beispiel #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateOrUpdateDocumentPropertyRequest"/> class.
 /// </summary>
 /// <param name="name">The document name.</param>
 /// <param name="propertyName">The property name.</param>
 /// <param name="property">The property with new value.</param>
 /// <param name="folder">Original document folder.</param>
 /// <param name="storage">File storage, which have to be used.</param>
 /// <param name="loadEncoding">Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.</param>
 /// <param name="password">Password for opening an encrypted document.</param>
 /// <param name="destFileName">Result name of the document after the operation. If this parameter is omitted then result of the operation will be saved as the source document.</param>
 /// <param name="revisionAuthor">Initials of the author to use for revisions.If you set this parameter and then make some changes to the document programmatically, save the document and later open the document in MS Word you will see these changes as revisions.</param>
 /// <param name="revisionDateTime">The date and time to use for revisions.</param>
 public CreateOrUpdateDocumentPropertyRequest(string name, string propertyName, DocumentProperty property, string folder = null, string storage = null, string loadEncoding = null, string password = null, string destFileName = null, string revisionAuthor = null, string revisionDateTime = null)
 {
     this.Name             = name;
     this.PropertyName     = propertyName;
     this.Property         = property;
     this.Folder           = folder;
     this.Storage          = storage;
     this.LoadEncoding     = loadEncoding;
     this.Password         = password;
     this.DestFileName     = destFileName;
     this.RevisionAuthor   = revisionAuthor;
     this.RevisionDateTime = revisionDateTime;
 }
Beispiel #14
0
 public void Dispose()
 {
     _big_store   = null;
     _property    = null;
     _small_store = null;
 }
Beispiel #15
0
    private void method_9(DocumentProperty A_0, bool A_1)
    {
        int num = 11;

        if (A_0 != null)
        {
            if (!A_1)
            {
                switch (A_0.PropertyId)
                {
                case BuiltInProperty.Title:
                case BuiltInProperty.Subject:
                case BuiltInProperty.Author:
                case BuiltInProperty.Comments:
                case BuiltInProperty.Template:
                case BuiltInProperty.LastAuthor:
                case BuiltInProperty.LastPrinted:
                case BuiltInProperty.CreationDate:
                case BuiltInProperty.LastSaveDate:
                case BuiltInProperty.PageCount:
                case BuiltInProperty.WordCount:
                case BuiltInProperty.CharCount:
                case BuiltInProperty.ApplicationName:
                case BuiltInProperty.Security:
                    this.method_10(smethod_2(A_0.Name), A_0.Value);
                    return;

                case BuiltInProperty.Keywords:
                case BuiltInProperty.Thumbnail:
                case BuiltInProperty.PresentationTarget:
                case BuiltInProperty.SlideCount:
                case BuiltInProperty.NoteCount:
                case BuiltInProperty.HiddenCount:
                case BuiltInProperty.MultimediaClipCount:
                case BuiltInProperty.ScaleCrop:
                case BuiltInProperty.ShareDoc:
                case BuiltInProperty.Hyperlinks:
                case BuiltInProperty.HyperlinksChanged:
                case BuiltInProperty.ExcelDigitalSignature:
                    return;

                case BuiltInProperty.RevisionNumber:
                    this.method_10(9, A_0.Value.ToString());
                    return;

                case BuiltInProperty.EditTime:
                {
                    TimeSpan span = (TimeSpan)A_0.Value;
                    int      num5 = int.Parse(span.TotalMinutes.ToString());
                    this.method_10(10, smethod_5(num5));
                    return;
                }

                case BuiltInProperty.Category:
                case BuiltInProperty.ByteCount:
                case BuiltInProperty.LineCount:
                case BuiltInProperty.ParagraphCount:
                case BuiltInProperty.HeadingPair:
                case BuiltInProperty.DocParts:
                case BuiltInProperty.Manager:
                case BuiltInProperty.Company:
                case BuiltInProperty.LinksDirty:
                case BuiltInProperty.CharactersWithSpaces:
                case BuiltInProperty.Version:
                case BuiltInProperty.ContentType:
                case BuiltInProperty.ContentStatus:
                    this.method_11(smethod_3(A_0.Name), A_0.Value);
                    return;

                case BuiltInProperty.LinkBase:
                {
                    string str = A_0.Value.ToString();
                    if (Class567.smethod_16(str))
                    {
                        int    num2  = (str.Length * 2) + 2;
                        byte[] bytes = new byte[num2];
                        Encoding.Unicode.GetBytes(str, 0, str.Length, bytes, 0);
                        this.method_12(BookmarkStart.b("渰挲簴猶昸眺琼焾ੀłфᑆై", num), bytes);
                    }
                    return;
                }
                }
            }
            else
            {
                switch (((PIDDSI)A_0.PropertyId))
                {
                case PIDDSI.ByteCount:
                case PIDDSI.LineCount:
                case PIDDSI.ParCount:
                case PIDDSI.HeadingPair:
                case PIDDSI.DocParts:
                case PIDDSI.Manager:
                case PIDDSI.Company:
                case PIDDSI.LinksDirty:
                case PIDDSI.CharactersWithSpaces:
                case PIDDSI.Version:
                case PIDDSI.ContentType:
                case PIDDSI.ContentStatus:
                case ((PIDDSI)0x3e8):
                    this.method_11((int)A_0.PropertyId, A_0.Value);
                    return;

                case PIDDSI.SlideCount:
                case PIDDSI.NoteCount:
                case PIDDSI.HiddenCount:
                case PIDDSI.MmclipCount:
                case PIDDSI.Scale:
                case (PIDDSI.LinksDirty | PIDDSI.Category):
                case PIDDSI.ShareDoc:
                case PIDDSI.Hyperlinks:
                case PIDDSI.HyperlinksChanged:
                case PIDDSI.ExcelDigitalSignature:
                case ((PIDDSI)0x19):
                    return;

                case PIDDSI.LinkBase:
                {
                    string str2 = A_0.Value.ToString();
                    if (Class567.smethod_16(str2))
                    {
                        int    num3    = (str2.Length * 2) + 2;
                        byte[] buffer2 = new byte[num3];
                        Encoding.Unicode.GetBytes(str2, 0, str2.Length, buffer2, 0);
                        this.method_12(BookmarkStart.b("渰挲簴猶昸眺琼焾ੀłфᑆై", num), buffer2);
                    }
                    return;
                }
                }
            }
        }
    }
Beispiel #16
0
    private static void smethod_3(Class857 A_0)
    {
        int      num    = 3;
        Class396 class2 = A_0.method_11();

        class2.method_18();
        string key  = "";
        string str2 = "";

        while (class2.method_19())
        {
            string str5 = class2.method_1();
            if (str5 != null)
            {
                if (!(str5 == BookmarkStart.b("䜨䨪䀬䨮", num)))
                {
                    if (str5 == BookmarkStart.b("弨䨪䄬娮吰Ḳ䄴丶䤸帺", num))
                    {
                        str2 = class2.method_3();
                    }
                }
                else
                {
                    key = class2.method_3();
                    if (A_0.method_9().CustomDocumentProperties[key] != null)
                    {
                        return;
                    }
                }
            }
        }
        DocumentProperty property = A_0.method_9().CustomDocumentProperties.dictionary_0.ContainsKey(key) ? A_0.method_9().CustomDocumentProperties.dictionary_0[key] : null;
        string           str3     = class2.method_21();
        string           str4     = str2;

        if (str4 != null)
        {
            if (str4 == BookmarkStart.b("䬨䐪䈬䌮吰刲嬴", num))
            {
                Class567.smethod_19(key, BookmarkStart.b("䜨䨪䀬䨮", num));
                Class567.smethod_20(Class1041.smethod_28(str3), BookmarkStart.b("弨䨪䄬娮吰", num));
                property = (property != null) ? property : A_0.method_9().CustomDocumentProperties.Add(key, str3);
                return;
            }
            if ((str4 == BookmarkStart.b("䴨䨪夬䨮", num)) || (str4 == BookmarkStart.b("崨䈪䀬䨮", num)))
            {
                Class567.smethod_19(key, BookmarkStart.b("䜨䨪䀬䨮", num));
                Class567.smethod_20(Class1041.smethod_3(str3), BookmarkStart.b("弨䨪䄬娮吰", num));
                property = (property != null) ? property : A_0.method_9().CustomDocumentProperties.Add(key, str3);
                return;
            }
            if (str4 == BookmarkStart.b("伨䜪䈬丮䔰", num))
            {
                Class567.smethod_19(key, BookmarkStart.b("䜨䨪䀬䨮", num));
                Class567.smethod_20(Class1041.smethod_12(str3), BookmarkStart.b("弨䨪䄬娮吰", num));
                property = (property != null) ? property : A_0.method_9().CustomDocumentProperties.Add(key, str3);
                return;
            }
        }
        Class567.smethod_19(key, BookmarkStart.b("䜨䨪䀬䨮", num));
        Class567.smethod_20(str3, BookmarkStart.b("弨䨪䄬娮吰", num));
        property = (property != null) ? property : A_0.method_9().CustomDocumentProperties.Add(key, str3);
    }
Beispiel #17
0
        public void TestPOIFSDocument()
        {
            // Verify correct number of blocks Get Created for document
            // that is exact multituple of block size
            POIFSDocument document;

            byte[] array = new byte[4096];

            for (int j = 0; j < array.Length; j++)
            {
                array[j] = (byte)j;
            }
            document = new POIFSDocument("foo", new SlowInputStream(new MemoryStream(array)));
            checkDocument(document, array);

            // Verify correct number of blocks Get Created for document
            // that is not an exact multiple of block size
            array = new byte[4097];
            for (int j = 0; j < array.Length; j++)
            {
                array[j] = (byte)j;
            }
            document = new POIFSDocument("bar", new MemoryStream(array));
            checkDocument(document, array);

            // Verify correct number of blocks Get Created for document
            // that is small
            array = new byte[4095];
            for (int j = 0; j < array.Length; j++)
            {
                array[j] = (byte)j;
            }
            document = new POIFSDocument("_bar", new MemoryStream(array));
            checkDocument(document, array);

            // Verify correct number of blocks Get Created for document
            // that is rather small
            array = new byte[199];
            for (int j = 0; j < array.Length; j++)
            {
                array[j] = (byte)j;
            }
            document = new POIFSDocument("_bar2",
                                         new MemoryStream(array));
            checkDocument(document, array);

            // Verify that output is correct
            array = new byte[4097];
            for (int j = 0; j < array.Length; j++)
            {
                array[j] = (byte)j;
            }
            document = new POIFSDocument("foobar",
                                         new MemoryStream(array));
            checkDocument(document, array);
            document.StartBlock = 0x12345678;   // what a big file!!
            DocumentProperty property = document.DocumentProperty;
            MemoryStream     stream   = new MemoryStream();

            property.WriteData(stream);
            byte[] output = stream.ToArray();
            byte[] array2 =
            {
                ( byte )'f',            ( byte )0,              ( byte )'o',            ( byte )0,              ( byte )'o',
                ( byte )0,              ( byte )'b',            ( byte )0,              ( byte )'a',            ( byte )0,
                ( byte )'r',            ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )14,
                ( byte )0,              ( byte )2,              ( byte )1,              unchecked (( byte )-1), unchecked (( byte )-1),
                unchecked (( byte )-1), unchecked (( byte )-1), unchecked (( byte )-1), unchecked (( byte )-1), unchecked (( byte )-1),
                unchecked (( byte )-1), unchecked (( byte )-1), unchecked (( byte )-1), unchecked (( byte )-1), unchecked (( byte )-1),
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0x78,           ( byte )0x56,           ( byte )0x34,
                ( byte )0x12,           ( byte )1,              ( byte )16,             ( byte )0,              ( byte )0,
                ( byte )0,              ( byte )0,              ( byte )0,              ( byte )0
            };

            Assert.AreEqual(array2.Length, output.Length);
            for (int j = 0; j < output.Length; j++)
            {
                Assert.AreEqual(array2[j],
                                output[j], "Checking property offset " + j);
            }
        }
Beispiel #18
0
        /**
         * create a DocumentNode. This method Is not public by design; it
         * Is intended strictly for the internal use of this package
         *
         * @param property the DocumentProperty for this DocumentEntry
         * @param parent the parent of this entry
         */

        public DocumentNode(DocumentProperty property, DirectoryNode parent) : base(property, parent)
        {
            _document = property.Document;
        }
        /// <summary>
        /// Creates a data model entry for the given path element.
        /// </summary>
        /// <param name="parentItem"></param>
        /// <param name="path">The full file name of the document to be loaded.</param>
        /// <param name="externalDocument">The properties used to build the document.</param>
        static void CreateDocument(AssetNetworkItem parentItem, String path, DocumentProperty externalDocument)
        {
            // The general idea here is to create the data structure that will be passed to the server to create the documents.  Once built, the same data is used
            // to modify the client side so it will look like the file was imported instantaneously. If the operation to add the document fails, then we will undo
            // the transaction but most of the time it will just look zippin' quick.  This is list of metadata properties used to create the document.
            List <PropertyStoreInfo> propertyStoreList = new List <PropertyStoreInfo>();

            // Each document requires an image so we can display an icon on the directory page.  The icon used for the documents is acquired from the type
            // information (each type is associated with an icon).
            DataModel.TypeRow typeRow = DataModel.Type.TypeKey.Find(externalDocument.typeId);

            // IMPORTANT CONCEPT: In order to create the document on the client side, we need to have unique identifiers.  These unique identifiers will be passed
            // to the server when it is time to create the document and all the records that go with it (metadata, entity tree, etc.).  If the operation is not
            // successful, then we roll back this transaction and all these records will go away, but if the operation is successful, then we'll get back the
            // actual database record which will, by virtue of having the same identifiers created here, update these records with the actual server information
            // (most importantly, we'll get back a RowVersion and all the other server-side defaults).
            CreateDocumentInfo createDocumentInfo = new CreateDocumentInfo();

            createDocumentInfo.EntityId       = Guid.NewGuid();
            createDocumentInfo.EntityTreeId   = Guid.NewGuid();
            createDocumentInfo.Name           = Path.GetFileName(path);
            createDocumentInfo.ParentEntityId = parentItem.EntityId;
            createDocumentInfo.TypeId         = typeRow.TypeId;

            // If a viewer has been specified for this file type, then create a metadata property for the viewer.
            if (!String.IsNullOrEmpty(externalDocument.ViewerUri))
            {
                PropertyStoreInfo viewerPropertyInfo = new PropertyStoreInfo();
                viewerPropertyInfo.PropertyStoreId = Guid.NewGuid();
                viewerPropertyInfo.PropertyId      = PropertyId.Viewer;
                viewerPropertyInfo.Value           = Encoding.Unicode.GetBytes(externalDocument.ViewerUri);
                propertyStoreList.Add(viewerPropertyInfo);
            }

            // This will create a metadata property for the data that goes with an item.  In this case, the data is the file contents.
            PropertyStoreInfo dataPropertyInfo = new PropertyStoreInfo();

            dataPropertyInfo.PropertyId      = PropertyId.Data;
            dataPropertyInfo.PropertyStoreId = Guid.NewGuid();
            using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
            {
                MemoryStream memoryStream = new MemoryStream();
                DirectoryPage.Copy(fileStream, memoryStream);
                Byte[] buffer = new Byte[memoryStream.Length];
                Array.Copy(memoryStream.GetBuffer(), buffer, memoryStream.Length);
                dataPropertyInfo.Value = buffer;
            }
            propertyStoreList.Add(dataPropertyInfo);

            // Package the properties up in an array.
            createDocumentInfo.Properties = propertyStoreList.ToArray();

            // At this point, we have enough data to create the document on the server.  We could quit now and just send the message off to the server and wait for
            // the server to update the client with the newly created document.  However, this involves a lag time which can be noticable on public systems.  To
            // make it look like the operation was instantaneous, we're going to create the document on the client side.  If the server accepts the web service
            // call, then all this data will be overwritten by the actual server version.  If the operation fails, all this data will be rolled back.
            DataModel.EntityRow entityRow = DataModel.Entity.NewRow() as DataModel.EntityRow;
            entityRow.EntityId     = createDocumentInfo.EntityId;
            entityRow.CreatedTime  = DateTime.Now;
            entityRow.ImageId      = typeRow.ImageId;
            entityRow.Name         = createDocumentInfo.Name;
            entityRow.ModifiedTime = DateTime.Now;
            entityRow.RowVersion   = 0;
            entityRow.IsContainer  = false;
            entityRow.TypeId       = createDocumentInfo.TypeId;
            DataModel.Entity.Rows.Add(entityRow);

            // This will create the client side version of all the properties associated with this document.
            foreach (PropertyStoreInfo propertyStoreInfo in createDocumentInfo.Properties)
            {
                DataModel.PropertyStoreRow viewerPropertyRow = DataModel.PropertyStore.NewRow() as DataModel.PropertyStoreRow;
                viewerPropertyRow.EntityId        = createDocumentInfo.EntityId;
                viewerPropertyRow.PropertyId      = propertyStoreInfo.PropertyId;
                viewerPropertyRow.PropertyStoreId = propertyStoreInfo.PropertyStoreId;
                viewerPropertyRow.RowVersion      = 0;
                viewerPropertyRow.Value           = propertyStoreInfo.Value;
                DataModel.PropertyStore.Rows.Add(viewerPropertyRow);
            }

            // Finally, we need a relation built between the parent container and this document.
            DataModel.EntityTreeRow entityTreeRow = DataModel.EntityTree.NewRow() as DataModel.EntityTreeRow;
            entityTreeRow.ParentId     = parentItem.EntityId;
            entityTreeRow.ChildId      = createDocumentInfo.EntityId;
            entityTreeRow.EntityTreeId = createDocumentInfo.EntityTreeId;
            entityTreeRow.RowVersion   = 0;
            DataModel.EntityTree.Rows.Add(entityTreeRow);

            // The object will be added to the common data model from a background thread.
            ThreadPool.QueueUserWorkItem(DirectoryPage.CreateItemThread, createDocumentInfo);
        }
Beispiel #20
0
 set => SetValue(DocumentProperty, value);
Beispiel #21
0
        static void Main(string[] args)
        {
            var reg_prt = new System.Text.RegularExpressions.Regex(@"(.+)\.prt(?:.\d+)?$");
            var reg_asm = new System.Text.RegularExpressions.Regex(@"(.+)\.asm(?:.\d+)?$");

            Console.WriteLine(GetFileWithoutExt("GB5781"));
            Console.WriteLine(GetFileWithoutExt("GB5781.prt"));
            Console.WriteLine(GetFileWithoutExt("GB5781.prt.23"));
            Console.WriteLine(GetFileWithoutExt("M12X30_GB5781.asm"));
            Console.WriteLine(GetFileWithoutExt("M12X30_GB5781.asm.677"));

            Console.WriteLine(Path.GetFileNameWithoutExtension("GB5781"));
            Console.WriteLine(Path.GetFileNameWithoutExtension("GB5781.prt.1"));
            Console.WriteLine(Path.GetFileNameWithoutExtension("M12X30_GB5781.asm.1"));
            Console.Read();
            return;

            //var t = getTime();
            if (DateTime.Now >= new DateTime(2014, 8, 1))
            {
                Console.WriteLine("dayu");
            }

            //AssociateFieldConllection collent = new AssociateFieldConllection();
            //collent.Add(new Associatefield("MaterialCode", "MODEL_NAME", true, 0, 0, false, "物料编码", true));
            //collent.Add(new Associatefield("MaterialSpec", "SPEC", false, 0, 0, false, "物料规格", false));
            //collent.Add(new Associatefield("MaterialSubstance", "MATERIAL", false, 0, 0, false, "物料材质", false));
            //collent.Add(new Associatefield("MaterialName", "DESCRIPTION", false, 0, 0, false, "物料名称", false));
            //collent.Add(new Associatefield("MaterialDrawNumber", "DRAWNO", false, 0, 0, false, "图号", false));

            //CreoOperate op = new CreoOperate();

            //op.AppTypeName = "PROE";
            //op.IntegType = Proway.PLM.Document.IntegrationType.PROE;
            //op.CategoryId = "affba405-d687-488b-8bb7-05e9a8a986ed";
            //op.WorkId = "";
            //op.CurOperatePosition =  Proway.PLM.Document.OperatePosition.CheckIn;
            //op.FolderId = "60C4C5B7-0107-4F41-9147-F8904FAC6728";
            //op.FileTypeId = "4be5f1a4-db00-4aa4-88cf-a8a5c48a88bf";
            //op.UserId = "FFB0AC2D-C1B5-49E2-89B2-F4058523DF18";
            //op.IsCreateCopy = false;
            //op.IsOperateBOM = true;
            //op.IndexFields = collent;

            ////op.CheckDoc(BOMJSON);

            //Dictionary<string,object> dic = new Dictionary<string,object>();

            //BOMHelp.Write(dic, _.MultiConfiguration, true);

            //var aa = dic.GetValue(_.MultiConfiguration, false);

            //Console.WriteLine(aa);


            //Console.WriteLine(OSHelp.IsVistaAndSubsequentVersion);
            //Console.WriteLine(OSHelp.IsWin7);

            //AccessControl.FileInfoAccessControl(@"c:\111.txt");
            //AccessControl.DirectoryInfoAccessControl(@"c:\111");

            //var regk = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Wow6432Node\\PTC");
            //Console.WriteLine(regk == null);

            //CreoClient creo = new CreoClient();
            //var aa = creo.GetBom();

            //测试版本
            //Console.WriteLine(OSHelp.GetExcutePlatform(@"D:\github\learn\Creo\CreoTest\Creo.Setup\pubilc\PLM64.dll").ToString());
            //Console.WriteLine(OSHelp.GetExcutePlatform(@"D:\github\learn\Creo\CreoTest\Creo.Setup\pubilc\PLM.dll").ToString());

            //Console.WriteLine(OSHelp.GetExcutePlatform(@"C:\Program Files\Kingdee\K3PLM\Integration\Proe\PLM.dll").ToString());

            foreach (var item in FileAndDirectoryManager.SearchFile(@"D:\MyWork\PTC\Creo 2.0\Common Files\M060\",
                                                                    new string[] { "i486_nt\\obj", "x86e_win64\\obj" }, "xtop.exe"))
            {
                Console.WriteLine(item);
            }

            if (UACHelp.IsRunAsAdmin())
            {
                Console.WriteLine("管理员启动");
            }
            else
            {
                Console.WriteLine("非管理员启动");
            }

            //CreoSetup setup = new CreoSetup();
            //setup.SourceDefaultDir = @"D:\Program Files\kingdee\K3PLM\Integration\Integration Setup\Resources";
            //setup.UserDefaultDir = @"C:\Program Files\Kingdee\K3PLM\Integration";

            //setup.CopyMenuFile();

            //ProcessStartInfo proc = new ProcessStartInfo();
            //proc.UseShellExecute = true;
            //proc.WorkingDirectory = Environment.CurrentDirectory;
            //proc.FileName = Application.ExecutablePath;
            //proc.Verb = "runas"; //使用管理员启动

            //string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ptc\\output.txt";
            //DocumentProperty docprop1 = DocumentProperty.LoadXml(path, Encoding.Default);
            //Console.WriteLine(docprop1.Count);

            //CreoClient cc = new CreoClient();
            //Console.WriteLine(cc.GetCurrentFileName());
            //Console.WriteLine(cc.GetCurrentFilePath());
            //Console.WriteLine(cc.GetCurrentFullPath());

            //var bom = cc.GetBom();

            //var aa = bom.Count;

            Console.Read();

            return;

#if false
            DocumentProperty docprop = new DocumentProperty();

            int index = 1;

            var partprop = getPartData("00" + index, index, "asm");
            docprop.Add(partprop);

            partprop.ChildRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "3" }, { "count", "1" }
            });
            partprop.ChildRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "5" }, { "count", "2" }
            });
            partprop.ChildRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "6" }, { "count", "1" }
            });
            partprop.ChildRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "7" }, { "count", "1" }
            });

            partprop.ObjectRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "2" }
            });

            index++;
            partprop = getPartData("00" + index, index, "drw");//2
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "prt");//3
            partprop.ObjectRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "4" }
            });
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "drw");//4
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "prt");//5
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "prt");//6
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "asm");//7
            partprop.ChildRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "8" }, { "count", "1" }
            });
            partprop.ChildRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "9" }, { "count", "10" }
            });
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "prt");//8
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "prt");//9
            docprop.Add(partprop);

            docprop.SaveXml(@"c:\123.txt");
#endif
        }