Ejemplo n.º 1
0
        /// <summary>
        /// Создать новый примитив - ящик по значениям параметров из строки таблицы
        /// </summary>
        /// <param name="rEntity">Строка таблицы со значениями параметров примитива</param>
        /// <param name="format">Формат файла конфигурации из которого была импортирована таблица</param>
        /// <param name="blockName">Наимнование блока (только при формате 'HEAP')</param>
        /// <returns>Объект примитива - ящик</returns>
        public static EntityCtor.ProxyEntity newBox(Settings.EntityParser.ProxyEntity entity /*, string blockName*/)
        {
            EntityCtor.ProxyEntity pEntityRes;
            double lAlongX = -1F, lAlongY = -1F, lAlongZ = -1;

            double [] ptDisplacement = new double[3];

            pEntityRes = new ProxyEntity(new Solid3d());

            // значения для параметров примитива
            lAlongX = double.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.BOX_LAENGTH_X).ToString()
                                   , System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture);
            lAlongY = double.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.BOX_LAENGTH_Y).ToString()
                                   , System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture);
            lAlongZ = double.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.BOX_LAENGTH_Z).ToString()
                                   , System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture);
            ptDisplacement[0] = double.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.BOX_PTDISPLACEMENT_X).ToString()
                                             , System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture);
            ptDisplacement[1] = double.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.BOX_PTDISPLACEMENT_Y).ToString()
                                             , System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture);
            ptDisplacement[2] = double.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.BOX_PTDISPLACEMENT_Z).ToString()
                                             , System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture);

            ((Solid3d)pEntityRes.m_entity).CreateBox(lAlongX, lAlongY, lAlongZ);
            pEntityRes.SetPoint3dDisplacement(ptDisplacement);

            //pEntityRes.m_BlockName = blockName;

            return(pEntityRes);
        }
Ejemplo n.º 2
0
        public void RemoveProxy()
        {
            Database db = HostApplicationServices.WorkingDatabase;
            ObjectId id = EntProxy.ObjectId;

            using (Transaction tr = db.TransactionManager.StartOpenCloseTransaction())
            {
                BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);

                foreach (ObjectId btrId in bt)
                {
                    BlockTableRecord btr = (BlockTableRecord)tr.GetObject(btrId, OpenMode.ForRead);

                    foreach (ObjectId entId in btr)
                    {
                        if (entId.ObjectClass.Name == "AcDbZombieEntity" && entId == id)
                        {
                            ProxyEntity ent = (ProxyEntity)tr.GetObject(entId, OpenMode.ForRead);

                            ent.UpgradeOpen();

                            using (DBObject newEnt = new Line())
                            {
                                ent.HandOverTo(newEnt, false, false);
                                newEnt.Erase();
                            }
                        }
                    }
                }

                tr.Commit();
            }
        }
Ejemplo n.º 3
0
 public ProxyEntity Get(ProxyEntity model)
 {
     using (LiGatherContext _db = new LiGatherContext())
     {
         return(_db.ProxyEntities.SingleOrDefault(t => t.Id == model.Id));
     }
 }
Ejemplo n.º 4
0
        public List <ProxyEntity> GetProxies()
        {
            Database           db     = HostApplicationServices.WorkingDatabase;
            List <ProxyEntity> result = new List <ProxyEntity>();

            using (Transaction tr = db.TransactionManager.StartOpenCloseTransaction())
            {
                BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);

                foreach (ObjectId btrId in bt)
                {
                    BlockTableRecord btr = (BlockTableRecord)tr.GetObject(btrId, OpenMode.ForRead);

                    foreach (ObjectId entId in btr)
                    {
                        if (entId.ObjectClass.Name == "AcDbZombieEntity")
                        {
                            ProxyEntity ent = (ProxyEntity)tr.GetObject(entId, OpenMode.ForRead);
                            result.Add(ent);
                        }
                    }
                }
                tr.Commit();

                return(result);
            }
            return(null);
        }
Ejemplo n.º 5
0
 public bool IsExist(ProxyEntity model)
 {
     using (LiGatherContext _db = new LiGatherContext())
     {
         return(_db.ProxyEntities.Any(t => t.IpAddress == model.IpAddress));
     }
 }
Ejemplo n.º 6
0
 GetObjClassName(DBObject obj)
 {
     // if this is a proxy we can't use the proxy class
     // name because we would get duplicates on the list
     // for each object.
     if (obj.IsAProxy)
     {
         ProxyObject proxyObj = obj as ProxyObject;
         if (proxyObj != null)
         {
             return(proxyObj.OriginalClassName);
         }
         else
         {
             ProxyEntity proxyEnt = obj as ProxyEntity;
             if (proxyEnt != null)
             {
                 return(proxyEnt.OriginalClassName);
             }
             else
             {
                 Debug.Assert(false);
                 return(obj.GetRXClass().Name);
             }
         }
     }
     else
     {
         return(obj.GetRXClass().Name);
     }
 }
