Exemplo n.º 1
0
    IEnumerator Upload()
    {
        WWWForm form = new WWWForm();

        form.AddField("grant_type", "refresh_token");
        form.AddField("refresh_token", Data.Instance.userData.refreshToken);

        form.headers["Content-Type"] = "application/x-www-form-urlencoded";
        UnityWebRequest www = UnityWebRequest.Post("https://securetoken.googleapis.com/v1/token?key=" + AuthKey, form);

        yield return(www.SendWebRequest());

        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
            Invoke("VerifyToken", 2);
        }
        else
        {
            RefreshData response = JsonUtility.FromJson <RefreshData>(www.downloadHandler.text);

            Debug.Log("new id_token    " + response.id_token);
            Debug.Log("old id_token    " + Data.Instance.userData.token);

            Debug.Log("new refresh_token       " + response.refresh_token);
            Debug.Log("old freshTokend_token   " + Data.Instance.userData.refreshToken);

            Data.Instance.userData.SaveToken(response.id_token);
            Data.Instance.userData.SaveRefreshToken(response.refresh_token);

            isDone = true;
        }
    }
Exemplo n.º 2
0
        public async Task <TokenDto> RefreshToken(RefreshData data)
        {
            var user = await _context
                       .Users
                       .Include(e => e.RefreshTokens)
                       .SingleOrDefaultAsync(e => e.RefreshTokens
                                             .Any(t => t.Token == data.RefreshToken))
                       ?? throw new ForbiddenException($"Invalid refresh token.");

            var token = user.RefreshTokens
                        .Single(e => e.Token == data.RefreshToken);

            if (token.Revoked != null || _dateTime.Now >= token.Expires)
            {
                throw new ForbiddenException("Invalid refresh token");
            }

            // revoke current
            token.Revoked = _dateTime.Now;
            // generate new
            var newToken = CreateRefreshToken();

            user.RefreshTokens.Add(newToken);
            await _context.SaveChangesAsync();

            // return new access + refresh
            var r = _jwtHelper.GenerateJwtToken(user);

            r.RefreshToken           = newToken.Token;
            r.RefreshTokenValidUntil = newToken.Expires;

            return(r);
        }
Exemplo n.º 3
0
 public void Notify(RefreshData <Appointment <T> > message)
 {
     using (var manager = new RefreshDataManager <Appointment <T> >())
     {
         manager.Send(message);
     }
 }
Exemplo n.º 4
0
        public async Task <bool> SetupConnection()
        {
            NameValueCollection header = new NameValueCollection()
            {
                { "Authorization", string.Format("Bearer {0}", ImgurConnection.ImgurConnectToken) }
            };
            NameValueCollection post = new NameValueCollection()
            {
                { "grant_type", "refresh_token" },
                { "client_id", ImgurConnection.ClientID },
                { "client_secret", ImgurConnection.ImgurSecret },
                { "refresh_token", ImgurConnection.ImgurRefreshToken }
            };
            PostQuery postReq = new PostQuery("https://api.imgur.com/oauth2/token", header, post);

            HttpWebResponse response = await WebConnection.MakeRequest(postReq);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                return(false);
            }
            else
            {
                string json;
                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                {
                    json = await reader.ReadToEndAsync();
                }
                RefreshData refreshData = JsonConvert.DeserializeObject <RefreshData>(json);
                ImgurConnection.ImgurConnectToken = refreshData.AccessToken;
                ImgurConnection.ImgurRefreshToken = refreshData.RefreshToken;
                return(true);
            }
        }
Exemplo n.º 5
0
 public void Notify(RefreshData <ToDo <T> > message)
 {
     using (var manager = new RefreshDataManager <ToDo <T> >())
     {
         manager.Send(message);
     }
 }
        public async void OnSuccess(ZTask task)
        {
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                Debug.WriteLine("success", RefreshData);

                RefreshData?.Invoke(task);
            });
        }
Exemplo n.º 7
0
        private void BtnUsun_Click(object sender, RoutedEventArgs e)
        {
            var Res = MessageBox.Show("Usunąć ?", "Usuwanie pozycji", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);

            if (Res == MessageBoxResult.Yes)
            {
                var zp = this.grdZlecenie.DataContext as zlecenia_produkcyjne;
                frmZlecenieProdukcji_db.UsunZlecenie(zp);
                RefreshData?.Invoke();
            }
        }
