コード例 #1
0
ファイル: DebridLinkFr_v2.cs プロジェクト: 24/source_04
        private DebridLinkConnexion CreateDebridLinkConnexion(DebridLinkFrRequestResult tokenResult)
        {
            DebridLinkConnexion connexion = new DebridLinkConnexion();

            connexion.ConnexionTime = tokenResult.RequestTime;
            connexion.Token         = tokenResult.Result.zGet("value.token").zAsString();
            connexion.Key           = tokenResult.Result.zGet("value.key").zAsString();
            int ts = tokenResult.Result.zGet("ts").zAsInt();

            connexion.ClientTime        = tokenResult.RequestTime;
            connexion.ServerTime        = zdate.UnixTimeStampToDateTime(ts);
            connexion.ServerTimeGap     = connexion.ServerTime - tokenResult.RequestTime;
            connexion.ConnexionLifetime = _connexionLifetime;
            connexion.EndConnexionTime  = connexion.ConnexionTime + GetConnexionTimespan(connexion.ConnexionLifetime) - TimeSpan.FromMinutes(5);
            return(connexion);
        }
コード例 #2
0
ファイル: DebridLinkFr_v2.cs プロジェクト: 24/source_04
        public void Connexion()
        {
            pb.Trace.WriteLine("{0:dd-MM-yyyy HH:mm:ss} - new connexion to debrid-link.fr", DateTime.Now);

            if (__trace)
            {
                pb.Trace.WriteLine("DebriderDebridLink.Connexion() :");
            }
            DebridLinkFrRequestResult tokenResult = GetNewToken();
            DebridLinkConnexion       connexion   = CreateDebridLinkConnexion(tokenResult);
            string validTokenUrl = tokenResult.Result.zGet("value.validTokenUrl").zAsString();

            if (__trace)
            {
                pb.Trace.WriteLine("  request time                : \"{0:dd/MM/yyyy HH:mm:ss}\"", tokenResult.RequestTime);
                pb.Trace.WriteLine("  result                      : \"{0}\"", tokenResult.Result.zGet("result").zAsString());
                pb.Trace.WriteLine("  token                       : \"{0}\"", connexion.Token);
                pb.Trace.WriteLine("  validTokenUrl               : \"{0}\"", validTokenUrl);
                pb.Trace.WriteLine("  key                         : \"{0}\"", connexion.Key);
                pb.Trace.WriteLine("  server time                 : {0} - {1:dd/MM/yyyy HH:mm:ss}", tokenResult.Result.zGet("ts").zAsInt(), connexion.ServerTime);
                pb.Trace.WriteLine("  server time gap             : {0}", connexion.ServerTimeGap);
            }

            _Login(validTokenUrl);

            connexion.zSave(_connexionFile);
            _connexion = connexion;

            if (_traceData != null)
            {
                _traceData.Trace(new BsonDocument {
                    { "OpeType", "Debrider.DebridLinkFr" }, { "Ope", "Login" }, { "Param", new BsonDocument {
                                                                                  } }, { "Result", connexion.ToBsonDocument() }
                });
            }
        }