Пример #1
0
    static IEnumerator Compute(string path, OnFinish on_finish)
    {
        FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
        byte[] buffer = new byte[kBlockSize];
        MD5 md5 = MD5.Create();
        int length, read_bytes;

        while (stream.Position < stream.Length)
        {
            length = (stream.Position + kBlockSize > stream.Length) ? (int)(stream.Length - stream.Position) : kBlockSize;
            read_bytes = stream.Read(buffer, 0, length);

            if (stream.Position < stream.Length)
            {
                md5.TransformBlock(buffer, 0, read_bytes, buffer, 0);
            }
            else
            {
                md5.TransformFinalBlock(buffer, 0, read_bytes);
                stream.Close();
                break;
            }

            yield return new WaitForEndOfFrame();
        }

        string md5hash = "";
        foreach (byte n in md5.Hash)
            md5hash += n.ToString("x2");

        Fun.DebugUtils.Log(String.Format("MD5 >> {0} > {1}", stream.Name, md5hash));

        if (on_finish != null)
            on_finish(md5hash);
    }
Пример #2
0
 public DeleteEntry(Context ctx, IKp2aApp app, PwEntry entry, OnFinish finish)
     : base(finish, app)
 {
     Ctx = ctx;
     Db = app.GetDb();
     _entry = entry;
 }
Пример #3
0
 public AfterUpdate(PwEntry backup, PwEntry updatedEntry, IKp2aApp app, OnFinish finish)
     : base(finish)
 {
     _backup = backup;
     _updatedEntry = updatedEntry;
     _app = app;
 }
Пример #4
0
 public SaveDb(Context ctx, IKp2aApp app, OnFinish finish, bool dontSave)
     : base(finish)
 {
     _ctx = ctx;
     _app = app;
     _dontSave = dontSave;
 }
    /// <summary>
    /// Download ZIP file from the given URL and do calling passed delegate.
    /// 
    /// NOTE: This does not resolve an error such as '404 Not Found'.
    /// </summary>
    IEnumerator Download(string url, OnFinish onFinish, bool remove)
    {
        WWW www = new WWW(url);

        yield return www;

        if (www.isDone)
        {
            byte[] data = www.bytes;

            string file = UriHelper.GetFileName(url);
            Debug.Log("Downloading of " + file + " is completed.");

            string docPath = Application.persistentDataPath;
            docPath += "/" + file;

            Debug.Log("Downloaded file path: " + docPath);

            ZipFile.UnZip(docPath, data);

            if (onFinish != null)
            {
                onFinish();
            }

            if (remove)
            {
                // delete zip file.
                System.IO.File.Delete(docPath);
            }
        }
    }
Пример #6
0
 public CreateDb(IKp2aApp app, Context ctx, IOConnectionInfo ioc, OnFinish finish, bool dontSave)
     : base(finish)
 {
     _ctx = ctx;
     _ioc = ioc;
     _dontSave = dontSave;
     _app = app;
 }
Пример #7
0
        public UpdateEntry(Context ctx, IKp2aApp app, PwEntry oldE, PwEntry newE, OnFinish finish)
            : base(finish)
        {
            _ctx = ctx;
            _app = app;

            _onFinishToRun = new AfterUpdate(oldE, newE, app, finish);
        }
Пример #8
0
 public MoveElement(IStructureItem elementToMove, PwGroup targetGroup, Context ctx, IKp2aApp app, OnFinish finish)
     : base(finish)
 {
     _elementToMove = elementToMove;
     _targetGroup = targetGroup;
     _ctx = ctx;
     _app = app;
 }
Пример #9
0
 /// <summary>
 /// Constructor for sync
 /// </summary>
 /// <param name="ctx"></param>
 /// <param name="app"></param>
 /// <param name="finish"></param>
 /// <param name="dontSave"></param>
 /// <param name="streamForOrigFile">Stream for reading the data from the (changed) original location</param>
 public SaveDb(Context ctx, IKp2aApp app, OnFinish finish, bool dontSave, Stream streamForOrigFile)
     : base(finish)
 {
     _ctx = ctx;
     _app = app;
     _dontSave = dontSave;
     _streamForOrigFile = streamForOrigFile;
 }
Пример #10
0
    public int CreateActor(ActorInfo info, ActorConfig config, OnFinish finish)
    {
        //int id = PlayScript.Instance.director.entityManager.CreateID();
        int id = director.entityManager.CreateID();
        Actor actor = new Actor(info, config, id, director);


        return id;
    }
