Esempio n. 1
0
            /// <summary>
            /// 初始化资源初始化器的新实例。
            /// </summary>
            /// <param name="resourceManager">资源管理器。</param>
            public ResourceIniter(ResourceManager resourceManager)
            {
                m_ResourceManager = resourceManager;
                m_CurrentVariant  = null;

                ResourceInitComplete = null;
            }
Esempio n. 2
0
 /// <summary>
 /// 初始化条件任务的新实例。
 /// </summary>
 public ConditionalTask()
 {
     m_Condition      = null;
     m_CompleteAction = null;
     m_FailureAction  = null;
     m_CancelAction   = null;
 }
Esempio n. 3
0
            /// <summary>
            /// 初始化网络频道基类的新实例。
            /// </summary>
            /// <param name="name">网络频道名称。</param>
            /// <param name="networkChannelHelper">网络频道辅助器。</param>
            public NetworkChannelBase(string name, INetworkChannelHelper networkChannelHelper)
            {
                m_Name                 = name ?? string.Empty;
                m_SendPacketPool       = new Queue <Packet>();
                m_ReceivePacketPool    = new EventPool <Packet>(EventPoolMode.Default);
                m_NetworkChannelHelper = networkChannelHelper;
                m_AddressFamily        = AddressFamily.Unknown;
                m_ResetHeartBeatElapseSecondsWhenReceivePacket = false;
                m_HeartBeatInterval   = DefaultHeartBeatInterval;
                m_Socket              = null;
                m_SendState           = new SendState();
                m_ReceiveState        = new ReceiveState();
                m_HeartBeatState      = new HeartBeatState();
                m_SentPacketCount     = 0;
                m_ReceivedPacketCount = 0;
                m_Active              = false;
                m_Disposed            = false;

                NetworkChannelConnected     = null;
                NetworkChannelClosed        = null;
                NetworkChannelMissHeartBeat = null;
                NetworkChannelError         = null;
                NetworkChannelCustomError   = null;

                networkChannelHelper.Initialize(this);
            }
            /// <summary>
            /// 初始化资源检查器的新实例。
            /// </summary>
            /// <param name="resourceManager">资源管理器。</param>
            public ResourceChecker(ResourceManager resourceManager)
            {
                m_ResourceManager           = resourceManager;
                m_CheckInfos                = new Dictionary <ResourceName, CheckInfo>();
                m_CurrentVariant            = null;
                m_UpdatableVersionListReady = false;
                m_ReadOnlyVersionListReady  = false;
                m_ReadWriteVersionListReady = false;

                ResourceNeedUpdate    = null;
                ResourceCheckComplete = null;
            }
Esempio n. 5
0
            /// <summary>
            /// 初始化版本资源列表处理器的新实例。
            /// </summary>
            /// <param name="resourceManager">资源管理器。</param>
            public VersionListProcessor(ResourceManager resourceManager)
            {
                m_ResourceManager        = resourceManager;
                m_DownloadManager        = null;
                m_VersionListLength      = 0;
                m_VersionListHashCode    = 0;
                m_VersionListZipLength   = 0;
                m_VersionListZipHashCode = 0;

                VersionListUpdateSuccess = null;
                VersionListUpdateFailure = null;
            }
            /// <summary>
            /// 初始化 Web 请求代理的新实例。
            /// </summary>
            /// <param name="webRequestAgentHelper">Web 请求代理辅助器。</param>
            public WebRequestAgent(IWebRequestAgentHelper webRequestAgentHelper)
            {
                if (webRequestAgentHelper == null)
                {
                    throw new GXException("Web request agent helper is invalid.");
                }

                m_Helper   = webRequestAgentHelper;
                m_Task     = null;
                m_WaitTime = 0f;

                WebRequestAgentStart   = null;
                WebRequestAgentSuccess = null;
                WebRequestAgentFailure = null;
            }
            /// <summary>
            /// 初始化下载代理的新实例。
            /// </summary>
            /// <param name="downloadAgentHelper">下载代理辅助器。</param>
            public DownloadAgent(IDownloadAgentHelper downloadAgentHelper)
            {
                if (downloadAgentHelper == null)
                {
                    throw new GXException("Download agent helper is invalid.");
                }

                m_Helper           = downloadAgentHelper;
                m_Task             = null;
                m_FileStream       = null;
                m_WaitFlushSize    = 0;
                m_WaitTime         = 0f;
                m_StartLength      = 0;
                m_DownloadedLength = 0;
                m_SavedLength      = 0;
                m_Disposed         = false;

                DownloadAgentStart   = null;
                DownloadAgentUpdate  = null;
                DownloadAgentSuccess = null;
                DownloadAgentFailure = null;
            }
            /// <summary>
            /// 初始化资源更新器的新实例。
            /// </summary>
            /// <param name="resourceManager">资源管理器。</param>
            public ResourceUpdater(ResourceManager resourceManager)
            {
                m_ResourceManager                           = resourceManager;
                m_UpdateWaitingInfo                         = new List <UpdateInfo>();
                m_UpdateCandidateInfo                       = new List <UpdateInfo>();
                m_CachedHashBytes                           = new byte[CachedHashBytesLength];
                m_DownloadManager                           = null;
                m_CheckResourcesComplete                    = false;
                m_UpdatingResourceGroup                     = null;
                m_GenerateReadWriteVersionListLength        = 0;
                m_CurrentGenerateReadWriteVersionListLength = 0;
                m_UpdateRetryCount                          = 3;
                m_UpdatingCount = 0;
                m_FailureFlag   = false;
                m_ReadWriteVersionListFileName       = Utility.Path.GetRegularPath(Path.Combine(m_ResourceManager.m_ReadWritePath, LocalVersionListFileName));
                m_ReadWriteVersionListBackupFileName = Utility.Text.Format("{0}.{1}", m_ReadWriteVersionListFileName, BackupExtension);

                ResourceUpdateStart       = null;
                ResourceUpdateChanged     = null;
                ResourceUpdateSuccess     = null;
                ResourceUpdateFailure     = null;
                ResourceUpdateAllComplete = null;
            }
Esempio n. 9
0
 /// <summary>
 /// 设置任务取消时的行为。
 /// </summary>
 /// <param name="cancelAction">任务取消时的行为。</param>
 public void SetCancelAction(GXAction <ConditionalTask, string> cancelAction)
 {
     m_CancelAction = cancelAction;
 }
Esempio n. 10
0
 /// <summary>
 /// 设置任务失败时的行为。
 /// </summary>
 /// <param name="failureAction">任务失败时的行为。</param>
 public void SetFailureAction(GXAction <ConditionalTask, string> failureAction)
 {
     m_FailureAction = failureAction;
 }
Esempio n. 11
0
 /// <summary>
 /// 设置任务完成时的行为。
 /// </summary>
 /// <param name="completeAction">任务完成时的行为。</param>
 public void SetCompleteAction(GXAction <ConditionalTask, string> completeAction)
 {
     m_CompleteAction = completeAction;
 }