Ejemplo n.º 7
0
 public void Update(ProxyEntity model)
 {
     using (LiGatherContext _db = new LiGatherContext())
     {
         _db.ProxyEntities.AddOrUpdate(model);
         _db.SaveChanges();
     }
 }
        /// <summary>
        /// Создать новый примитив - ящик по значениям параметров из строки таблицы
        /// </summary>
        /// <param name="rEntity">Строка таблицы со значениями параметров примитива</param>
        /// <param name="format">Формат файла конфигурации из которого была импортирована таблица</param>
        /// <param name="blockName">Наимнование блока (только при формате 'HEAP')</param>
        /// <returns>Объект примитива - ящик</returns>
        public static EntityParser.ProxyEntity newBox(DataRow rEntity, MSExcel.FORMAT format /*, string blockName*/)
        {
            EntityParser.ProxyEntity pEntityRes;

            string name = string.Empty;

            MSExcel.COMMAND_ENTITY command = MSExcel.COMMAND_ENTITY.UNKNOWN;

            if (TryParseCommandAndNameEntity(format, rEntity, out name, out command) == true)
            {
                // значения для параметров примитива
                switch (format)
                {
                case MSExcel.FORMAT.HEAP:
                    pEntityRes = new ProxyEntity(
                        name
                        , command
                        , new ProxyEntity.Property[] {
                        new ProxyEntity.Property((int)MSExcel.HEAP_INDEX_COLUMN.BOX_LAENGTH_X
                                                 , double.Parse(rEntity[(int)MSExcel.HEAP_INDEX_COLUMN.BOX_LAENGTH_X].ToString()
                                                                , System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture))
                        , new ProxyEntity.Property((int)MSExcel.HEAP_INDEX_COLUMN.BOX_LAENGTH_Y
                                                   , double.Parse(rEntity[(int)MSExcel.HEAP_INDEX_COLUMN.BOX_LAENGTH_Y].ToString()
                                                                  , System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture))
                        , new ProxyEntity.Property((int)MSExcel.HEAP_INDEX_COLUMN.BOX_LAENGTH_Z
                                                   , double.Parse(rEntity[(int)MSExcel.HEAP_INDEX_COLUMN.BOX_LAENGTH_Z].ToString()
                                                                  , System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture))
                        , new ProxyEntity.Property((int)MSExcel.HEAP_INDEX_COLUMN.BOX_PTDISPLACEMENT_X
                                                   , double.Parse(rEntity[(int)MSExcel.HEAP_INDEX_COLUMN.BOX_PTDISPLACEMENT_X].ToString()
                                                                  , System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture))
                        , new ProxyEntity.Property((int)MSExcel.HEAP_INDEX_COLUMN.BOX_PTDISPLACEMENT_Y
                                                   , double.Parse(rEntity[(int)MSExcel.HEAP_INDEX_COLUMN.BOX_PTDISPLACEMENT_Y].ToString()
                                                                  , System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture))
                        , new ProxyEntity.Property((int)MSExcel.HEAP_INDEX_COLUMN.BOX_PTDISPLACEMENT_Z
                                                   , double.Parse(rEntity[(int)MSExcel.HEAP_INDEX_COLUMN.BOX_PTDISPLACEMENT_Z].ToString()
                                                                  , System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture))
                    }
                        );

                    //pEntityRes.m_BlockName = blockName;
                    break;

                case MSExcel.FORMAT.ORDER:
                default:
                    // соэдать примитив по умолчанию
                    pEntityRes = new ProxyEntity();
                    break;
                }
            }
            else
            {
                pEntityRes = new ProxyEntity();

                Core.Logging.DebugCaller(MethodBase.GetCurrentMethod(), string.Format(@"Ошибка опрделения имени, типа  сущности..."));
            }

            return(pEntityRes);
        }
Ejemplo n.º 9
0
        public void ConstructorSetupDefault_DoesNotThrow()
        {
            Utils.MethodStart();

            Assert.DoesNotThrow(() => { _ = new ProxyEntity(); });
            Assert.DoesNotThrowAsync(async() => await Task.Run(() => { _ = new ProxyEntity(); }));

            Utils.MethodComplete();
        }
Ejemplo n.º 10
0
        public static void Main(string[] args)
        {
            Console.Title = "AivyCore - 1.0.0";

            configuration.AddRule(LogLevel.Debug, LogLevel.Fatal, log_console);
            LogManager.Configuration = configuration;

            try
            {
                string type = args[0];
                if (type == "-p")
                {
                    if (int.TryParse(args[1], out int proxy_type))
                    {
                        DofusMultiProxy multi_proxy = new DofusMultiProxy();
                        if (int.TryParse(args[2], out int proxy_port))
                        {
                            ProxyEntity p_entity = multi_proxy.Active((ProxyCallbackTypeEnum)proxy_type, true, proxy_port, args[3], args[4]);
                        }
                        else
                        {
                            throw new Exception();
                        }
                    }
                    else
                    {
                        throw new Exception();
                    }
                }
                if (type == "-s")
                {
                    // to do
                }
            }
            catch (Exception e)
            {
                LogManager.GetCurrentClassLogger().Fatal($"bad args {string.Join(" ", args)}\ntry with -> -type(s or p) parsing_type(2 or 1 or 0) port(number) folder_location(string) exe_name(string)");
                LogManager.GetCurrentClassLogger().Error(e);

                Console.ReadKey();
                Environment.Exit(0);
            }

            /*DofusRetroProxy r_proxy = new DofusRetroProxy(@"D:\retro\resources\app\retroclient");
             * ProxyEntity retro_entity = r_proxy.Active(true, 668);*/

            /*DofusProxy proxy = new DofusProxy(@"D:\AppDofus");
             * ProxyEntity p_entity = proxy.Active(true, 666);*/

            /*Thread.Sleep(2000);
             * ProxyEntity p2_entity = proxy.Active(true, 667);
             *
             * DofusServer server = new DofusServer(@"D:\AppDofus");
             * ServerEntity s_entity = server.Active(true, 777);*/

            Console.ReadLine();
        }
Ejemplo n.º 11
0
 public Proxy FromEntity(ProxyEntity entity)
 {
     return(new Proxy(entity.Host, entity.Port, entity.Type, entity.Username, entity.Password)
     {
         Id = entity.Id,
         Country = entity.Country,
         WorkingStatus = entity.Status,
         LastChecked = entity.LastChecked,
         Ping = entity.Ping
     });
 }
Ejemplo n.º 12
0
    public crawlAcDbProxyEntity(ProxyEntity prxy)
    {
        Entity ent = (Entity)prxy;

        this.ObjectId = ent.ObjectId.ToString();

        this.Layer      = prxy.Layer;
        this.Linetype   = prxy.Linetype;
        this.LineWeight = prxy.LineWeight.ToString();
        this.Color      = prxy.Color.ToString();
    }
