Esempio n. 1
0
        private void MigrateBranchedDataDirectoriesToRootDirectory()
        {
            File branchedDir = StoreUtil.getBranchedDataRootDirectory(_storeDir);

            branchedDir.mkdirs();
            foreach (File oldBranchedDir in _storeDir.listFiles())
            {
                if (!oldBranchedDir.Directory || !oldBranchedDir.Name.StartsWith("branched-"))
                {
                    continue;
                }

                long timestamp = 0;
                try
                {
                    timestamp = long.Parse(oldBranchedDir.Name.substring(oldBranchedDir.Name.IndexOf('-') + 1));
                }
                catch (System.FormatException)
                {                         // OK, it wasn't a branched directory after all.
                    continue;
                }

                File targetDir = StoreUtil.getBranchedDataDirectory(_storeDir, timestamp);
                try
                {
                    FileUtils.moveFile(oldBranchedDir, targetDir);
                }
                catch (IOException e)
                {
                    throw new Exception("Couldn't move branched directories to " + branchedDir, e);
                }
            }
        }
Esempio n. 2
0
 public Task <bool> HasTrack()
 {
     // MediaElementState.Closed === No media
     return(StoreUtil.OnUiCompute <bool>(() => {
         return Player.CurrentState != MediaElementState.Closed;
     }));
 }
Esempio n. 3
0
        /// <summary>
        /// Resource management is not proper here. Suggest an improvement.
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        private async Task SetSource(IStorageFile file)
        {
            var stream = await file.OpenReadAsync();

            sourceStream = stream;
            await StoreUtil.OnUiThread(() => {
                Player.SetSource(stream, stream.ContentType);
            });
        }
Esempio n. 4
0
    private IEnumerator GetProducts(string[] productIDS, bool stateChange)
    {
        string err        = "err";
        bool   isFinished = false;

        StoreUtil.Instance().RequestProducts(productIDS, delegate(string result)
        {
            err        = result;
            isFinished = true;
        });
        while (!isFinished)
        {
            yield return(null);
        }
        if (err != string.Empty)
        {
            bool isShow    = Loading.IsShow();
            bool isBarrier = GUIMain.IsBarrierON();
            if (isShow)
            {
                Loading.Invisible();
            }
            if (isBarrier)
            {
                GUIMain.BarrierOFF();
            }
            bool isClosed = false;
            AlertManager.ShowAlertDialog(delegate(int i)
            {
                isClosed = true;
            }, AlertManager.GetNeptuneErrorCode(err));
            while (!isClosed)
            {
                yield return(null);
            }
            if (isShow)
            {
                Loading.ResumeDisplay();
            }
            if (isBarrier)
            {
                GUIMain.BarrierON(null);
            }
            this.getProductsSucceed = false;
        }
        else
        {
            if (stateChange)
            {
                this.init_status = StoreInit.STATUS.DONE_REQUEST_PRODUCT;
            }
            this.getProductsSucceed = true;
        }
        yield break;
    }
Esempio n. 5
0
    private IEnumerator ReConsume()
    {
        if (this.init_status != StoreInit.STATUS.DONE_REQUEST_PRODUCT)
        {
            yield break;
        }
        bool isSuccess  = false;
        bool isFinished = false;

        StoreUtil.Instance().ReConsumeNonConsumedItems(delegate(bool result)
        {
            isFinished = true;
            isSuccess  = result;
        });
        while (!isFinished)
        {
            yield return(null);
        }
        global::Debug.Log("================================================= STORE ReConsume isSuccess --> " + isSuccess);
        if (!isSuccess)
        {
            bool isShow    = Loading.IsShow();
            bool isBarrier = GUIMain.IsBarrierON();
            if (isShow)
            {
                Loading.Invisible();
            }
            if (isBarrier)
            {
                GUIMain.BarrierOFF();
            }
            bool isClosed = false;
            AlertManager.ShowAlertDialog(delegate(int i)
            {
                isClosed = true;
            }, "C-SH02");
            while (!isClosed)
            {
                yield return(null);
            }
            if (isShow)
            {
                Loading.ResumeDisplay();
            }
            if (isBarrier)
            {
                GUIMain.BarrierON(null);
            }
        }
        else
        {
            this.init_status = StoreInit.STATUS.DONE_RECONSUME;
        }
        yield break;
    }