Пример #11
0
        protected AddEntry(Context ctx, IKp2aApp app, PwEntry entry, PwGroup parentGroup, OnFinish finish)
            : base(finish)
        {
            _ctx = ctx;
            _parentGroup = parentGroup;
            _app = app;
            _entry = entry;

            _onFinishToRun = new AfterAdd(app.GetDb(), entry, OnFinishToRun);
        }
        public void RemoveAndWaitOneFrame( SpriteRenderer spriteRenderer, OnFinish onFinish = null )
        {
            SpriteRenderer duplicatedSpriteRenderer = CreateDuplicatedSpriteRenderer( spriteRenderer );

            GameObject gameObject = spriteRenderer.gameObject;
            spriteRenderer.enabled = false;
            SpriteRenderer.Destroy( spriteRenderer );

            StartCoroutine( EndRemovalAfterOneFrame( gameObject, duplicatedSpriteRenderer, onFinish ) );
        }
Пример #13
0
    public static void Get(string path, OnFinish on_finish)
    {
        if (!File.Exists(path))
        {
            Debug.Log(string.Format("MD5Async.Compute - Can't find a file.\npath: {0}", path));
            return;
        }

        Fun.FunapiManager.instance.StartCoroutine(Compute(path, on_finish));
    }
Пример #14
0
        public LoadDb(IKp2aApp app, IOConnectionInfo ioc, Task<MemoryStream> databaseData, CompositeKey compositeKey, String keyfileOrProvider, OnFinish finish)
            : base(finish)
        {
            _app = app;
            _ioc = ioc;
            _databaseData = databaseData;
            _compositeKey = compositeKey;
            _keyfileOrProvider = keyfileOrProvider;

            _rememberKeyfile = app.GetBooleanPreference(PreferenceKey.remember_keyfile);
        }
Пример #15
0
        public EditGroup(Context ctx, IKp2aApp app, String name, PwIcon iconid, PwUuid customIconId, PwGroup group, OnFinish finish)
            : base(finish)
        {
            _ctx = ctx;
            _name = name;
            _iconId = iconid;
            Group = group;
            _customIconId = customIconId;
            _app = app;

            _onFinishToRun = new AfterEdit(this, OnFinishToRun);
        }
Пример #16
0
        private AddGroup(Context ctx, IKp2aApp app, String name, int iconid, PwGroup parent, OnFinish finish, bool dontSave)
            : base(finish)
        {
            _ctx = ctx;
            _name = name;
            _iconId = iconid;
            Parent = parent;
            DontSave = dontSave;
            _app = app;

            _onFinishToRun = new AfterAdd(this, OnFinishToRun);
        }
        IEnumerator EndRemovalAfterOneFrame( GameObject gameObject, SpriteRenderer duplicatedSpriteRenderer, OnFinish onFinish )
        {
            /*
             * We assume the http://docs.unity3d.com/ScriptReference/Object.Destroy.html is correct
             * and that destroying objects will be done right after Update() loop, but before rendering.
             * Also, we assume that WaitForEndOfFrame() waits till just after the rendering loop.
             */
            yield return new WaitForEndOfFrame();

            if ( onFinish != null ) {
                onFinish();
            }

            GameObject.Destroy( duplicatedSpriteRenderer.gameObject );
        }
Пример #18
0
    // Prepare sth.
    public void DirectorPrepare(OnFinish onfinish)
    {
        for (int i = 0; i < director.lstRD.Count; ++i)
        {
            RoleData rd = director.lstRD[i];



            ActorConfig config = new ActorConfig();
            ActorInfo info = new ActorInfo();
            director.helper.CreateActor(info, config, delegate(bool finish)
            {

            });
        }

        director.helper.CreateCamera();
    }
