public StorageKeyValue Save()
    {
        DataMap keyValue = DataMap.Create();

        keyValue.AddOrReplaceBuffer(_key, GetBytes(_value));
        _storage.SubmitUpdatesAsync(keyValue, null, hSaveDone);

        return(this);
    }
示例#2
0
    public void write_data(byte[] aData, string aName)
    {
        if (StorageCreated && !IsWriting)
        {
            //Debug.Log("trying to write data " + aData.Length);
            IsWriting = true;
            DataMap toSave = DataMap.Create();
            toSave.AddOrReplaceBuffer(aName, aData);
            mStorage.SubmitUpdatesAsync(toSave, null, delegate(ContainerContext Storage2, SubmitDataMapUpdatesAsyncOp op2)
            {
                bool ok = op2.Success && op2.Status == ConnectedStorageStatus.SUCCESS;

                ManagerManager.Log("write data success " + ok + " " + op2.Success + " " + op2.Status);
                //TODO confirm success??

                IsWriting = false;
            });
        }
        else
        {
            ManagerManager.Log("error, could not write " + StorageCreated + " " + IsWriting);
        }
    }