Esempio n. 6
0
    public IEnumerator InitStore()
    {
        if (this.init_status > StoreInit.STATUS.DONE_NOTHING)
        {
            yield break;
        }
        bool result      = false;
        bool initialized = false;

        StoreUtil.Instance().InitStore(delegate(bool r)
        {
            result      = r;
            initialized = true;
        });
        while (!initialized)
        {
            yield return(null);
        }
        if (!result)
        {
            bool isShow    = Loading.IsShow();
            bool isBarrier = GUIMain.IsBarrierON();
            if (isShow)
            {
                Loading.Invisible();
            }
            if (isBarrier)
            {
                GUIMain.BarrierOFF();
            }
            bool isClosed = false;
            AlertManager.ShowAlertDialog(delegate(int i)
            {
                isClosed = true;
            }, "C-NP200");
            while (!isClosed)
            {
                yield return(null);
            }
            if (isShow)
            {
                Loading.ResumeDisplay();
            }
            if (isBarrier)
            {
                GUIMain.BarrierON(null);
            }
        }
        else
        {
            this.init_status = StoreInit.STATUS.DONE_INIT;
        }
        global::Debug.Log("================================================= STORE INIT isSuccess --> " + result);
        yield break;
    }
        public async Task UpdateProgress()
        {
            await StoreUtil.OnUiThread(() => {
                OnPropertyChanged("Status");
                OnPropertyChanged("BytesReceived");
                OnPropertyChanged("TotalBytesToReceive");
                OnPropertyChanged("TotalBytesToReceiveReadable");
            });

            //Debug.WriteLine(Progress.Status + ": " + Progress.BytesReceived + " / " + Progress.TotalBytesToReceive);
        }
Esempio n. 8
0
 private async void ws_MessageReceived(MessageWebSocket sender, MessageWebSocketMessageReceivedEventArgs args)
 {
     try {
         // throws Exception if eof is received, which is the case for example if auth fails
         var reader  = args.GetDataReader();
         var message = reader.ReadString(reader.UnconsumedBufferLength);
         await StoreUtil.OnUiThread(() => OnMessageReceived(message));
     } catch (Exception) {
         // assumes eof has been received i.e. the server has closed the connection
         // http://msdn.microsoft.com/en-US/library/windows/apps/hh701366
         ws.Close(1005, String.Empty);
     }
 }
Esempio n. 9
0
    private void SetProductScrollView()
    {
        this.productScrollView.Callback = new Action(this.SetDigistoneNumber);
        Vector3     localPosition = this.productScrollView.transform.localPosition;
        GUICollider component     = this.productScrollView.GetComponent <GUICollider>();

        component.SetOriginalPos(localPosition);
        this.productScrollView.selectParts = this.productScrollViewItem;
        Rect listWindowViewRect = default(Rect);

        listWindowViewRect.xMin = -560f;
        listWindowViewRect.xMax = 560f;
        listWindowViewRect.yMin = -256f - GUIMain.VerticalSpaceSize;
        listWindowViewRect.yMax = 256f + GUIMain.VerticalSpaceSize;
        this.productScrollView.ListWindowViewRect = listWindowViewRect;
        this.storeProductList = StoreUtil.Instance().GetStoneStoreDataList();
        this.productScrollView.initLocation = true;
        this.productScrollView.AllBuild(this.storeProductList);
    }