Ejemplo n.º 13
0
        public ProxyAcceptCallback(ProxyEntity proxy)
            : base(proxy)
        {
            _client_api        = new OpenClientApi("./proxy_callback_api.json");
            _client_mapper     = new ClientEntityMapper();
            _client_repository = new ClientRepository(_client_api, _client_mapper);

            _client_creator      = new ClientCreatorRequest(_client_repository);
            _client_connector    = new ClientConnectorRequest(_client_repository);
            _client_disconnector = new ClientDisconnectorRequest(_client_repository);
            _client_linker       = new ClientLinkerRequest(_client_repository);
            _client_receiver     = new ClientReceiverRequest(_client_repository);
            _client_sender       = new ClientSenderRequest(_client_repository);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// 直接采集IP并更新到数据库
 /// </summary>
 /// <param name="countNum">采集IP总数</param>
 /// <param name="getNum">每次提取数量</param>
 /// <param name="isValidate">是否对代理验证</param>
 public void ProxySave(int countNum = 100, int getNum = 5, bool isValidate = false)
 {
     new Thread(() =>
     {
         while (true)
         {
             if (countNum == 0)
             {
                 break;
             }
             var ipLists = GetProxyByHttp(getNum).Split(Environment.NewLine.ToCharArray()).ExceptNull().ToList();
             foreach (var ipList in ipLists)
             {
                 var ipAndPort = ipList.Split(':');
                 if (string.IsNullOrWhiteSpace(ipList) || ipAndPort.Length < 2)
                 {
                     continue;
                 }
                 Console.WriteLine("获取到代理:" + ipList);
                 var model               = new ProxyEntity();
                 model.IpAddress         = ipAndPort[0];
                 model.Port              = Conv.ToInt(ipAndPort[1]);
                 model.Usage             = 0;
                 model.CreateTime        = DateTime.Now;
                 ProxyDomain proxyDomain = new ProxyDomain();
                 if (isValidate)
                 {
                     if (ThreadValidate.VerificationIp(model.IpAddress, model.Port))
                     {
                         if (!proxyDomain.IsExist(model))
                         {
                             proxyDomain.Add(model);
                         }
                         countNum--;
                     }
                 }
                 if (!proxyDomain.IsExist(model))
                 {
                     proxyDomain.Add(model);
                 }
                 countNum--;
             }
         }
         Console.WriteLine("IP采集完毕");
     })
     {
         IsBackground = false
     }.Start();
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Создать новый примитив - окружность по значениям параметров из строки таблицы
        /// </summary>
        /// <param name="rEntity">Строка таблицы со значениями параметров примитива</param>
        /// <param name="format">Формат файла конфигурации из которого была импортирована таблица</param>
        /// <param name="blockName">Наимнование блока (только при формате 'HEAP')</param>
        /// <returns>Объект примитива - окружность</returns>
        public static EntityCtor.ProxyEntity newCircle(Settings.EntityParser.ProxyEntity entity /*, string blockName*/)
        {
            EntityCtor.ProxyEntity pEntityRes;
            // соэдать примитив
            pEntityRes = new ProxyEntity(new Circle());
            // значения для параметров примитива
            (pEntityRes.m_entity as Circle).Center = new Point3d(
                double.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.CIRCLE_CENTER_X).ToString(), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture)
                , double.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.CIRCLE_CENTER_Y).ToString(), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture)
                , double.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.CIRCLE_CENTER_Z).ToString(), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture));
            (pEntityRes.m_entity as Circle).Radius     = double.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.CIRCLE_RADIUS).ToString(), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture);
            (pEntityRes.m_entity as Circle).ColorIndex = int.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.CIRCLE_COLORINDEX).ToString());
            (pEntityRes.m_entity as Circle).Thickness  = double.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.CIRCLE_TICKNESS).ToString(), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture);

            //pEntityRes.m_BlockName = blockName;
            return(pEntityRes);
        }
Ejemplo n.º 16
0
 public ProxyEntity Active <Callback>(bool active, int port, string folder_path) where Callback : ProxyAcceptCallback
 {
     if (active)
     {
         ProxyEntity result = _proxy_creator.Handle(folder_path, port);
         result = _proxy_activator.Handle(result, active, Activator.CreateInstance(typeof(Callback), new object[] { result }) as Callback);
         return(result);
     }
     else
     {
         if (_proxy_repository.Remove(x => x.Port == port))
         {
             return(null);
         }
         throw new ArgumentNullException($"cannot disable proxy with port : {port}");
     }
 }
Ejemplo n.º 17
0
 public virtual ProxyEntity Active(bool active, int port)
 {
     if (active)
     {
         ProxyEntity result = _proxy_creator.Handle(_exe_path, port);
         result = _proxy_activator.Handle(result, active, new DofusProxyAcceptCallback(result));
         return(result);
     }
     else
     {
         if (_proxy_repository.Remove(x => x.Port == port))
         {
             return(null);
         }
         throw new ArgumentNullException($"cannot disable proxy with port : {port}");
     }
 }
        public DofusProxyClientReceiveCallback(ClientEntity client,
                                               ClientEntity remote,
                                               ClientRepository repository,
                                               ClientCreatorRequest creator,
                                               ClientLinkerRequest linker,
                                               ClientConnectorRequest connector,
                                               ClientDisconnectorRequest disconnector,
                                               ClientSenderRequest sender,
                                               ProxyEntity proxy, ProxyTagEnum tag = ProxyTagEnum.UNKNOW)
            : base(client, remote, repository, creator, linker, connector, disconnector, sender, tag)
        {
            if (tag is ProxyTagEnum.UNKNOW)
            {
                throw new ArgumentNullException(nameof(tag));
            }

            _proxy = proxy ?? throw new ArgumentNullException(nameof(proxy));
        }