Пример #19
0
    private int[] LoadActors(List<RoleData> rds, OnFinish finish)
    {
        List<int> roleIds = new List<int>();
        for (int i = 0; i < rds.Count; ++i)
        {
            RoleData role = rds[i];
            ActorInfo actorInfo = new ActorInfo();
            /*
            actorInfo.hp = role.maxBlood; // set current max blood
            actorInfo.hp = role.blood;
            //actorInfo.stiffValue = role.stiffValue;
            actorInfo.campType = role.camp;
            actorInfo.localIndex = role.localIndex;
            actorInfo.monsterPackageIndex = role.monsterPackageIndex;
            actorInfo.unitType = role.unitType;
            actorInfo.des = role.des;
            actorInfo.teamId = role.teamId;
            actorInfo.battleInfo = role.battleInfo;
            actorInfo.beGoodStatus = role.beGoodStatus;
            actorInfo.handleInfos = role.handleInfos;
            actorInfo.skillInfos = role.skillInfos;
            actorInfo.lookDistance = role.lookDistance;
            //actorInfo.badStateInfos = role.badStsteInfo; // buffer

            actorInfo.skillWeight = role.skillWeight;
            actorInfo.targetPos = format[role.localIndex].pos;
            actorInfo.startAngle = format[role.localIndex].angle;

            ActorConfig actorConfig = new ActorConfig();


            actorConfig.assetName = role.asset;

            int actorID = CompetitionManager.Instance.world.CreateActor(actorInfo, actorConfig, format[role.localIndex].pos, Quaternion.Euler(0, format[role.localIndex].angle, 0), role.ReadConfig, delegate(bool isLoad)
            {
                if (--remain <= 0)
                    onFinish(true);
            });
            roleIds.Add(actorID);
            */
        }
        return roleIds.ToArray();
    }
Пример #20
0
        public static void Prepare(SplashImage[] images, OnFinish action)
        {
            for (int i = 0; i < images.Length; i++)
            {
                if (i > 0)
                {
                    images[i].IsActive = false;
                }

                if (i == images.Length - 1)
                {
                    images[i].Finish += action;
                }
                else
                {
                    images[i].Next = images[i + 1];
                }
            }
        }
Пример #21
0
 public override void StartNewGame(OnFinish <UserInfo> startNewGameListener)
 {
 }
Пример #22
0
 public override void DownObbUpdate(OnFinish <ResultObbDownload> downObbUpdateListener)
 {
 }
Пример #23
0
 public override void GetHeadsetState(bool notifyWhenHeadsetChanged, OnFinish <ResultGetHeadsetState> getHeadsetStateListener)
 {
 }
Пример #24
0
 public override void GetDynamicUpdate(string rootDir, OnFinish <ResultGetDynamic> getDynamicUpdateListener)
 {
 }
Пример #25
0
 public override void GetForceUpdate(OnFinish <ResultGetForce> getForceUpdateListener)
 {
 }
Пример #26
0
 public void OrderFinished(CrossBot routine, string msg)
 {
     OnFinish?.Invoke(routine);
     Trader.SendMessageAsync($"Your order is complete, Thanks for your order! {msg}");
 }
Пример #27
0
 public override void GetServerList(OnFinish <ServerList> getServerListListener)
 {
 }
Пример #28
0
 public virtual void GetBattery(OnFinish <BatteryInfo> getBatteryInfoListener)
 {
     currentActivity.Call("getBattery");
 }
Пример #29
0
 public ExportDb(IKp2aApp app, OnFinish onFinish, FileFormatProvider fileFormat, IOConnectionInfo targetIoc)
     : base(onFinish)
 {
     _app = app;
     this._fileFormat = fileFormat;
     _targetIoc = targetIoc;
 }