Exemplo n.º 8
0
        private void BtnPopraw_Click(object sender, RoutedEventArgs e)
        {
            frmZlecenieProdukcji frmZlecenieProdukcji = new frmZlecenieProdukcji(this.grdZlecenie.DataContext as zlecenia_produkcyjne);

            frmZlecenieProdukcji.ShowDialog();
            //if (frmZlecenieProdukcji.DialogResult.HasValue && frmZlecenieProdukcji.DialogResult.Value)
            //    RefreshData?.Invoke();
            //;
            RefreshData?.Invoke();
            //this.grdZlecenie.DataContext;
        }
Exemplo n.º 9
0
        private void refreshTimer_Tick(object sender, EventArgs e)
        {
            levelName = EngineFunctions.GetCurrentLevelName.Call();
            if (levelName != previousLevelName)
            {
                LevelChanged?.Invoke(levelName);
                previousLevelName   = levelName;
                levelNameLabel.Text = levelName;
            }

            RefreshData?.Invoke();
        }
Exemplo n.º 10
0
    private void setCheckedCategory()
    {
        List <SRL_RecipeCategory> list = new List <SRL_RecipeCategory>();

        foreach (TreeNode node in tvCategories.CheckedNodes)
        {
            SRL_RecipeCategory recipeCat = new SRL_RecipeCategory(RecipeId, int.Parse(node.Value), node.Text);
            list.Add(recipeCat);
        }
        RecipeCategories = list.ToArray();

        if (RefreshData != null)
        {
            RefreshData.Invoke(RecipeCategories);
        }
    }
Exemplo n.º 11
0
        public async Task <IHttpActionResult> RefreshToken([FromBody] RefreshData refreshData)
        {
            try
            {
                DataToken dataToken = await _userRepository.RefreshToken(refreshData.RefreshToken);

                if (dataToken == null)
                {
                    return(new HttpJsonApiResult <string>("Not Found", Request, HttpStatusCode.NotFound));
                }
                return(new HttpJsonApiResult <DataToken>(dataToken, Request, HttpStatusCode.OK));
            }
            catch (Exception)
            {
                return(new HttpJsonApiResult <string>(
                           "Internal Server Error", Request, HttpStatusCode.InternalServerError));
            }
        }
Exemplo n.º 12
0
        private void Refresh()
        {
            try
            {
                int i = 0;
                ManualResetEvent[] handles = new ManualResetEvent[this.databases.Count];

                foreach (RevokingDBWithCaching db in this.databases)
                {
                    handles[i] = new ManualResetEvent(false);
                    RefreshData data = new RefreshData()
                    {
                        FlushCount = this.flush_count,
                        MRE        = handles[i],
                        DB         = db
                    };

                    ThreadPool.QueueUserWorkItem((object state) =>
                    {
                        RefreshData item = (RefreshData)state;
                        try
                        {
                            RefreshOne(item);
                        }
                        catch (System.Exception e)
                        {
                            throw e;
                        }
                        finally
                        {
                            item.MRE.Set();
                        }
                    }, data);
                    i++;
                }

                WaitHandle.WaitAll(handles);
            }
            catch (System.Exception e)
            {
                Logger.Error(e.Message, e);
            }
        }
Exemplo n.º 13
0
        public TotalPage()
        {
            InitializeComponent();
            Title = "Covid-19 Total Cases";
            Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;
            BindingContext = new RefreshData(Navigation);

            var current = Connectivity.NetworkAccess;

            if (current == NetworkAccess.Internet)
            {
                GetSkillsData();
            }
            else
            {
                layoutMain.IsVisible   = false;
                layoutNoWifi.IsVisible = true;
                DisplayAlert("Unknown", "Active Internet Connection is Required to display data", "OK");
            }
        }
