Esempio n. 1
0
            public static void 登陆()
            {
                if (MMPU.启动模式 == 0)
                {
                    ByQRCode.QrCodeStatus_Changed += ByQRCode_QrCodeStatus_Changed;
                    ByQRCode.QrCodeRefresh        += ByQRCode_QrCodeRefresh;
                    ByQRCode.LoginByQrCode("#FF000000", "#FFFFFFFF", true).Save("./BiliQR.png", System.Drawing.Imaging.ImageFormat.Png);
                }
                else if (MMPU.启动模式 == 1)
                {
                    Console.WriteLine("配置引导方式:手机登陆");
                    Console.Write("请输入手机号以验证短信验证码:");
                    string tel = Console.ReadLine();
                    try
                    {
                        BySMS.SendSMS(tel);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine($"短信验证登陆失败,请求验证码错误,错误原因:{e.Message}\r\n登陆验证失败,请重启再次尝试登陆或复制DDTV2本体中有效BiliUser.ini覆盖本地文件后重启DDTVLiveRec\r\n[======如果是非windows系统,请检查文件权限======]");
                        return;
                    }
                    Console.Write("验证短信请求已发送,请输入收到的验证码:");
                    string code = Console.ReadLine();
                    try
                    {
                        BiliUser.account = BySMS.Login(code, tel);
                    }
                    catch (Exception)
                    {
                        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                        {
                            ByQRCode.QrCodeStatus_Changed += ByQRCode_QrCodeStatus_Changed;
                            ByQRCode.QrCodeRefresh        += ByQRCode_QrCodeRefresh;
                            ByQRCode.LoginByQrCode("#FF000000", "#FFFFFFFF", true).Save("./BiliQR.png", System.Drawing.Imaging.ImageFormat.Png);
                            InfoLog.InfoPrintf("短信验证登陆失败,切换备用二维码扫码登陆方式, 请用阿B手机客户端扫描DDTVLiveRec目录中的[BiliQR.png]文件进行登陆", InfoLog.InfoClass.系统错误信息);
                            return;
                        }
                        else
                        {
                            Console.WriteLine("登陆验证失败,请复制DDTV2本体中有效BiliUser.ini覆盖本地文件后重启DDTVLiveRec\r\n[======如果是非windows系统,请检查文件权限======]");
                            return;
                        }
                    }

                    MMPU.UID = account.Uid;
                    MMPU.写ini配置文件("User", "UID", MMPU.UID, MMPU.BiliUserFile);
                    foreach (var item in account.Cookies)
                    {
                        MMPU.Cookie = MMPU.Cookie + item + ";";
                    }
                    MMPU.CookieEX = account.Expires_Cookies;
                    MMPU.csrf     = account.CsrfToken;

                    MMPU.写ini配置文件("User", "csrf", MMPU.csrf, MMPU.BiliUserFile);
                    MMPU.写ini配置文件("User", "Cookie", Encryption.AesStr(MMPU.Cookie, MMPU.AESKey, MMPU.AESVal), MMPU.BiliUserFile);
                    MMPU.写ini配置文件("User", "CookieEX", MMPU.CookieEX.ToString("yyyy-MM-dd HH:mm:ss"), MMPU.BiliUserFile);
                    InfoLog.InfoPrintf("UID:" + account.Uid + ",登陆成功", InfoLog.InfoClass.载必要提示);
                }
            }
        public BiliLoginWindowQR()
        {
            InitializeComponent();
            ByQRCode.QrCodeStatus_Changed += ByQRCode_QrCodeStatus_Changed;
            ByQRCode.QrCodeRefresh        += ByQRCode_QrCodeRefresh;

            LoginQR.Source = ChangeBitmapToImageSource(ByQRCode.LoginByQrCode());
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Task t = Task.Run(() =>
            {
                ByQRCode.QrCodeStatus_Changed += ByQRCode_QrCodeStatus_Changed;
                ByQRCode.QrCodeRefresh        += ByQRCode_QrCodeRefresh;
                ByQRCode.LoginByQrCode().Save("tmp.jpg");
                while (true)
                {
                }
            });

            t.Wait();
        }
Esempio n. 4
0
        private static void Main(string[] args)
        {
            Console.WriteLine($"测试版本:{AssemblyName.GetAssemblyName("BiliAccount.dll").Version.ToString()}");
            Console.WriteLine("账号");
            string username = Console.ReadLine();

            Console.WriteLine("密码");
            string  pwd     = Console.ReadLine();
            Account account = ByPassword.LoginByPassword(username, pwd);

            Console.WriteLine(var_dump(account));

            ByQRCode.QrCodeStatus_Changed += ByQRCode_QrCodeStatus_Changed;
            ByQRCode.QrCodeRefresh        += ByQRCode_QrCodeRefresh;
            ByQRCode.LoginByQrCode().Save("tmp.jpg");

            Application.Run();
        }
Esempio n. 5
0
 public static void 登陆()
 {
     ByQRCode.QrCodeStatus_Changed += ByQRCode_QrCodeStatus_Changed;
     ByQRCode.QrCodeRefresh        += ByQRCode_QrCodeRefresh;
     ByQRCode.LoginByQrCode().Save("./BiliQR.png", System.Drawing.Imaging.ImageFormat.Png);
 }