Пример #30
0
        protected virtual void UpdateImageLoadingTask()
        {
            var ffSource          = GetImageSourceBinding(ImagePath, ImageStream);
            var placeholderSource = GetImageSourceBinding(LoadingPlaceholderImagePath, null);

            Cancel();
            TaskParameter imageLoader = null;

            if (ffSource == null)
            {
                _internalImage.Source = null;
                IsLoading             = false;
                return;
            }

            IsLoading = true;

            if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.Url)
            {
                imageLoader = ImageService.Instance.LoadUrl(ffSource.Path, CacheDuration);
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.CompiledResource)
            {
                imageLoader = ImageService.Instance.LoadCompiledResource(ffSource.Path);
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.ApplicationBundle)
            {
                imageLoader = ImageService.Instance.LoadFileFromApplicationBundle(ffSource.Path);
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.Filepath)
            {
                imageLoader = ImageService.Instance.LoadFile(ffSource.Path);
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.Stream)
            {
                imageLoader = ImageService.Instance.LoadStream(ffSource.Stream);
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.EmbeddedResource)
            {
                imageLoader = ImageService.Instance.LoadEmbeddedResource(ffSource.Path);
            }

            if (imageLoader != null)
            {
                // LoadingPlaceholder
                if (placeholderSource != null)
                {
                    if (placeholderSource != null)
                    {
                        imageLoader.LoadingPlaceholder(placeholderSource.Path, placeholderSource.ImageSource);
                    }
                }

                // ErrorPlaceholder
                if (!string.IsNullOrWhiteSpace(ErrorPlaceholderImagePath))
                {
                    var errorPlaceholderSource = GetImageSourceBinding(ErrorPlaceholderImagePath, null);
                    if (errorPlaceholderSource != null)
                    {
                        imageLoader.ErrorPlaceholder(errorPlaceholderSource.Path, errorPlaceholderSource.ImageSource);
                    }
                }

                if (CustomDataResolver != null)
                {
                    imageLoader.WithCustomDataResolver(CustomDataResolver);
                    imageLoader.WithCustomLoadingPlaceholderDataResolver(CustomLoadingPlaceholderDataResolver);
                    imageLoader.WithCustomErrorPlaceholderDataResolver(CustomErrorPlaceholderDataResolver);
                }

                // Downsample
                if ((int)DownsampleHeight != 0 || (int)DownsampleWidth != 0)
                {
                    if (DownsampleHeight > DownsampleWidth)
                    {
                        if (DownsampleUseDipUnits)
                        {
                            imageLoader.DownSampleInDip(height: (int)DownsampleHeight);
                        }
                        else
                        {
                            imageLoader.DownSample(height: (int)DownsampleHeight);
                        }
                    }
                    else
                    {
                        if (DownsampleUseDipUnits)
                        {
                            imageLoader.DownSampleInDip(width: (int)DownsampleWidth);
                        }
                        else
                        {
                            imageLoader.DownSample(width: (int)DownsampleWidth);
                        }
                    }
                }

                // RetryCount
                if (RetryCount > 0)
                {
                    imageLoader.Retry(RetryCount, RetryDelay);
                }

                if (BitmapOptimizations.HasValue)
                {
                    imageLoader.BitmapOptimizations(BitmapOptimizations.Value);
                }

                // FadeAnimation
                if (FadeAnimationEnabled.HasValue)
                {
                    imageLoader.FadeAnimation(FadeAnimationEnabled.Value, duration: FadeAnimationDuration);
                }

                // FadeAnimationForCachedImages
                if (FadeAnimationEnabled.HasValue && FadeAnimationForCachedImages.HasValue)
                {
                    imageLoader.FadeAnimation(FadeAnimationEnabled.Value, FadeAnimationForCachedImages.Value, FadeAnimationDuration);
                }

                // TransformPlaceholders
                if (TransformPlaceholders.HasValue)
                {
                    imageLoader.TransformPlaceholders(TransformPlaceholders.Value);
                }

                // Transformations
                if (Transformations != null && Transformations.Count > 0)
                {
                    imageLoader.Transform(Transformations);
                }

                if (InvalidateLayoutAfterLoaded.HasValue)
                {
                    imageLoader.InvalidateLayout(InvalidateLayoutAfterLoaded.Value);
                }

                imageLoader.WithPriority(LoadingPriority);
                if (CacheType.HasValue)
                {
                    imageLoader.WithCache(CacheType.Value);
                }

                if (LoadingDelay > 0)
                {
                    imageLoader.Delay(LoadingDelay);
                }

                imageLoader.Finish((work) =>
                {
                    IsLoading = false;
                    OnFinish?.Invoke(this, new Args.FinishEventArgs(work));
                });

                imageLoader.Success((imageInformation, loadingResult) =>
                {
                    OnSuccess?.Invoke(this, new Args.SuccessEventArgs(imageInformation, loadingResult));
                    _lastImageSource = ffSource;
                });

                if (OnError != null)
                {
                    imageLoader.Error((ex) => OnError?.Invoke(this, new Args.ErrorEventArgs(ex)));
                }

                if (OnDownloadStarted != null)
                {
                    imageLoader.DownloadStarted((downloadInformation) => OnDownloadStarted(this, new Args.DownloadStartedEventArgs(downloadInformation)));
                }

                if (OnDownloadProgress != null)
                {
                    imageLoader.DownloadProgress((progress) => OnDownloadProgress(this, new Args.DownloadProgressEventArgs(progress)));
                }

                if (OnFileWriteFinished != null)
                {
                    imageLoader.FileWriteFinished((info) => OnFileWriteFinished(this, new Args.FileWriteFinishedEventArgs(info)));
                }

                if (!string.IsNullOrWhiteSpace(CustomCacheKey))
                {
                    imageLoader.CacheKey(CustomCacheKey);
                }

                SetupOnBeforeImageLoading(imageLoader);

                _scheduledWork = imageLoader.Into(_internalImage);
            }
        }
Пример #31
0
 public virtual void RegisterSwitchAccountListener(OnFinish <UserInfo> switchAccountListener)
 {
     currentActivity.Call("registerSwitchAccountListener");
 }