Exemplo n.º 14
0
        public async Task <AuthResult> RefreshTokenAsync(RefreshData refreshData)
        {
            var claimsFromToken = _jwtManager.GetPrincipalFromToken(refreshData.Token);

            if (claimsFromToken == null)
            {
                return(AuthResult.CreateWithSingleError("Invalid token format."));
            }

            var storedRefreshToken = await _jwtManager.GetRefreshToken(refreshData.Token);


            if (!_jwtManager.ValidateRefreshToken(storedRefreshToken, claimsFromToken))
            {
                return(AuthResult.CreateWithSingleError("Invalid token"));
            }

            await _jwtManager.UseRefreshToken(storedRefreshToken);

            var user = await _userManager.FindByIdAsync(_jwtManager.GetUserId(claimsFromToken));

            return(await GeneraAuthResultAsync(user));
        }
Exemplo n.º 15
0
        private static void RefreshOne(object state)
        {
            RefreshData data = (RefreshData)state;

            int flush_count          = data.FlushCount;
            RevokingDBWithCaching db = data.DB;

            if (Snapshot.IsRoot(db.GetHead()))
            {
                return;
            }

            List <ISnapshot> snapshots = new List <ISnapshot>();

            SnapshotRoot root = (SnapshotRoot)db.GetHead().GetRoot();
            ISnapshot    next = root;

            for (int i = 0; i < flush_count; ++i)
            {
                next = next.GetNext();
                snapshots.Add(next);
            }

            root.Merge(snapshots, data.DB.DBName);
            root.ResetSolidity();

            if (db.GetHead() == next)
            {
                db.SetHead(root);
            }
            else
            {
                next.GetNext().SetPrevious(root);
                root.SetNext(next.GetNext());
            }
        }
Exemplo n.º 16
0
 public void FireRefreshData()
 {
     RefreshData?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 17
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Logger.Write("btnSave_Click -> Start", Logger.Level.Info);
        try
        {
            Page.Validate("general");
            if (!Page.IsValid)
            {
                return;
            }

            Recipe recipe;
            if (RecipeId == 0)
            {
                recipe = new Recipe();
            }
            else
            {
                recipe = BusinessFacade.Instance.GetRecipe(this.RecipeId);
            }

            if (recipe == null)
            {
                return; //TODO Exception (record is not exist)
            }

            Logger.Write("btnSave_Click -> Set recipe data", Logger.Level.Info);

            if (fuRecipeImage.HasFile && fuRecipeImage.PostedFile != null && ImageHelper.IsImage(fuRecipeImage.PostedFile.FileName))
            {
                Bitmap bitmap = ImageHelper.ResizeImage(new Bitmap(this.fuRecipeImage.PostedFile.InputStream, false), 300, 231);
                RecipePicture = ImageHelper.GetBitmapBytes(bitmap);
            }

            recipe.RecipeName        = txtRecipeName.Text;
            recipe.IsPublic          = chkPublic.Checked;
            recipe.Description       = txtRecipeDesc.Text;
            recipe.Tags              = txtTags.Text;
            recipe.PreparationMethod = txtPreparationMethod.Text;
            recipe.Remarks           = txtRemarks.Text;
            recipe.Tools             = txtTools.Text;

            if (ddlDifficulty.SelectedValue != "0")
            {
                recipe.DifficultyLevel = int.Parse(ddlDifficulty.SelectedValue);
            }
            else
            {
                recipe.DifficultyLevel = null;
            }

            if (!string.IsNullOrEmpty(txtPrepTime.Text))
            {
                recipe.PreperationTime = GetTimeInMinutes(txtPrepTime.Text, int.Parse(ddlPrepTimeUnits.SelectedValue));
            }
            else
            {
                recipe.PreperationTime = null;
            }

            if (!string.IsNullOrEmpty(this.txtCookTime.Text))
            {
                recipe.CookingTime = this.GetTimeInMinutes(this.txtCookTime.Text, int.Parse(this.ddlCookTimeUnits.SelectedValue));
            }
            else
            {
                recipe.CookingTime = null;
            }

            if (!string.IsNullOrEmpty(this.txtServings.Text))
            {
                recipe.Servings = int.Parse(this.txtServings.Text);
            }
            else
            {
                recipe.Servings = 1;
            }

            recipe.VideoLink = this.txtEmbeddedLink.Text;
            recipe.Picture   = this.RecipePicture;

            if (recipe.UserId == 0)
            {
                recipe.UserId = ((BasePage)Page).UserId;
            }

            Logger.Write("btnSave_Click -> Set recipe categories", Logger.Level.Info);

            recipe.RecipeCategories.Clear();
            foreach (SRL_RecipeCategory rcat in this.RecipeCategories)
            {
                recipe.RecipeCategories.Add(new RecipeCategory(rcat.RecipeId, rcat.CategoryId));
            }

            Logger.Write("btnSave_Click -> Set recipe ingrediants", Logger.Level.Info);

            recipe.Ingredients.Clear();

            int index = 0;
            foreach (SRL_Ingredient item in Ingridiants.ListOfIngediants)
            {
                decimal fraction;
                decimal.TryParse(item.FractionValue, out fraction);

                Ingredient ing = new Ingredient
                {
                    //IngredientId = item.Id,
                    RecipeId          = RecipeId,
                    FoodId            = item.FoodId,
                    FoodName          = item.FoodName,
                    MeasurementUnitId = item.MeasurementUnitId,
                    //Quantity = item.IntQuantity + fraction,
                    Remarks   = item.Remarks,
                    SortOrder = ++index
                };

                recipe.Ingredients.Add(ing);
            }

            Logger.Write("btnSave_Click -> Save recipe", Logger.Level.Info);

            int returnedRecipeId;
            if (BusinessFacade.Instance.SaveRecipe(recipe, out returnedRecipeId))
            {
                if (RefreshData != null)
                {
                    RefreshData.Invoke();
                }
            }

            Logger.Write("btnSave_Click -> End and redirect", Logger.Level.Info);

            RecipeCategories = null;
            Response.Redirect(string.Format("~/RecipeDetails.aspx?RecipeId={0}", returnedRecipeId));
        }
        catch (Exception ex)
        {
            Logger.Write("Save recipe failed", ex, Logger.Level.Error);
        }
    }