Esempio n. 10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void migrationOfBranchedDataDirectories() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MigrationOfBranchedDataDirectories()
        {
            long[] timestamps = new long[3];
            for (int i = 0; i < timestamps.Length; i++)
            {
                StartDbAndCreateNode();
                timestamps[i] = MoveAwayToLookLikeOldBranchedDirectory();
                Thread.Sleep(1);                           // To make sure we get different timestamps
            }

            File databaseDirectory = _directory.databaseDir();
            int  clusterPort       = PortAuthority.allocatePort();

            (new TestHighlyAvailableGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(databaseDirectory).setConfig(ClusterSettings.server_id, "1").setConfig(ClusterSettings.cluster_server, "127.0.0.1:" + clusterPort).setConfig(ClusterSettings.initial_hosts, "localhost:" + clusterPort).setConfig(HaSettings.ha_server, "127.0.0.1:" + PortAuthority.allocatePort()).setConfig(OnlineBackupSettings.online_backup_enabled, false.ToString()).newGraphDatabase().shutdown();
            // It should have migrated those to the new location. Verify that.
            foreach (long timestamp in timestamps)
            {
                assertFalse("directory branched-" + timestamp + " still exists.", (new File(databaseDirectory, "branched-" + timestamp)).exists());
                assertTrue("directory " + timestamp + " is not there", StoreUtil.getBranchedDataDirectory(databaseDirectory, timestamp).exists());
            }
        }
    private IEnumerator StartPurchaseItem(string productId, Action <bool> onCompleted)
    {
        bool          isFinished = false;
        Action <bool> onFnished  = null;

        if (null != CMD_Shop.instance)
        {
            onFnished = delegate(bool isSuccess)
            {
                if (onCompleted != null)
                {
                    if (isSuccess && 0 < this.data.limitCount)
                    {
                        this.data.purchasedCount++;
                        if (this.data.purchasedCount >= this.data.limitCount && null != CMD_Shop.instance)
                        {
                            CMD_Shop.instance.DeleteListParts(this.IDX);
                        }
                    }
                    onCompleted(isSuccess);
                }
                isFinished = true;
            };
        }
        else
        {
            onFnished = delegate(bool nop)
            {
                isFinished = true;
            };
        }
        StoreUtil.Instance().StartPurchaseItem(productId, onFnished);
        while (!isFinished)
        {
            yield return(null);
        }
        yield break;
    }
Esempio n. 12
0
    static public StoreProduct[] m_StoreProductChanged = null; //!< ストアイベント表示:ストア商品一覧のイベント中置き換え状態

    /*==========================================================================*/
    /*		func																*/
    /*==========================================================================*/
    //----------------------------------------------------------------------------

    /*!
     *          @brief	現在時間で有効なストアイベントを考慮した商品一覧を構築
     *          @note	現在時で一度データを固めることで、色んな場所でストアイベントをチェックして時間差で不具合が生じるのを防ぐ。各処理はここで固めた状態を参照する
     */
    //----------------------------------------------------------------------------
    static public void SetupStoreProductListNow()
    {
#if STORE_BUY_TIP_LOG
        if (TimeManager.Instance != null)
        {
            Debug.Log("StoreProductList Setup Now!! - " + TimeManager.Instance.m_TimeNow);
        }
#endif

        //----------------------------------------
        // 一旦クリア
        //----------------------------------------
        m_StoreProductBase    = null;
        m_StoreProductChanged = null;

        //----------------------------------------
        // 置き換え前の通常商品リストを構築
        //----------------------------------------
        m_StoreProductBase    = new StoreProduct[6];
        m_StoreProductBase[0] = StoreUtil.GetProductFromNum(0);
        m_StoreProductBase[1] = StoreUtil.GetProductFromNum(1);
        m_StoreProductBase[2] = StoreUtil.GetProductFromNum(2);
        m_StoreProductBase[3] = StoreUtil.GetProductFromNum(3);
        m_StoreProductBase[4] = StoreUtil.GetProductFromNum(4);
        m_StoreProductBase[5] = StoreUtil.GetProductFromNum(5);

        //----------------------------------------
        // イベントを考慮した状態の商品リストを構築
        //----------------------------------------
        m_StoreProductChanged    = new StoreProduct[6];
        m_StoreProductChanged[0] = StoreUtil.GetReplaceEventProduct(m_StoreProductBase[0]);
        m_StoreProductChanged[1] = StoreUtil.GetReplaceEventProduct(m_StoreProductBase[1]);
        m_StoreProductChanged[2] = StoreUtil.GetReplaceEventProduct(m_StoreProductBase[2]);
        m_StoreProductChanged[3] = StoreUtil.GetReplaceEventProduct(m_StoreProductBase[3]);
        m_StoreProductChanged[4] = StoreUtil.GetReplaceEventProduct(m_StoreProductBase[4]);
        m_StoreProductChanged[5] = StoreUtil.GetReplaceEventProduct(m_StoreProductBase[5]);
    }
Esempio n. 13
0
 protected virtual void Awake()
 {
     StoreUtil.instance = this;
 }
Esempio n. 14
0
 protected virtual void OnDestroy()
 {
     StoreUtil.instance = null;
 }
Esempio n. 15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void cleanStoreDir() throws java.io.IOException
        internal virtual void CleanStoreDir()
        {
            // Tests verify that this method is called
            StoreUtil.cleanStoreDir(DatabaseLayout.databaseDirectory());
        }
Esempio n. 16
0
 //public async Task TestWebSocketsWrapper() {
 //    await ws.Connect();
 //    ws.Opened += () => SetOutput("Opened!");
 //    ws.MessageReceived += msg => SetOutput("Got msg: " + msg);
 //    ws.Closed += reason => SetOutput("Closed. " + reason);
 //    Output = "Connected.";
 //    //await ws.Send(@"{""cmd"":""status""}");
 //    //Output = "Sent message";
 //}
 private async void SetOutput(string msg)
 {
     await StoreUtil.OnUiThread(() => Output = msg);
 }
Esempio n. 17
0
 // When operations happen on a background thread we have to marshal UI updates back to the UI thread.
 private void MarshalLog(string value)
 {
     StoreUtil.OnUiThread(() => Log(value));
 }
Esempio n. 18
0
 async void webSocket_MessageReceived(MessageWebSocket sender, MessageWebSocketMessageReceivedEventArgs args)
 {
     var reader = args.GetDataReader();
     var msg    = reader.ReadString(reader.UnconsumedBufferLength);
     await StoreUtil.OnUiThread(() => Output = msg);
 }
Esempio n. 19
0
        public async Task Store_GetPrincipalName()
        {
            var name = await StoreUtil.GetUserNameAsync();

            Assert.IsNotNull(name);
        }
Esempio n. 20
0
        public void Store_GetComputerName()
        {
            var computerName = StoreUtil.GetComputerName();

            Assert.IsNotNull(computerName);
        }
Esempio n. 21
0
 private static Task OnUi(Task t)
 {
     return(StoreUtil.OnUiThread(async() => await t));
 }
Esempio n. 22
0
 public Task Pause()
 {
     return(StoreUtil.OnUiThread(Player.Pause));
 }
Esempio n. 23
0
 public Task Play()
 {
     return(StoreUtil.OnUiThread(Player.Play));
 }
Esempio n. 24
0
 public Task Stop()
 {
     return(StoreUtil.OnUiThread(Player.Stop));
 }
Esempio n. 25
0
 public Task <bool> IsPlaying()
 {
     return(StoreUtil.OnUiCompute <bool>(() => {
         return Player.CurrentState == MediaElementState.Playing;
     }));
 }