├── readMe.txt ├── libs ├── jint.dll ├── Newtonsoft.Json.dll └── System.Net.Http.dll ├── ShoppingWebCrawler.Host ├── Configs │ ├── redis.config.json │ ├── TCPServerConf.config │ ├── HotWords.txt │ └── SupportPlatforms.xml ├── Doc │ └── WebCrawlerDesign.jpg ├── packages.config ├── NativeMethods.cs └── PlatformCrawlers │ └── BaseRequest.cs ├── ShoppingWebCrawler.Host.DeskTop ├── Configs │ ├── redis.config.json │ └── desk │ │ └── quartz.config ├── Resources │ ├── close_16px_gray.ico │ ├── close_16px_light.ico │ └── radiotower_48X48.ico ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ └── AssemblyInfo.cs ├── Program.cs ├── packages.config ├── NativeMethods.cs ├── Services │ ├── TaobaoService.cs │ └── AlimamaService.cs ├── UI │ └── BaseForm.cs └── readMe.txt ├── SocketLibrary ├── Doc │ └── Performace.xls ├── NTCPMSG │ ├── Fakes │ │ └── Newtonsoft.Json.fakes │ ├── src │ │ └── TCP-V1.3.0.0 Source code.zip │ ├── packages.config │ ├── EntityPackage │ │ ├── readMe.txt │ │ ├── ProductBaseCollection.cs │ │ ├── Products │ │ │ ├── TmallProduct.cs │ │ │ ├── VipProduct.cs │ │ │ ├── YhdProduct.cs │ │ │ ├── ETaoProduct.cs │ │ │ ├── GuomeiProduct.cs │ │ │ ├── Zhe800Product.cs.txt │ │ │ ├── MogujieProduct.cs │ │ │ ├── DangdangProduct.cs │ │ │ ├── MeilishuoProduct.cs.txt │ │ │ ├── JingdongProduct.cs │ │ │ ├── SuningProduct.cs │ │ │ └── TaobaoProduct.cs │ │ ├── Arguments │ │ │ ├── RegisterPortArgument.cs │ │ │ ├── VipSearchResultBag.cs │ │ │ ├── KeyWordTag.cs │ │ │ ├── YouhuiquanFetchWebPageArgument.cs │ │ │ ├── BrandTag.cs │ │ │ ├── MogujieFetchWebPageArgument.cs │ │ │ └── SuningFetchWebPageArgument.cs │ │ ├── FilterFiled.cs │ │ ├── OrderRule.cs │ │ ├── IDataContainer.cs │ │ ├── OrderField.cs │ │ ├── YouhuiquanExistsModel.cs │ │ ├── SupportPlatform.cs │ │ ├── SupportPlatformEnum.cs │ │ ├── ResolvedSearchUrlWithParas.cs │ │ ├── MamaQuanOrProductTuiGuangResult.cs │ │ ├── DataResultContainer.cs │ │ └── QingTaoKeHideQuanResult.cs │ ├── Client │ │ ├── ConnectionState.cs │ │ ├── ISingleConnectionCable.cs │ │ └── WebCrawlerCollection.cs │ ├── Serialize │ │ ├── MessageType.cs │ │ ├── IMessageParse.cs │ │ ├── ISerialize.cs │ │ └── JsonSerializer.cs │ ├── InnerEvent.cs │ ├── Event │ │ ├── CableConnectedEventArgs.cs │ │ ├── AcceptEventArgs.cs │ │ ├── ErrorEventArgs.cs │ │ └── DisconnectEventArgs.cs │ ├── CommandConstants.cs │ └── MessageFlag.cs ├── ClientTest │ ├── app.config │ └── Program.cs ├── Example │ ├── app.config │ ├── Event.cs │ ├── Program.cs │ └── MessageConvert │ │ ├── BinMessageConvert.cs │ │ ├── XmlMessageConvert.cs │ │ ├── JsonMessageConvert.cs │ │ ├── SimpleBinMessageConvert.cs │ │ ├── CustomerSoapMessageConvert.cs │ │ └── DefaultMessageConvert.cs └── ServerTest │ ├── app.config │ └── MessageConvert │ ├── BinMessageConvert.cs │ ├── XmlMessageConvert.cs │ ├── JsonMessageConvert.cs │ ├── SimpleBinMessageConvert.cs │ ├── CustomerSoapMessageConvert.cs │ └── DefaultMessageConvert.cs ├── ShoppingWebCrawler.Host.Common ├── Caching │ └── ICacheManager.cs ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ └── AssemblyInfo.cs ├── packages.config ├── app.config ├── Common │ ├── PushToRedisCookiesEventArgs.cs │ └── TypeFinder │ │ ├── ITypeFinder.cs │ │ └── WebAppTypeFinder.cs └── Extensions │ ├── ProcessExtensions.cs │ └── EnumExtensions.cs ├── ShoppingWebCrawler.Cef.Core ├── packages.config ├── CefRuntimePlatform.cs ├── Classes.Handlers │ ├── CefUserData.cs │ ├── CefCompletionCallback.cs │ ├── CefStringVisitor.cs │ ├── CefSetCookieCallback.cs │ ├── CefDeleteCookiesCallback.cs │ ├── CefTask.cs │ ├── CefGetGeolocationCallback.cs │ ├── CefResolveCallback.cs │ ├── CefEndTracingCallback.cs │ ├── CefPdfPrintCallback.cs │ ├── CefWebPluginUnstableCallback.cs │ ├── CefDomVisitor.cs │ ├── CefWebPluginInfoVisitor.cs │ └── CefRunFileDialogCallback.cs ├── Interop │ ├── _Platform │ │ └── NativeMethods.cs │ ├── Base │ │ ├── cefglue_userdata_t.cs │ │ ├── bool_t.cs │ │ ├── cef_base_t.cs │ │ ├── cef_string_map.cs │ │ └── cef_string_t.cs │ ├── Structs │ │ ├── cef_cursor_info_t.cs │ │ ├── cef_draggable_region_t.cs │ │ ├── cef_point_t.cs │ │ ├── cef_page_range_t.cs │ │ ├── cef_size_t.cs │ │ ├── cef_mouse_event_t.cs │ │ ├── cef_screen_info_t.cs │ │ ├── cef_key_event_t.cs │ │ ├── cef_rect_t.cs │ │ ├── cef_geoposition_t.cs │ │ ├── cef_popup_features_t.cs │ │ ├── cef_urlparts_t.cs │ │ └── cef_request_context_settings_t.cs │ ├── version.g.cs │ └── libcef.cs ├── Enums │ ├── CefNavigationType.cs │ ├── CefProcessId.cs │ ├── CefStorageType.cs │ ├── CefPaintElementType.cs │ ├── CefMouseButtonType.cs │ ├── CefJSDialogType.cs │ ├── CefDuplexMode.cs │ ├── CefPostDataElementType.cs │ ├── CefDomDocumentType.cs │ ├── CefDomEventPhase.cs │ ├── CefMenuItemType.cs │ ├── CefGeopositionErrorCode.cs │ ├── CefValueType.cs │ ├── CefV8AccessControl.cs │ ├── CefV8PropertyAttribute.cs │ ├── CefFocusSource.cs │ ├── CefDomNodeType.cs │ ├── CefXmlNodeType.cs │ ├── CefWindowOpenDisposition.cs │ ├── CefJsonParserError.cs │ ├── CefReturnValue.cs │ ├── CefContextMenuEditStateFlags.cs │ ├── CefScaleFactor.cs │ ├── CefTerminationStatus.cs │ ├── CefXmlEncodingType.cs │ ├── CefDragOperationsMask.cs │ ├── CefContextMenuMediaStateFlags.cs │ ├── CefState.cs │ ├── CefJsonParserOptions.cs │ ├── CefPdfPrintMarginType.cs │ ├── CefDomEventCategory.cs │ ├── CefUrlRequestStatus.cs │ ├── CefEventFlags.cs │ ├── CefResponseFilterStatus.cs │ ├── CefPluginPolicy.cs │ ├── CefKeyEventType.cs │ ├── CefContextMenuMediaType.cs │ ├── CefContextSafetyImplementation.cs │ ├── CefLogSeverity.cs │ ├── CefColorModel.cs │ ├── CefContextMenuTypeFlags.cs │ └── CefCursorType.cs ├── Exceptions │ ├── CefRuntimeException.cs │ └── CefVersionMismatchException.cs ├── Platform │ └── Windows │ │ ├── LoadLibraryFlags.cs │ │ └── NativeMethods.cs ├── StringHelper.cs ├── Structs │ ├── CefPoint.cs │ ├── CefSize.cs │ ├── CefColor.cs │ ├── CefPageRange.cs │ ├── CefDraggableRegion.cs │ ├── CefRectangle.cs │ └── CefMouseEvent.cs └── Classes.Proxies │ ├── CefPrintJobCallback.cs │ ├── CefCallback.cs │ ├── CefGeolocationCallback.cs │ ├── CefPrintDialogCallback.cs │ ├── CefRequestCallback.cs │ ├── CefRunContextMenuCallback.cs │ ├── CefJSDialogCallback.cs │ ├── CefDownloadItemCallback.cs │ ├── CefBeforeDownloadCallback.cs │ ├── CefAuthCallback.cs │ └── CefFileDialogCallback.cs ├── ShoppingWebCrawler.Client ├── packages.config ├── App.config ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── ShoppingWebCrawler.Host.WindowService ├── readMe.txt ├── Program.cs ├── packages.config ├── App.config ├── Properties │ └── AssemblyInfo.cs ├── Configs │ └── winSer │ │ ├── quartz.config │ │ └── Quartz_Jobs_WinService001.xml └── ScheduleTasks │ └── ServiceHelthCheckerJob.cs └── ShoppingWebCrawler.Cef.Framework ├── PluginCrashedEventArgs.cs ├── TooltipEventArgs.cs ├── LoadStartEventArgs.cs ├── TitleChangedEventArgs.cs ├── RenderProcessTerminatedEventArgs.cs ├── LoadEndEventArgs.cs ├── AddressChangedEventArgs.cs ├── StatusMessageEventArgs.cs ├── ConsoleMessageEventArgs.cs ├── LoadingStateChangeEventArgs.cs ├── CookieVistCompletedEventAgrs.cs ├── NativeMethods.cs ├── LoadErrorEventArgs.cs ├── FilterSpecialUrlEventArgs.cs ├── Handler ├── CefWebRequestHandler.cs ├── DefaultContextMenuHandler.cs └── CefWebLoadHandler.cs └── BeforePopupEventArgs.cs /readMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micro-chen/ShoppingWebCrawler/HEAD/readMe.txt -------------------------------------------------------------------------------- /libs/jint.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micro-chen/ShoppingWebCrawler/HEAD/libs/jint.dll -------------------------------------------------------------------------------- /libs/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micro-chen/ShoppingWebCrawler/HEAD/libs/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /libs/System.Net.Http.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micro-chen/ShoppingWebCrawler/HEAD/libs/System.Net.Http.dll -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host/Configs/redis.config.json: -------------------------------------------------------------------------------- 1 | {"IpAddress":"127.0.0.1","Port":6379,"Pwd":"admin888","WhichDb":1} -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/Configs/redis.config.json: -------------------------------------------------------------------------------- 1 | {"IpAddress":"127.0.0.1","Port":6379,"Pwd":"admin888","WhichDb":1} -------------------------------------------------------------------------------- /SocketLibrary/Doc/Performace.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micro-chen/ShoppingWebCrawler/HEAD/SocketLibrary/Doc/Performace.xls -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host/Doc/WebCrawlerDesign.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micro-chen/ShoppingWebCrawler/HEAD/ShoppingWebCrawler.Host/Doc/WebCrawlerDesign.jpg -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/Fakes/Newtonsoft.Json.fakes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micro-chen/ShoppingWebCrawler/HEAD/SocketLibrary/NTCPMSG/Fakes/Newtonsoft.Json.fakes -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/src/TCP-V1.3.0.0 Source code.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micro-chen/ShoppingWebCrawler/HEAD/SocketLibrary/NTCPMSG/src/TCP-V1.3.0.0 Source code.zip -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.Common/Caching/ICacheManager.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micro-chen/ShoppingWebCrawler/HEAD/ShoppingWebCrawler.Host.Common/Caching/ICacheManager.cs -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/Resources/close_16px_gray.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micro-chen/ShoppingWebCrawler/HEAD/ShoppingWebCrawler.Host.DeskTop/Resources/close_16px_gray.ico -------------------------------------------------------------------------------- /SocketLibrary/ClientTest/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SocketLibrary/Example/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SocketLibrary/ServerTest/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Client/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/Resources/close_16px_light.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micro-chen/ShoppingWebCrawler/HEAD/ShoppingWebCrawler.Host.DeskTop/Resources/close_16px_light.ico -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/Resources/radiotower_48X48.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/micro-chen/ShoppingWebCrawler/HEAD/ShoppingWebCrawler.Host.DeskTop/Resources/radiotower_48X48.ico -------------------------------------------------------------------------------- /ShoppingWebCrawler.Client/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/CefRuntimePlatform.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | 5 | public enum CefRuntimePlatform 6 | { 7 | Windows, 8 | Linux, 9 | MacOSX, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host/Configs/TCPServerConf.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.Common/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SocketLibrary/Example/Event.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Example 6 | { 7 | public enum Event 8 | { 9 | OneWay = 1, 10 | 11 | Return = 2, 12 | 13 | PushMessage = 3, 14 | 15 | Bin = 4, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefUserData.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using ShoppingWebCrawler.Cef.Core.Interop; 7 | 8 | public abstract unsafe partial class CefUserData 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/readMe.txt: -------------------------------------------------------------------------------- 1 | 定义 客户端与服务端进行通信的承载对象 2 | class 3 | 或者 4 | Strut 对象结构 5 | 其他 clr 基础类型 int long 等不用做封装 6 | 注意:尽量保持对象结构的简单,最好不要出现 对象中国包含多个对象的对象这种列表,会降低性能 7 | 8 | 9 | /// 10 | /// 注意 这种数据接收 是接收服务器推送来的数据 11 | /// 发送请求响应模式 必须用同步发送方法 12 | /// 异步 是单向通信 13 | 14 | 服务端 返回的消息 统一是json 格式数据 -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.WindowService/readMe.txt: -------------------------------------------------------------------------------- 1 | *************注意************* 2 | 使用Windows 服务承载蜘蛛进程的时候,抓包 请使用 3 | 使用HttpAnalyzerStdV7 监视所有会话和系统进程,即可抓包 4 | 注意:必须监视全部的进程:All Sessions And System Processes 。因为蜘蛛cef 每次请求网址都打开了新的render进程 5 | 6 | 7 | 8 | 虽然wireshark也能探测到 但是不友好,使用起来不方便。 9 | fiddler 不能探测到 蜘蛛进程的http报文! 除非可以设置它的代理,但是cef 进程设置代理比较麻烦。 10 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/Client/ConnectionState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace NTCPMessage.Client 6 | { 7 | /// 8 | /// 连接状态 9 | /// 10 | public enum ConnectionState 11 | { 12 | Closed, 13 | Open 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/_Platform/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core.Interop 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | internal static partial class NativeMethods 8 | { 9 | public const int CW_USEDEFAULT = unchecked((int)0x80000000); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/PluginCrashedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShoppingWebCrawler.Cef.Framework 4 | { 5 | public class PluginCrashedEventArgs : EventArgs 6 | { 7 | public PluginCrashedEventArgs(string pluginPath) 8 | { 9 | PluginPath = pluginPath; 10 | } 11 | 12 | public string PluginPath { get; private set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/TooltipEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShoppingWebCrawler.Cef.Framework 4 | { 5 | public class TooltipEventArgs : EventArgs 6 | { 7 | public TooltipEventArgs(string text) 8 | { 9 | Text = text; 10 | } 11 | 12 | public string Text { get; private set; } 13 | public bool Handled { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Base/cefglue_userdata_t.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core.Interop 2 | { 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 7 | internal unsafe partial struct cefglue_userdata_t 8 | { 9 | internal cef_base_t _base; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/LoadStartEventArgs.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using ShoppingWebCrawler.Cef.Core; 4 | 5 | namespace ShoppingWebCrawler.Cef.Framework 6 | { 7 | public class LoadStartEventArgs : EventArgs 8 | { 9 | public LoadStartEventArgs(CefFrame frame) 10 | { 11 | Frame = frame; 12 | } 13 | 14 | public CefFrame Frame { get; private set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/Program.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | 4 | namespace ShoppingWebCrawler.Host.DeskTop 5 | { 6 | 7 | 8 | 9 | internal static class Program 10 | { 11 | [STAThread] 12 | private static void Main(string[] args) 13 | { 14 | // 初始化 15 | InitApp.Init(args); 16 | 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefNavigationType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_log_severity_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | public enum CefNavigationType 8 | { 9 | LinkClicked = 0, 10 | FormSubmitted, 11 | BackForward, 12 | Reload, 13 | FormResubmitted, 14 | Other, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/ProductBaseCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage 8 | { 9 | /// 10 | /// 产品集合类 11 | /// 12 | public class ProductBaseCollection:List 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefProcessId.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_process_id_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Existing process IDs. 9 | /// 10 | public enum CefProcessId 11 | { 12 | Browser, 13 | Renderer, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefStorageType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_storage_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Storage types. 9 | /// 10 | public enum CefStorageType 11 | { 12 | Local = 0, 13 | Session, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Exceptions/CefRuntimeException.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | public class CefRuntimeException : Exception 8 | { 9 | public CefRuntimeException(string message) 10 | : base(message) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefPaintElementType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_paint_element_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Paint element types. 9 | /// 10 | public enum CefPaintElementType 11 | { 12 | View = 0, 13 | Popup, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/TitleChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ShoppingWebCrawler.Cef.Framework 7 | { 8 | public class TitleChangedEventArgs : EventArgs 9 | { 10 | public TitleChangedEventArgs(string title) 11 | { 12 | Title = title; 13 | } 14 | 15 | public string Title { get; private set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.Common/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefMouseButtonType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_mouse_button_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Mouse button types. 9 | /// 10 | public enum CefMouseButtonType 11 | { 12 | Left = 0, 13 | Middle, 14 | Right, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Exceptions/CefVersionMismatchException.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | public sealed class CefVersionMismatchException : CefRuntimeException 8 | { 9 | public CefVersionMismatchException(string message) 10 | : base(message) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefJSDialogType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_jsdialog_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Supported JavaScript dialog types. 9 | /// 10 | public enum CefJSDialogType 11 | { 12 | Alert = 0, 13 | Confirm, 14 | Prompt, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/RenderProcessTerminatedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ShoppingWebCrawler.Cef.Core; 3 | namespace ShoppingWebCrawler.Cef.Framework 4 | { 5 | public class RenderProcessTerminatedEventArgs : EventArgs 6 | { 7 | public RenderProcessTerminatedEventArgs(CefTerminationStatus status) 8 | { 9 | Status = status; 10 | } 11 | 12 | public CefTerminationStatus Status { get; private set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Products/TmallProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Products 8 | { 9 | public class TmallProduct: ProductBase 10 | { 11 | public TmallProduct() 12 | { 13 | this.Platform = SupportPlatformEnum.Tmall; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Client/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ShoppingWebCrawler.Client 8 | { 9 | class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | Console.Write("Test Client will be start....."); 14 | 15 | TestClient.Test(args); 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefDuplexMode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_duplex_mode_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Print job duplex mode values. 9 | /// 10 | public enum CefDuplexMode 11 | { 12 | Unknown = -1, 13 | Simplex, 14 | LongEdge, 15 | ShortEdge, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.WindowService/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using ShoppingWebCrawler.Host.WindowService.App_Start; 7 | 8 | namespace ShoppingWebCrawler.Host.WindowService 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | WinServiceConfig.Init(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefPostDataElementType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_postdataelement_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Post data elements may represent either bytes or files. 9 | /// 10 | public enum CefPostDataElementType 11 | { 12 | Empty = 0, 13 | Bytes, 14 | File, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefDomDocumentType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_dom_document_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// DOM document types. 11 | /// 12 | public enum CefDomDocumentType 13 | { 14 | Unknown = 0, 15 | Html, 16 | Xhtml, 17 | Plugin, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_cursor_info_t.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core.Interop 2 | { 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 7 | internal unsafe struct cef_cursor_info_t 8 | { 9 | public cef_point_t hotspot; 10 | public float image_scale_factor; 11 | public void* buffer; 12 | public cef_size_t size; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/LoadEndEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ShoppingWebCrawler.Cef.Core; 3 | namespace ShoppingWebCrawler.Cef.Framework 4 | { 5 | public class LoadEndEventArgs : EventArgs 6 | { 7 | public LoadEndEventArgs(CefFrame frame, int httpStatusCode) 8 | { 9 | Frame = frame; 10 | HttpStatusCode = httpStatusCode; 11 | } 12 | 13 | public int HttpStatusCode { get; private set; } 14 | 15 | public CefFrame Frame { get; private set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefDomEventPhase.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_dom_event_phase_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// DOM event processing phases. 11 | /// 12 | public enum CefDomEventPhase 13 | { 14 | Unknown = 0, 15 | Capturing, 16 | AtTarget, 17 | Bubbling, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefMenuItemType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_menu_item_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Supported menu item types. 9 | /// 10 | public enum CefMenuItemType 11 | { 12 | None, 13 | Command, 14 | Check, 15 | Radio, 16 | Separator, 17 | SubMenu, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/AddressChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ShoppingWebCrawler.Cef.Core; 3 | 4 | 5 | namespace ShoppingWebCrawler.Cef.Framework 6 | { 7 | public class AddressChangedEventArgs : EventArgs 8 | { 9 | public AddressChangedEventArgs(CefFrame frame, string address) 10 | { 11 | Address = address; 12 | Frame = frame; 13 | } 14 | 15 | public string Address { get; private set; } 16 | 17 | public CefFrame Frame { get; private set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefGeopositionErrorCode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_geoposition_error_code_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Geoposition error codes. 9 | /// 10 | public enum CefGeopositionErrorCode 11 | { 12 | None = 0, 13 | PermissionDenied, 14 | PositionUnavailable, 15 | Timeout, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_draggable_region_t.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // 4 | namespace ShoppingWebCrawler.Cef.Core.Interop 5 | { 6 | using System; 7 | using System.Runtime.InteropServices; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe struct cef_draggable_region_t 11 | { 12 | public cef_rect_t bounds; 13 | public int draggable; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Products/VipProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Products 8 | { 9 | /// 10 | /// 唯品会商品 11 | /// 12 | public class VipProduct : ProductBase 13 | { 14 | public VipProduct() 15 | { 16 | this.Platform = SupportPlatformEnum.Vip; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Products/YhdProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Products 8 | { 9 | /// 10 | /// 一号店商品 11 | /// 12 | public class YhdProduct : ProductBase 13 | { 14 | public YhdProduct() 15 | { 16 | this.Platform = SupportPlatformEnum.Yhd; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Products/ETaoProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Products 8 | { 9 | /// 10 | /// 一淘商品 11 | /// 12 | public class ETaoProduct : ProductBase 13 | { 14 | public ETaoProduct() 15 | { 16 | this.Platform = SupportPlatformEnum.ETao; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Products/GuomeiProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Products 8 | { 9 | 10 | /// 11 | /// 国美商品 12 | /// 13 | public class GuomeiProduct : ProductBase 14 | { 15 | public GuomeiProduct() 16 | { 17 | this.Platform = SupportPlatformEnum.Guomei; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Products/Zhe800Product.cs.txt: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Products 8 | { 9 | /// 10 | /// 折800商品 11 | /// 12 | public class Zhe800Product : ProductBase 13 | { 14 | public Zhe800Product() 15 | { 16 | this.Platform = SupportPlatformEnum.Zhe800; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/StatusMessageEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Framework 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | public sealed class StatusMessageEventArgs : EventArgs 8 | { 9 | private readonly string _value; 10 | 11 | public StatusMessageEventArgs(string value) 12 | { 13 | _value = value; 14 | } 15 | 16 | public string Value { get { return _value; } } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Products/MogujieProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Products 8 | { 9 | 10 | /// 11 | /// 蘑菇街商品 12 | /// 13 | public class MogujieProduct : ProductBase 14 | { 15 | public MogujieProduct() 16 | { 17 | this.Platform = SupportPlatformEnum.Mogujie; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Arguments/RegisterPortArgument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Arguments 8 | { 9 | /// 10 | /// 注册端口到主节点 11 | /// 12 | public class RegisterPortArgument 13 | { 14 | /// 15 | /// 从节点的guid编码 16 | /// 17 | public string SlaveIdentity { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Products/DangdangProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Products 8 | { 9 | /// 10 | /// 当当商品 11 | /// 12 | public class DangdangProduct : ProductBase 13 | { 14 | public DangdangProduct() 15 | { 16 | this.Platform = SupportPlatformEnum.Dangdang; 17 | } 18 | 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefValueType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_value_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Supported value types. 9 | /// 10 | public enum CefValueType 11 | { 12 | Invalid = 0, 13 | Null, 14 | Bool, 15 | Int, 16 | Double, 17 | String, 18 | Binary, 19 | Dictionary, 20 | List, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Products/MeilishuoProduct.cs.txt: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Products 8 | { 9 | 10 | /// 11 | /// 美丽说商品 12 | /// 13 | public class MeilishuoProduct : ProductBase 14 | { 15 | public MeilishuoProduct() 16 | { 17 | this.Platform = SupportPlatformEnum.Meilishuo; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefV8AccessControl.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_v8_accesscontrol_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// V8 access control values. 11 | /// 12 | [Flags] 13 | public enum CefV8AccessControl 14 | { 15 | Default = 0, 16 | AllCanRead = 1, 17 | AllCanWrite = 1 << 1, 18 | ProhibitsOverwriting = 1 << 2, 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefV8PropertyAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_v8_propertyattribute_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// V8 property attribute values. 11 | /// 12 | [Flags] 13 | public enum CefV8PropertyAttribute 14 | { 15 | None = 0, 16 | ReadOnly = 1 << 0, 17 | DontEnum = 1 << 1, 18 | DontDelete = 1 << 2, 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefFocusSource.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | 5 | /// 6 | /// Focus sources. 7 | /// 8 | public enum CefFocusSource 9 | { 10 | /// 11 | /// The source is explicit navigation via the API (LoadURL(), etc). 12 | /// 13 | Navigation = 0, 14 | 15 | /// 16 | /// The source is a system-generated focus event. 17 | /// 18 | System, 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/ConsoleMessageEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShoppingWebCrawler.Cef.Framework 4 | { 5 | public class ConsoleMessageEventArgs : EventArgs 6 | { 7 | public ConsoleMessageEventArgs(string message, string source, int line) 8 | { 9 | Message = message; 10 | Source = source; 11 | Line = line; 12 | } 13 | 14 | public string Message { get; private set; } 15 | public string Source { get; private set; } 16 | public int Line { get; private set; } 17 | public bool Handled { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/LoadingStateChangeEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShoppingWebCrawler.Cef.Framework 4 | { 5 | public class LoadingStateChangeEventArgs : EventArgs 6 | { 7 | public LoadingStateChangeEventArgs(bool isLoading, bool canGoBack, bool canGoForward) 8 | { 9 | IsLoading = isLoading; 10 | CanGoBack = canGoBack; 11 | CanGoForward = canGoForward; 12 | } 13 | 14 | public bool IsLoading { get; private set; } 15 | public bool CanGoBack { get; private set; } 16 | public bool CanGoForward { get; private set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_point_t.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // 4 | namespace ShoppingWebCrawler.Cef.Core.Interop 5 | { 6 | using System; 7 | using System.Runtime.InteropServices; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe struct cef_point_t 11 | { 12 | public int x; 13 | public int y; 14 | 15 | public cef_point_t(int x, int y) 16 | { 17 | this.x = x; 18 | this.y = y; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.Common/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/FilterFiled.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage 8 | { 9 | /// 10 | /// 过滤字段 11 | /// 12 | public class FilterFiled 13 | { 14 | /// 15 | /// 字段名称 16 | /// 17 | public string FieldName { get; set; } 18 | 19 | /// 20 | /// 字段值 21 | /// 22 | public string FieldValue { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_page_range_t.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // 4 | namespace ShoppingWebCrawler.Cef.Core.Interop 5 | { 6 | using System; 7 | using System.Runtime.InteropServices; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe struct cef_page_range_t 11 | { 12 | public int from; 13 | public int to; 14 | 15 | public cef_page_range_t(int from, int to) 16 | { 17 | this.from = from; 18 | this.to = to; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_size_t.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // 4 | namespace ShoppingWebCrawler.Cef.Core.Interop 5 | { 6 | using System; 7 | using System.Runtime.InteropServices; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe struct cef_size_t 11 | { 12 | public int width; 13 | public int height; 14 | 15 | public cef_size_t(int width, int height) 16 | { 17 | this.width = width; 18 | this.height = height; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefDomNodeType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_dom_node_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// DOM node types. 11 | /// 12 | public enum CefDomNodeType 13 | { 14 | Unsupported = 0, 15 | Element, 16 | Attribute, 17 | Text, 18 | CDataSection, 19 | ProcessingInstruction, 20 | Comment, 21 | Document, 22 | DocumentType, 23 | DocumentFragment, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefXmlNodeType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_xml_node_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// XML node types. 9 | /// 10 | public enum CefXmlNodeType 11 | { 12 | Unsupported = 0, 13 | ProcessingInstruction, 14 | DocumentType, 15 | ElementStart, 16 | ElementEnd, 17 | Attribute, 18 | Text, 19 | CData, 20 | EntityReference, 21 | WhiteSpace, 22 | Comment, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_mouse_event_t.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core.Interop 2 | { 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 7 | internal unsafe struct cef_mouse_event_t 8 | { 9 | public int x; 10 | public int y; 11 | public CefEventFlags modifiers; 12 | 13 | public cef_mouse_event_t(int x, int y, CefEventFlags modifiers) 14 | { 15 | this.x = x; 16 | this.y = y; 17 | this.modifiers = modifiers; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Platform/Windows/LoadLibraryFlags.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core.Platform.Windows 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | [Flags] 8 | public enum LoadLibraryFlags : uint 9 | { 10 | DONT_RESOLVE_DLL_REFERENCES = 0x00000001, 11 | LOAD_IGNORE_CODE_AUTHZ_LEVEL = 0x00000010, 12 | LOAD_LIBRARY_AS_DATAFILE = 0x00000002, 13 | LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 0x00000040, 14 | LOAD_LIBRARY_AS_IMAGE_RESOURCE = 0x00000020, 15 | LOAD_WITH_ALTERED_SEARCH_PATH = 0x00000008 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.WindowService/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/StringHelper.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | internal static class StringHelper 8 | { 9 | public static bool IsNullOrEmpty(string value) 10 | { 11 | return value == null || value.Length == 0; 12 | } 13 | 14 | public static bool IsNullOrWhiteSpace(string value) 15 | { 16 | if (value == null) return true; 17 | 18 | for (int i = 0; i < value.Length; i++) 19 | { 20 | if (!char.IsWhiteSpace(value[i])) return false; 21 | } 22 | 23 | return true; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/CookieVistCompletedEventAgrs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using ShoppingWebCrawler.Cef.Core; 7 | 8 | namespace ShoppingWebCrawler.Cef.Framework 9 | { 10 | public class CookieVistCompletedEventAgrs : EventArgs 11 | { 12 | #region 属性 13 | /// 14 | /// 域名 15 | /// 16 | public string DomainName { get; set; } 17 | //指向cookie结果集合的引用 18 | public IList Results; 19 | 20 | 21 | #endregion 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Host 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Runtime.InteropServices; 7 | using System.Text; 8 | 9 | internal static class NativeMethods 10 | { 11 | [DllImport("user32.dll")] 12 | [return: MarshalAs(UnmanagedType.Bool)] 13 | public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags); 14 | 15 | [DllImport("user32.dll")] 16 | public static extern IntPtr GetFocus(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_screen_info_t.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // 4 | namespace ShoppingWebCrawler.Cef.Core.Interop 5 | { 6 | using System; 7 | using System.Runtime.InteropServices; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe struct cef_screen_info_t 11 | { 12 | public float device_scale_factor; 13 | public int depth; 14 | public int depth_per_component; 15 | public int is_monochrome; 16 | public cef_rect_t rect; 17 | public cef_rect_t available_rect; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace ShoppingWebCrawler.Cef.Framework 8 | { 9 | 10 | 11 | internal static class NativeMethods 12 | { 13 | [DllImport("user32.dll")] 14 | [return: MarshalAs(UnmanagedType.Bool)] 15 | public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags); 16 | 17 | [DllImport("user32.dll")] 18 | public static extern IntPtr GetFocus(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_key_event_t.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core.Interop 2 | { 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 7 | internal unsafe struct cef_key_event_t 8 | { 9 | public CefKeyEventType type; 10 | public CefEventFlags modifiers; 11 | public int windows_key_code; 12 | public int native_key_code; 13 | public int is_system_key; 14 | public ushort character; 15 | public ushort unmodified_character; 16 | public int focus_on_editable_field; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Host.DeskTop 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Runtime.InteropServices; 7 | using System.Text; 8 | 9 | internal static class NativeMethods 10 | { 11 | [DllImport("user32.dll")] 12 | [return: MarshalAs(UnmanagedType.Bool)] 13 | public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags); 14 | 15 | [DllImport("user32.dll")] 16 | public static extern IntPtr GetFocus(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/OrderRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage 8 | { 9 | /// 10 | /// 排序规则 11 | /// 12 | public enum OrderRule 13 | { 14 | /// 15 | /// 默认排序 16 | /// 17 | Default=0, 18 | /// 19 | /// 正序排列 20 | /// 21 | ASC = 1, 22 | 23 | /// 24 | /// 倒序 25 | /// 26 | DESC = 2 27 | 28 | 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefWindowOpenDisposition.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_window_open_disposition_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// The manner in which a link click should be opened. 9 | /// 10 | public enum CefWindowOpenDisposition 11 | { 12 | Unknown, 13 | SuppressOpen, 14 | CurrentTab, 15 | SingletonTab, 16 | NewForegroundTab, 17 | NewBackgroundTab, 18 | NewPopup, 19 | NewWindow, 20 | SaveToDisk, 21 | OffTheRecord, 22 | IgnoreAction, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Platform/Windows/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core.Platform.Windows 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | 8 | internal static partial class NativeMethods 9 | { 10 | [DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)] 11 | public static extern IntPtr GetModuleHandle(string lpModuleName); 12 | 13 | [DllImport("kernel32.dll", SetLastError = true)] 14 | public static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hReservedNull, LoadLibraryFlags dwFlags); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/LoadErrorEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ShoppingWebCrawler.Cef.Core; 3 | 4 | namespace ShoppingWebCrawler.Cef.Framework 5 | { 6 | public class LoadErrorEventArgs : EventArgs 7 | { 8 | public LoadErrorEventArgs(CefFrame frame, CefErrorCode errorCode, string errorText, string failedUrl) 9 | { 10 | Frame = frame; 11 | ErrorCode = errorCode; 12 | ErrorText = errorText; 13 | FailedUrl = failedUrl; 14 | } 15 | 16 | public string FailedUrl { get; private set; } 17 | 18 | public string ErrorText { get; private set; } 19 | 20 | public CefErrorCode ErrorCode { get; private set; } 21 | 22 | public CefFrame Frame { get; private set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/FilterSpecialUrlEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using ShoppingWebCrawler.Cef.Core; 7 | 8 | namespace ShoppingWebCrawler.Cef.Framework 9 | { 10 | /// 11 | /// 拦截到指定的url 事件参数 12 | /// 13 | public class FilterSpecialUrlEventArgs:EventArgs 14 | { 15 | /// 16 | /// cef browser 实例 17 | /// 18 | public CefBrowser Browser { get; set; } 19 | 20 | /// 21 | /// 指定的请求地址 22 | /// 23 | public string Url { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefJsonParserError.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_json_parser_error_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Error codes that can be returned from CefParseJSONAndReturnError. 9 | /// 10 | public enum CefJsonParserError 11 | { 12 | NoError = 0, 13 | InvalidEscape, 14 | SyntaxError, 15 | UnexpectedToken, 16 | TrailingComma, 17 | TooMuchNesting, 18 | UnexpectedDataAfterRoot, 19 | UnsupportedEncoding, 20 | UnquotedDictionaryKey, 21 | ParseErrorCount, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SocketLibrary/Example/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Example 6 | { 7 | class Program 8 | { 9 | static void Main(string[] args) 10 | { 11 | Console.WriteLine("Run example as Server or Client?"); 12 | Console.WriteLine("0: Server"); 13 | Console.WriteLine("else: Client"); 14 | Console.Write("Please choose [1]:"); 15 | 16 | if (Console.ReadLine().Trim() == "0") 17 | { 18 | Server.Run(args); 19 | } 20 | else 21 | { 22 | Client.Run(args); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.WindowService/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Structs/CefPoint.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using ShoppingWebCrawler.Cef.Core.Interop; 7 | 8 | public struct CefPoint 9 | { 10 | private int _x; 11 | private int _y; 12 | 13 | public CefPoint(int x, int y) 14 | { 15 | _x = x; 16 | _y = y; 17 | } 18 | 19 | public int X 20 | { 21 | get { return _x; } 22 | set { _x = value; } 23 | } 24 | 25 | public int Y 26 | { 27 | get { return _y; } 28 | set { _y = value; } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/IDataContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage 8 | { 9 | /// 10 | /// 返回给客户端的数据容器接口 11 | /// 12 | public interface IDataContainer 13 | { 14 | /// 15 | /// 状态 0 失败,1 成功 16 | /// 17 | int Status { get; set; } 18 | 19 | /// 20 | /// 错误消息 21 | /// 22 | string ErrorMsg { get; set; } 23 | 24 | /// 25 | /// 响应的消息 26 | /// 27 | string Result { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefReturnValue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_return_value_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Return value types. 9 | /// 10 | public enum CefReturnValue 11 | { 12 | /// 13 | /// Cancel immediately. 14 | /// 15 | Cancel = 0, 16 | 17 | /// 18 | /// Continue immediately. 19 | /// 20 | Continue, 21 | 22 | /// 23 | /// Continue asynchronously (usually via a callback). 24 | /// 25 | ContinueAsync, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefContextMenuEditStateFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_context_menu_edit_state_flags_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// Supported context menu edit state bit flags. 11 | /// 12 | [Flags] 13 | public enum CefContextMenuEditStateFlags 14 | { 15 | None = 0, 16 | CanUndo = 1 << 0, 17 | CanRedo = 1 << 1, 18 | CanCut = 1 << 2, 19 | CanCopy = 1 << 3, 20 | CanPaste = 1 << 4, 21 | CanDelete = 1 << 5, 22 | CanSelectAll = 1 << 6, 23 | CanTranslate = 1 << 7, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_rect_t.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // 4 | namespace ShoppingWebCrawler.Cef.Core.Interop 5 | { 6 | using System; 7 | using System.Runtime.InteropServices; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe struct cef_rect_t 11 | { 12 | public int x; 13 | public int y; 14 | public int width; 15 | public int height; 16 | 17 | public cef_rect_t(int x, int y, int width, int height) 18 | { 19 | this.x = x; 20 | this.y = y; 21 | this.width = width; 22 | this.height = height; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Proxies/CefPrintJobCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface for asynchronous continuation of print job requests. 11 | /// 12 | public sealed unsafe partial class CefPrintJobCallback 13 | { 14 | /// 15 | /// Indicate completion of the print job. 16 | /// 17 | public void Continue() 18 | { 19 | cef_print_job_callback_t.cont(_self); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/OrderField.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage 8 | { 9 | /// 10 | /// 排序字段 11 | /// 12 | public class OrderField 13 | { 14 | 15 | /// 16 | /// 显示名称 17 | /// 18 | public string DisplayName { get; set; } 19 | 20 | /// 21 | /// 排序字段值 22 | /// 23 | public string FieldValue { get; set; } 24 | 25 | /// 26 | /// 排序规则 27 | /// 28 | public OrderRule Rule { get; set; } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefScaleFactor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_scale_factor_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Supported UI scale factors for the platform. SCALE_FACTOR_NONE is used for 9 | /// density independent resources such as string, html/js files or an image that 10 | /// can be used for any scale factors (such as wallpapers). 11 | /// 12 | public enum CefScaleFactor : int 13 | { 14 | None = 0, 15 | P100, 16 | P125, 17 | P133, 18 | P140, 19 | P150, 20 | P180, 21 | P200, 22 | P250, 23 | P300, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefTerminationStatus.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_termination_status_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Process termination status values. 9 | /// 10 | public enum CefTerminationStatus 11 | { 12 | /// 13 | /// Non-zero exit status. 14 | /// 15 | Termination, 16 | 17 | /// 18 | /// SIGKILL or task manager kill. 19 | /// 20 | WasKilled, 21 | 22 | /// 23 | /// Segmentation fault. 24 | /// 25 | ProcessCrashed, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefXmlEncodingType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_xml_encoding_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Supported XML encoding types. The parser supports ASCII, ISO-8859-1, and 9 | /// UTF16 (LE and BE) by default. All other types must be translated to UTF8 10 | /// before being passed to the parser. If a BOM is detected and the correct 11 | /// decoder is available then that decoder will be used automatically. 12 | /// 13 | public enum CefXmlEncoding 14 | { 15 | None = 0, 16 | Utf8, 17 | Utf16LE, 18 | Utf16BE, 19 | Ascii, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Arguments/VipSearchResultBag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Arguments 8 | { 9 | /// 10 | /// 唯品会网页搜索数据包 11 | /// 12 | public class VipSearchResultBag 13 | { 14 | /// 15 | /// 品牌 16 | /// 17 | public string BrandStoreList { get; set; } 18 | 19 | /// 20 | /// 类别 21 | /// 22 | public string CategoryTree { get; set; } 23 | /// 24 | /// 结果列表 25 | /// 26 | public string SearchList { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/Client/ISingleConnectionCable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using NTCPMessage.EntityPackage; 4 | using NTCPMessage.Event; 5 | using NTCPMessage.Serialize; 6 | 7 | namespace NTCPMessage.Client 8 | { 9 | public interface ISingleConnectionCable:INTCPConnection 10 | { 11 | /// 12 | /// 是否自动连接 13 | /// 14 | bool AutoConnect { get; } 15 | /// 16 | /// 窗口Id 17 | /// 18 | ushort CableId { get; } 19 | 20 | /// 21 | /// 连接池容量大小 22 | /// 23 | int Capacity { get; } 24 | 25 | /// 26 | /// 尝试连接次数 27 | /// 28 | int TryConnectInterval { get; } 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Structs/CefSize.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using ShoppingWebCrawler.Cef.Core.Interop; 7 | 8 | public struct CefSize 9 | { 10 | private int _width; 11 | private int _height; 12 | 13 | public CefSize(int width, int height) 14 | { 15 | _width = width; 16 | _height = height; 17 | } 18 | 19 | public int Width 20 | { 21 | get { return _width; } 22 | set { _width = value; } 23 | } 24 | 25 | public int Height 26 | { 27 | get { return _height; } 28 | set { _height = value; } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/YouhuiquanExistsModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Newtonsoft.Json; 7 | 8 | namespace NTCPMessage.EntityPackage 9 | { 10 | /// 11 | /// 优惠券实体是否存在模型 12 | /// 13 | public class YouhuiquanExistsModel 14 | { 15 | /// 16 | /// 卖家Id 17 | /// 18 | public long SellerId { get; set; } 19 | 20 | /// 21 | /// 商品Id 22 | /// 23 | public long ItemId { get; set; } 24 | 25 | /// 26 | /// 是否有优惠券 27 | /// 28 | public bool IsExistsQuan{ get; set; } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefDragOperationsMask.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_drag_operations_mask. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// "Verb" of a drag-and-drop operation as negotiated between the source and 11 | /// destination. These constants match their equivalents in WebCore's 12 | /// DragActions.h and should not be renumbered. 13 | /// 14 | public enum CefDragOperationsMask : uint 15 | { 16 | None = 0, 17 | Copy = 1, 18 | Link = 2, 19 | Generic = 4, 20 | Private = 8, 21 | Move = 16, 22 | Delete = 32, 23 | Every = UInt32.MaxValue, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.Common/Common/PushToRedisCookiesEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using NTCPMessage.EntityPackage; 7 | 8 | namespace ShoppingWebCrawler.Host.Common 9 | { 10 | 11 | /// 12 | /// 推送到远程redis服务器cookies 事件参数 13 | /// 14 | public class PushToRedisCookiesEventArgs:EventArgs 15 | { 16 | /// 17 | /// 平台枚举 18 | /// 19 | public SupportPlatformEnum Platform 20 | { 21 | get; set; 22 | } 23 | /// 24 | /// 发送的cookie 内容 25 | /// 26 | public string CookiesContent { get; set; } 27 | } 28 | 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefContextMenuMediaStateFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_context_menu_media_state_flags_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// Supported context menu media state bit flags. 11 | /// 12 | [Flags] 13 | public enum CefContextMenuMediaStateFlags 14 | { 15 | None = 0, 16 | Error = 1 << 0, 17 | Paused = 1 << 1, 18 | Muted = 1 << 2, 19 | Loop = 1 << 3, 20 | CanSave = 1 << 4, 21 | HasAudio = 1 << 5, 22 | HasVideo = 1 << 6, 23 | ControlRootElement = 1 << 7, 24 | CanPrint = 1 << 8, 25 | CanRotate = 1 << 9, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_geoposition_t.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // 4 | namespace ShoppingWebCrawler.Cef.Core.Interop 5 | { 6 | using System; 7 | using System.Runtime.InteropServices; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe struct cef_geoposition_t 11 | { 12 | public double latitude; 13 | public double longitude; 14 | public double altitude; 15 | public double accuracy; 16 | public double altitude_accuracy; 17 | public double heading; 18 | public double speed; 19 | public cef_time_t timestamp; 20 | public CefGeopositionErrorCode error_code; 21 | public cef_string_t error_message; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefState.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_state_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Text; 10 | 11 | /// 12 | /// Represents the state of a setting. 13 | /// 14 | public enum CefState : int 15 | { 16 | /// 17 | /// Use the default state for the setting. 18 | /// 19 | Default = 0, 20 | 21 | /// 22 | /// Enable or allow the setting. 23 | /// 24 | Enabled, 25 | 26 | /// 27 | /// Disable or disallow the setting. 28 | /// 29 | Disabled, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Base/bool_t.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core.Interop 2 | { 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | // 7 | // While C# bool type is not blittable, we use this struct to represent C++ bool type. 8 | // 9 | 10 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN, Size = 1)] 11 | internal unsafe struct bool_t 12 | { 13 | private byte _value; 14 | 15 | public bool_t(bool value) 16 | { 17 | _value = (byte)(value ? 1 : 0); 18 | } 19 | 20 | public static implicit operator bool(bool_t value) 21 | { 22 | return value._value != 0; 23 | } 24 | 25 | public static implicit operator bool_t(bool value) 26 | { 27 | return new bool_t(value); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefCompletionCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Generic callback interface used for asynchronous completion. 11 | /// 12 | public abstract unsafe partial class CefCompletionCallback 13 | { 14 | private void on_complete(cef_completion_callback_t* self) 15 | { 16 | CheckSelf(self); 17 | 18 | OnComplete(); 19 | } 20 | 21 | /// 22 | /// Method that will be called once the task is complete. 23 | /// 24 | protected abstract void OnComplete(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefJsonParserOptions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_json_parser_options_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// Options that can be passed to CefParseJSON. 11 | /// 12 | [Flags] 13 | public enum CefJsonParserOptions 14 | { 15 | /// 16 | /// Parses the input strictly according to RFC 4627. See comments in Chromium's 17 | /// base/json/json_reader.h file for known limitations/deviations from the RFC. 18 | /// 19 | Rfc = 0, 20 | 21 | /// 22 | /// Allows commas to exist after the last element in structures. 23 | /// 24 | AllowTrailingCommas = 1 << 0, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefStringVisitor.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Implement this interface to receive string values asynchronously. 11 | /// 12 | public abstract unsafe partial class CefStringVisitor 13 | { 14 | private void visit(cef_string_visitor_t* self, cef_string_t* @string) 15 | { 16 | CheckSelf(self); 17 | 18 | Visit(cef_string_t.ToString(@string)); 19 | } 20 | 21 | /// 22 | /// Method that will be executed. 23 | /// 24 | protected abstract void Visit(string value); 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefPdfPrintMarginType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_pdf_print_margin_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Margin type for PDF printing. 9 | /// 10 | public enum CefPdfPrintMarginType 11 | { 12 | /// 13 | /// Default margins. 14 | /// 15 | Default, 16 | 17 | /// 18 | /// No margins. 19 | /// 20 | None, 21 | 22 | /// 23 | /// Minimum margins. 24 | /// 25 | Minimum, 26 | 27 | /// 28 | /// Custom margins using the |margin_*| values from cef_pdf_print_settings_t. 29 | /// 30 | Custom, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Proxies/CefCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Generic callback interface used for asynchronous continuation. 11 | /// 12 | public sealed unsafe partial class CefCallback 13 | { 14 | /// 15 | /// Continue processing. 16 | /// 17 | public void Continue() 18 | { 19 | cef_callback_t.cont(_self); 20 | } 21 | 22 | /// 23 | /// Cancel processing. 24 | /// 25 | public void Cancel() 26 | { 27 | cef_callback_t.cancel(_self); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Proxies/CefGeolocationCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface used for asynchronous continuation of geolocation 11 | /// permission requests. 12 | /// 13 | public sealed unsafe partial class CefGeolocationCallback 14 | { 15 | /// 16 | /// Call to allow or deny geolocation access. 17 | /// 18 | public void Continue(bool allow) 19 | { 20 | // FIXME: it is can be executed only once - so may be make it self-disposable ? 21 | 22 | cef_geolocation_callback_t.cont(_self, allow ? 1 : 0); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefDomEventCategory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_dom_event_category_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// DOM event category flags. 11 | /// 12 | public enum CefDomEventCategory 13 | { 14 | Unknown = 0x0, 15 | UI = 0x1, 16 | Mouse = 0x2, 17 | Mutation = 0x4, 18 | Keyboard = 0x8, 19 | Text = 0x10, 20 | Composition = 0x20, 21 | Drag = 0x40, 22 | Clipboard = 0x80, 23 | Message = 0x100, 24 | Wheel = 0x200, 25 | BeforeTextInserted = 0x400, 26 | Overflow = 0x800, 27 | PageTransition = 0x1000, 28 | PopState = 0x2000, 29 | Progress = 0x4000, 30 | XmlHttpRequestProgress = 0x8000, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/Handler/CefWebRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using ShoppingWebCrawler.Cef.Core; 2 | 3 | namespace ShoppingWebCrawler.Cef.Framework 4 | { 5 | public sealed class CefWebRequestHandler : CefRequestHandler 6 | { 7 | private readonly CefWebBrowser _core; 8 | 9 | public CefWebRequestHandler(CefWebBrowser core) 10 | { 11 | _core = core; 12 | } 13 | 14 | protected override void OnPluginCrashed(CefBrowser browser, string pluginPath) 15 | { 16 | _core.InvokeIfRequired(() => _core.OnPluginCrashed(new PluginCrashedEventArgs(pluginPath))); 17 | } 18 | 19 | protected override void OnRenderProcessTerminated(CefBrowser browser, CefTerminationStatus status) 20 | { 21 | _core.InvokeIfRequired(() => _core.OnRenderProcessTerminated(new RenderProcessTerminatedEventArgs(status))); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SocketLibrary/ClientTest/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Net; 5 | using System.Net.Sockets; 6 | using System.Diagnostics; 7 | 8 | using NTCPMessage.Client; 9 | using NTCPMessage.Event; 10 | namespace ClientTest 11 | { 12 | class Program 13 | { 14 | static void Main(string[] args) 15 | { 16 | Console.Write("Test SingleConnectionCable choose 0, Test SingelCOnnection choose 1. [0]"); 17 | int option; 18 | 19 | if (!int.TryParse(Console.ReadLine(), out option)) 20 | { 21 | option = 0; 22 | } 23 | 24 | if (option == 1) 25 | { 26 | TestSingleConnection.Test(args); 27 | } 28 | else 29 | { 30 | TestSingleConnectionCable.Test(args); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Structs/CefColor.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | 5 | public struct CefColor 6 | { 7 | private uint _value; 8 | 9 | public CefColor(uint argb) 10 | { 11 | _value = argb; 12 | } 13 | 14 | public CefColor(byte alpha, byte red, byte green, byte blue) 15 | { 16 | _value = unchecked((uint)((alpha << 24) | (red << 16) | (green << 8) | blue)); 17 | } 18 | 19 | public byte A { get { return unchecked((byte)(_value >> 24)); } } 20 | 21 | public byte R { get { return unchecked((byte)(_value >> 16)); } } 22 | 23 | public byte G { get { return unchecked((byte)(_value >> 8)); } } 24 | 25 | public byte B { get { return unchecked((byte)(_value)); } } 26 | 27 | public uint ToArgb() 28 | { 29 | return _value; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.Common/Common/TypeFinder/ITypeFinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | 5 | namespace ShoppingWebCrawler.Host.Common.TypeFinder 6 | { 7 | /// 8 | /// Classes implementing this interface provide information about types 9 | /// to various services in the Nop engine. 10 | /// 11 | public interface ITypeFinder 12 | { 13 | IList GetAssemblies(); 14 | 15 | IEnumerable FindClassesOfType(Type assignTypeFrom, bool onlyConcreteClasses = true); 16 | 17 | IEnumerable FindClassesOfType(Type assignTypeFrom, IEnumerable assemblies, bool onlyConcreteClasses = true); 18 | 19 | IEnumerable FindClassesOfType(bool onlyConcreteClasses = true); 20 | 21 | IEnumerable FindClassesOfType(IEnumerable assemblies, bool onlyConcreteClasses = true); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Products/JingdongProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Newtonsoft.Json; 7 | 8 | namespace NTCPMessage.EntityPackage.Products 9 | { 10 | 11 | /// 12 | /// 京东商品 13 | /// 14 | public class JingdongProduct : ProductBase 15 | { 16 | public JingdongProduct() 17 | { 18 | this.Platform = SupportPlatformEnum.Jingdong; 19 | } 20 | 21 | /// 22 | /// 商品的pid 23 | /// 24 | [JsonIgnore] 25 | public string Pid { get; set; } 26 | 27 | /// 28 | /// 上一页的起始位置 29 | /// 30 | public int Prev_start { get; set; } 31 | /// 32 | /// 下一页的起始位置 33 | /// 34 | public int Next_start { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/Serialize/MessageType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.Serialize 8 | { 9 | 10 | /// 11 | /// 消息类型 12 | /// 13 | public enum MessageType 14 | { 15 | /// 16 | /// 基础类型消息 字符串消息 17 | /// 18 | None = 20, 19 | /// 20 | /// 二进制消息 21 | /// 22 | Bin = 21, 23 | /// 24 | /// XML消息 25 | /// 26 | Xml = 22, 27 | /// 28 | /// Json消息 29 | /// 30 | Json = 23, 31 | /// 32 | /// 简单二进制消息 33 | /// 34 | SimpleBin = 24, 35 | /// 36 | /// 自定义格式消息 37 | /// 38 | Customer=25 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefUrlRequestStatus.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_urlrequest_flags_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | public enum CefUrlRequestStatus 10 | { 11 | /// 12 | /// Unknown status. 13 | /// 14 | Unknown = 0, 15 | 16 | /// 17 | /// Request succeeded. 18 | /// 19 | Success, 20 | 21 | /// 22 | /// An IO request is pending, and the caller will be informed when it is 23 | /// completed. 24 | /// 25 | IOPending, 26 | 27 | /// 28 | /// Request was canceled programatically. 29 | /// 30 | Canceled, 31 | 32 | /// 33 | /// Request failed for some reason. 34 | /// 35 | Failed, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefSetCookieCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Interface to implement to be notified of asynchronous completion via 11 | /// CefCookieManager::SetCookie(). 12 | /// 13 | public abstract unsafe partial class CefSetCookieCallback 14 | { 15 | private void on_complete(cef_set_cookie_callback_t* self, int success) 16 | { 17 | CheckSelf(self); 18 | OnComplete(success != 0); 19 | } 20 | 21 | /// 22 | /// Method that will be called upon completion. |success| will be true if the 23 | /// cookie was set successfully. 24 | /// 25 | protected abstract void OnComplete(bool success); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Products/SuningProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Products 8 | { 9 | /// 10 | /// 苏宁商品 11 | /// 12 | public class SuningProduct : ProductBase 13 | { 14 | public SuningProduct() 15 | { 16 | this.Platform = SupportPlatformEnum.Suning; 17 | } 18 | 19 | /// 20 | /// 覆盖shopId 21 | /// 22 | public override long ShopId 23 | { 24 | get 25 | { 26 | long _shopId; 27 | long.TryParse(this.BizCode, out _shopId); 28 | return _shopId; 29 | } 30 | } 31 | /// 32 | /// 经销商编码 33 | /// : "0000000000" 34 | /// 35 | public string BizCode { get; set; } 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Structs/CefPageRange.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using ShoppingWebCrawler.Cef.Core.Interop; 7 | 8 | public struct CefPageRange 9 | { 10 | internal static unsafe CefPageRange Create(cef_page_range_t* pageRange) 11 | { 12 | return new CefPageRange( 13 | pageRange->from, 14 | pageRange->to 15 | ); 16 | } 17 | 18 | private int _from; 19 | private int _to; 20 | 21 | public CefPageRange(int from, int to) 22 | { 23 | _from = from; 24 | _to = to; 25 | } 26 | 27 | public int From 28 | { 29 | get { return _from; } 30 | set { _from = value; } 31 | } 32 | 33 | public int To 34 | { 35 | get { return _to; } 36 | set { _to = value; } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Proxies/CefPrintDialogCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface for asynchronous continuation of print dialog requests. 11 | /// 12 | public sealed unsafe partial class CefPrintDialogCallback 13 | { 14 | /// 15 | /// Continue printing with the specified |settings|. 16 | /// 17 | public void Continue(CefPrintSettings settings) 18 | { 19 | cef_print_dialog_callback_t.cont(_self, settings.ToNative()); 20 | } 21 | 22 | /// 23 | /// Cancel the printing. 24 | /// 25 | public void Cancel() 26 | { 27 | cef_print_dialog_callback_t.cancel(_self); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_popup_features_t.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // 4 | namespace ShoppingWebCrawler.Cef.Core.Interop 5 | { 6 | using System; 7 | using System.Runtime.InteropServices; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe struct cef_popup_features_t 11 | { 12 | public int x; 13 | public int xSet; 14 | public int y; 15 | public int ySet; 16 | public int width; 17 | public int widthSet; 18 | public int height; 19 | public int heightSet; 20 | 21 | public int menuBarVisible; 22 | public int statusBarVisible; 23 | public int toolBarVisible; 24 | public int locationBarVisible; 25 | public int scrollbarsVisible; 26 | public int resizable; 27 | 28 | public int fullscreen; 29 | public int dialog; 30 | public cef_string_list* additionalFeatures; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefDeleteCookiesCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Interface to implement to be notified of asynchronous completion via 11 | /// CefCookieManager::DeleteCookies(). 12 | /// 13 | public abstract unsafe partial class CefDeleteCookiesCallback 14 | { 15 | private void on_complete(cef_delete_cookies_callback_t* self, int num_deleted) 16 | { 17 | CheckSelf(self); 18 | OnComplete(num_deleted); 19 | } 20 | 21 | /// 22 | /// Method that will be called upon completion. |num_deleted| will be the 23 | /// number of cookies that were deleted or -1 if unknown. 24 | /// 25 | protected abstract void OnComplete(int numDeleted); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefEventFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_event_flags_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// Supported event bit flags. 11 | /// 12 | [Flags] 13 | public enum CefEventFlags : uint 14 | { 15 | None = 0, 16 | 17 | CapsLockOn = 1 << 0, 18 | 19 | ShiftDown = 1 << 1, 20 | ControlDown = 1 << 2, 21 | AltDown = 1 << 3, 22 | 23 | LeftMouseButton = 1 << 4, 24 | MiddleMouseButton = 1 << 5, 25 | RightMouseButton = 1 << 6, 26 | 27 | /// 28 | /// Mac OS-X command key. 29 | /// 30 | CommandDown = 1 << 7, 31 | 32 | NumLockOn = 1 << 8, 33 | IsKeyPad = 1 << 9, 34 | IsLeft = 1 << 10, 35 | IsRight = 1 << 11, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefResponseFilterStatus.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_response_filter_status_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Return values for CefResponseFilter::Filter(). 9 | /// 10 | public enum CefResponseFilterStatus 11 | { 12 | /// 13 | /// Some or all of the pre-filter data was read successfully but more data is 14 | /// needed in order to continue filtering (filtered output is pending). 15 | /// 16 | RESPONSE_FILTER_NEED_MORE_DATA, 17 | 18 | /// 19 | /// Some or all of the pre-filter data was read successfully and all available 20 | /// filtered output has been written. 21 | /// 22 | RESPONSE_FILTER_DONE, 23 | 24 | /// 25 | /// An error occurred during filtering. 26 | /// 27 | RESPONSE_FILTER_ERROR 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SocketLibrary/Example/MessageConvert/BinMessageConvert.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Net; 8 | using NTCPMessage.Serialize; 9 | using NTCPMessage.EntityPackage; 10 | 11 | namespace Example2010.MessageConvert 12 | { 13 | 14 | /// 15 | /// 二进制消息转换 16 | /// 17 | public class BinMessageConvert : MessageParse 18 | { 19 | public BinMessageConvert() 20 | : base(new BinSerializer(), new JsonSerializer()) 21 | { 22 | 23 | } 24 | 25 | public override IDataContainer ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, NTCPMessage.MessageFlag Flag, ushort CableId, uint Channel, uint Event, SoapMessage obj) 26 | { 27 | //Console.WriteLine(obj); 28 | var result = new DataContainer(); 29 | result.Result = "1111111111"; 30 | 31 | return result; 32 | 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /SocketLibrary/ServerTest/MessageConvert/BinMessageConvert.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Net; 8 | using NTCPMessage.Serialize; 9 | using NTCPMessage.EntityPackage; 10 | 11 | namespace ServerTest.MessageConvert 12 | { 13 | 14 | /// 15 | /// 二进制消息转换 16 | /// 17 | public class BinMessageConvert : MessageParse 18 | { 19 | public BinMessageConvert() 20 | : base(new BinSerializer(), new JsonSerializer()) 21 | { 22 | 23 | } 24 | 25 | public override IDataContainer ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, NTCPMessage.MessageFlag Flag, ushort CableId, uint Channel, uint Event, SoapMessage obj) 26 | { 27 | //Console.WriteLine(obj); 28 | var result = new DataContainer(); 29 | result.Result = "1111111111"; 30 | 31 | return result; 32 | 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Proxies/CefRequestCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface used for asynchronous continuation of url requests. 11 | /// 12 | public sealed unsafe partial class CefRequestCallback 13 | { 14 | /// 15 | /// Continue the url request. If |allow| is true the request will be continued. 16 | /// Otherwise, the request will be canceled. 17 | /// 18 | public void Continue(bool allow) 19 | { 20 | cef_request_callback_t.cont(_self, allow ? 1 : 0); 21 | } 22 | 23 | /// 24 | /// Cancel the url request. 25 | /// 26 | public void Cancel() 27 | { 28 | cef_request_callback_t.cancel(_self); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefPluginPolicy.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_plugin_policy_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Plugin policies supported by CefRequestContextHandler::OnBeforePluginLoad. 9 | /// 10 | public enum CefPluginPolicy : int 11 | { 12 | /// 13 | /// Allow the content. 14 | /// 15 | Allow, 16 | 17 | /// 18 | /// Allow important content and block unimportant content based on heuristics. 19 | /// The user can manually load blocked content. 20 | /// 21 | DetectImportant, 22 | 23 | /// 24 | /// Block the content. The user can manually load blocked content. 25 | /// 26 | Block, 27 | 28 | /// 29 | /// Disable the content. The user cannot load disabled content. 30 | /// 31 | Disable, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/Services/TaobaoService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using NTCPMessage.EntityPackage; 7 | using Newtonsoft.Json; 8 | using ShoppingWebCrawler.Host.Common; 9 | 10 | namespace ShoppingWebCrawler.Host.DeskTop.Services 11 | { 12 | /// 13 | /// 淘宝服务 14 | /// 15 | public class TaobaoService 16 | { 17 | 18 | /// 19 | /// 获取淘宝的Cookie 20 | /// 21 | /// 22 | public static DataContainer GetLoginTokenCookies() 23 | { 24 | var container = new DataContainer(); 25 | var ckVistor = new LazyCookieVistor(); 26 | var _PageCooies = ckVistor.LoadCookiesAsyc(GlobalContext.TaobaoSiteURL).Result; 27 | var json_cookies = JsonConvert.SerializeObject(_PageCooies); 28 | 29 | container.Result = json_cookies; 30 | 31 | 32 | return container; 33 | 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/SupportPlatform.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage 8 | { 9 | public class SupportPlatform 10 | { 11 | /// 12 | /// 编号 13 | /// 14 | public int Id { get; set; } 15 | 16 | /// 17 | /// 平台简称 18 | /// 19 | public string Name { get; set; } 20 | /// 21 | /// 平台描述 22 | /// 23 | public string Description { get; set; } 24 | 25 | /// 26 | /// 站点地址 27 | /// 28 | public string SiteUrl { get; set; } 29 | 30 | /// 31 | /// 平台枚举根据id编码走 32 | /// 33 | public SupportPlatformEnum Platform 34 | { 35 | get 36 | { 37 | return (SupportPlatformEnum)this.Id; 38 | } 39 | } 40 | 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Arguments/KeyWordTag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Arguments 8 | { 9 | /// 10 | /// 查询关键词 标签 11 | /// 12 | public class KeyWordTag 13 | { 14 | 15 | /// 16 | /// 所在的分组显示名称 17 | /// 品牌、分类、产地....... 18 | /// 19 | public string GroupShowName { get; set; } 20 | 21 | /// 22 | /// 标签名称 23 | /// 24 | public string TagName { get; set; } 25 | 26 | /// 27 | /// 对应的平台的特定的筛选字段 28 | /// 29 | public string FilterFiled { get; set; } 30 | /// 31 | /// 标签值 32 | /// 33 | public string Value { get; set; } 34 | 35 | /// 36 | /// 来自的平台 37 | /// 38 | public SupportPlatformEnum Platform { get; set; } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/Services/AlimamaService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using NTCPMessage.EntityPackage; 7 | using Newtonsoft.Json; 8 | using ShoppingWebCrawler.Host.Common; 9 | 10 | namespace ShoppingWebCrawler.Host.DeskTop.Services 11 | { 12 | /// 13 | /// 阿里妈妈服务 14 | /// 15 | public class AlimamaService 16 | { 17 | 18 | /// 19 | /// 获取阿里妈妈的Cookie 20 | /// 21 | /// 22 | public static DataContainer GetLoginTokenCookies() 23 | { 24 | var container = new DataContainer(); 25 | var ckVistor = new LazyCookieVistor(); 26 | var _PageCooies = ckVistor.LoadCookiesAsyc(GlobalContext.AlimamaSiteURL).Result; 27 | var json_cookies = JsonConvert.SerializeObject(_PageCooies); 28 | 29 | container.Result = json_cookies; 30 | 31 | 32 | return container; 33 | 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/InnerEvent.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Text; 21 | 22 | namespace NTCPMessage 23 | { 24 | enum InnerEvent 25 | { 26 | GetProcessorId = 1, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Structs/CefDraggableRegion.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using ShoppingWebCrawler.Cef.Core.Interop; 7 | 8 | public sealed class CefDraggableRegion 9 | { 10 | internal static unsafe CefDraggableRegion FromNative(cef_draggable_region_t* ptr) 11 | { 12 | return new CefDraggableRegion(ptr); 13 | } 14 | 15 | private readonly CefRectangle _bounds; 16 | private readonly bool _draggable; 17 | 18 | private unsafe CefDraggableRegion(cef_draggable_region_t* ptr) 19 | { 20 | _bounds = new CefRectangle( 21 | ptr->bounds.x, 22 | ptr->bounds.y, 23 | ptr->bounds.width, 24 | ptr->bounds.height 25 | ); 26 | _draggable = ptr->draggable != 0; 27 | } 28 | 29 | public CefRectangle Bounds { get { return _bounds; } } 30 | 31 | public bool Draggable { get { return _draggable; } } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/SupportPlatformEnum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | namespace NTCPMessage.EntityPackage 4 | { 5 | /// 6 | /// 电商平台类型枚举 7 | /// 天猫..... 8 | /// 9 | public enum SupportPlatformEnum 10 | { 11 | [Description("天猫")] 12 | Tmall = 0, 13 | [Description("淘宝")] 14 | Taobao = 1, 15 | [Description("京东")] 16 | Jingdong = 2, 17 | [Description("拼多多")] 18 | Pdd = 3, 19 | [Description("唯品会")] 20 | Vip = 4, 21 | [Description("国美")] 22 | Guomei = 5, 23 | [Description("苏宁")] 24 | Suning = 6, 25 | [Description("当当")] 26 | Dangdang = 7, 27 | [Description("一号店")] 28 | Yhd = 8, 29 | //[Description("美丽说")] 30 | //Meilishuo = 9, 31 | [Description("蘑菇街")] 32 | Mogujie = 10, 33 | //[Description("折800")] 34 | //Zhe800 = 11, 35 | [Description("一淘")] 36 | ETao = 12, 37 | [Description("阿里妈妈")] 38 | Alimama = 13 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefTask.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using ShoppingWebCrawler.Cef.Core.Interop; 6 | 7 | /// 8 | /// Implement this interface for asynchronous task execution. If the task is 9 | /// posted successfully and if the associated message loop is still running then 10 | /// the Execute() method will be called on the target thread. If the task fails 11 | /// to post then the task object may be destroyed on the source thread instead of 12 | /// the target thread. For this reason be cautious when performing work in the 13 | /// task object destructor. 14 | /// 15 | public abstract unsafe partial class CefTask 16 | { 17 | private void execute(cef_task_t* self) 18 | { 19 | CheckSelf(self); 20 | 21 | Execute(); 22 | } 23 | 24 | /// 25 | /// Method that will be executed on the target thread. 26 | /// 27 | protected abstract void Execute(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Proxies/CefRunContextMenuCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface used for continuation of custom context menu display. 11 | /// 12 | public sealed unsafe partial class CefRunContextMenuCallback 13 | { 14 | /// 15 | /// Complete context menu display by selecting the specified |command_id| and 16 | /// |event_flags|. 17 | /// 18 | public void Continue(int commandId, CefEventFlags eventFlags) 19 | { 20 | cef_run_context_menu_callback_t.cont(_self, commandId, eventFlags); 21 | } 22 | 23 | /// 24 | /// Cancel context menu display. 25 | /// 26 | public void Cancel() 27 | { 28 | cef_run_context_menu_callback_t.cancel(_self); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SocketLibrary/Example/MessageConvert/XmlMessageConvert.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Net; 7 | using NTCPMessage.Serialize; 8 | using NTCPMessage.EntityPackage; 9 | 10 | namespace Example2010.MessageConvert 11 | { 12 | 13 | 14 | /// 15 | /// XML 消息转换 16 | /// 17 | /// 18 | public class XmlMessageConvert : MessageParse 19 | { 20 | 21 | public XmlMessageConvert() 22 | : base(new XMLSerializer(), new JsonSerializer()) 23 | { 24 | 25 | } 26 | 27 | public override IDataContainer ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, NTCPMessage.MessageFlag Flag, ushort CableId, uint Channel, uint Event, SoapMessage obj) 28 | { 29 | //Console.WriteLine(obj); 30 | 31 | var result = new DataContainer(); 32 | result.Result = "1111111111"; 33 | 34 | return result; 35 | 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SocketLibrary/ServerTest/MessageConvert/XmlMessageConvert.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Net; 7 | using NTCPMessage.Serialize; 8 | using NTCPMessage.EntityPackage; 9 | 10 | namespace ServerTest.MessageConvert 11 | { 12 | 13 | 14 | /// 15 | /// XML 消息转换 16 | /// 17 | /// 18 | public class XmlMessageConvert : MessageParse 19 | { 20 | 21 | public XmlMessageConvert() 22 | : base(new XMLSerializer(), new JsonSerializer()) 23 | { 24 | 25 | } 26 | 27 | public override IDataContainer ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, NTCPMessage.MessageFlag Flag, ushort CableId, uint Channel, uint Event, SoapMessage obj) 28 | { 29 | //Console.WriteLine(obj); 30 | 31 | var result = new DataContainer(); 32 | result.Result = "1111111111"; 33 | 34 | return result; 35 | 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SocketLibrary/Example/MessageConvert/JsonMessageConvert.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using NTCPMessage.Serialize; 9 | using NTCPMessage.EntityPackage; 10 | 11 | namespace Example2010.MessageConvert 12 | { 13 | 14 | 15 | /// 16 | /// json 消息转换 17 | /// 18 | /// 19 | public class JsonMessageConvert : MessageParse 20 | { 21 | 22 | public JsonMessageConvert() 23 | : base(new JsonSerializer(), new JsonSerializer()) 24 | { 25 | 26 | } 27 | 28 | public override IDataContainer ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, NTCPMessage.MessageFlag Flag, ushort CableId, uint Channel, uint Event, SoapMessage obj) 29 | { 30 | //Console.WriteLine(obj); 31 | var result = new DataContainer(); 32 | result.Result = "1111111111"; 33 | 34 | return result; 35 | 36 | } 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/ResolvedSearchUrlWithParas.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage 8 | { 9 | /// 10 | /// 解析平台搜索地址对象 11 | /// 12 | public class ResolvedSearchUrlWithParas 13 | { 14 | 15 | public ResolvedSearchUrlWithParas() 16 | { 17 | this.IsNeedPreRequest = true; 18 | } 19 | /// 20 | /// 已经解析完毕的搜索页面地址 21 | /// 有的平台搜索url 参数需要频繁变更,所以,需要在插件中解析地址 22 | /// 但是有的平台需要具体的参数;所以传递的时候 先尝试在site 的插件中进行解析地址 23 | /// 针对get 请求,在url中直接将参数拼接好 24 | /// 25 | public string Url { get; set; } 26 | 27 | /// 28 | /// Post请求附带的参数; 29 | /// 30 | public Dictionary ParasPost { get; set; } 31 | 32 | /// 33 | /// 是否需要预请求 34 | /// true 将进行请求url ,false 将进行内容解析的时候,解析地址参数 35 | /// 36 | public bool IsNeedPreRequest { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SocketLibrary/ServerTest/MessageConvert/JsonMessageConvert.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using NTCPMessage.Serialize; 9 | using NTCPMessage.EntityPackage; 10 | 11 | namespace ServerTest.MessageConvert 12 | { 13 | 14 | 15 | /// 16 | /// json 消息转换 17 | /// 18 | /// 19 | public class JsonMessageConvert : MessageParse 20 | { 21 | 22 | public JsonMessageConvert() 23 | : base(new JsonSerializer(), new JsonSerializer()) 24 | { 25 | 26 | } 27 | 28 | public override IDataContainer ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, NTCPMessage.MessageFlag Flag, ushort CableId, uint Channel, uint Event, SoapMessage obj) 29 | { 30 | //Console.WriteLine(obj); 31 | var result = new DataContainer(); 32 | result.Result = "1111111111"; 33 | 34 | return result; 35 | 36 | } 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.Common/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ShoppingWebCrawler.Host.Common.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefKeyEventType.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | 5 | /// 6 | /// Key event types. 7 | /// 8 | public enum CefKeyEventType : int 9 | { 10 | /// 11 | /// Notification that a key transitioned from "up" to "down". 12 | /// 13 | RawKeyDown = 0, 14 | 15 | /// 16 | /// Notification that a key was pressed. This does not necessarily correspond 17 | /// to a character depending on the key and language. Use KEYEVENT_CHAR for 18 | /// character input. 19 | /// 20 | KeyDown, 21 | 22 | /// 23 | /// Notification that a key was released. 24 | /// 25 | KeyUp, 26 | 27 | /// 28 | /// Notification that a character was typed. Use this for text input. Key 29 | /// down events may generate 0, 1, or more than one character event depending 30 | /// on the key, locale, and operating system. 31 | /// 32 | Char, 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.Common/Extensions/ProcessExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Management; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace System.Diagnostics 9 | { 10 | public static class ProcessExtensions 11 | { 12 | /// 13 | /// 获取进程的命令行信息 14 | /// 15 | /// 16 | /// 17 | public static string GetCommandLine(this Process process) 18 | { 19 | var commandLine = new StringBuilder(); 20 | 21 | commandLine.Append(" "); 22 | using (var searcher = new ManagementObjectSearcher("SELECT CommandLine FROM Win32_Process WHERE ProcessId = " + process.Id)) 23 | { 24 | foreach (var @object in searcher.Get()) 25 | { 26 | commandLine.Append(@object["CommandLine"]); 27 | commandLine.Append(" "); 28 | } 29 | } 30 | 31 | return commandLine.ToString(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ShoppingWebCrawler.Host.DeskTop.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefContextMenuMediaType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_context_menu_media_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// Supported context menu media types. 11 | /// 12 | public enum CefContextMenuMediaType 13 | { 14 | /// 15 | /// No special node is in context. 16 | /// 17 | None, 18 | 19 | /// 20 | /// An image node is selected. 21 | /// 22 | Image, 23 | 24 | /// 25 | /// A video node is selected. 26 | /// 27 | Video, 28 | 29 | /// 30 | /// An audio node is selected. 31 | /// 32 | Audio, 33 | 34 | /// 35 | /// A file node is selected. 36 | /// 37 | File, 38 | 39 | /// 40 | /// A plugin node is selected. 41 | /// 42 | Plugin, 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SocketLibrary/Example/MessageConvert/SimpleBinMessageConvert.cs: -------------------------------------------------------------------------------- 1 | using NTCPMessage.EntityPackage; 2 | using NTCPMessage.Serialize; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Net; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Example2010.MessageConvert 11 | { 12 | 13 | 14 | /// 15 | /// 简单二进制消息转换 16 | /// 17 | /// 18 | public class SimpleBinMessageConvert : MessageParse 19 | { 20 | 21 | public SimpleBinMessageConvert() 22 | : base(new SimpleBinSerializer(), new JsonSerializer()) 23 | { 24 | 25 | } 26 | 27 | public override IDataContainer ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, NTCPMessage.MessageFlag Flag, ushort CableId, uint Channel, uint Event, SoapMessage obj) 28 | { 29 | //Console.WriteLine(obj); 30 | var result = new DataContainer(); 31 | result.Result = "1111111111"; 32 | 33 | return result; 34 | 35 | } 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /SocketLibrary/ServerTest/MessageConvert/SimpleBinMessageConvert.cs: -------------------------------------------------------------------------------- 1 | using NTCPMessage.EntityPackage; 2 | using NTCPMessage.Serialize; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Net; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ServerTest.MessageConvert 11 | { 12 | 13 | 14 | /// 15 | /// 简单二进制消息转换 16 | /// 17 | /// 18 | public class SimpleBinMessageConvert : MessageParse 19 | { 20 | 21 | public SimpleBinMessageConvert() 22 | : base(new SimpleBinSerializer(), new JsonSerializer()) 23 | { 24 | 25 | } 26 | 27 | public override IDataContainer ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, NTCPMessage.MessageFlag Flag, ushort CableId, uint Channel, uint Event, SoapMessage obj) 28 | { 29 | //Console.WriteLine(obj); 30 | var result = new DataContainer(); 31 | result.Result = "1111111111"; 32 | 33 | return result; 34 | 35 | } 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Client/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ShoppingWebCrawler.Client")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ShoppingWebCrawler.Client")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | //将 ComVisible 设置为 false 将使此程序集中的类型 18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("bf325389-3cb7-4a43-a150-088d1c8b10ea")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Proxies/CefJSDialogCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface used for asynchronous continuation of JavaScript dialog 11 | /// requests. 12 | /// 13 | public sealed unsafe partial class CefJSDialogCallback 14 | { 15 | /// 16 | /// Continue the JS dialog request. Set |success| to true if the OK button was 17 | /// pressed. The |user_input| value should be specified for prompt dialogs. 18 | /// 19 | public void Continue(bool success, string userInput) 20 | { 21 | fixed (char* userInput_str = userInput) 22 | { 23 | var n_userInput = new cef_string_t(userInput_str, userInput != null ? userInput.Length : 0); 24 | 25 | cef_jsdialog_callback_t.cont(_self, success ? 1 : 0, &n_userInput); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ShoppingWebCrawler.Host.Common")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ShoppingWebCrawler.Host.Common")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | //将 ComVisible 设置为 false 将使此程序集中的类型 18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("09e590e4-7fb7-4308-a19e-c33d36b166d3")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Base/cef_base_t.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core.Interop 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Runtime.InteropServices; 6 | using System.Security; 7 | using System.Text; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe struct cef_base_t 11 | { 12 | internal UIntPtr _size; 13 | internal IntPtr _add_ref; 14 | internal IntPtr _release; 15 | internal IntPtr _has_one_ref; 16 | 17 | [UnmanagedFunctionPointer(libcef.CEF_CALLBACK)] 18 | #if !DEBUG 19 | [SuppressUnmanagedCodeSecurity] 20 | #endif 21 | public delegate void add_ref_delegate(cef_base_t* self); 22 | 23 | [UnmanagedFunctionPointer(libcef.CEF_CALLBACK)] 24 | #if !DEBUG 25 | [SuppressUnmanagedCodeSecurity] 26 | #endif 27 | public delegate int release_delegate(cef_base_t* self); 28 | 29 | [UnmanagedFunctionPointer(libcef.CEF_CALLBACK)] 30 | #if !DEBUG 31 | [SuppressUnmanagedCodeSecurity] 32 | #endif 33 | public delegate int has_one_ref_delegate(cef_base_t* self); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ShoppingWebCrawler.Host.DeskTop")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ShoppingWebCrawler.Host.DeskTop")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | //将 ComVisible 设置为 false 将使此程序集中的类型 18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("6f2915fc-5dbf-44b5-afdd-630425b931ea")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Proxies/CefDownloadItemCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface used to asynchronously cancel a download. 11 | /// 12 | public sealed unsafe partial class CefDownloadItemCallback 13 | { 14 | /// 15 | /// Call to cancel the download. 16 | /// 17 | public void Cancel() 18 | { 19 | cef_download_item_callback_t.cancel(_self); 20 | } 21 | 22 | /// 23 | /// Call to pause the download. 24 | /// 25 | public void Pause() 26 | { 27 | cef_download_item_callback_t.pause(_self); 28 | } 29 | 30 | /// 31 | /// Call to resume the download. 32 | /// 33 | public void Resume() 34 | { 35 | cef_download_item_callback_t.resume(_self); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefContextSafetyImplementation.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | /// 4 | /// CEF offers two context safety implementations with different performance characteristics. 5 | /// 6 | public enum CefContextSafetyImplementation : int 7 | { 8 | /// 9 | /// The default implementation (value of 0) uses a map of hash values and should provide 10 | /// better performance in situations with a small number contexts. 11 | /// 12 | SafeDefault = 0, 13 | 14 | /// 15 | /// The alternate implementation (value of 1) uses a hidden value attached to each context 16 | /// and should provide better performance in situations with a large number of contexts. 17 | /// 18 | SafeAlternate = 1, 19 | 20 | /// 21 | /// If you need better performance in the creation of V8 references and you 22 | /// plan to manually track context lifespan you can disable context safety by 23 | /// specifying a value of -1. 24 | /// 25 | Disabled = -1, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefLogSeverity.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_log_severity_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Log severity levels. 9 | /// 10 | public enum CefLogSeverity 11 | { 12 | /// 13 | /// Default logging (currently INFO logging). 14 | /// 15 | Default, 16 | 17 | /// 18 | /// Verbose logging. 19 | /// 20 | Verbose, 21 | 22 | /// 23 | /// INFO logging. 24 | /// 25 | Info, 26 | 27 | /// 28 | /// WARNING logging. 29 | /// 30 | Warning, 31 | 32 | /// 33 | /// ERROR logging. 34 | /// 35 | Error, 36 | 37 | /// 38 | /// ERROR_REPORT logging. 39 | /// 40 | ErrorReport, 41 | 42 | /// 43 | /// Completely disable logging. 44 | /// 45 | Disable = 99, 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Structs/CefRectangle.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using ShoppingWebCrawler.Cef.Core.Interop; 7 | 8 | public struct CefRectangle 9 | { 10 | private int _x; 11 | private int _y; 12 | private int _width; 13 | private int _height; 14 | 15 | public CefRectangle(int x, int y, int width, int height) 16 | { 17 | _x = x; 18 | _y = y; 19 | _width = width; 20 | _height = height; 21 | } 22 | 23 | public int X 24 | { 25 | get { return _x; } 26 | set { _x = value; } 27 | } 28 | 29 | public int Y 30 | { 31 | get { return _y; } 32 | set { _y = value; } 33 | } 34 | 35 | public int Width 36 | { 37 | get { return _width; } 38 | set { _width = value; } 39 | } 40 | 41 | public int Height 42 | { 43 | get { return _height; } 44 | set { _height = value; } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/Event/CableConnectedEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Text; 22 | 23 | namespace NTCPMessage.Event 24 | { 25 | public class CableConnectedEventArgs : EventArgs 26 | { 27 | public CableConnectedEventArgs() 28 | { 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/Serialize/IMessageParse.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Net; 4 | using NTCPMessage.EntityPackage; 5 | using NTCPMessage.Event; 6 | 7 | namespace NTCPMessage.Serialize 8 | { 9 | /// 10 | /// 消息接受处理转换接口 11 | /// 12 | public interface IMessageParse 13 | { 14 | /// 15 | /// 接受数据并转换 16 | /// 17 | /// 18 | /// 19 | void ReceiveEventHandler(object sender, ReceiveEventArgs args); 20 | 21 | /// 22 | /// 处理消息 23 | /// 24 | /// 25 | /// 26 | /// 27 | /// 28 | /// 29 | /// 30 | /// 31 | /// 32 | U ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, MessageFlag Flag, 33 | UInt16 CableId, UInt32 Channel, UInt32 Event, T obj); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefGetGeolocationCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Implement this interface to receive geolocation updates. The methods of this 11 | /// class will be called on the browser process UI thread. 12 | /// 13 | public abstract unsafe partial class CefGetGeolocationCallback 14 | { 15 | private void on_location_update(cef_get_geolocation_callback_t* self, cef_geoposition_t* position) 16 | { 17 | CheckSelf(self); 18 | 19 | var mPosition = CefGeoposition.FromNative(position); 20 | 21 | OnLocationUpdate(mPosition); 22 | } 23 | 24 | /// 25 | /// Called with the 'best available' location information or, if the location 26 | /// update failed, with error information. 27 | /// 28 | protected abstract void OnLocationUpdate(CefGeoposition position); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/UI/BaseForm.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | using System.Windows.Forms; 9 | using ShoppingWebCrawler.Cef.Core; 10 | using ShoppingWebCrawler.Host.Common; 11 | using System.Net; 12 | 13 | namespace ShoppingWebCrawler.Host.DeskTop.UI 14 | { 15 | public class BaseForm : Form 16 | { 17 | 18 | public BaseForm() 19 | { 20 | } 21 | 22 | 23 | 24 | /// 25 | /// 归属的域 26 | /// 27 | public string DomainIdentity { get; set; } 28 | 29 | protected IEnumerable _PageCooies; 30 | 31 | /// 32 | /// 加载Cookies 33 | /// 34 | protected void LoadCookies() 35 | { 36 | if (null == this.DomainIdentity || this.DomainIdentity.Length <= 0) 37 | { 38 | return; 39 | } 40 | 41 | var ckVistor = new LazyCookieVistor(); 42 | _PageCooies = ckVistor.LoadCookies(this.DomainIdentity); 43 | 44 | } 45 | 46 | 47 | 48 | 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.WindowService/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ShoppingWebCrawler.Host.WindowService")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ShoppingWebCrawler.Host.WindowService")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | //将 ComVisible 设置为 false 将使此程序集中的类型 18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("9414ed88-973e-4b7a-b41e-4f63cddb8135")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Arguments/YouhuiquanFetchWebPageArgument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Arguments 8 | { 9 | /// 10 | /// 查询淘宝优惠券参数结构 11 | /// 前段 调用展示列表的时候 12 | /// 第一阶段发送此参数 用来查询是否商品有优惠券,但是不查询优惠券的额度门槛详细 13 | /// 14 | public class YouhuiquanFetchWebPageArgument 15 | { 16 | 17 | /// 18 | /// 参数列表 19 | /// 批量查询卖家的商品的优惠券是否存在信息列表 20 | /// 21 | public List ArgumentsForExistsList { get; set; } 22 | 23 | /// 24 | /// 参数-查询单个商品的优惠券信息 25 | /// 26 | public QuanArgument ArgumentsForQuanDetails { get; set; } 27 | 28 | 29 | public class QuanArgument { 30 | /// 31 | /// 卖家Id 32 | /// 33 | public long SellerId { get; set; } 34 | 35 | /// 36 | /// 商品Id 37 | /// 38 | public long ItemId { get; set; } 39 | } 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host/Configs/HotWords.txt: -------------------------------------------------------------------------------- 1 | 热水袋 2 | 暖风机 3 | 暖宝宝 4 | 保暖内衣女 5 | 加湿器 6 | 热水袋 7 | 充电短靴女 8 | 优衣库 9 | 手套女冬 10 | 马甲女冬 11 | 打底衫女 12 | 电热毯 13 | 雪地靴 14 | 厨房置物架 15 | iphonex手机壳 16 | 口罩 17 | 围巾女冬季 18 | 暖手宝 19 | 地毯 20 | 取暖器 21 | 探路者 22 | 男包 23 | 小米6 24 | 烤盘架 25 | 雨伞 26 | 玻璃钢电缆桥架 27 | 麻绳 绳子 28 | 电脑桌 29 | 衬衫 30 | 键盘 31 | 紫铜管 32 | 大码连衣裙 33 | 玩具 34 | 红豆薏米粉 35 | 洗衣液 36 | 菜青虫 37 | 情趣内衣 38 | 摩托车 39 | 实木床 40 | 拖鞋女夏时尚 外穿 41 | 吸顶灯 42 | 运动鞋女 43 | 面膜 44 | 大车压痕全包围脚垫 45 | 椅子 46 | 高跟鞋 47 | 麻绳 48 | 小清新套装裙 49 | 蓝牙耳机 50 | 零食 51 | 钓竿 52 | 显示器 53 | 剃须刀 54 | 办公桌 55 | 水杯 56 | 凉鞋 57 | 电动车 58 | 双肩包 59 | 地毯 60 | 牛仔裤男 61 | 充电宝 62 | 医用腰带 63 | 仿真草皮 64 | 小米 65 | 拖鞋 66 | 假花摆件 67 | 仿真紫罗兰 68 | 拖鞋男 69 | 温度计 70 | 凉拖女 71 | 蕾丝连衣裙 72 | 文胸 73 | 中老年女装 74 | 四季冰丝汽车方向盘 75 | 草皮墙 76 | 插座面板 77 | 罗格朗 78 | 平板电脑 79 | 护腰带 80 | 爬山虎壁挂常青 81 | 耐克男鞋 82 | 女款时尚羽绒服 83 | 裙子 84 | 床 85 | 女装 86 | 魅族 87 | 点焊机 88 | 假草盆栽 89 | 女装 90 | 洗衣机 91 | 拉杆箱 92 | 除尘器布袋 93 | u盘 94 | 涤纶防静电布袋 95 | 不锈钢输液椅 96 | 手机 97 | 老人手机 98 | 吊带连衣裙 99 | 耐高温滤袋 100 | 欧普隐形吊灯 101 | 紫罗兰花藤 102 | 电视 103 | 气动点焊机 104 | 冷弯设备 105 | 开关插座 罗格朗 106 | 妈妈连衣裙 107 | 园艺 108 | 鸸鹋油 澳洲 109 | 连衣裙 110 | 韩版商务手提包 111 | 冰箱 112 | t恤 113 | 行车记录仪 -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefResolveCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface for CefRequestContext::ResolveHost. 11 | /// 12 | public abstract unsafe partial class CefResolveCallback 13 | { 14 | private void on_resolve_completed(cef_resolve_callback_t* self, CefErrorCode result, cef_string_list* resolved_ips) 15 | { 16 | CheckSelf(self); 17 | 18 | var mResolvedIps = cef_string_list.ToArray(resolved_ips); 19 | OnResolveCompleted(result, mResolvedIps); 20 | } 21 | 22 | /// 23 | /// Called after the ResolveHost request has completed. |result| will be the 24 | /// result code. |resolved_ips| will be the list of resolved IP addresses or 25 | /// empty if the resolution failed. 26 | /// 27 | protected abstract void OnResolveCompleted(CefErrorCode result, string[] resolvedIps); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/Configs/desk/quartz.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.WindowService/Configs/winSer/quartz.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefEndTracingCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Implement this interface to receive notification when tracing has completed. 11 | /// The methods of this class will be called on the browser process UI thread. 12 | /// 13 | public abstract unsafe partial class CefEndTracingCallback 14 | { 15 | private void on_end_tracing_complete(cef_end_tracing_callback_t* self, cef_string_t* tracing_file) 16 | { 17 | CheckSelf(self); 18 | 19 | OnEndTracingComplete(cef_string_t.ToString(tracing_file)); 20 | } 21 | 22 | /// 23 | /// Called after all processes have sent their trace data. |tracing_file| is 24 | /// the path at which tracing data was written. The client is responsible for 25 | /// deleting |tracing_file|. 26 | /// 27 | protected abstract void OnEndTracingComplete(string tracingFile); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefPdfPrintCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface for CefBrowserHost::PrintToPDF. The methods of this class 11 | /// will be called on the browser process UI thread. 12 | /// 13 | public abstract unsafe partial class CefPdfPrintCallback 14 | { 15 | private void on_pdf_print_finished(cef_pdf_print_callback_t* self, cef_string_t* path, int ok) 16 | { 17 | CheckSelf(self); 18 | 19 | var m_path = cef_string_t.ToString(path); 20 | OnPdfPrintFinished(m_path, ok != 0); 21 | } 22 | 23 | /// 24 | /// Method that will be executed when the PDF printing has completed. |path| 25 | /// is the output path. |ok| will be true if the printing completed 26 | /// successfully or false otherwise. 27 | /// 28 | protected abstract void OnPdfPrintFinished(string path, bool ok); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefWebPluginUnstableCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Interface to implement for receiving unstable plugin information. The methods 11 | /// of this class will be called on the browser process IO thread. 12 | /// 13 | public abstract unsafe partial class CefWebPluginUnstableCallback 14 | { 15 | private void is_unstable(cef_web_plugin_unstable_callback_t* self, cef_string_t* path, int unstable) 16 | { 17 | CheckSelf(self); 18 | 19 | var m_path = cef_string_t.ToString(path); 20 | IsUnstable(m_path, unstable != 0); 21 | } 22 | 23 | /// 24 | /// Method that will be called for the requested plugin. |unstable| will be 25 | /// true if the plugin has reached the crash count threshold of 3 times in 120 26 | /// seconds. 27 | /// 28 | protected abstract void IsUnstable(string path, bool unstable); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefColorModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_color_model_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | /// 8 | /// Print job color mode values. 9 | /// 10 | public enum CefColorModel 11 | { 12 | Unknown = 0, 13 | Gray, 14 | Color, 15 | Cmyk, 16 | Cmy, 17 | Kcmy, 18 | Cmy_K, // CMY_K represents CMY+K. 19 | Black, 20 | Grayscale, 21 | Rgb, 22 | Rgb16, 23 | Rgba, 24 | 25 | ColorMode_Color, // Used in samsung printer ppds. 26 | ColorMode_Monochrome, // Used in samsung printer ppds. 27 | 28 | HP_Color_Color, // Used in HP color printer ppds. 29 | HP_Color_Black, // Used in HP color printer ppds. 30 | 31 | PrintoutMode_Normal, // Used in foomatic ppds. 32 | PrintoutMode_Normal_Gray, // Used in foomatic ppds. 33 | 34 | ProcessColorModel_Cmyk, // Used in canon printer ppds. 35 | ProcessColorModel_Greyscale, // Used in canon printer ppds. 36 | ProcessColorModel_Rgb, // Used in canon printer ppds 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/Serialize/ISerialize.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace NTCPMessage.Serialize 6 | { 7 | public interface ISerialize 8 | { 9 | /// 10 | /// Object to bytes 11 | /// 12 | /// object that will be serialized 13 | /// bytes 14 | byte[] GetBytes(object obj); 15 | 16 | /// 17 | /// bytes to object 18 | /// 19 | /// data will be deserialized 20 | /// object 21 | object GetObject(byte[] data); 22 | } 23 | 24 | public interface ISerialize: ISerialize 25 | { 26 | /// 27 | /// Object to bytes 28 | /// 29 | /// object that will be serialized 30 | /// bytes 31 | byte[] GetBytes(ref T obj); 32 | 33 | /// 34 | /// bytes to object 35 | /// 36 | /// data will be deserialized 37 | /// object 38 | new T GetObject(byte[] data); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/MamaQuanOrProductTuiGuangResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage 8 | { 9 | 10 | /// 11 | /// 推广商品返回的转换后的商品链接和券链接 12 | /// 13 | public class MamaQuanOrProductTuiGuangResult 14 | { 15 | public DataStruct data { get; set; } 16 | public InfoStruct info { get; set; } 17 | public bool ok { get; set; } 18 | public string invalidKey { get; set; } 19 | 20 | public class DataStruct 21 | { 22 | public string taoToken { get; set; } 23 | public string couponShortLinkUrl { get; set; } 24 | public string qrCodeUrl { get; set; } 25 | public string clickUrl { get; set; } 26 | public string couponLinkTaoToken { get; set; } 27 | public string couponLink { get; set; } 28 | public string type { get; set; } 29 | public string shortLinkUrl { get; set; } 30 | } 31 | public class InfoStruct 32 | { 33 | public string message { get; set; } 34 | public bool ok { get; set; } 35 | } 36 | } 37 | 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Products/TaobaoProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Products 8 | { 9 | /// 10 | /// 淘宝商品实体 11 | /// 12 | public class TaobaoProduct:ProductBase 13 | { 14 | public TaobaoProduct() 15 | { 16 | this.Platform = SupportPlatformEnum.Taobao; 17 | } 18 | 19 | /// 20 | /// 卖家地址 21 | /// 22 | public string SellerAddress { get; set; } 23 | /// 24 | /// 是否为金牌卖家 25 | /// 26 | public bool IsGold { get; set; } 27 | 28 | /// 29 | /// 是否天猫商品 30 | /// 31 | public bool IsTmall { get; set; } 32 | /// 33 | /// 是否流行 34 | /// 35 | public bool IsFashion { get; set; } 36 | /// 37 | /// 是否新品 38 | /// 39 | public bool IsXinPin { get; set; } 40 | 41 | /// 42 | /// 是否有运费险 43 | /// 44 | public bool IsHasYunfeiXian { get; set; } 45 | 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/version.g.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DO NOT MODIFY! THIS IS AUTOGENERATED FILE! 3 | // 4 | namespace ShoppingWebCrawler.Cef.Core.Interop 5 | { 6 | using System; 7 | using System.Runtime.InteropServices; 8 | using System.Diagnostics.CodeAnalysis; 9 | 10 | internal static unsafe partial class libcef 11 | { 12 | public const string CEF_VERSION = "3.2623.1397.gaf139d7"; 13 | public const int CEF_VERSION_MAJOR = 3; 14 | public const int CEF_COMMIT_NUMBER = 1397; 15 | public const string CEF_COMMIT_HASH = "af139d7761c1fd6921ec020535d641e685f9ddad"; 16 | 17 | public const int CHROME_VERSION_MAJOR = 49; 18 | public const int CHROME_VERSION_MINOR = 0; 19 | public const int CHROME_VERSION_BUILD = 2623; 20 | public const int CHROME_VERSION_PATCH = 110; 21 | 22 | public const string CEF_API_HASH_UNIVERSAL = "32c1d3523da124f2dea7b80b92c53c4d4a463c65"; 23 | 24 | public const string CEF_API_HASH_PLATFORM_WIN = "64b27477b82b44b51ce817522f744fca6768cbbb"; 25 | public const string CEF_API_HASH_PLATFORM_MACOSX = "e3b9c36454ae5ae4fb3509e17fb6a7d2877c847d"; 26 | public const string CEF_API_HASH_PLATFORM_LINUX = "87a195efc055fb9f39c84f5ce8199cc8766290e3"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_urlparts_t.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // 4 | namespace ShoppingWebCrawler.Cef.Core.Interop 5 | { 6 | using System; 7 | using System.Runtime.InteropServices; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe struct cef_urlparts_t 11 | { 12 | public cef_string_t spec; 13 | public cef_string_t scheme; 14 | public cef_string_t username; 15 | public cef_string_t password; 16 | public cef_string_t host; 17 | public cef_string_t port; 18 | public cef_string_t origin; 19 | public cef_string_t path; 20 | public cef_string_t query; 21 | 22 | internal static void Clear(cef_urlparts_t* self) 23 | { 24 | libcef.string_clear(&self->spec); 25 | libcef.string_clear(&self->scheme); 26 | libcef.string_clear(&self->username); 27 | libcef.string_clear(&self->password); 28 | libcef.string_clear(&self->host); 29 | libcef.string_clear(&self->port); 30 | libcef.string_clear(&self->origin); 31 | libcef.string_clear(&self->path); 32 | libcef.string_clear(&self->query); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.WindowService/ScheduleTasks/ServiceHelthCheckerJob.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | using Quartz; 9 | using ShoppingWebCrawler.Host.WindowService.App_Start; 10 | using ShoppingWebCrawler.Host.Common.Logging; 11 | 12 | namespace ShoppingWebCrawler.Host.WindowService.ScheduleTasks 13 | { 14 | /// 15 | /// 监视的host 进程的健康监视 16 | /// 用一定的频率设置,发送心跳包,一旦为能成功返回TCP结果 那么重启服务 17 | /// 18 | public sealed class ServiceHelthCheckerJob : IJob 19 | { 20 | 21 | public void Execute(IJobExecutionContext context) 22 | { 23 | Logger.Info("ServiceHelthCheckerJob 被执行!"); 24 | 25 | if (ShoppingWebCrawlerHostService.IsServiceRunning==true) 26 | { 27 | var checkResult = RemoteTcpTestClient.TestPingSendMessage(); 28 | if (false == checkResult) 29 | { 30 | //一旦返回结果不对 那么重新启动host 进程 31 | Logger.Info("开始重启蜘蛛 Host !"); 32 | ShoppingWebCrawlerHostService.StartWebCrawlerHostProcess(); 33 | 34 | } 35 | } 36 | 37 | 38 | } 39 | 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Proxies/CefBeforeDownloadCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface used to asynchronously continue a download. 11 | /// 12 | public sealed unsafe partial class CefBeforeDownloadCallback 13 | { 14 | /// 15 | /// Call to continue the download. Set |download_path| to the full file path 16 | /// for the download including the file name or leave blank to use the 17 | /// suggested name and the default temp directory. Set |show_dialog| to true 18 | /// if you do wish to show the default "Save As" dialog. 19 | /// 20 | public void Continue(string downloadPath, bool showDialog) 21 | { 22 | fixed (char* downloadPath_ptr = downloadPath) 23 | { 24 | var n_downloadPath = new cef_string_t(downloadPath_ptr, downloadPath != null ? downloadPath.Length : 0); 25 | cef_before_download_callback_t.cont(_self, &n_downloadPath, showDialog ? 1 : 0); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/BeforePopupEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ShoppingWebCrawler.Cef.Core; 3 | namespace ShoppingWebCrawler.Cef.Framework 4 | { 5 | public class BeforePopupEventArgs : EventArgs 6 | { 7 | public BeforePopupEventArgs( 8 | CefFrame frame, 9 | string targetUrl, 10 | string targetFrameName, 11 | CefPopupFeatures popupFeatures, 12 | CefWindowInfo windowInfo, 13 | CefClient client, 14 | CefBrowserSettings settings, 15 | bool noJavascriptAccess) 16 | { 17 | Frame = frame; 18 | TargetUrl = targetUrl; 19 | TargetFrameName = targetFrameName; 20 | PopupFeatures = popupFeatures; 21 | WindowInfo = windowInfo; 22 | Client = client; 23 | Settings = settings; 24 | NoJavascriptAccess = noJavascriptAccess; 25 | } 26 | 27 | public bool NoJavascriptAccess { get; set; } 28 | 29 | public CefBrowserSettings Settings { get; private set; } 30 | 31 | public CefClient Client { get; set; } 32 | 33 | public CefWindowInfo WindowInfo { get; private set; } 34 | 35 | public CefPopupFeatures PopupFeatures { get; private set; } 36 | 37 | public string TargetFrameName { get; private set; } 38 | 39 | public string TargetUrl { get; private set; } 40 | 41 | public CefFrame Frame { get; private set; } 42 | 43 | public bool Handled { get; set; } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/Client/WebCrawlerCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | namespace NTCPMessage.Client 9 | { 10 | /// 11 | /// 蜘蛛服务连接集合 12 | /// 13 | public class WebCrawlerCollection : List 14 | { 15 | public WebCrawlerCollection() 16 | { 17 | 18 | } 19 | 20 | /// 21 | /// 索引器-按照名称获取连接对象 22 | /// 23 | /// 24 | /// 25 | public WebCrawlerConnection this[string name] 26 | { 27 | get 28 | { 29 | 30 | var conn = this.FirstOrDefault(x => x.Name == name); 31 | return conn; 32 | } 33 | set 34 | { 35 | if (null == this) 36 | { 37 | return; 38 | } 39 | var conn = this.FirstOrDefault(x => x.Name == name); 40 | 41 | var pos = this.IndexOf(conn); 42 | if (null != conn) 43 | { 44 | this[pos] = value; 45 | } 46 | } 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/Handler/DefaultContextMenuHandler.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using ShoppingWebCrawler.Cef.Core; 5 | namespace ShoppingWebCrawler.Cef.Framework 6 | { 7 | 8 | /// 9 | /// 默认的 响应右键的菜单处理 10 | /// 11 | /// 12 | public class DefaultContextMenuHandler: CefContextMenuHandler 13 | { 14 | 15 | private bool _isShowMenu; 16 | 17 | public DefaultContextMenuHandler(bool isShowMenu) 18 | { 19 | this._isShowMenu = isShowMenu; 20 | } 21 | 22 | protected override void OnBeforeContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams state, CefMenuModel model) 23 | { 24 | model.Clear();//清除掉构建的菜单对象 25 | if (this._isShowMenu == false) { 26 | return; 27 | } 28 | 29 | 30 | //添加刷新菜单 31 | //model.AddItem((int)CefMenuId.ReloadNoCache, "强制刷新"); 32 | model.AddItem((int)CefMenuId.Back, "返回"); 33 | model.AddItem((int)CefMenuId.Forward, "前进"); 34 | model.AddItem((int)CefMenuId.ReloadNoCache, "强制刷新"); 35 | model.AddItem((int)CefMenuId.ViewSource, "查看源码"); 36 | 37 | base.OnBeforeContextMenu(browser, frame, state, model); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/Event/AcceptEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Text; 21 | using System.Net; 22 | 23 | namespace NTCPMessage.Event 24 | { 25 | public class AcceptEventArgs : EventArgs 26 | { 27 | public EndPoint RemoteIPEndPoint { get; private set; } 28 | 29 | public AcceptEventArgs(EndPoint remoteIPEndPoint) 30 | { 31 | this.RemoteIPEndPoint = remoteIPEndPoint; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/CommandConstants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage 8 | { 9 | /// 10 | /// SOAP命令 11 | /// 12 | public static class CommandConstants 13 | { 14 | 15 | public const string CMD_Ping = "ping"; 16 | 17 | /// 18 | /// 支持的电商平台集合 19 | /// 20 | public const string CMD_Platforms = "platforms"; 21 | 22 | /// 23 | /// 抓取网页 24 | /// 25 | public const string CMD_FetchPage = "fetch_page"; 26 | /// 27 | /// 检索优惠券是否存在 28 | /// 29 | public const string CMD_FetchquanExistsList = "quan_exists_list"; 30 | 31 | /// 32 | /// 检索指定商品的券详细 33 | /// 34 | public const string CMD_FetchquanDetails = "quan_details"; 35 | 36 | /// 37 | /// 从节点注册端口到主节点 38 | /// 39 | public const string CMD_RegisterSlavePort = "register_port"; 40 | 41 | ///// 42 | ///// 检索蜘蛛服务端的信息:info 43 | ///// 44 | //public const string CMD_ScanSoapServerSupportCluster= "server_cluster"; 45 | 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/MessageFlag.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Text; 21 | 22 | namespace NTCPMessage 23 | { 24 | [Flags] 25 | public enum MessageFlag : byte 26 | { 27 | None = 0x00, 28 | Sync = 0x01, // Send syncronization message 29 | EncryptToServer = 0x02, //Send encrypt message to server. 30 | EncryptToClient = 0x04, //Send encrypt message to client. 31 | Inner= 0x08, //inner message 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Framework/Handler/CefWebLoadHandler.cs: -------------------------------------------------------------------------------- 1 | using ShoppingWebCrawler.Cef.Core; 2 | 3 | namespace ShoppingWebCrawler.Cef.Framework 4 | { 5 | public sealed class CefWebLoadHandler : CefLoadHandler 6 | { 7 | private readonly CefWebBrowser _core; 8 | 9 | public CefWebLoadHandler(CefWebBrowser core) 10 | { 11 | _core = core; 12 | } 13 | 14 | protected override void OnLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) 15 | { 16 | _core.InvokeIfRequired(() => _core.OnLoadEnd(new LoadEndEventArgs(frame, httpStatusCode))); 17 | } 18 | 19 | protected override void OnLoadError(CefBrowser browser, CefFrame frame, CefErrorCode errorCode, string errorText, string failedUrl) 20 | { 21 | _core.InvokeIfRequired(() => _core.OnLoadError(new LoadErrorEventArgs(frame, errorCode, errorText, failedUrl))); 22 | } 23 | 24 | protected override void OnLoadStart(CefBrowser browser, CefFrame frame) 25 | { 26 | _core.InvokeIfRequired(() => _core.OnLoadStart(new LoadStartEventArgs(frame))); 27 | } 28 | 29 | protected override void OnLoadingStateChange(CefBrowser browser, bool isLoading, bool canGoBack, bool canGoForward) 30 | { 31 | _core.InvokeIfRequired(() => _core.OnLoadingStateChange(new LoadingStateChangeEventArgs(isLoading, canGoBack, canGoForward))); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SocketLibrary/Example/MessageConvert/CustomerSoapMessageConvert.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using NTCPMessage.EntityPackage; 8 | using NTCPMessage.Serialize; 9 | using System.Net; 10 | using Newtonsoft.Json; 11 | 12 | namespace Example2010.MessageConvert 13 | { 14 | 15 | 16 | /// 17 | /// 自定义消息转换 18 | /// 19 | 20 | public class CustomerSoapMessageConvert : MessageParse 21 | { 22 | /// 23 | /// Constractor 24 | /// 25 | /// serializer for input data 26 | /// serializer for return data 27 | public CustomerSoapMessageConvert() 28 | : base(new SoapMessageSerializer(), new JsonSerializer()) 29 | { 30 | } 31 | 32 | public override IDataContainer ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, NTCPMessage.MessageFlag Flag, ushort CableId, uint Channel, uint Event, SoapMessage obj) 33 | { 34 | //Console.WriteLine(obj); 35 | 36 | var result = new DataContainer(); 37 | result.Result = "1111111111"; 38 | 39 | return result; 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/DataResultContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage 8 | { 9 | public class DataContainer : IDataContainer 10 | { 11 | public DataContainer() 12 | { 13 | this.Status = 1; 14 | } 15 | /// 16 | /// 状态 0 失败,1 成功 17 | /// 18 | public int Status { get; set; } 19 | 20 | /// 21 | /// 错误消息 22 | /// 23 | public string ErrorMsg { get; set; } 24 | /// 25 | /// 返回客户端的结果 26 | /// 如果是对象请转为json格式 27 | /// 28 | public string Result { get; set; } 29 | 30 | /// 31 | /// 设置结果为成功 32 | /// 33 | public void SetSuccess() 34 | { 35 | this.Status = 1; 36 | this.Result = "success"; 37 | } 38 | /// 39 | /// 返回空的内容消息容器 40 | /// 41 | /// 42 | public static IDataContainer CreateNullDataContainer() 43 | { 44 | 45 | return new DataContainer { Status = 0, ErrorMsg = "参数未能被识别或者为空!" }; 46 | 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SocketLibrary/ServerTest/MessageConvert/CustomerSoapMessageConvert.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using NTCPMessage.EntityPackage; 8 | using NTCPMessage.Serialize; 9 | using System.Net; 10 | using Newtonsoft.Json; 11 | 12 | namespace ServerTest.MessageConvert 13 | { 14 | 15 | 16 | /// 17 | /// 自定义消息转换 18 | /// 19 | 20 | public class CustomerSoapMessageConvert : MessageParse 21 | { 22 | /// 23 | /// Constractor 24 | /// 25 | /// serializer for input data 26 | /// serializer for return data 27 | public CustomerSoapMessageConvert() 28 | : base(new SoapMessageSerializer(), new JsonSerializer()) 29 | { 30 | } 31 | 32 | public override IDataContainer ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, NTCPMessage.MessageFlag Flag, ushort CableId, uint Channel, uint Event, SoapMessage obj) 33 | { 34 | //Console.WriteLine(obj); 35 | 36 | var result = new DataContainer(); 37 | result.Result = "1111111111"; 38 | 39 | return result; 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefContextMenuTypeFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_context_menu_type_flags_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | 9 | /// 10 | /// Supported context menu type flags. 11 | /// 12 | [Flags] 13 | public enum CefContextMenuTypeFlags 14 | { 15 | /// 16 | /// No node is selected. 17 | /// 18 | None = 0, 19 | 20 | /// 21 | /// The top page is selected. 22 | /// 23 | Page = 1 << 0, 24 | 25 | /// 26 | /// A subframe page is selected. 27 | /// 28 | Frame = 1 << 1, 29 | 30 | /// 31 | /// A link is selected. 32 | /// 33 | Link = 1 << 2, 34 | 35 | /// 36 | /// A media node is selected. 37 | /// 38 | Media = 1 << 3, 39 | 40 | /// 41 | /// There is a textual or mixed selection that is selected. 42 | /// 43 | Selection = 1 << 4, 44 | 45 | /// 46 | /// An editable element is selected. 47 | /// 48 | Editable = 1 << 5 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host/Configs/SupportPlatforms.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/Event/ErrorEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Text; 21 | 22 | namespace NTCPMessage.Event 23 | { 24 | public class ErrorEventArgs : EventArgs 25 | { 26 | public string Func { get; private set; } 27 | public Exception ErrorException { get; private set; } 28 | 29 | public ErrorEventArgs(string func, Exception e) 30 | { 31 | Func = func; 32 | ErrorException = e; 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefDomVisitor.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Interface to implement for visiting the DOM. The methods of this class will 11 | /// be called on the render process main thread. 12 | /// 13 | public abstract unsafe partial class CefDomVisitor 14 | { 15 | private void visit(cef_domvisitor_t* self, cef_domdocument_t* document) 16 | { 17 | CheckSelf(self); 18 | 19 | var m_document = CefDomDocument.FromNative(document); 20 | 21 | Visit(m_document); 22 | 23 | m_document.Dispose(); 24 | } 25 | 26 | /// 27 | /// Method executed for visiting the DOM. The document object passed to this 28 | /// method represents a snapshot of the DOM at the time this method is 29 | /// executed. DOM objects are only valid for the scope of this method. Do not 30 | /// keep references to or attempt to access any DOM objects outside the scope 31 | /// of this method. 32 | /// 33 | protected abstract void Visit(CefDomDocument document); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/libcef.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core.Interop 2 | { 3 | using System; 4 | using System.Runtime.InteropServices; 5 | using System.Security; 6 | 7 | #if !DEBUG 8 | [SuppressUnmanagedCodeSecurity] 9 | #endif 10 | internal static unsafe partial class libcef 11 | { 12 | internal const string DllName = "libcef"; 13 | 14 | internal const int ALIGN = 0; 15 | 16 | internal const CallingConvention CEF_CALL = CallingConvention.Cdecl; 17 | 18 | // Windows: CallingConvention.StdCall 19 | // Unix: CallingConvention.Cdecl 20 | // FIXME: CEF#598 (http://code.google.com/p/chromiumembedded/issues/detail?id=598) 21 | internal const CallingConvention CEF_CALLBACK = CallingConvention.Winapi; 22 | 23 | #region cef_version.h 24 | 25 | [DllImport(libcef.DllName, EntryPoint = "cef_build_revision", CallingConvention = libcef.CEF_CALL)] 26 | public static extern int build_revision(); 27 | 28 | [DllImport(libcef.DllName, EntryPoint = "cef_version_info", CallingConvention = libcef.CEF_CALL)] 29 | public static extern int version_info(int entry); 30 | 31 | [DllImport(libcef.DllName, EntryPoint = "cef_api_hash", CallingConvention = libcef.CEF_CALL)] 32 | public static extern sbyte* api_hash(int entry); 33 | 34 | #endregion 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefWebPluginInfoVisitor.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Interface to implement for visiting web plugin information. The methods of 11 | /// this class will be called on the browser process UI thread. 12 | /// 13 | public abstract unsafe partial class CefWebPluginInfoVisitor 14 | { 15 | private int visit(cef_web_plugin_info_visitor_t* self, cef_web_plugin_info_t* info, int count, int total) 16 | { 17 | CheckSelf(self); 18 | 19 | var m_info = CefWebPluginInfo.FromNative(info); 20 | 21 | var result = Visit(m_info, count, total); 22 | 23 | return result ? 1 : 0; 24 | } 25 | 26 | /// 27 | /// Method that will be called once for each plugin. |count| is the 0-based 28 | /// index for the current plugin. |total| is the total number of plugins. 29 | /// Return false to stop visiting plugins. This method may never be called if 30 | /// no plugins are found. 31 | /// 32 | protected abstract bool Visit(CefWebPluginInfo info, int count, int total); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.DeskTop/readMe.txt: -------------------------------------------------------------------------------- 1 | 本项目用来展示网页UI 进行页面人工操作,登录 获取Cookie 2 | ***********必须将 项目根目录下的libs 文件夹 拷贝对应的 libcef文件 3 | libs 文件目录: 4 | 卷序列号为 00000235 4010:61AA 5 | . \LIBS 6 | │ jint.dll 7 | │ Newtonsoft.Json.dll 8 | │ System.Net.Http.dll 9 | │ 10 | ├─x64 11 | │ │ cef.pak 12 | │ │ cef_100_percent.pak 13 | │ │ cef_200_percent.pak 14 | │ │ cef_extensions.pak 15 | │ │ cef_sandbox.lib 16 | │ │ d3dcompiler_43.dll 17 | │ │ d3dcompiler_47.dll 18 | │ │ devtools_resources.pak 19 | │ │ icudtl.dat 20 | │ │ libcef.dll 21 | │ │ libcef.lib 22 | │ │ libEGL.dll 23 | │ │ libGLESv2.dll 24 | │ │ natives_blob.bin 25 | │ │ snapshot_blob.bin 26 | │ │ widevinecdmadapter.dll 27 | │ │ 28 | │ └─locales 29 | │ en-GB.pak 30 | │ en-US.pak 31 | │ zh-CN.pak 32 | │ zh-TW.pak 33 | │ 34 | └─x86 35 | │ cef.pak 36 | │ cef_100_percent.pak 37 | │ cef_200_percent.pak 38 | │ cef_extensions.pak 39 | │ d3dcompiler_43.dll 40 | │ d3dcompiler_47.dll 41 | │ devtools_resources.pak 42 | │ icudtl.dat 43 | │ libcef.dll 44 | │ libcef.lib 45 | │ libEGL.dll 46 | │ libGLESv2.dll 47 | │ natives_blob.bin 48 | │ snapshot_blob.bin 49 | │ widevinecdmadapter.dll 50 | │ wow_helper.exe 51 | │ 52 | └─locales 53 | en-GB.pak 54 | en-US.pak 55 | zh-CN.pak 56 | zh-TW.pak 57 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Base/cef_string_map.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core.Interop 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Runtime.InteropServices; 6 | using System.Security; 7 | using System.Text; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe struct cef_string_map 11 | { 12 | public static Dictionary ToDictionary(cef_string_map* map) 13 | { 14 | if (map == null) return null; 15 | 16 | var result = new Dictionary(); 17 | var count = libcef.string_map_size(map); 18 | if (count == 0) return result; 19 | 20 | cef_string_t n_value = new cef_string_t(); 21 | 22 | for (var i = 0; i < count; i++) 23 | { 24 | libcef.string_map_key(map, i, &n_value); // FIXME: do not ignore return value of libcef.string_map_key 25 | var key = cef_string_t.ToString(&n_value); 26 | libcef.string_map_value(map, i, &n_value); // FIXME: do not ignore return value of libcef.string_map_value 27 | var value = cef_string_t.ToString(&n_value); 28 | result.Add(key, value); 29 | } 30 | 31 | libcef.string_clear(&n_value); 32 | 33 | return result; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/Serialize/JsonSerializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Newtonsoft.Json; 5 | 6 | namespace NTCPMessage.Serialize 7 | { 8 | 9 | public class JsonSerializer : ISerialize where T : class 10 | { 11 | 12 | 13 | #region ISerialize Members 14 | 15 | public byte[] GetBytes(ref T obj) 16 | { 17 | return ((ISerialize)this).GetBytes(obj); 18 | 19 | } 20 | 21 | public T GetObject(byte[] data) 22 | { 23 | return ((ISerialize)this).GetObject(data) as T; 24 | } 25 | byte[] ISerialize.GetBytes(object obj) 26 | { 27 | if (obj == null) 28 | { 29 | return null; 30 | } 31 | 32 | string sJSON = JsonConvert.SerializeObject(obj); 33 | 34 | return Encoding.UTF8.GetBytes(sJSON); 35 | } 36 | object ISerialize.GetObject(byte[] data) 37 | { 38 | if (data == null || data.Length <= 0) 39 | { 40 | throw new ArgumentNullException("To DeserializeObject ,you must pass the data bytes can't be null or zero length!"); 41 | } 42 | 43 | 44 | string jsonData = Encoding.UTF8.GetString(data); 45 | return JsonConvert.DeserializeObject(jsonData); 46 | } 47 | 48 | #endregion 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Arguments/BrandTag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Arguments 8 | { 9 | /// 10 | /// 查询关键词 标签 11 | /// 12 | public class BrandTag 13 | { 14 | 15 | 16 | /// 17 | /// 品牌Id 18 | /// 19 | public string BrandId { get; set; } 20 | /// 21 | /// 品牌名称 22 | /// 23 | public string BrandName { get; set; } 24 | 25 | /// 26 | /// 图标地址 27 | /// 28 | public string IconUrl { get; set; } 29 | 30 | 31 | private string _CharIndex; 32 | 33 | /// 34 | /// 对应的字母索引 35 | /// 36 | public string CharIndex 37 | { 38 | get 39 | { 40 | return this._CharIndex; 41 | } 42 | set 43 | { 44 | this._CharIndex = value; 45 | } 46 | } 47 | 48 | 49 | /// 50 | /// 过滤字段 51 | /// 52 | public string FilterField { get; set; } 53 | /// 54 | /// 来自的平台 55 | /// 56 | public SupportPlatformEnum Platform { get; set; } 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.Common/Common/TypeFinder/WebAppTypeFinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using System.Web; 5 | 6 | namespace ShoppingWebCrawler.Host.Common.TypeFinder 7 | { 8 | /// 9 | /// Provides information about types in the current web application. 10 | /// Optionally this class can look at all assemblies in the bin folder. 11 | /// 继承AppDomainTypeFinder 来具体化 Web程序中的程序集的操作访问 12 | /// 13 | public class WebAppTypeFinder : AppDomainTypeFinder 14 | { 15 | #region Fields 16 | 17 | private bool _binFolderAssembliesLoaded = false; 18 | 19 | #endregion 20 | 21 | #region Ctor 22 | 23 | public WebAppTypeFinder() 24 | { 25 | } 26 | 27 | #endregion 28 | 29 | #region Properties 30 | 31 | 32 | 33 | #endregion 34 | 35 | #region Methods 36 | 37 | 38 | 39 | public override IList GetAssemblies() 40 | { 41 | if (!_binFolderAssembliesLoaded) 42 | { 43 | _binFolderAssembliesLoaded = true; 44 | string binPath = GetBinDirectory(); 45 | //binPath = _webHelper.MapPath("~/bin"); 46 | LoadMatchingAssemblies(binPath); 47 | } 48 | 49 | return base.GetAssemblies(); 50 | } 51 | 52 | #endregion 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Base/cef_string_t.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core.Interop 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Runtime.InteropServices; 6 | using System.Security; 7 | using System.Text; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe partial struct cef_string_t 11 | { 12 | internal char* _str; 13 | internal UIntPtr _length; 14 | internal IntPtr _dtor; 15 | 16 | [UnmanagedFunctionPointer(libcef.CEF_CALL)] 17 | #if !DEBUG 18 | [SuppressUnmanagedCodeSecurity] 19 | #endif 20 | public delegate void dtor_delegate(char* str); 21 | 22 | public cef_string_t(char* str, int length) 23 | { 24 | _str = str; 25 | _length = (UIntPtr)length; 26 | _dtor = IntPtr.Zero; 27 | } 28 | 29 | public static void Copy(string value, cef_string_t* str) 30 | { 31 | fixed (char* value_ptr = value) 32 | { 33 | libcef.string_set(value_ptr, value != null ? (UIntPtr)value.Length : UIntPtr.Zero, str, 1); // FIXME: do not ignore result 34 | } 35 | } 36 | 37 | public static string ToString(cef_string_t* obj) 38 | { 39 | if (obj == null) return null; 40 | 41 | return new string((char*)obj->_str, 0, (int)obj->_length); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Interop/Structs/cef_request_context_settings_t.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // 4 | namespace ShoppingWebCrawler.Cef.Core.Interop 5 | { 6 | using System; 7 | using System.Runtime.InteropServices; 8 | 9 | [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)] 10 | internal unsafe struct cef_request_context_settings_t 11 | { 12 | public UIntPtr size; 13 | public cef_string_t cache_path; 14 | public int persist_session_cookies; 15 | public int persist_user_preferences; 16 | public int ignore_certificate_errors; 17 | public cef_string_t accept_language_list; 18 | 19 | #region Alloc & Free 20 | private static int _sizeof; 21 | 22 | static cef_request_context_settings_t() 23 | { 24 | _sizeof = Marshal.SizeOf(typeof(cef_request_context_settings_t)); 25 | } 26 | 27 | public static cef_request_context_settings_t* Alloc() 28 | { 29 | var ptr = (cef_request_context_settings_t*)Marshal.AllocHGlobal(_sizeof); 30 | *ptr = new cef_request_context_settings_t(); 31 | ptr->size = (UIntPtr)_sizeof; 32 | return ptr; 33 | } 34 | 35 | public static void Free(cef_request_context_settings_t* ptr) 36 | { 37 | Marshal.FreeHGlobal((IntPtr)ptr); 38 | } 39 | #endregion 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/Event/DisconnectEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Text; 21 | using System.Net; 22 | 23 | namespace NTCPMessage.Event 24 | { 25 | public class DisconnectEventArgs : EventArgs 26 | { 27 | public EndPoint RemoteIPEndPoint { get; private set; } 28 | 29 | public UInt16 CableId { get; private set; } 30 | 31 | public DisconnectEventArgs(EndPoint remoteIPEndPoint, UInt16 cableId) 32 | { 33 | this.RemoteIPEndPoint = remoteIPEndPoint; 34 | this.CableId = cableId; 35 | } 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/QingTaoKeHideQuanResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage 8 | { 9 | /// 10 | /// 轻淘API 查询出的隐藏活动优惠券 11 | /// 12 | public class QingTaoKeHideQuanResult 13 | { 14 | /// 15 | /// 0 是正确响应 非0是错误 16 | /// 17 | public int status { get; set; } 18 | 19 | /// 20 | /// 券集合 21 | /// 22 | public List data { get; set; } 23 | 24 | public string v { get; set; } 25 | 26 | /// 27 | /// 隐藏券item 28 | /// 29 | public class HideQuanItem 30 | { 31 | public long sellerId { get; set; } 32 | public string activityId { get; set; } 33 | //public decimal? amount { get; set; } 34 | //public decimal? applyAmount { get; set; } 35 | //public string startDate { get; set; } 36 | 37 | //public string endDate { get; set; } 38 | 39 | //public string remain { get; set; } 40 | //public string requisitioned { get; set; } 41 | //public int total { get; set; } 42 | //public int quan_class { get; set; } 43 | //public bool useAble { get; set; } 44 | } 45 | 46 | } 47 | 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /SocketLibrary/ServerTest/MessageConvert/DefaultMessageConvert.cs: -------------------------------------------------------------------------------- 1 | using NTCPMessage.EntityPackage; 2 | using NTCPMessage.Event; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Net; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using Newtonsoft.Json; 10 | using NTCPMessage.Serialize; 11 | 12 | namespace ServerTest.MessageConvert 13 | { 14 | 15 | /// 16 | /// 默认的消息 17 | /// 统一为基本字符串消息 18 | /// 19 | public class DefaultMessageConvert: IMessageParse 20 | { 21 | public void ReceiveEventHandler(object sender, ReceiveEventArgs args) 22 | { 23 | 24 | string clientData = Encoding.UTF8.GetString(args.Data); 25 | string ret = ProcessMessage(args.SCBID, args.RemoteIPEndPoint, args.Flag, args.CableId, args.Channel, args.Event, 26 | clientData); 27 | 28 | if (ret != null) 29 | { 30 | 31 | args.ReturnData = Encoding.UTF8.GetBytes(ret); 32 | } 33 | else 34 | { 35 | args.ReturnData = null; 36 | } 37 | } 38 | public virtual string ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, NTCPMessage.MessageFlag Flag, ushort CableId, uint Channel, uint Event, string obj) 39 | { 40 | return string.Format("server time is:{0}", DateTime.Now.ToString()); 41 | 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SocketLibrary/Example/MessageConvert/DefaultMessageConvert.cs: -------------------------------------------------------------------------------- 1 | using NTCPMessage.EntityPackage; 2 | using NTCPMessage.Event; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Net; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using Newtonsoft.Json; 10 | using NTCPMessage.Serialize; 11 | 12 | namespace Example2010.MessageConvert 13 | { 14 | 15 | /// 16 | /// 默认的消息 17 | /// 统一为基本字符串消息 18 | /// 19 | public class DefaultMessageConvert: IMessageParse 20 | { 21 | public void ReceiveEventHandler(object sender, ReceiveEventArgs args) 22 | { 23 | 24 | string clientData = Encoding.UTF8.GetString(args.Data); 25 | string ret = ProcessMessage(args.SCBID, args.RemoteIPEndPoint, args.Flag, args.CableId, args.Channel, args.Event, 26 | clientData); 27 | 28 | if (ret != null) 29 | { 30 | 31 | args.ReturnData = Encoding.UTF8.GetBytes(ret); 32 | } 33 | else 34 | { 35 | args.ReturnData = null; 36 | } 37 | } 38 | public virtual string ProcessMessage(int SCBID, EndPoint RemoteIPEndPoint, NTCPMessage.MessageFlag Flag, ushort CableId, uint Channel, uint Event, string obj) 39 | { 40 | return string.Format("server time is:{0}", DateTime.Now.ToString()); ; 41 | 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Structs/CefMouseEvent.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using ShoppingWebCrawler.Cef.Core.Interop; 5 | using System.Diagnostics; 6 | 7 | /// 8 | /// Structure representing mouse event information. 9 | /// 10 | public unsafe struct CefMouseEvent 11 | { 12 | private int _x; 13 | private int _y; 14 | private CefEventFlags _modifiers; 15 | 16 | public CefMouseEvent(int x, int y, CefEventFlags modifiers) 17 | { 18 | _x = x; 19 | _y = y; 20 | _modifiers = modifiers; 21 | } 22 | 23 | internal CefMouseEvent(cef_mouse_event_t* ptr) 24 | { 25 | Debug.Assert(ptr != null); 26 | 27 | _x = ptr->x; 28 | _y = ptr->y; 29 | _modifiers = ptr->modifiers; 30 | } 31 | 32 | internal cef_mouse_event_t ToNative() 33 | { 34 | return new cef_mouse_event_t(_x, _y, _modifiers); 35 | } 36 | 37 | public int X 38 | { 39 | get { return _x; } 40 | set { _x = value; } 41 | } 42 | 43 | public int Y 44 | { 45 | get { return _y; } 46 | set { _y = value; } 47 | } 48 | 49 | public CefEventFlags Modifiers 50 | { 51 | get { return _modifiers; } 52 | set { _modifiers = value; } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Arguments/MogujieFetchWebPageArgument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Arguments 8 | { 9 | /// 10 | /// 【蘑菇街】搜索页面 参数 11 | /// 具体详细的搜索面板 回头慢慢完善 12 | /// 13 | public sealed class MogujieFetchWebPageArgument : BaseFetchWebPageArgument 14 | { 15 | public MogujieFetchWebPageArgument() 16 | { 17 | this.Platform = SupportPlatformEnum.Mogujie; 18 | } 19 | 20 | 21 | /// 22 | /// 排序参数 23 | /// 24 | public override string OrderFiledName 25 | { 26 | get 27 | { 28 | return "sort"; 29 | } 30 | 31 | } 32 | 33 | 34 | /// 35 | /// 获取【蘑菇街】平台支持的排序字段列表 36 | /// 37 | /// 38 | public override List GetCurrentPlatformSupportOrderFields() 39 | { 40 | List fields = new List() { 41 | 42 | new OrderField { DisplayName="综合", FieldValue="pop" }, 43 | new OrderField { DisplayName="销量", FieldValue="sell" }, 44 | new OrderField { DisplayName="新品", FieldValue="new" }, 45 | 46 | }; 47 | 48 | return fields; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.WindowService/Configs/winSer/Quartz_Jobs_WinService001.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | ServiceHelthCheckerJob 16 | ShoppingWebCrawler 17 | ServiceHelthCheckerJob 用来监视ShoppingWebCrawler.Host的运行状况 18 | ShoppingWebCrawler.Host.WindowService.ScheduleTasks.ServiceHelthCheckerJob,ShoppingWebCrawler.Host.WindowService 19 | true 20 | false 21 | 22 | 23 | 24 | 25 | ServiceHelthCheckerJobTrigger 26 | ShoppingWebCrawler 27 | ServiceHelthCheckerJob 28 | ShoppingWebCrawler 29 | 30 | 31 | 0/10 * * * * ? 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host.Common/Extensions/EnumExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Reflection; 5 | 6 | namespace System 7 | { 8 | public static class EnumExtensions 9 | { 10 | 11 | 12 | /// 13 | /// 获取枚举值 整数值的字符串 14 | /// 15 | /// 16 | /// 17 | public static string GetEnumValueString(this Enum emObj) 18 | { 19 | var type = emObj.GetType(); 20 | var name = Enum.GetName(type, emObj); 21 | var value = Convert.ToInt32(Enum.Parse(type, name)); 22 | 23 | return value.ToString(); 24 | } 25 | /// 26 | /// 获取枚举值上的Description特性的说明 27 | /// 28 | /// 枚举类型 29 | /// 枚举值 30 | /// 特性的说明 31 | public static string GetEnumDescription(this Enum emObj) 32 | { 33 | var type = emObj.GetType(); 34 | FieldInfo field = type.GetField(Enum.GetName(type, emObj)); 35 | DescriptionAttribute descAttr = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute; 36 | if (descAttr == null) 37 | { 38 | return string.Empty; 39 | } 40 | 41 | return descAttr.Description; 42 | } 43 | 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Proxies/CefAuthCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface used for asynchronous continuation of authentication 11 | /// requests. 12 | /// 13 | public sealed unsafe partial class CefAuthCallback 14 | { 15 | /// 16 | /// Continue the authentication request. 17 | /// 18 | public void Continue(string username, string password) 19 | { 20 | if (username == null) throw new ArgumentNullException("username"); 21 | if (password == null) throw new ArgumentNullException("password"); 22 | 23 | fixed (char* username_str = username) 24 | fixed (char* password_str = password) 25 | { 26 | var n_username = new cef_string_t(username_str, username.Length); 27 | var n_password = new cef_string_t(password_str, password.Length); 28 | 29 | cef_auth_callback_t.cont(_self, &n_username, &n_password); 30 | } 31 | } 32 | 33 | /// 34 | /// Cancel the authentication request. 35 | /// 36 | public void Cancel() 37 | { 38 | cef_auth_callback_t.cancel(_self); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Proxies/CefFileDialogCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface for asynchronous continuation of file dialog requests. 11 | /// 12 | public sealed unsafe partial class CefFileDialogCallback 13 | { 14 | /// 15 | /// Continue the file selection. |selected_accept_filter| should be the 0-based 16 | /// index of the value selected from the accept filters array passed to 17 | /// CefDialogHandler::OnFileDialog. |file_paths| should be a single value or a 18 | /// list of values depending on the dialog mode. An empty |file_paths| value is 19 | /// treated the same as calling Cancel(). 20 | /// 21 | public void Continue(int selectedAcceptFilter, string[] filePaths) 22 | { 23 | var n_filePaths = cef_string_list.From(filePaths); 24 | 25 | cef_file_dialog_callback_t.cont(_self, selectedAcceptFilter, n_filePaths); 26 | 27 | libcef.string_list_free(n_filePaths); 28 | } 29 | 30 | /// 31 | /// Cancel the file selection. 32 | /// 33 | public void Cancel() 34 | { 35 | cef_file_dialog_callback_t.cancel(_self); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Enums/CefCursorType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This file manually written from cef/include/internal/cef_types.h. 3 | // C API name: cef_cursor_type_t. 4 | // 5 | namespace ShoppingWebCrawler.Cef.Core 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Text; 10 | 11 | /// 12 | /// Cursor type values. 13 | /// 14 | public enum CefCursorType 15 | { 16 | Pointer = 0, 17 | Cross, 18 | Hand, 19 | IBeam, 20 | Wait, 21 | Help, 22 | EastResize, 23 | NorthResize, 24 | NorthEastResize, 25 | NorthWestResize, 26 | SouthResize, 27 | SouthEastResize, 28 | SouthWestResize, 29 | WestResize, 30 | NorthSouthResize, 31 | EastWestResize, 32 | NorthEastSouthWestResize, 33 | NorthWestSouthEastResize, 34 | ColumnResize, 35 | RowResize, 36 | MiddlePanning, 37 | EastPanning, 38 | NorthPanning, 39 | NorthEastPanning, 40 | NorthWestPanning, 41 | SouthPanning, 42 | SouthEastPanning, 43 | SouthWestPanning, 44 | WestPanning, 45 | Move, 46 | VerticalText, 47 | Cell, 48 | ContextMenu, 49 | Alias, 50 | Progress, 51 | NoDrop, 52 | Copy, 53 | None, 54 | NotAllowed, 55 | ZoomIn, 56 | ZoomOut, 57 | Grab, 58 | Grabbing, 59 | Custom, 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Cef.Core/Classes.Handlers/CefRunFileDialogCallback.cs: -------------------------------------------------------------------------------- 1 | namespace ShoppingWebCrawler.Cef.Core 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using ShoppingWebCrawler.Cef.Core.Interop; 8 | 9 | /// 10 | /// Callback interface for CefBrowserHost::RunFileDialog. The methods of this 11 | /// class will be called on the browser process UI thread. 12 | /// 13 | public abstract unsafe partial class CefRunFileDialogCallback 14 | { 15 | private void on_file_dialog_dismissed(cef_run_file_dialog_callback_t* self, int selected_accept_filter, cef_string_list* file_paths) 16 | { 17 | CheckSelf(self); 18 | 19 | var mFilePaths = cef_string_list.ToArray(file_paths); 20 | 21 | OnFileDialogDismissed(selected_accept_filter, mFilePaths); 22 | } 23 | 24 | /// 25 | /// Called asynchronously after the file dialog is dismissed. 26 | /// |selected_accept_filter| is the 0-based index of the value selected from 27 | /// the accept filters array passed to CefBrowserHost::RunFileDialog. 28 | /// |file_paths| will be a single value or a list of values depending on the 29 | /// dialog mode. If the selection was cancelled |file_paths| will be empty. 30 | /// 31 | protected abstract void OnFileDialogDismissed(int selectedAcceptFilter, string[] filePaths); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ShoppingWebCrawler.Host/PlatformCrawlers/BaseRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.Specialized; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Net.Http; 7 | using System.Threading.Tasks; 8 | using ShoppingWebCrawler.Host.Common.Http; 9 | using ShoppingWebCrawler.Host.Common; 10 | 11 | namespace ShoppingWebCrawler.Host.PlatformCrawlers 12 | { 13 | public class BaseRequest 14 | { 15 | 16 | 17 | /// 18 | /// 通用的请求头信息 19 | /// 静态公共头信息 由于是静态头信息,所以不要添加键值对 20 | /// 直接使用键 访问修改值即可 21 | /// 22 | public static NameValueCollection GetCommonRequestHeaders(bool isMobile=false) 23 | { 24 | 25 | var commonRequestHeaders = new NameValueCollection(); 26 | commonRequestHeaders.Add("Accept", "*/*"); 27 | commonRequestHeaders.Add("Cache-Control", "no-cache"); 28 | commonRequestHeaders.Add("Accept-Language", "zh-CN,zh;q=0.8"); 29 | commonRequestHeaders.Add("Connection", "Keep-Alive"); 30 | if (isMobile==true) 31 | { 32 | //移动端UA 33 | commonRequestHeaders.Add("User-Agent", GlobalContext.MobileUserAgent); 34 | } 35 | else 36 | { 37 | //PC 端UA 38 | commonRequestHeaders.Add("User-Agent", GlobalContext.ChromeUserAgent); 39 | 40 | } 41 | 42 | return commonRequestHeaders; 43 | } 44 | 45 | 46 | 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SocketLibrary/NTCPMSG/EntityPackage/Arguments/SuningFetchWebPageArgument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NTCPMessage.EntityPackage.Arguments 8 | { 9 | /// 10 | /// 【苏宁】搜索页面 参数 11 | /// 具体详细的搜索面板 回头慢慢完善 12 | /// 13 | public sealed class SuningFetchWebPageArgument:BaseFetchWebPageArgument 14 | { 15 | 16 | public SuningFetchWebPageArgument() 17 | { 18 | this.Platform = SupportPlatformEnum.Suning; 19 | } 20 | 21 | 22 | /// 23 | /// 排序参数 24 | /// 25 | public override string OrderFiledName 26 | { 27 | get 28 | { 29 | return "st"; 30 | } 31 | 32 | } 33 | /// 34 | /// 获取【苏宁】平台支持的排序字段列表 35 | /// 36 | /// 37 | public override List GetCurrentPlatformSupportOrderFields() 38 | { 39 | List fields = new List() { 40 | 41 | new OrderField { DisplayName="综合", FieldValue="0" }, 42 | new OrderField { DisplayName="销量", FieldValue="8" }, 43 | new OrderField { DisplayName="价格", FieldValue="9" }, 44 | new OrderField { DisplayName="评价数", FieldValue="6" }, 45 | 46 | }; 47 | 48 | return fields; 49 | } 50 | } 51 | } 52 | --------------------------------------------------------------------------------