Exemplo n.º 18
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Logger.Write("btnSave_Click -> Start", Logger.Level.Info);
        try
        {
            Page.Validate("general");
            if (!Page.IsValid)
            {
                return;
            }

            Recipe recipe;
            bool   isNewRecipe = false;

            if (RecipeId == 0)
            {
                recipe      = new Recipe();
                isNewRecipe = true;
            }
            else
            {
                recipe = BusinessFacade.Instance.GetRecipe(RecipeId);
            }

            if (recipe == null)
            {
                return; //TODO Exception (record is not exist)
            }

            Logger.Write("btnSave_Click -> Set recipe data", Logger.Level.Info);

            if (fuRecipeImage.HasFile && fuRecipeImage.PostedFile != null && ImageHelper.IsImage(fuRecipeImage.PostedFile.FileName))
            {
                Bitmap bitmap = ImageHelper.ResizeImage(new Bitmap(this.fuRecipeImage.PostedFile.InputStream, false), 300, 231);
                RecipePicture = ImageHelper.GetBitmapBytes(bitmap);
            }

            recipe.RecipeName        = txtRecipeName.Text;
            recipe.IsPublic          = chkPublic.Checked;
            recipe.Description       = txtRecipeDesc.Text;
            recipe.Tags              = txtTags.Text;
            recipe.PreparationMethod = txtPreparationMethod.Text;
            recipe.Remarks           = txtRemarks.Text;
            recipe.Tools             = txtTools.Text;

            if (ddlDifficulty.SelectedValue != "0")
            {
                recipe.DifficultyLevel = int.Parse(ddlDifficulty.SelectedValue);
            }
            else
            {
                recipe.DifficultyLevel = null;
            }

            if (!string.IsNullOrEmpty(txtPrepTime.Text))
            {
                recipe.PreperationTime = GetTimeInMinutes(txtPrepTime.Text, int.Parse(ddlPrepTimeUnits.SelectedValue));
            }
            else
            {
                recipe.PreperationTime = null;
            }

            if (!string.IsNullOrEmpty(this.txtCookTime.Text))
            {
                recipe.CookingTime = this.GetTimeInMinutes(this.txtCookTime.Text, int.Parse(this.ddlCookTimeUnits.SelectedValue));
            }
            else
            {
                recipe.CookingTime = null;
            }

            if (!string.IsNullOrEmpty(this.txtServings.Text))
            {
                recipe.Servings = int.Parse(this.txtServings.Text);
            }
            else
            {
                recipe.Servings = 1;
            }

            recipe.VideoLink = this.txtEmbeddedLink.Text;
            //recipe.Picture = this.RecipePicture;

            if (recipe.UserId == 0)
            {
                recipe.UserId = ((BasePage)Page).UserId;
            }

            int returnedRecipeId;
            if (BusinessFacade.Instance.SaveRecipe(recipe, Ingridiants.ListOfIngediants, RecipeCategories.ToList(), isNewRecipe, out returnedRecipeId))
            {
                if (RefreshData != null)
                {
                    RefreshData.Invoke();
                }
            }

            Logger.Write("btnSave_Click -> End and redirect", Logger.Level.Info);

            RecipeCategories = null;

            if (returnedRecipeId != 0)
            {
                Response.Redirect(string.Format("~/RecipeDetails.aspx?RecipeId={0}", returnedRecipeId));
            }
        }
        catch (Exception ex)
        {
            Logger.Write("Save recipe failed", ex, Logger.Level.Error);
        }
    }
