Пример #1
0
    /// <summary>
    /// 所有数据接收完成的回调,将临时文件保存为制定的文件名
    /// </summary>
    protected override void CompleteContent()
    {
        Debug.Log("下载完成!");
        string CompleteFilePath = SavePath + "/" + FileName; //完整路径
        string TempFilePath     = fs.Name;                   //临时文件路径

        OnDispose();

        if (File.Exists(TempFilePath))
        {
            if (File.Exists(CompleteFilePath))
            {
                File.Delete(CompleteFilePath);
            }
            File.Move(TempFilePath, CompleteFilePath);
            //Debug.Log("重命名文件!");
        }
        else
        {
            Debug.Log("生成文件失败=>下载的文件不存在!");
        }
        if (EventComplete != null)
        {
            EventComplete.Invoke(CompleteFilePath);
        }
    }
Пример #2
0
            public ConsoleEvent(string content, bool newlineWhenFinished = true, float delayWhenFinished = 0f, float?cps = DefaultCharactersPerSecond, string tColor = null, Color?bColor = null, EventComplete onEventComplete = null)
            {
                NewlineWhenFinished = newlineWhenFinished;
                DelayWhenFinished   = delayWhenFinished;
                CharactersPerSecond = cps ?? DefaultCharactersPerSecond;

                textContent     = content;
                textColor       = tColor;
                backgroundColor = bColor;
                callback        = onEventComplete;

                progress = 0f;
            }
Пример #3
0
        internal static async Task <Task> SendReply(PostEventContext post, string json)
        {
            var result = Task.CompletedTask;

            if (post.IsWebSocketRequest)
            {
                if (post.SocketRemainsOpen())
                {
                    var completion = await post.GetSocketCompletion();

                    return(completion.Task);
                }

                await SendSocketReply(post, json);
            }
            else
            {
                await SendAjaxReply(post.Http, json);
            }
            EventComplete?.Invoke(post.Http, _EventArgs);
            return(result);
        }
Пример #4
0
        private void FillInProcessName(int pid)
        {
            Process p = null;
            try
            {
                p = Process.GetProcessById(pid);
            }
            catch { }

            string name = p == null ? "Unknown" : p.ProcessName;
            this.ProcessInfo = new ProcessInfo(pid, name);

            eventComplete = eventComplete | EventComplete.ProcessName;
            FireCompleteEvent();
        }
Пример #5
0
        public void FillInHostName(IPAddress ipa)
        {
            string hostName = string.Empty;
            try
            {
                IPHostEntry entry = Dns.GetHostEntry(ipa);
                hostName = entry.HostName;
            }
            catch { }

            HostName = hostName;
            eventComplete = eventComplete | EventComplete.HostName;
            FireCompleteEvent();
        }
Пример #6
0
        public void FillInGeoLocation(IPAddress ipa)
        {
            try
            {
                this.Location = GeoLocationApi.GetLocation(ipa);
            }
            catch { }

            eventComplete = eventComplete | EventComplete.GeoLocation;
            FireCompleteEvent();
        }
Пример #7
0
        public void FillInArinInfo(IPAddress ipa)
        {
            try
            {
                this.Owner = ArinApi.GetOrginization(ipa);
            }
            catch { }

            eventComplete = eventComplete | EventComplete.ArinInfo;
            FireCompleteEvent();
        }
Пример #8
0
    public void LoadAsset(string relPath, EventComplete completeDoFun, EventStatus status)
    {
        string absPath = "";
        LoadingWWW loading;

        // first check updatepath to get
        foreach(var p in mUpdatePaths)
        {
            absPath = p + "/" + relPath;
            if(mCacheAssets.ContainsKey(absPath) && completeDoFun != null)
            {
                completeDoFun(mCacheAssets[absPath]);
                return;
            }

            if(System.IO.File.Exists(absPath))
            {
                loading.www = new WWW("file://" + absPath);
                loading.status = status;
                loading.complete = completeDoFun;
                loading.relPath = relPath;
                loading.absPath = absPath;
                if(loading.status != null)
                    loading.status(new LoadingProgressArg(loading.www.progress, relPath));
                mLoadingList.Add(loading);
            }
        }

        // then check streaming path
        absPath = Application.streamingAssetsPath + "/" + relPath;
        AssetBundle bundle = null;
        if (mCacheAssets.TryGetValue(absPath, out bundle) && completeDoFun != null)
        {
            completeDoFun(bundle);
            return;
        }

        if(Application.platform == RuntimePlatform.Android)
            loading.www = new WWW(absPath);
        else
            loading.www = new WWW("file://" + absPath);
        loading.status = status;
        loading.complete = completeDoFun;
        loading.relPath = relPath;
        loading.absPath = absPath;
        if(loading.status != null)
            loading.status(new LoadingProgressArg(loading.www.progress, relPath));
        mLoadingList.Add(loading);
    }
Пример #9
0
 private void GameEventCompleteInternal(object sender, GameEventCompleteEventArgs e)
 {
     EventComplete?.Invoke(this, e);
 }
Пример #10
0
 private void FireEventComplete() => EventComplete?.Invoke();