/// <summary>
        ///     Перегружает файл и формирует индекс на его основе
        /// </summary>
        protected override void RebuildIndex()
        {
            ReloadLibSource();
            XElement indexXml = XElement.Load(_fileSource.Open("/index"));

            foreach (XElement xcls in indexXml.Elements("class"))
            {
                string key = xcls.Attr("fullcode");
                if (!Cache.ContainsKey(key))
                {
                    var desc = new BSharpRuntimeClassDescriptor();
                    desc.Fullname     = key;
                    desc.ResourceName = xcls.Attr("uri");
                    var cls = new BSharpRuntimeClass(Container);
                    cls.Fullname      = key;
                    cls.Name          = xcls.Attr("code");
                    cls.Namespace     = xcls.Attr("namespace");
                    cls.PrototypeCode = xcls.Attr("prototype");
                    cls.RuntimeCode   = xcls.Attr("runtime");
                    cls.Loaded        = false;
                    desc.CachedClass  = cls;

                    Cache[key] = desc;
                }
            }
        }
示例#2
0
        /*
         * Собственно, запуск процессора.
         */
        public void Process()
        {
            if (fileSource != null)
            {
                fileSource.Open();

                IDataRecord dataRecord;

                while ((dataRecord = fileSource.GetNextRecord()) != null)
                {
                    try
                    {
                        ToffLead lead = DataTransformer.MakeToffLead(dataRecord);

                        if (lead != null)
                        {
                            logLines.Add(string.Format(PATTERN_MESSAGE, lead.innOrOgrn, ToffAPI.createApplication(lead)));
                        }
                    }
                    catch (Exception e)
                    {
                        logLines.Add(e.ToString());
                    }
                }

                fileSource.Close();
            }
        }