Exemplo n.º 19
0
 private static bool ValidateRefreshData(RefreshData data)
 {
     return(data.token != null && data.token.access_token != null);
 }
 public void RefreshList(ZTask task)
 {
     RefreshData?.Invoke(task);
     taskOperation = TaskOperation.Modify;
 }
Exemplo n.º 21
0
 private void _client_SendContent(object sender, string e)
 {
     RefreshData?.Invoke(this, e);
 }
Exemplo n.º 22
0
 public async Task <TokenDto> Refresh([FromBody] RefreshData data)
 {
     return(await _authService.RefreshToken(data));
 }
Exemplo n.º 23
0
 public void RaiseRefreshData()
 {
     RefreshData?.Invoke(this, new EventArgs());
 }
Exemplo n.º 24
0
        private QueueItem CreateRefreshQueueItem(Action <GuestControllerResult <RefreshResponse> > callback)
        {
            Action <GuestControllerResult <RefreshResponse> > failureCallback = delegate(GuestControllerResult <RefreshResponse> r)
            {
                callback(new GuestControllerResult <RefreshResponse>(success: false, r.Response, r.ResponseHeaders));
            };
            QueueItem queueItem = CreateQueueItem("/client/{client-id}/guest/refresh-auth/{refresh-token}", HttpMethod.POST, new EmptyRequest(), GuestControllerAuthenticationType.None, delegate(GuestControllerResult <RefreshResponse> r)
            {
                if (!r.Success)
                {
                    AuthenticationUnavailableEventArgs e = new AuthenticationUnavailableEventArgs();
                    this.OnAuthenticationLost(this, e);
                    failureCallback(r);
                }
                else
                {
                    GuestApiErrorCollection guestApiErrorCollection = r.Response.error;
                    RefreshData data = r.Response.data;
                    IRefreshGuestControllerTokenError refreshGuestControllerTokenError = GuestControllerErrorParser.GetGuestControllerTokenRefreshError(guestApiErrorCollection);
                    if (refreshGuestControllerTokenError is IRefreshRequiresLegalMarketingUpdateError)
                    {
                        refreshGuestControllerTokenError = null;
                        guestApiErrorCollection          = null;
                        this.OnLegalMarketingUpdateRequired(this, new LegalMarketingUpdateRequiredEventArgs());
                    }
                    if (refreshGuestControllerTokenError is IRefreshTokenGatedLocationError)
                    {
                        logger.Critical("Location gated during Guest Controller token refresh");
                        AuthenticationLostGatedCountryEventArgs e2 = new AuthenticationLostGatedCountryEventArgs();
                        this.OnAuthenticationLost(this, e2);
                        failureCallback(r);
                    }
                    else if (refreshGuestControllerTokenError is IRefreshProfileDisabledError || refreshGuestControllerTokenError is IRefreshTemporaryBanError)
                    {
                        logger.Critical("Banned during Guest Controller token refresh");
                        AccountBannedEventArgs e3 = new AccountBannedEventArgs(logger, null);
                        this.OnAuthenticationLost(this, e3);
                        failureCallback(r);
                    }
                    else if (refreshGuestControllerTokenError != null)
                    {
                        logger.Critical("Guest Controller token refresh error: " + refreshGuestControllerTokenError);
                        AuthenticationRevokedEventArgs e4 = new AuthenticationRevokedEventArgs();
                        this.OnAuthenticationLost(this, e4);
                        failureCallback(r);
                    }
                    else if (guestApiErrorCollection != null)
                    {
                        logger.Critical("Unhandled error during Guest Controller token refresh: " + JsonParser.ToJson(guestApiErrorCollection));
                        AuthenticationUnavailableEventArgs e = new AuthenticationUnavailableEventArgs();
                        this.OnAuthenticationLost(this, e);
                        failureCallback(r);
                    }
                    else if (data == null || data.token == null || data.token.access_token == null || data.token.refresh_token == null)
                    {
                        logger.Critical("Refreshing Guest Controller token returned invalid refresh data: " + JsonParser.ToJson(data));
                        AuthenticationUnavailableEventArgs e = new AuthenticationUnavailableEventArgs();
                        this.OnAuthenticationLost(this, e);
                        failureCallback(r);
                    }
                    else
                    {
                        Token token = data.token;
                        database.UpdateGuestControllerToken(token, data.etag);
                        this.OnAccessTokenChanged(this, new GuestControllerAccessTokenChangedEventArgs(token.access_token));
                        callback(r);
                    }
                }
            });

            queueItem.RefreshedAccessToken = true;
            return(queueItem);
        }