Ejemplo n.º 19
0
        public static void RemoveProxiesFromBlocks()
        {
            Database db = HostApplicationServices.WorkingDatabase;

            using (Transaction tr =
                       db.TransactionManager.StartOpenCloseTransaction())
            {
                BlockTable bt =
                    (BlockTable)tr.GetObject(
                        db.BlockTableId, OpenMode.ForRead);

                foreach (ObjectId btrId in bt)
                {
                    BlockTableRecord btr =
                        (BlockTableRecord)tr.GetObject(btrId, OpenMode.ForRead);

                    foreach (ObjectId entId in btr)
                    {
                        if (entId.ObjectClass.Name == "AcDbZombieEntity")
                        {
                            ProxyEntity ent =
                                (ProxyEntity)tr.GetObject(entId, OpenMode.ForRead);

                            // If you want to check what exact proxy it is
                            if (ent.ApplicationDescription != "ProxyToRemove")
                            {
                                return;
                            }

                            ent.UpgradeOpen();

                            using (DBObject newEnt = new Line())
                            {
                                ent.HandOverTo(newEnt, false, false);
                                newEnt.Erase();
                            }
                        }
                    }
                }

                tr.Commit();
            }
        }
        public static EntityCtor.ProxyEntity newRLineDecartZ(Settings.EntityParser.ProxyEntity entity /*, string blockName*/)
        {
            EntityCtor.ProxyEntity pEntityRes;
            string nameEntityRelative = string.Empty;

            // соэдать примитив
            pEntityRes = new ProxyEntity(new Line());
            // значения для параметров примитива
            nameEntityRelative = entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.RLINE_NAME_ENTITY_RELATIVE).ToString();

            (pEntityRes.m_entity as Line).StartPoint = Point3d.Origin;
            (pEntityRes.m_entity as Line).EndPoint   = new Point3d(
                Point3d.Origin.X
                , Point3d.Origin.Y
                , (double)entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.RLINE_LENGTH)
                );

            return(pEntityRes);
        }
        /// <summary>
        /// Создать новый примитив - линия по значениям параметров из строки таблицы
        /// </summary>
        /// <param name="rEntity">Строка таблицы со значениями параметров примитива</param>
        /// <param name="format">Формат файла конфигурации из которого была импортирована таблица</param>
        /// <param name="blockName">Наимнование блока (только при формате 'HEAP')</param>
        /// <returns>Объект примитива - линия</returns>
        public static EntityCtor.ProxyEntity newALineDecartY(Settings.EntityParser.ProxyEntity entity /*, string blockName*/)
        {
            EntityCtor.ProxyEntity pEntityRes;
            // соэдать примитив
            pEntityRes = new ProxyEntity(new Line());
            // значения для параметров примитива
            (pEntityRes.m_entity as Line).StartPoint = new Point3d(
                (double)entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.ALINE_START_DECART_X)
                , (double)entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.ALINE_START_DECART_Y)
                , (double)entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.ALINE_START_DECART_Z));
            (pEntityRes.m_entity as Line).EndPoint = new Point3d(
                (pEntityRes.m_entity as Line).StartPoint.X
                , (pEntityRes.m_entity as Line).StartPoint.Y +
                (double)entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.ALINE_LENGTH)
                , (pEntityRes.m_entity as Line).StartPoint.Z);
            (pEntityRes.m_entity as Line).ColorIndex = int.Parse(entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.ALINE_COLORINDEX).ToString());
            (pEntityRes.m_entity as Line).Thickness  = (double)entity.GetProperty(Settings.MSExcel.HEAP_INDEX_COLUMN.ALINE_TICKNESS);

            return(pEntityRes);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 通过在线代理直接获取未验证的IP代理
        /// 主要用于本地IP代理库存不足,临时获取
        /// </summary>
        /// <returns></returns>
        public ProxyEntity GetHttProxyEntity()
        {
            var ipList    = GetProxyByHttp();
            var ipAndPort = ipList.Split(':');
            var model     = new ProxyEntity();

            model.IpAddress   = ipAndPort[0];
            model.Port        = Conv.ToInt(ipAndPort[1]);
            model.Usage       = 1;
            model.CanUse      = true;
            model.CreateTime  = DateTime.Now;
            model.LastUseTime = DateTime.Now;
            ProxyDomain proxyDomain = new ProxyDomain();

            if (!proxyDomain.IsExist(model))
            {
                proxyDomain.Add(model);
            }
            return(model);
        }
Ejemplo n.º 23
0
        public void OpenAsyncTask_DoesNotThrow()
        {
            Utils.MethodStart();

            foreach (var timeout in EnumValues.GetTimeoutMs())
            {
                foreach (var host in EnumValues.GetUri())
                {
                    Assert.DoesNotThrow(() =>
                    {
                        TestContext.WriteLine($@"Assert.DoesNotThrow. timeout: {timeout}. host: {host}");
                        var proxy      = new ProxyEntity();
                        var httpClient = new HttpClientEntity(timeout, host);
                        TestContext.WriteLine($@"{httpClient.Settings}");
                        var task = Task.Run(async() =>
                        {
                            await httpClient.OpenAsync(proxy).ConfigureAwait(true);
                        });
                        task.Wait();
                        TestContext.WriteLine($@"{httpClient.Log}");
                    });
                    Assert.DoesNotThrowAsync(async() => await Task.Run(() =>
                    {
                        TestContext.WriteLine($@"Assert.DoesNotThrow. timeout: {timeout}. host: {host}");
                        var proxy      = new ProxyEntity();
                        var httpClient = new HttpClientEntity(timeout, host);
                        TestContext.WriteLine($@"{httpClient.Settings}");
                        var task = Task.Run(async() =>
                        {
                            await httpClient.OpenAsync(proxy).ConfigureAwait(true);
                        });
                        task.Wait();
                        TestContext.WriteLine($@"{httpClient.Log}");
                    }));
                }
            }

            Utils.MethodComplete();
        }
Ejemplo n.º 24
0
 public void LockUpdate(ProxyEntity model)
 {
     using (LiGatherContext _db = new LiGatherContext())
     {
         var proxyEntity = _db.ProxyEntities.Where(t => t.Id == model.Id && t.CanUse == true).ToList();
         if (!proxyEntity.Any())
         {
             return;
         }
         _db.ProxyEntities.AddOrUpdate(model);
         var i = _db.SaveChanges();
         if (i == 0)
         {
             Console.WriteLine("EF 内存泄露,启动清扫策略。");
             //日志记录
             new LogDomain().Add(new LogEntity {
                 ErrorDetails = "EF 内存泄露,启动清扫策略。", TriggerTime = DateTime.Now
             });
             _db.Database.ExecuteSqlCommand("update ProxyEntity set CanUse=0 where CanUse!=0");
         }
         Console.WriteLine("移除失效代理:{0}:{1}", model.IpAddress, model.Port);
     }
 }
Ejemplo n.º 25
0
        public void ConstructorSetup_DoesNotThrow()
        {
            Utils.MethodStart();

            foreach (var use in EnumValues.GetBool())
            {
                foreach (var useDefaultCredentials in EnumValues.GetBool())
                {
                    foreach (var host in EnumValues.GetUri())
                    {
                        foreach (var port in EnumValues.GetInt())
                        {
                            foreach (var domain in EnumValues.GetString())
                            {
                                foreach (var username in EnumValues.GetString())
                                {
                                    foreach (var password in EnumValues.GetString())
                                    {
                                        Assert.DoesNotThrow(() =>
                                        {
                                            _ = new ProxyEntity(use, useDefaultCredentials, host, port, domain, username, password);
                                        });
                                        Assert.DoesNotThrowAsync(async() => await Task.Run(() =>
                                        {
                                            _ = new ProxyEntity(use, useDefaultCredentials, host, port, domain, username, password);
                                        }));
                                    }
                                }
                            }
                        }
                    }
                }
            }

            Utils.MethodComplete();
        }
 /// <summary>
 /// There are no comments for ProxyEntitySet in the schema.
 /// </summary>
 public void AddToProxyEntitySet(ProxyEntity proxyEntity)
 {
     base.AddObject("ProxyEntitySet", proxyEntity);
 }
 /// <summary>
 /// Create a new ProxyEntity object.
 /// </summary>
 /// <param name="id">Initial value of Id.</param>
 /// <param name="uuid">Initial value of Uuid.</param>
 /// <param name="relationshipDescription">Initial value of RelationshipDescription.</param>
 public static ProxyEntity CreateProxyEntity(int id, global::System.Guid uuid, string relationshipDescription)
 {
     ProxyEntity proxyEntity = new ProxyEntity();
     proxyEntity.Id = id;
     proxyEntity.Uuid = uuid;
     proxyEntity.RelationshipDescription = relationshipDescription;
     return proxyEntity;
 }