Пример #32
0
 private void Finish()
 {
     OnFinish?.Invoke();
 }
Пример #33
0
        private async Task OnValidSubmit(EditContext editContext)
        {
            await OnFinish.InvokeAsync(editContext);

            OnFinishEvent.Invoke(this);
        }
Пример #34
0
 protected void InvokeOnFinish()
 {
     OnFinish?.Invoke();
 }
Пример #35
0
 protected DeleteRunnable(OnFinish finish, IKp2aApp app)
     : base(finish)
 {
     App = app;
 }
Пример #36
0
 public virtual void GetMemory(OnFinish <MemoryInfo> getMemroyInfoListener)
 {
     currentActivity.Call("getMemory");
 }
Пример #37
0
 public AfterAdd(AddGroup addGroup,OnFinish finish)
     : base(finish)
 {
     _addGroup = addGroup;
 }
Пример #38
0
 void SceneShutdown()
 {
     mDoFade = false;
     mCurCombo = 0;
     mCurPoints = 0;
     finishCallback = null;
 }
Пример #39
0
 public override void GetNoticeList(OnFinish <NoticeList> getNoticeListListener, string serverId, string language, string country, string type)
 {
 }
Пример #40
0
 public void TradeFinished(PokeRoutineExecutor routine, PokeTradeDetail <T> info, T result)
 {
     LogUtil.LogInfo($"Finished trading {info.Trainer.TrainerName} {(Species)info.TradeData.Species} for {(Species)result.Species}", routine.Connection.Name);
     OnFinish?.Invoke(routine);
 }
Пример #41
0
 public override void GetGoodsList(OnFinish <GoodsList> getGoodsListListener, string serverId, string category, string currency)
 {
 }
Пример #42
0
 public override void StopRecordVideo(OnFinish <ResultVideoRecord> stopRecordVideoListener)
 {
 }
Пример #43
0
 public override void DownDynamicUpdate(OnFinish <ResultDownload> downDynamicUpdateListener)
 {
 }
Пример #44
0
 public override void PlayVideo(string videoUrl, OnFinish <Result> playVideoListener)
 {
 }
Пример #45
0
 public override void DownForceUpdate(OnFinish <ResultDownload> downForceUpdateListener)
 {
 }
Пример #46
0
 public override void RegisterSwitchAccountListener(OnFinish <UserInfo> switchAccountListener)
 {
 }
Пример #47
0
 public override void ExpandFunction(string functionName, string jsonParameter, string headName, OnFinish <ResultExpand> expandFunctionListener)
 {
 }
Пример #48
0
 public override void StartBind(OnFinish <ResultBind> startBindListener)
 {
 }
Пример #49
0
 public override void GetABTestVer(OnFinish <ResultGetABTestVer> getABTestVerListener)
 {
 }
Пример #50
0
 public override void Logout(OnFinish <Result> logoutListener)
 {
 }
Пример #51
0
 public ActionOnFinish(ActionToPerformOnFinsh actionToPerform, OnFinish finish)
     : base(finish)
 {
     _actionToPerform = actionToPerform;
 }
Пример #52
0
 public override string Pay(OrderInfo orderInfo, OnFinish <ResultPay> payListener)
 {
     return(null);
 }
Пример #53
0
 public static AddGroup GetInstance(Context ctx, IKp2aApp app, String name, int iconid, PwGroup parent, OnFinish finish, bool dontSave)
 {
     return new AddGroup(ctx, app, name, iconid, parent, finish, dontSave);
 }
Пример #54
0
 public override void Exit(OnFinish <Result> exitListener)
 {
 }
Пример #55
0
 protected override void OnLoadData()
 {
     OnComplete?.Invoke(_data);
     OnFinish?.Invoke(true, this);
 }
Пример #56
0
 abstract public void StartSkill(Actor actor, OnFinish finish);
Пример #57
0
 public AfterAdd(Database db, PwEntry entry, OnFinish finish)
     : base(finish)
 {
     _db = db;
     _entry = entry;
 }
Пример #58
0
	void Story1(OnFinish finish)
	{
	}
Пример #59
0
 public static AddEntry GetInstance(Context ctx, IKp2aApp app, PwEntry entry, PwGroup parentGroup, OnFinish finish)
 {
     return new AddEntry(ctx, app, entry, parentGroup, finish);
 }
Пример #60
0
 public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg)
 {
     LogUtil.LogInfo($"Canceling trade with {info.Trainer.TrainerName}, because {msg}.", routine.Connection.Name);
     OnFinish?.Invoke(routine);
 }