public void IntTest()
        {
            var expectedResult = 356;

            nameValueMap.Value["IntValue"] = "356";


            int intValue = nameValueMap.AsInt("IntValue");

            Assert.Equal(expectedResult, intValue);
        }
Example #2
0
        public void RunWithArguments(Document doc, NameValueMap map)
        {
            LogTrace("Processing " + doc.FullFileName);

            try
            {
                // Using NameValueMapExtension
                if (map.HasKey("intIndex"))
                {
                    int intValue = map.AsInt("intIndex");
                    LogTrace($"Value of intIndex is: {intValue}");
                }

                if (map.HasKey("stringCollectionIndex"))
                {
                    IEnumerable <string> strCollection = map.AsStringCollection("stringCollectionIndex");

                    foreach (string strValue in strCollection)
                    {
                        LogTrace($"String value is: {strValue}");
                    }
                }

                if (doc.DocumentType == DocumentTypeEnum.kPartDocumentObject)
                {
                    using (new HeartBeat())
                    {
                        // TODO: handle the Inventor part here
                    }
                }
                else if (doc.DocumentType == DocumentTypeEnum.kAssemblyDocumentObject) // Assembly.
                {
                    using (new HeartBeat())
                    {
                        // TODO: handle the Inventor assembly here
                    }
                }
            }
            catch (Exception e)
            {
                LogError("Processing failed. " + e.ToString());
            }
        }