Ejemplo n.º 28
0
        public async void SpiderData()
        {
            Log.ClsLog          clsLog         = new Log.ClsLog();
            Page.ClsPageContent clsPageContent = new Page.ClsPageContent();
            SnatchAt            sa             = new SnatchAt();
            string PContent = "";
            Bitmap MContent = null;

            UrlContorl      urlContorl = new UrlContorl();
            CookieContainer cookies    = new CookieContainer();
            ProxyEntity     proxy      = new ProxyEntity();

            Common.NetContorl netContorl = new Common.NetContorl();

            CancellationTokenSource tokenSource = new CancellationTokenSource();
            HttpClient _client = new HttpClient("", 0, false);

            //Links.ForEach(url =>//串行
            //Parallel.ForEach<PageUrlEntity>(Program.pageUrlList.GetConsumingEnumerable(), new ParallelOptions() { MaxDegreeOfParallelism = 5 }, pageUrlEntity =>
            //找出要抓取的Url
            foreach (PageUrlEntity pageUrlEntity in Program.pageUrlList.GetConsumingEnumerable())
            {
                //判断分析队列中的页面数是否大于最大分析队列页面数,如果大于则休眠系统设置时间
                if (Program.clsContentSignal >= Program.sysPara.MaxPage)
                {
                    Thread.Sleep(Program.sysPara.SpiderSleepTime);
                }

                if (Program.sysPara.IsProxy == "true")
                {
                    proxy = netContorl.GetProxyEntity_URL();
                    while (proxy == null)
                    {
                        Thread.Sleep(Program.sysPara.NetSleepTime);
                        proxy = netContorl.GetProxyEntity_URL();
                    }
                    _client = new HttpClient(proxy.proxyAddess.Split(':')[0].ToString(), Convert.ToInt32(proxy.proxyAddess.Split(':')[1].ToString()), false);
                }

                //开始抓取数据
                try
                {
                    //抓取数据
                    try
                    {
                        PContent = "";
                        MContent = null;

                        if (pageUrlEntity.UrlType == "MGET")
                        {
                            PContent = _client.GetResponse(pageUrlEntity.SourUrl, pageUrlEntity.Url, pageUrlEntity.UrlType, pageUrlEntity.UrlPara, pageUrlEntity.EnCode);
                            pageUrlEntity.CookieContent = cookies;
                            pageUrlEntity.PContent      = "";
                            if (MContent == null)
                            {
                                throw new Exception("空图片");
                            }
                            clsPageContent.AddPageContent(pageUrlEntity, MContent);
                        }
                        else
                        {
                            PContent = _client.GetResponse(pageUrlEntity.SourUrl, pageUrlEntity.Url, pageUrlEntity.UrlType, pageUrlEntity.UrlPara, pageUrlEntity.EnCode);
                            pageUrlEntity.CookieContent = cookies;
                            pageUrlEntity.PContent      = PContent;
                            if (PContent == "")
                            {
                                throw new Exception("空页面");
                            }
                            if (PContent.Contains("超时"))
                            {
                                throw new Exception("操作超时");
                            }
                            clsPageContent.AddPageContent(pageUrlEntity, PContent);
                        }
                    }
                    catch (Exception ex)
                    {
                        clsLog.AddLog(DateTime.Now.ToString(), "抓取数据失败" + ex.ToString());
                        clsLog.AddLog(DateTime.Now.ToString(), pageUrlEntity.SType + ";" + pageUrlEntity.Url + ";");
                        urlContorl.SaveUrl(pageUrlEntity, PContent, ex.ToString());
                    }
                }
                catch (Exception ex)
                {
                    clsLog.AddLog(DateTime.Now.ToString(), "抓取失败" + ex.ToString());
                    clsLog.AddLog(DateTime.Now.ToString(), pageUrlEntity.SType + ";" + pageUrlEntity.Url + ";");
                    urlContorl.SaveUrl(pageUrlEntity, PContent, ex.ToString());
                }
                Interlocked.Decrement(ref Program.clsUrlSignal);

                Thread.SpinWait(Program.sysPara.BegSpiderIntervalTime + Program.sysPara.IntervalSpiderIntervalTime * (Program.CurrSpiderTimes - 1));
            }
        }
Ejemplo n.º 29
0
        public static CADShape ToCADShape(this ObjectId objId, bool isToUCS)
        {
            CADShape sp = new CADShape();

            try
            {
                //var dbObject = objId.QOpenForRead();
                var entity = objId.QOpenForRead <Entity>();
                sp.Name  = entity.GetType().Name;
                sp.Type  = entity.GetType().Name;
                sp.Layer = entity.Layer;
                if (entity is BlockReference)
                {
                    sp.Name = "Block";
                    sp.AddPoints(entity as BlockReference, isToUCS);
                }
                else if (entity is Line)
                {
                    sp.AddPoints(entity as Line, isToUCS);
                }
                else if (entity is Polyline)
                {
                    sp.AddPoints(entity as Polyline, isToUCS);

                    // string name = GetRoomsCommand.GetText(entity.Bounds.MinPoint, entity.Bounds.MaxPoint);
                }
                else if (entity is MLeader)
                {
                    MLeader mleader = entity as MLeader;
                    if (mleader.MText != null)
                    {
                        sp.Text = mleader.MText.Text;
                    }
                    //sp.AddPoints(entity as MLeader);
                }
                else if (entity is Circle)
                {
                    Circle circle = entity as Circle;
                    //if (mleader.MText != null)
                    //    sp.Text = mleader.MText.Text;
                    sp.AddPoints(circle, isToUCS);
                }
                else if (entity is MText)
                {
                    MText text = entity as MText;
                    sp.Text = text.Text;
                    //text.InsertionPoint(0);
                    sp.AddPoints(text, isToUCS);
                }
                else if (entity is DBText)
                {
                    DBText text = entity as DBText;
                    sp.Text = text.TextString;
                    //text.InsertionPoint(0);
                    sp.AddPoints(text, isToUCS);
                }

                else if (entity is Hatch)
                {
                    Hatch hatch = entity as Hatch;
                    //sp.Text = text.Text;
                    //text.InsertionPoint(0);
                    sp.AddPoints(hatch, isToUCS);
                }
                else if (entity is ProxyEntity)
                {
                    ProxyEntity pe = entity as ProxyEntity;
                    sp.Name = pe.OriginalDxfName;
                    sp.Type = "ProxyEntity";
                    sp.Text = pe.OriginalClassName;
                }
                else
                {
                    //sp = null;
                    sp.AddPoints(entity, isToUCS);
                }

                // objId.q
            }
            catch (Exception ex)
            {
                sp.Name = "Exception";
                sp.Text = ex.Message;
            }

            return(sp);
        }
