Esempio n. 1
0
        public static Document Create(string xml)
        {
            try
            {
                xml = xml.Trim();

                var version = MTConnect.Version.Get(xml);

                using (var textReader = new StringReader(Namespaces.Clear(xml)))
                    using (var xmlReader = XmlReader.Create(textReader))
                    {
                        var doc = (Document)serializer.Deserialize(xmlReader);
                        if (doc != null)
                        {
                            doc._version = version;
                            return(doc);
                        }
                    }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(null);
        }
 public void Reset()
 {
     Namespaces.Clear();
     _currentNamespace = null;
     _currentEntity    = null;
     _currentProperty  = null;
 }
Esempio n. 3
0
        private void ChangeActiveTaxonomy(TaxonomyItem newTaxonomyItem)
        {
            // handle the case where no taxonomy is selected
            // this can happen when all taxonomies are closed
            if (newTaxonomyItem == null)
            {
                Namespaces.Clear();
                CurrentDirectory = "";
                return;
            }

            var taxonomy = newTaxonomyItem.Taxonomy.Value;

            Namespaces.Clear();
            foreach (var ns in taxonomy.AllNamespaces())
            {
                var namespaceItem = new NamespaceItem(ns);
                foreach (var tag in taxonomy.TagsInNamespace(ns))
                {
                    namespaceItem.Tags.Add(tag);
                }
                Namespaces.Add(namespaceItem);
            }
            CurrentDirectory = taxonomy.RootPath;
        }
Esempio n. 4
0
        public static CuttingTool Read(string xml)
        {
            try
            {
                xml = xml.Trim();

                XmlSerializer serializer = new XmlSerializer(typeof(CuttingTool));

                using (var textReader = new StringReader(Namespaces.Clear(xml)))
                    using (var xmlReader = XmlReader.Create(textReader))
                    {
                        var obj = (CuttingTool)serializer.Deserialize(xmlReader);
                        if (obj != null)
                        {
                            obj.Xml = xml;
                            return(obj);
                        }
                    }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(null);
        }
Esempio n. 5
0
        public virtual void Reset()
        {
            References = new AssemblyReferences(DefaultReferences);
            Namespaces.Clear();
            ImportNamespaces(DefaultNamespaces);

            ScriptPackSession.State.Clear();
        }
Esempio n. 6
0
 public void Reset()
 {
     RootNamespaces.Clear();
     Namespaces.Clear();
     Symbols.Clear();
     LastError = string.Empty;
     FileName  = null;
 }
 /// <summary>
 /// Adds a namespace to the referenced namespaces
 /// used at compile time.
 /// </summary>
 /// <param name="nameSpace"></param>
 public void AddNamespace(string nameSpace)
 {
     if (string.IsNullOrEmpty(nameSpace))
     {
         Namespaces.Clear();
         return;
     }
     Namespaces.Add(nameSpace);
 }
 public static void LoadFromConfiguration()
 {
     Namespaces.Clear();
     foreach (var configuration in MappingConfiguration.Assemblies.Values)
     {
         LoadFromAssembly(configuration);
     }
     ExtractTypes(Namespaces);
 }
 public void ClearAll(LoginatorViewModel loginator)
 {
     DispatcherHelper.CheckBeginInvokeOnUI(() => {
         lock (ViewModelConstants.SYNC_OBJECT) {
             Logs.Clear();
             Namespaces.Clear();
             Applications.Clear();
         }
     });
 }
Esempio n. 10
0
 public static void LoadFrom(Dictionary <string, Assembly> assemblies)
 {
     Namespaces.Clear();
     foreach (var rootNamespace in assemblies.Keys)
     {
         var assembly = assemblies[rootNamespace];
         LoadFromAssembly(assembly, rootNamespace);
     }
     ExtractTypes(Namespaces);
 }
 public void Clear()
 {
     //Includes.Clear();
     Methods.Clear();
     Fields.Clear();
     Structs.Clear();
     Typedefs.Clear();
     Enrichments.Clear();
     Usings.Clear();
     Namespaces.Clear();
 }
Esempio n. 12
0
        public static Document Create(string xml)
        {
            try
            {
                xml = xml.Trim();

                var version = MTConnect.Version.Get(xml);

                var serializer = new XmlSerializer(typeof(Document));
                using (var textReader = new StringReader(Namespaces.Clear(xml)))
                    using (var xmlReader = XmlReader.Create(textReader))
                    {
                        var doc = (Document)serializer.Deserialize(xmlReader);
                        if (doc != null)
                        {
                            if (doc.Devices != null && doc.Devices.Count > 0)
                            {
                                // Assign XPaths for each Device
                                foreach (var device in doc.Devices)
                                {
                                    device.AssignXPaths();
                                }

                                // Assign TypePaths for each Device
                                foreach (var device in doc.Devices)
                                {
                                    device.AssignTypePaths();
                                }
                            }

                            doc._version = version;
                            return(doc);
                        }
                    }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(null);
        }
Esempio n. 13
0
 public void Dispose()
 {
     Namespaces.Clear();
     Scripts.Clear();
     IndexTable.Clear();
 }
Esempio n. 14
0
 public void Add(UnitorModel model)
 {
     Types.AddRange(model.Types);
     Namespaces.Clear();
     Namespaces.AddRange(Types.Select(t => t.Namespace).Distinct());
 }