Exemplo n.º 25
0
 private void HandleRefreshSuccess(Action <IRestoreLastSessionResult> callback, GuestControllerResult <RefreshResponse> result, SessionDocument lastSessionDoc)
 {
     try
     {
         GuestApiErrorCollection   error2 = result.Response.error;
         RefreshData               data   = result.Response.data;
         IRestoreLastSessionResult error  = GuestControllerErrorParser.GetRestoreLastSessionResult(error2);
         if (data == null && error != null)
         {
             if (error is IRestoreLastSessionFailedInvalidOrExpiredTokenResult && lastSessionDoc.AccountStatus == "AWAIT_PARENT_CONSENT")
             {
                 callback(new RestoreLastSessionFailedParentalConsentResult());
             }
             else
             {
                 callback(error);
             }
             return;
         }
         if (data == null)
         {
             if (error2 != null)
             {
                 logger.Critical("Received unhandled error exception:\n" + JsonParser.ToJson(error2) + "\nResponse headers:\n" + string.Join("\n", result.ResponseHeaders.Select((KeyValuePair <string, string> h) => h.Key + ": " + h.Value).ToArray()));
             }
             callback(new RestoreLastSessionResult(success: false, null));
             return;
         }
         if (!ValidateRefreshData(data))
         {
             logger.Critical("Error parsing the refresh data: " + JsonParser.ToJson(data));
             callback(new RestoreLastSessionResult(success: false, null));
             return;
         }
         Token token = data.token;
         lastSessionDoc.GuestControllerAccessToken = token.access_token;
         lastSessionDoc.GuestControllerEtag        = data.etag;
         database.UpdateGuestControllerToken(token, data.etag);
         try
         {
             IInternalSession session = sessionFactory.Create(lastSessionDoc.Swid);
             session.Resume(delegate(IResumeSessionResult r)
             {
                 HandleOfflineSessionResumed(r, session, error, callback);
             });
         }
         catch (Exception ex)
         {
             logger.Critical("Error creating session: " + ex);
             callback(new RestoreLastSessionResult(success: false, null));
         }
     }
     catch (CorruptionException ex2)
     {
         logger.Fatal("Corruption detected during session restoration: " + ex2);
         callback(new RestoreLastSessionCorruptionDetectedResult());
     }
     catch (Exception ex)
     {
         logger.Critical("Unhandled exception: " + ex);
         callback(new RestoreLastSessionResult(success: false, null));
     }
 }
Exemplo n.º 26
0
 public void RegisterData(RefreshData d)
 {
     DataBlocks.Add(d);
 }