Ejemplo n.º 30
0
        public void SpiderData()
        {
            Log.ClsLog          clsLog         = new Log.ClsLog();
            Page.ClsPageContent clsPageContent = new Page.ClsPageContent();
            SnatchAt            sa             = new SnatchAt();
            string PContent = "";
            Bitmap MContent = null;

            UrlContorl      urlContorl = new UrlContorl();
            CookieContainer cookies    = new CookieContainer();
            ProxyEntity     proxy      = new ProxyEntity();

            Common.NetContorl netContorl = new Common.NetContorl();

            CancellationTokenSource tokenSource = new CancellationTokenSource();
            CookieContainer         cookie      = new CookieContainer();
            HttpClient _client = new HttpClient("", 0, false, cookie);

            //Links.ForEach(url =>//串行
            //Parallel.ForEach<PageUrlEntity>(Program.pageUrlList.GetConsumingEnumerable(), new ParallelOptions() { MaxDegreeOfParallelism = 5 }, pageUrlEntity =>
            //找出要抓取的Url
            foreach (PageUrlEntity pageUrlEntity in Program.pageUrlList.GetConsumingEnumerable())
            {
                if (pageUrlEntity.CookieContent != null)
                {
                    _client = new HttpClient("", 0, false, pageUrlEntity.CookieContent);
                    cookie  = pageUrlEntity.CookieContent;
                }
                //判断分析队列中的页面数是否大于最大分析队列页面数,如果大于则休眠系统设置时间
                if (Program.clsContentSignal >= Program.sysPara.MaxPage)
                {
                    Thread.Sleep(Program.sysPara.SpiderSleepTime);
                }

                if (Program.sysPara.IsProxy == "true")
                {
                    proxy = netContorl.GetProxyEntity_URL2();
                    while (proxy == null)
                    {
                        Thread.Sleep(Program.sysPara.NetSleepTime);
                        proxy = netContorl.GetProxyEntity_URL2();
                    }
                    proxy.proxyAddess = proxy.proxyAddess.Replace("http://", "");
                    if (pageUrlEntity.CookieContent.Count > 0)
                    {
                        _client = new HttpClient("", 0, false, pageUrlEntity.CookieContent);
                        cookie  = pageUrlEntity.CookieContent;
                    }
                    else
                    {
                        _client = new HttpClient(proxy.proxyAddess.Split(':')[0].ToString(), Convert.ToInt32(proxy.proxyAddess.Split(':')[1].ToString()), true, null);
                    }
                }
                int _spidertime = 1;
                //开始抓取数据
                try
                {
                    //抓取数据
                    try
                    {
                        PContent = "";
                        MContent = null;

                        if (pageUrlEntity.UrlType == "MGET")
                        {
                            PContent = _client.GetResponse(pageUrlEntity.SourUrl, pageUrlEntity.Url, pageUrlEntity.UrlType, pageUrlEntity.UrlPara, pageUrlEntity.EnCode);
                            pageUrlEntity.CookieContent = cookies;
                            pageUrlEntity.PContent      = "";
                            if (MContent == null)
                            {
                                throw new Exception("空图片");
                            }
                            clsPageContent.AddPageContent(pageUrlEntity, MContent);
                        }
                        else
                        {
                            PContent = _client.GetResponse(pageUrlEntity.SourUrl, pageUrlEntity.Url, pageUrlEntity.UrlType, pageUrlEntity.UrlPara, pageUrlEntity.EnCode);
                            pageUrlEntity.CookieContent = cookies;
                            pageUrlEntity.PContent      = PContent;
                            if (string.IsNullOrEmpty(PContent))
                            {
                                throw new Exception("空页面");
                            }
                            if (PContent.Contains("超时"))
                            {
                                throw new Exception("操作超时");
                            }
                            clsPageContent.AddPageContent(pageUrlEntity, PContent);
                        }
                    }
                    catch (Exception ex)
                    {
                        clsLog.AddLog(DateTime.Now.ToString(), "抓取数据失败" + ex.ToString());
                        clsLog.AddLog(DateTime.Now.ToString(), pageUrlEntity.SType + ";" + pageUrlEntity.Url + ";");
                        Program.helper.OntxtviewCompleted(this, new EventControllerArgs()
                        {
                            IsSuccess = true, Msg = "抓取数据失败" + ex.ToString()
                        });
                        Program.helper.OntxtviewCompleted(this, new EventControllerArgs()
                        {
                            IsSuccess = true, Msg = pageUrlEntity.SType + ";" + pageUrlEntity.Url + ";"
                        });

                        //urlContorl.SaveUrl(pageUrlEntity, PContent, ex.ToString());

                        //错误页面重抓
                        if (_spidertime < 4)
                        {
                            Program.helper.OntxtviewCompleted(this, new EventControllerArgs()
                            {
                                IsSuccess = true, Msg = "错误页面重抓"
                            });
                            if (Program.sysPara.IsProxy == "true")
                            {
                                proxy = netContorl.GetProxyEntity_URL2();
                                while (proxy == null)
                                {
                                    Thread.Sleep(Program.sysPara.NetSleepTime);
                                    proxy = netContorl.GetProxyEntity_URL2();
                                }
                                proxy.proxyAddess = proxy.proxyAddess.Replace("http://", "");
                                _client           = new HttpClient(proxy.proxyAddess.Split(':')[0].ToString(), Convert.ToInt32(proxy.proxyAddess.Split(':')[1].ToString()), true, pageUrlEntity.CookieContent);
                            }


                            PContent = "";
                            MContent = null;
                            Program.helper.OntxtviewCompleted(this, new EventControllerArgs()
                            {
                                IsSuccess = true, Msg = "第" + _spidertime + "次重抓"
                            });
                            if (pageUrlEntity.UrlType == "MGET")
                            {
                                PContent = _client.GetResponse(pageUrlEntity.SourUrl, pageUrlEntity.Url, pageUrlEntity.UrlType, pageUrlEntity.UrlPara, pageUrlEntity.EnCode);
                                pageUrlEntity.CookieContent = cookies;
                                pageUrlEntity.PContent      = "";
                                if (MContent == null)
                                {
                                    throw new Exception("空图片");
                                }
                                clsPageContent.AddPageContent(pageUrlEntity, MContent);
                            }
                            else
                            {
                                PContent = _client.GetResponse(pageUrlEntity.SourUrl, pageUrlEntity.Url, pageUrlEntity.UrlType, pageUrlEntity.UrlPara, pageUrlEntity.EnCode);
                                pageUrlEntity.CookieContent = cookies;
                                pageUrlEntity.PContent      = PContent;
                                if (string.IsNullOrEmpty(PContent))
                                {
                                    throw new Exception("空页面");
                                }
                                if (PContent.Contains("超时"))
                                {
                                    throw new Exception("操作超时");
                                }
                                clsPageContent.AddPageContent(pageUrlEntity, PContent);
                            }
                            Thread.Sleep(Program.sysPara.BegSpiderIntervalTime + Program.sysPara.IntervalSpiderIntervalTime * (Program.CurrSpiderTimes - 1));

                            _spidertime++;
                        }
                    }
                }
                catch (Exception ex)
                {
                    clsLog.AddLog(DateTime.Now.ToString(), "抓取失败" + ex.ToString());
                    clsLog.AddLog(DateTime.Now.ToString(), pageUrlEntity.SType + ";" + pageUrlEntity.Url + ";");
                    Program.helper.OntxtviewCompleted(this, new EventControllerArgs()
                    {
                        IsSuccess = true, Msg = "抓取数据失败" + ex.ToString()
                    });
                    Program.helper.OntxtviewCompleted(this, new EventControllerArgs()
                    {
                        IsSuccess = true, Msg = pageUrlEntity.SType + ";" + pageUrlEntity.Url + ";"
                    });

                    //urlContorl.SaveUrl(pageUrlEntity, PContent, ex.ToString());
                }
                Interlocked.Decrement(ref Program.clsUrlSignal);
                Program.helper.OnAllItemAnalyzeCompleted(this, new EventControllerArgs()
                {
                    IsSuccess = true
                });
                Thread.Sleep(Program.sysPara.BegSpiderIntervalTime + Program.sysPara.IntervalSpiderIntervalTime * (Program.CurrSpiderTimes - 1));
            }
        }
