Exemplo n.º 1
0
        public static bool Login(string username, string pwd, string machineName)
        {
            var localmachine = MachineLogic.localMachine();
            var logininf     = new loginInfo
            {
                pwd         = pwd,
                machineName = machineName,
                username    = username
            };

            if (localmachine.username == username)
            {
                logininf.machineId = localmachine.machineId;
            }

            var url   = ServerAddrs.lylApiServerAddr + "api/user/login";
            var token = HTTPRuqest.LYLPost <string>(url, logininf);
            //
            var usermachine = AutoLogin(token);

            localmachine.machineName = usermachine.machineName;
            localmachine.username    = username;
            localmachine.machinepwd  = usermachine.machinePwd;
            localmachine.token       = token;
            localmachine.machineId   = usermachine.machineId;
            MachineLogic.RecordMachineInfo(localmachine);
            return(true);
        }
Exemplo n.º 2
0
        public static string ApplyPlay()
        {
            var url     = ServerAddrs.lylApiServerAddr + "api/videoPlay/createPlay";
            var headers = new Dictionary <string, string>();

            headers.Add("token", MachineLogic.localMachine().token);
            return(HTTPRuqest.LYLPost <string>(url, null, headers));
        }
Exemplo n.º 3
0
        public static LYLUserMachineInfo AutoLogin(string token)
        {
            var url     = ServerAddrs.lylApiServerAddr + "api/user/autoLogin";
            var headers = new Dictionary <string, string>();

            headers.Add("token", token);
            var usermachine = HTTPRuqest.LYLPost <LYLUserMachineInfo>(url, null, headers);

            return(usermachine);
        }
Exemplo n.º 4
0
        public static MachineInfo GetMachineById(string machineId)
        {
            var url = ServerAddrs.lylApiServerAddr + "api/machine/getMachaineById";
            var rparams = new Dictionary<string, string>();
            rparams.Add("machineId", machineId);

            var headers = new Dictionary<string, string>();
            headers.Add("token", localMachine().token);
            return HTTPRuqest.LYLGet<MachineInfo>(url, rparams, headers);
        }
Exemplo n.º 5
0
        public static string requestChangePwd(string username)
        {
            var url       = ServerAddrs.lylApiServerAddr + "api/user/requestChangePwd";
            var checkInfo = new EmailCheckInfo
            {
                username = username
            };
            var checkid = HTTPRuqest.LYLPost <string>(url, checkInfo);

            return(checkid);
        }
Exemplo n.º 6
0
        public static bool?checkRegisterUser(string checkId, string checkCode)
        {
            var url       = ServerAddrs.lylApiServerAddr + "api/user/checkRegisterInfo";
            var checkInfo = new EmailCheckInfo
            {
                checkId      = checkId,
                checkingCode = checkCode
            };

            return(HTTPRuqest.LYLPost <bool?>(url, checkInfo));
        }
Exemplo n.º 7
0
        public static bool?checkChangePwd(string checkId, string checkCode, string newPwd)
        {
            var url       = ServerAddrs.lylApiServerAddr + "api/user/checkChangePwdInfo";
            var checkInfo = new EmailCheckInfo
            {
                checkId      = checkId,
                checkingCode = checkCode,
                pwd          = newPwd
            };

            return(HTTPRuqest.LYLPost <bool?>(url, checkInfo));
        }
Exemplo n.º 8
0
        public static string requestRegisterUser(string username, string pwd, string email)
        {
            var url       = ServerAddrs.lylApiServerAddr + "api/user/requestRegisterUser";
            var checkInfo = new EmailCheckInfo
            {
                username = username,
                pwd      = pwd,
                email    = email
            };
            var checkid = HTTPRuqest.LYLPost <string>(url, checkInfo);

            return(checkid);
        }
Exemplo n.º 9
0
        public static bool ChangeMachineName(string machineId, string machineName)
        {
            var url = ServerAddrs.lylApiServerAddr + "api/machine/changeMachineName";
            MachineInfo machineinfo = new MachineInfo { machineId = machineId, machineName = machineName };

            var headers = new Dictionary<string, string>();
            headers.Add("token", localMachine().token);
            var res= HTTPRuqest.LYLPost<bool>(url, machineinfo, headers);

            if(res==true)
            {
                var localmachineInfo = localMachine();
                localmachineInfo.machineName = machineName;
                RecordMachineInfo(localmachineInfo);
            }
            return res;
        }