admin
2020-06-22 924bdf1c9fb74babf2438d5545db3594756625d1
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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using CefSharp;
using CefSharp.WinForms;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using WebSocketSharp.Server;
using WindowsFormsApp1.entity;
using WindowsFormsApp1.entity.tb;
using WindowsFormsApp1.utils;
using WindowsFormsApp1.utils.tb;
 
namespace WindowsFormsApp1
{
    static class Program
    {
        private static object onSuccess;
 
 
 
 
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            AppDomain.CurrentDomain.AssemblyResolve += Resolver;
            CefSettings _settings = new CefSettings();
            _settings.PersistSessionCookies = true;
            Cef.Initialize(_settings);
            TestServer();
            //TestDataBase();
            Application.Run(new Main());
            //Application.Run(new TBLogin(2));
            //TestCookie();
            // kam();
        }
 
        //测试服务器
        private static void TestServer() {
            new Thread(new ThreadStart(()=> {
                var httpServer = new HttpServer("http://127.0.0.1:8091");
                httpServer.OnGet += (sender,e) =>
                {
                    var req = e.Request;
                    var res = e.Response;
                    res.ContentType = "application/json";
                    res.ContentEncoding = Encoding.UTF8;
                    JObject obj = new JObject();
                    obj["code"] = 0;
                    byte[] contents= System.Text.Encoding.Default.GetBytes(obj.ToString());
                    res.StatusCode = 200;
                    res.ContentLength64 = contents.LongLength;
                    res.Close(contents, true);
                };
                httpServer.Start();
            })).Start();
        }
 
        //可爱猫测试
        private static void kam() {
            KeAiMaoUtil.GetLoginState();
        }
 
        private static void TestDataBase() {
 
            SQLiteDataBaseUtil.getInstance().AddConfig(new Config("test","测试"));
 
            Console.WriteLine(JsonConvert.SerializeObject(SQLiteDataBaseUtil.getInstance().GetConfig("test")));
 
            SQLiteDataBaseUtil.getInstance().DeleteConfig("test");
 
        }
 
 
        private static Assembly Resolver(object sender, ResolveEventArgs args)
        {
            if (args.Name.StartsWith("CefSharp"))
            {
                string assemblyName = args.Name.Split(new[] { ',' }, 2)[0] + ".dll";
                string archSpecificPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                                                       Environment.Is64BitProcess ? "x64" : "x86",
                                                       assemblyName);
                return File.Exists(archSpecificPath)
                           ? Assembly.LoadFile(archSpecificPath)
                           : null;
            }
            return null;
        }
 
        private static void TestCookie() {
            String cookies = "cna=Q9eYFEM1rm8CAXH7EKUDSamu; otherx=e%3D1%26p%3D*%26s%3D0%26c%3D0%26f%3D0%26g%3D0%26t%3D0; hng=CN%7Czh-CN%7CCNY%7C156; lid=%E6%A4%B0%E8%A7%86%E7%A7%91%E6%8A%80; enc=RGqVJip4t0I%2Bu6rmW8v5j6r8tqJSACRF%2F92GJymWSYUrcPIi%2BLfoZwxWR31%2BNEoPUsPmhqtFMEU9tg0cNz2UuA%3D%3D; sm4=500100; sgcookie=EsgReQXiPG936%2FDLxoo76; t=2e0bd62b0e7ef117c2752bc8f5a47149; tracknick=%5Cu6930%5Cu89C6%5Cu79D1%5Cu6280; lgc=%5Cu6930%5Cu89C6%5Cu79D1%5Cu6280; _tb_token_=e7e1833ff3e3e; cookie2=141eef46fe5d454202093f0c085f77d6; _m_h5_tk=aa1765c2711f8214225e4cd840e2fc7f_1592215556600; _m_h5_tk_enc=f385dc4a51d9511d2f572363e2600eb6; dnk=%5Cu6930%5Cu89C6%5Cu79D1%5Cu6280; uc1=existShop=false&pas=0&cookie14=UoTV7gOtpy1DDQ%3D%3D&cookie21=UtASsssmfuQi&cookie16=W5iHLLyFPlMGbLDwA%2BdvAGZqLg%3D%3D&cookie15=URm48syIIVrSKA%3D%3D; uc3=id2=UNN%2F6whEupDGWQ%3D%3D&nk2=sbdfkkkB37A%3D&vt3=F8dBxGDXLASVnQp5e6g%3D&lg2=UtASsssmOIJ0bQ%3D%3D; _l_g_=Ug%3D%3D; uc4=id4=0%40UgQ3BPth2rlXv3Pxjwnw703Qf5%2Fd&nk4=0%40s9JQzQv3gdCkG6Ybkta0BsGleQ%3D%3D; unb=3327215652; cookie1=AnRaCZfOZrWoY8u%2BoXxB8y%2FnnwnZszWqI6Bbr5BrFtM%3D; login=true; cookie17=UNN%2F6whEupDGWQ%3D%3D; _nk_=%5Cu6930%5Cu89C6%5Cu79D1%5Cu6280; sg=%E6%8A%8021; csg=85507ef5; l=eBPRIjGqvEU6H_93KOfZourza77TSIRAguPzaNbMiOCP_5565gThWZxkse8BCnGNh6VkR3RILX7QBeYBqQAonxvtFnNOGsDmn; isg=BMvLGZKcEXVl109UCASCztw-Wm-1YN_i6adODD3Iq4phXOu-xTQzM-b6NlSy_Dfa";
            TBCookieUtil.parseAccount(cookies); 
         }
    }
 
 
}