Ejemplo n.º 31
0
 public DofusRetroProxyAcceptCallback(ProxyEntity proxy, Account account)
     : base(proxy)
 {
     Account = account;
 }
Ejemplo n.º 32
0
        private string jsonGetObjectData(ObjectId id_platf)
        {
            string result = "";

            try
            {//Всякое может случиться
                //Открываем переданный в функцию объект на чтение, преобразуем его к Entity
                Entity ent = (Entity)id_platf.GetObject(OpenMode.ForRead);

                //Далее последовательно проверяем класс объекта на соответствие классам основных примитивов

                if (id_platf.ObjectClass.Name == "AcDbLine")
                {                                                       //Если объект - отрезок (line)
                    crawlAcDbLine kline = new crawlAcDbLine((Line)ent); //Преобразуем к типу линия
                    result = jsonHelper.To <crawlAcDbLine>(kline);
                }
                else if (id_platf.ObjectClass.Name == "AcDbPolyline")
                {//Если объект - полилиния
                    Polyline          kpLine = (Polyline)ent;
                    crawlAcDbPolyline jpline = new crawlAcDbPolyline(kpLine);
                    result = jsonHelper.To <crawlAcDbPolyline>(jpline);
                }
                else if (id_platf.ObjectClass.Name == "AcDb2dPolyline")
                {//2D полилиния - такие тоже попадаются
                    Polyline2d        kpLine = (Polyline2d)ent;
                    crawlAcDbPolyline jpline = new crawlAcDbPolyline(kpLine);
                    result = jsonHelper.To <crawlAcDbPolyline>(jpline);
                }
                else if (id_platf.ObjectClass.Name == "AcDb3dPolyline")
                {//2D полилиния - такие тоже попадаются
                    Polyline3d kpLine = (Polyline3d)ent;

                    crawlAcDbPolyline jpline = new crawlAcDbPolyline(kpLine);
                    result = jsonHelper.To <crawlAcDbPolyline>(jpline);
                }
                else if (id_platf.ObjectClass.Name == "AcDbText")
                { //Текст
                    DBText        dbtxt = (DBText)ent;
                    crawlAcDbText jtext = new crawlAcDbText(dbtxt);
                    result = jsonHelper.To <crawlAcDbText>(jtext);
                }
                else if (id_platf.ObjectClass.Name == "AcDbMText")
                {//Мтекст
                    MText          mtxt  = (MText)ent;
                    crawlAcDbMText jtext = new crawlAcDbMText(mtxt);
                    result = jsonHelper.To <crawlAcDbMText>(jtext);
                }
                else if (id_platf.ObjectClass.Name == "AcDbArc")
                {//Дуга
                    Arc          arc  = (Arc)ent;
                    crawlAcDbArc cArc = new crawlAcDbArc(arc);
                    result = jsonHelper.To <crawlAcDbArc>(cArc);
                }
                else if (id_platf.ObjectClass.Name == "AcDbCircle")
                {//Окружность
                    Circle          circle  = (Circle)ent;
                    crawlAcDbCircle cCircle = new crawlAcDbCircle(circle);
                    result = jsonHelper.To <crawlAcDbCircle>(cCircle);
                }
                else if (id_platf.ObjectClass.Name == "AcDbEllipse")
                {  //Эллипс
                    Ellipse          el   = (Ellipse)ent;
                    crawlAcDbEllipse cEll = new crawlAcDbEllipse(el);
                    result = jsonHelper.To <crawlAcDbEllipse>(cEll);
                }
                else if (id_platf.ObjectClass.Name == "AcDbAlignedDimension")
                {//Размер повернутый
                    AlignedDimension dim = (AlignedDimension)ent;

                    crawlAcDbAlignedDimension rDim = new crawlAcDbAlignedDimension(dim);
                    result = jsonHelper.To <crawlAcDbAlignedDimension>(rDim);
                }

                else if (id_platf.ObjectClass.Name == "AcDbRotatedDimension")
                {//Размер повернутый
                    RotatedDimension dim = (RotatedDimension)ent;

                    crawlAcDbRotatedDimension rDim = new crawlAcDbRotatedDimension(dim);
                    result = jsonHelper.To <crawlAcDbRotatedDimension>(rDim);
                }

                else if (id_platf.ObjectClass.Name == "AcDbPoint3AngularDimension")
                {//Угловой размер по 3 точкам
                    Point3AngularDimension dim = (Point3AngularDimension)ent;

                    crawlAcDbPoint3AngularDimension rDim = new crawlAcDbPoint3AngularDimension(dim);
                    result = jsonHelper.To <crawlAcDbPoint3AngularDimension>(rDim);
                }

                else if (id_platf.ObjectClass.Name == "AcDbLineAngularDimension2")
                {//Еще угловой размер по точкам
                    LineAngularDimension2 dim = (LineAngularDimension2)ent;

                    crawlAcDbLineAngularDimension2 rDim = new crawlAcDbLineAngularDimension2(dim);
                    result = jsonHelper.To <crawlAcDbLineAngularDimension2>(rDim);
                }
                else if (id_platf.ObjectClass.Name == "AcDbDiametricDimension")
                {  //Размер диаметра окружности
                    DiametricDimension          dim  = (DiametricDimension)ent;
                    crawlAcDbDiametricDimension rDim = new crawlAcDbDiametricDimension(dim);
                    result = jsonHelper.To <crawlAcDbDiametricDimension>(rDim);
                }
                else if (id_platf.ObjectClass.Name == "AcDbArcDimension")
                {  //Дуговой размер
                    ArcDimension          dim  = (ArcDimension)ent;
                    crawlAcDbArcDimension rDim = new crawlAcDbArcDimension(dim);
                    result = jsonHelper.To <crawlAcDbArcDimension>(rDim);
                }
                else if (id_platf.ObjectClass.Name == "AcDbRadialDimension")
                {  //Радиальный размер
                    RadialDimension          dim  = (RadialDimension)ent;
                    crawlAcDbRadialDimension rDim = new crawlAcDbRadialDimension(dim);
                    result = jsonHelper.To <crawlAcDbRadialDimension>(rDim);
                }
                else if (id_platf.ObjectClass.Name == "AcDbAttributeDefinition")
                {  //Атрибут блока
                    AttributeDefinition ad = (AttributeDefinition)ent;

                    crawlAcDbAttributeDefinition atd = new crawlAcDbAttributeDefinition(ad);
                    result = jsonHelper.To <crawlAcDbAttributeDefinition>(atd);
                }
                else if (id_platf.ObjectClass.Name == "AcDbHatch")
                {//Штриховка
                    Teigha.DatabaseServices.Hatch htch = ent as Teigha.DatabaseServices.Hatch;

                    crawlAcDbHatch cHtch = new crawlAcDbHatch(htch);
                    result = jsonHelper.To <crawlAcDbHatch>(cHtch);
                }
                else if (id_platf.ObjectClass.Name == "AcDbSpline")
                {//Сплайн
                    Spline spl = ent as Spline;

                    crawlAcDbSpline cScpline = new crawlAcDbSpline(spl);
                    result = jsonHelper.To <crawlAcDbSpline>(cScpline);
                }
                else if (id_platf.ObjectClass.Name == "AcDbPoint")
                {//Точка
                    DBPoint        Pnt = ent as DBPoint;
                    crawlAcDbPoint pt  = new crawlAcDbPoint(Pnt);
                    result = jsonHelper.To <crawlAcDbPoint>(pt);
                }

                else if (id_platf.ObjectClass.Name == "AcDbBlockReference")
                {//Блок
                    BlockReference          blk  = ent as BlockReference;
                    crawlAcDbBlockReference cBlk = new crawlAcDbBlockReference(blk);

                    result = jsonHelper.To <crawlAcDbBlockReference>(cBlk);

                    //newDocument(id_platf, result);
                }
                else if (id_platf.ObjectClass.Name == "AcDbProxyEntity")
                {//Прокси
                    ProxyEntity pxy = ent as ProxyEntity;


                    crawlAcDbProxyEntity cBlk = new crawlAcDbProxyEntity(pxy);

                    result = jsonHelper.To <crawlAcDbProxyEntity>(cBlk);

                    DocumentFromBlockOrProxy(id_platf, result);
                }
                else if (id_platf.ObjectClass.Name == "AcDbSolid")
                {//Солид 2Д
                    Solid solid = (Solid)ent;


                    crawlAcDbSolid cSld = new crawlAcDbSolid(solid);

                    result = jsonHelper.To <crawlAcDbSolid>(cSld);
                }

                /*
                 *
                 *
                 * else if (id_platf.ObjectClass.Name == "AcDbLeader")
                 * {  //Выноска Autocad
                 * Leader ld = (Leader)ent;
                 *
                 * if (ld.EndPoint.Z != 0 || ld.StartPoint.Z != 0)
                 * {
                 * //ed.WriteMessage("DEBUG: Преобразован объект: Выноска Autocad");
                 *
                 * ld.EndPoint = new Point3d(ld.EndPoint.X, ld.EndPoint.Y, 0);
                 * ld.StartPoint = new Point3d(ld.StartPoint.X, ld.StartPoint.Y, 0);
                 *
                 * result = true;
                 * };
                 *
                 * }
                 * /*
                 * else if (id_platf.ObjectClass.Name == "AcDbPolygonMesh")
                 * {
                 * BUG: В платформе нет API для доступа к вершинам сетей AcDbPolygonMesh и AcDbPolygonMesh и AcDbSurface
                 *
                 * }
                 * else if (id_platf.ObjectClass.Name == "AcDbSolid")
                 * {
                 * BUG: Чтобы плющить Solid-ы нужны API функции 3d
                 * }
                 * else if (id_platf.ObjectClass.Name == "AcDbRegion")
                 * {
                 * Region rgn = ent as Region;
                 * BUG: нет свойств у региона
                 * }
                 *
                 */
                else
                {
                    //Если объект не входит в число перечисленных типов,
                    //то выводим в командную строку класс этого необработанного объекта

                    cDebug.WriteLine("Не могу обработать тип объекта: " + id_platf.ObjectClass.Name);
                }
            }
            catch (System.Exception ex)
            {
                //Если что-то сломалось, то в командную строку выводится ошибка
                cDebug.WriteLine("Не могу преобразовать - ошибка: " + ex.Message);
            };

            //Возвращаем значение функции
            return(result);
        }