예제 #1
0
            void IChatApiListener.ChatInitializationCallback(ErrorCode result)
            {
                if (Error.Succeeded(result))
                {
                    Api.SetMessageFlushInterval(this.MessageFlushInterval);
                    Api.SetUserChangeEventInterval(this.UserChangeEventInterval);

                    m_ChatController.DownloadEmoticonData();

                    m_ChatController.SetChatState(ChatState.Initialized);
                }
                else
                {
                    m_ChatController.SetChatState(ChatState.Uninitialized);
                }

                try
                {
                    if (m_ChatController.InitializationComplete != null)
                    {
                        m_ChatController.InitializationComplete(result);
                    }
                }
                catch (Exception x)
                {
                    m_ChatController.ReportError(x.ToString());
                }
            }
예제 #2
0
 void IChatApiListener.ChatEmoticonDataDownloadCallback(ErrorCode error)
 {
     if (Error.Succeeded(error))
     {
         m_ChatController.SetupEmoticonData();
     }
 }
예제 #3
0
            void IChatApiListener.ChatShutdownCallback(ErrorCode result)
            {
                if (Error.Succeeded(result))
                {
                    ErrorCode ret = m_ChatController.m_CoreApi.Shutdown();
                    if (Error.Failed(ret))
                    {
                        string err = Error.GetString(ret);
                        ReportError(string.Format("Error shutting down the Twitch sdk: {0}", err));
                    }

                    m_ChatController.SetChatState(ChatState.Uninitialized);
                }
                else
                {
                    // if shutdown fails the state will probably be messed up but this should never happen
                    m_ChatController.SetChatState(ChatState.Initialized);

                    ReportError(String.Format("Error shutting down Twith chat: {0}", result));
                }

                try
                {
                    if (m_ChatController.ShutdownComplete != null)
                    {
                        m_ChatController.ShutdownComplete(result);
                    }
                }
                catch (Exception x)
                {
                    m_ChatController.ReportError(x.ToString());
                }
            }
예제 #4
0
            public virtual bool Connect(bool anonymous)
            {
                m_Anonymous = anonymous;

                ErrorCode ret = ErrorCode.TTV_EC_SUCCESS;

                // connect to the channel
                if (anonymous)
                {
                    ret = Api.ConnectAnonymous(m_ChannelName, this);
                }
                else
                {
                    ret = Api.Connect(m_ChannelName, UserName, AuthToken, this);
                }

                if (Error.Failed(ret))
                {
                    String err = Error.GetString(ret);
                    ReportError(String.Format("Error connecting: {0}", err));

                    FireDisconnected(m_ChannelName);

                    return(false);
                }
                else
                {
                    SetChannelState(ChannelState.Connecting);
                    DownloadBadgeData();

                    return(true);
                }
            }
예제 #5
0
            public bool Disconnect()
            {
                switch (m_ChannelState)
                {
                case ChannelState.Connected:
                case ChannelState.Connecting:
                {
                    // kick off an async disconnect
                    ErrorCode ret = Api.Disconnect(m_ChannelName);
                    if (Error.Failed(ret))
                    {
                        String err = Error.GetString(ret);
                        ReportError(String.Format("Error disconnecting: {0}", err));

                        return(false);
                    }

                    SetChannelState(ChannelState.Disconnecting);
                    return(true);
                }

                case ChannelState.Created:
                case ChannelState.Disconnected:
                case ChannelState.Disconnecting:
                default:
                {
                    return(false);
                }
                }
            }
 protected override void CheckError(ErrorCode err)
 {
     if (err != ErrorCode.TTV_EC_SUCCESS)
     {
         System.Windows.Forms.MessageBox.Show(err.ToString());
     }
 }
예제 #7
0
        internal virtual void SetupEmoticonData()
        {
            if (m_EmoticonData != null)
            {
                return;
            }

            ErrorCode ec = m_ChatApi.GetEmoticonData(out m_EmoticonData);

            if (Error.Succeeded(ec))
            {
                try
                {
                    if (EmoticonDataAvailable != null)
                    {
                        EmoticonDataAvailable();
                    }
                }
                catch (Exception x)
                {
                    ReportError(x.ToString());
                }
            }
            else
            {
                ReportError("Error preparing emoticon data: " + Error.GetString(ec));
            }
        }
예제 #8
0
        public virtual bool Initialize()
        {
            if (m_ChatState != ChatState.Uninitialized)
            {
                return(false);
            }

            SetChatState(ChatState.Initializing);

            ErrorCode ret = m_CoreApi.Initialize(ClientId, null);

            if (Error.Failed(ret))
            {
                SetChatState(ChatState.Uninitialized);

                String err = Error.GetString(ret);
                ReportError(String.Format("Error initializing Twitch sdk: {0}", err));

                return(false);
            }

            // initialize chat
            m_ActiveEmoticonMode = this.EmoticonParsingMode;

            TTV_ChatTokenizationOption tokenizationOptions = TTV_ChatTokenizationOption.TTV_CHAT_TOKENIZATION_OPTION_NONE;

            switch (m_ActiveEmoticonMode)
            {
            case EmoticonMode.None:
                tokenizationOptions = TTV_ChatTokenizationOption.TTV_CHAT_TOKENIZATION_OPTION_NONE;
                break;

            case EmoticonMode.Url:
                tokenizationOptions = TTV_ChatTokenizationOption.TTV_CHAT_TOKENIZATION_OPTION_EMOTICON_URLS;
                break;

            case EmoticonMode.TextureAtlas:
                tokenizationOptions = TTV_ChatTokenizationOption.TTV_CHAT_TOKENIZATION_OPTION_EMOTICON_TEXTURES;
                break;
            }

            // kick off the async init
            ret = m_ChatApi.Initialize(tokenizationOptions, m_ChatAPIListener);
            if (Error.Failed(ret))
            {
                m_CoreApi.Shutdown();
                SetChatState(ChatState.Uninitialized);

                String err = Error.GetString(ret);
                ReportError(String.Format("Error initializing Twitch chat: %s", err));

                return(false);
            }
            else
            {
                SetChatState(ChatState.Initialized);
                return(true);
            }
        }
        protected override bool CheckError(Twitch.ErrorCode err)
        {
            if (Error.Failed(err))
            {
                System.Windows.Forms.MessageBox.Show(err.ToString());
                return(false);
            }

            return(true);
        }
예제 #10
0
        public override void Update()
        {
            base.Update();

            // Submit video frame
            if (m_BroadcastState == BroadcastState.Broadcasting)
            {
                float curTime = Time.realtimeSinceStartup;

                // If you send frames too quickly to the SDK (based on the broadcast FPS you configured) it will not be able
                // to make use of them all.  In that case, it will simply release buffers without using them which means the
                // game wasted time doing the capture.  To mitigate this, the app should pace the captures to the broadcast FPS.
                float captureDelta         = curTime - m_LastCaptureTime;
                bool  isTimeForNextCapture = captureDelta >= (1.0f / (float)m_VideoParams.TargetFps);

                if (!isTimeForNextCapture)
                {
                    return;
                }

                IntPtr p = m_SceneRenderTexture.GetNativeTexturePtr();
                if (p != IntPtr.Zero)
                {
                    ErrorCode ret = m_UnityBroadcastApi.SubmitTexturePointer(p, m_SceneRenderTexture.width, m_SceneRenderTexture.height);

                    // mark the time of the first video frame submission (don't need to lock since we're setting a bool)
                    m_AudioQueue.AcceptSamples = m_AudioParams.EnablePassthroughAudio;

                    // if there is a problem when submitting a frame let the client know
                    if (ret != ErrorCode.TTV_EC_SUCCESS)
                    {
                        string err = Error.GetString(ret);
                        if (Error.Succeeded(ret))
                        {
                            ReportWarning(string.Format("Warning in SubmitTexturePointer: {0}\n", err));
                        }
                        else
                        {
                            ReportError(string.Format("Error in SubmitTexturePointer: {0}\n", err));

                            // errors are not recoverable
                            StopBroadcasting();
                        }

                        FireFrameSubmissionIssue(ret);
                    }
                }

                m_LastCaptureTime = curTime;

                // TODO: we may need to handle multi-threaded rendering which means that we can't submit the texture from Update(), we need to use a render event
                //GL.IssuePluginEvent((int)123456);
            }
        }
예제 #11
0
            void IChatChannelListener.ChatStatusCallback(string channelName, ErrorCode result)
            {
                if (Error.Succeeded(result))
                {
                    return;
                }

                // destroy the channel object
                Channels.Remove(m_ChannelName);

                DisconnectionComplete();
            }
예제 #12
0
        public override PixelFormat DeterminePixelFormat()
        {
            PixelFormat format = base.DeterminePixelFormat();

            ErrorCode ret = m_UnityBroadcastApi.GetCapturePixelFormat(ref format);

            if (Error.Failed(ret))
            {
                string err = Error.GetString(ret);
                ReportError(string.Format("Error in GetCapturePixelFormat: {0}", err));
            }

            return(format);
        }
        public override void Update()
        {
            base.Update();

            if (m_BroadcastState != BroadcastState.Broadcasting)
            {
                return;
            }

            float curTime = Time.realtimeSinceStartup;

            // If you send frames too quickly to the SDK (based on the broadcast FPS you configured) it will not be able
            // to make use of them all.  In that case, it will simply release buffers without using them which means the
            // game wasted time doing the capture.  To mitigate this, the app should pace the captures to the broadcast FPS.
            float captureDelta         = curTime - m_LastCaptureTime;
            bool  isTimeForNextCapture = captureDelta >= (1.0f / (float)m_VideoParams.TargetFps);

            if (!isTimeForNextCapture)
            {
                return;
            }

            IntPtr p = m_BroadcastRenderTexture.GetNativeTexturePtr();

            if (p != IntPtr.Zero)
            {
                ErrorCode ret = this.UnityStream.SubmitTexturePointer(p);

                // if there is a problem when submitting a frame let the client know
                if (ret != ErrorCode.TTV_EC_SUCCESS)
                {
                    string err = Error.GetString(ret);
                    if (Error.Succeeded(ret))
                    {
                        ReportWarning(string.Format("Warning in SubmitTexturePointer: {0}\n", err));
                    }
                    else
                    {
                        ReportError(string.Format("Error in SubmitTexturePointer: {0}\n", err));

                        // errors are not recoverable
                        StopBroadcasting();
                    }

                    FireFrameSubmissionIssue(ret);
                }
            }

            m_LastCaptureTime = curTime;
        }
예제 #14
0
        internal virtual void DownloadEmoticonData()
        {
            // don't download emoticons
            if (m_ActiveEmoticonMode == EmoticonMode.None)
            {
                return;
            }

            if (m_EmoticonData == null)
            {
                ErrorCode ret = m_ChatApi.DownloadEmoticonData();
                if (Error.Failed(ret))
                {
                    string err = Error.GetString(ret);
                    ReportError(string.Format("Error trying to download emoticon data: {0}", err));
                }
            }
        }
예제 #15
0
        /// <summary>
        /// Periodically updates the internal state of the controller.
        /// </summary>
        public virtual void Update()
        {
            // for stress testing to make sure memory is being passed around properly
            //GC.Collect();

            if (m_ChatState == ChatState.Uninitialized)
            {
                return;
            }

            ErrorCode ret = m_ChatApi.FlushEvents();

            if (Error.Failed(ret))
            {
                string err = Error.GetString(ret);
                ReportError(string.Format("Error flushing chat events: {0}, in state {1}", err, m_ChatState.ToString()));
            }
        }
예제 #16
0
            internal virtual void SetupBadgeData()
            {
                if (m_BadgeData != null)
                {
                    return;
                }

                ErrorCode ec = Api.GetBadgeData(m_ChannelName, out m_BadgeData);

                if (Error.Succeeded(ec))
                {
                    FireBadgeDataAvailable(m_ChannelName);
                }
                else
                {
                    ReportError("Error preparing badge data: " + Error.GetString(ec));
                }
            }
        protected void UnityIosStreamInfoCallback(string message)
        {
            LitJson.JsonReader reader = new LitJson.JsonReader(message);

            Dictionary <string, string> dict = new Dictionary <string, string>();

            reader.Read();
            JsonReadFlatObjectIntoDictionary(reader, dict);

            ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]);

            StreamInfo info = new StreamInfo();

            info.Viewers  = int.Parse(dict["Viewers"]);
            info.StreamId = UInt64.Parse(dict["Id"]);

            StreamInfoDoneCallback(status, info);
        }
        protected void UnityIosUserInfoCallback(string message)
        {
            LitJson.JsonReader reader = new LitJson.JsonReader(message);

            Dictionary <string, string> dict = new Dictionary <string, string>();

            reader.Read();
            JsonReadFlatObjectIntoDictionary(reader, dict);

            ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]);

            UserInfo info = new UserInfo();

            info.Name        = dict["Name"];
            info.DisplayName = dict["DisplayName"];

            UserInfoDoneCallback(status, info);
        }
        protected void UnityIosArchivingStateCallback(string message)
        {
            LitJson.JsonReader reader = new LitJson.JsonReader(message);

            Dictionary <string, string> dict = new Dictionary <string, string>();

            reader.Read();
            JsonReadFlatObjectIntoDictionary(reader, dict);

            ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]);

            ArchivingState state = new ArchivingState();

            state.CureUrl          = dict["CureUrl"];
            state.RecordingEnabled = dict["RecordingEnabled"] != "0";

            ArchivingStateDoneCallback(status, state);
        }
예제 #20
0
            internal virtual void DownloadBadgeData()
            {
                // don't download badges
                if (this.ActiveEmoticonMode == EmoticonMode.None)
                {
                    return;
                }

                if (m_BadgeData == null)
                {
                    ErrorCode ret = Api.DownloadBadgeData(m_ChannelName);
                    if (Error.Failed(ret))
                    {
                        string err = Error.GetString(ret);
                        ReportError(string.Format("Error trying to download badge data: {0}", err));
                    }
                }
            }
예제 #21
0
            public bool SendChatMessage(string message)
            {
                if (m_ChannelState != ChannelState.Connected)
                {
                    return(false);
                }

                ErrorCode ret = Api.SendMessage(m_ChannelName, message);

                if (Error.Failed(ret))
                {
                    String err = Error.GetString(ret);
                    ReportError(String.Format("Error sending chat message: {0}", err));

                    return(false);
                }

                return(true);
            }
예제 #22
0
            internal virtual void CleanupBadgeData()
            {
                if (m_BadgeData == null)
                {
                    return;
                }

                ErrorCode ec = Api.ClearBadgeData(m_ChannelName);

                if (Error.Succeeded(ec))
                {
                    m_BadgeData = null;

                    FireBadgeDataExpired(m_ChannelName);
                }
                else
                {
                    ReportError("Error releasing badge data: " + Error.GetString(ec));
                }
            }
        protected void UnityIosRequestAuthTokenCallback(string message)
        {
            LitJson.JsonReader reader = new LitJson.JsonReader(message);

            Dictionary <string, string> dict = new Dictionary <string, string>();

            reader.Read();
            JsonReadFlatObjectIntoDictionary(reader, dict);

            ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]);

            AuthToken token = null;

            if (Error.Succeeded(status))
            {
                token      = new AuthToken();
                token.Data = dict["Token"];
            }

            RequestAuthTokenDoneCallback(status, token);
        }
        protected void UnityIosLoginCallback(string message)
        {
            LitJson.JsonReader reader = new LitJson.JsonReader(message);

            Dictionary <string, string> dict = new Dictionary <string, string>();

            reader.Read();
            JsonReadFlatObjectIntoDictionary(reader, dict);

            ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]);

            ChannelInfo info = null;

            if (Error.Succeeded(status))
            {
                info             = new ChannelInfo();
                info.Name        = dict["Name"];
                info.DisplayName = dict["DisplayName"];
                info.ChannelUrl  = dict["ChannelUrl"];
            }

            LoginCallback(status, info);
        }
예제 #25
0
        public virtual bool Shutdown()
        {
            if (m_ChatState != ChatState.Initialized)
            {
                return(false);
            }

            // shutdown asynchronously
            ErrorCode ret = m_ChatApi.Shutdown();

            if (Error.Failed(ret))
            {
                String err = Error.GetString(ret);
                ReportError(String.Format("Error shutting down chat: {0}", err));

                return(false);
            }

            CleanupEmoticonData();

            SetChatState(ChatState.ShuttingDown);

            return(true);
        }
예제 #26
0
 protected void HandleFrameSubmissionIssue(ErrorCode result)
 {
     // if you are receiving TTV_WRN_QUEUELENGTH then it's possible the bitrate is too high for the user's internet connection
     DebugOverlay.Instance.AddViewportText("FrameSubmissionIssue: " + result.ToString(), 1);
 }
예제 #27
0
 protected void FireGameNameListReceived(ErrorCode result, GameInfoList list)
 {
     try
     {
         if (m_BroadcastController.GameNameListReceived != null)
         {
             m_BroadcastController.GameNameListReceived(result, list == null ? new GameInfo[0] : list.List);
         }
     }
     catch (Exception x)
     {
         ReportError(x.ToString());
     }
 }
예제 #28
0
 protected void FireLoginAttemptComplete(ErrorCode result)
 {
     try
     {
         if (m_BroadcastController.LoginAttemptComplete != null)
         {
             m_BroadcastController.LoginAttemptComplete(result);
         }
     }
     catch (Exception x)
     {
         ReportError(x.ToString());
     }
 }
예제 #29
0
            void IStreamCallbacks.GetArchivingStateCallback(ErrorCode result, ArchivingState state)
            {
                this.ArchivingState = state;

                if (Error.Failed(result))
                {
                    //string err = Error.GetString(result);
                    //ReportWarning(string.Format("ArchivingStateDoneCallback got failure: {0}", err));
                }
            }
예제 #30
0
            void IStreamCallbacks.LoginCallback(ErrorCode result, ChannelInfo channelInfo)
            {
                if (Error.Succeeded(result))
                {
                    this.ChannelInfo = channelInfo;
                    SetBroadcastState(BroadcastState.LoggedIn);
                    this.LoggedIn = true;
                }
                else
                {
                    SetBroadcastState(BroadcastState.Initialized);
                    this.LoggedIn = false;

                    string err = Error.GetString(result);
                    ReportError(string.Format("LoginCallback got failure: {0}", err));
                }

                FireLoginAttemptComplete(result);
            }
예제 #31
0
            void IChatAPIListener.ChatShutdownCallback(ErrorCode result)
            {
                if (Error.Succeeded(result))
                {
                    ErrorCode ret = m_ChatController.m_Core.Shutdown();
                    if (Error.Failed(ret))
                    {
                        string err = Error.GetString(ret);
                        ReportError(string.Format("Error shutting down the Twitch sdk: {0}", err));
                    }

                    m_ChatController.SetChatState(ChatState.Uninitialized);
                }
                else
                {
                    // if shutdown fails the state will probably be messed up but this should never happen
                    m_ChatController.SetChatState(ChatState.Initialized);

                    ReportError(String.Format("Error shutting down Twith chat: {0}", result));
                }

                try
                {
                    if (m_ChatController.ShutdownComplete != null)
                    {
                        m_ChatController.ShutdownComplete(result);
                    }
                }
                catch (Exception x)
                {
                    m_ChatController.ReportError(x.ToString());
                }
            }
예제 #32
0
            void IStreamCallbacks.StopCallback(ErrorCode ret)
            {
                if (Error.Succeeded(ret))
                {
                    this.VideoParams = null;
                    this.AudioParams = null;

                    CleanupBuffers();

                    FireBroadcastStopped();

                    if (this.LoggedIn)
                    {
                        SetBroadcastState(BroadcastState.ReadyToBroadcast);
                    }
                    else
                    {
                        SetBroadcastState(BroadcastState.Initialized);
                    }
                }
                else
                {
                    // there's not really a good state to go into here
                    SetBroadcastState(BroadcastState.ReadyToBroadcast);

                    string err = Error.GetString(ret);
                    ReportError(string.Format("StopCallback got failure: {0}", err));
                }
            }
예제 #33
0
 protected override void CheckError(ErrorCode err)
 {
     if (err != ErrorCode.TTV_EC_SUCCESS)
     {
         System.Windows.Forms.MessageBox.Show(err.ToString());
     }
 }
예제 #34
0
 void IChatChannelListener.ChatBadgeDataDownloadCallback(string channelName, ErrorCode error)
 {
     // grab the texture and badge data
     if (Error.Succeeded(error))
     {
         SetupBadgeData();
     }
 }
예제 #35
0
            void IStreamCallbacks.GetStreamInfoCallback(ErrorCode result, StreamInfo streamInfo)
            {
                if (Error.Succeeded(result))
                {
                    this.StreamInfo = streamInfo;

                    FireStreamInfoUpdated(streamInfo);
                }
                else
                {
                    //string err = Error.GetString(result);
                    //ReportWarning(string.Format("StreamInfoDoneCallback got failure: {0}", err));
                }
            }
예제 #36
0
 void IStreamCallbacks.SetStreamInfoCallback(ErrorCode result)
 {
     if (Error.Failed(result))
     {
         string err = Error.GetString(result);
         ReportWarning(string.Format("SetStreamInfoCallback got failure: {0}", err));
     }
 }
예제 #37
0
 void IStreamCallbacks.SendStartSpanMetaDataCallback(ErrorCode ret)
 {
     if (Error.Failed(ret))
     {
         string err = Error.GetString(ret);
         ReportError(string.Format("SendStartSpanMetaDataCallback got failure: {0}", err));
     }
 }
예제 #38
0
 void IChatChannelListener.ChatBadgeDataDownloadCallback(string channelName, ErrorCode error)
 {
     // grab the texture and badge data
     if (Error.Succeeded(error))
     {
         SetupBadgeData();
     }
 }
예제 #39
0
            void IStreamCallbacks.RequestAuthTokenCallback(ErrorCode result, AuthToken authToken)
            {
                if (Error.Succeeded(result))
                {
                    // Now that the user is authorized the information can be requested about which server to stream to
                    this.AuthToken = authToken;
                    SetBroadcastState(BroadcastState.Authenticated);
                }
                else
                {
                    this.AuthToken.Data = "";
                    SetBroadcastState(BroadcastState.Initialized);

                    string err = Error.GetString(result);
                    ReportError(string.Format("RequestAuthTokenDoneCallback got failure: {0}", err));
                }

                FireAuthTokenRequestComplete(result, authToken);
            }
예제 #40
0
 protected void CheckError(ErrorCode err)
 {
     m_ChatController.CheckError(err);
 }
예제 #41
0
 protected void HandleFrameSubmissionIssue(ErrorCode result)
 {
     // if you are receiving TTV_WRN_QUEUELENGTH then it's possible the bitrate is too high for the user's internet connection
     DebugOverlay.Instance.AddViewportText("FrameSubmissionIssue: " + result.ToString(), 1);
 }
예제 #42
0
 void IChatAPIListener.ChatEmoticonDataDownloadCallback(ErrorCode error)
 {
     if (Error.Succeeded(error))
     {
         m_ChatController.SetupEmoticonData();
     }
 }
예제 #43
0
 protected void CheckError(ErrorCode err)
 {
     m_BroadcastController.CheckError(err);
 }
예제 #44
0
            void IStreamCallbacks.StartCallback(ErrorCode ret)
            {
                if (Error.Succeeded(ret))
                {
                    FireBroadcastStarted();

                    SetBroadcastState(BroadcastState.Broadcasting);
                }
                else
                {
                    this.VideoParams = null;
                    this.AudioParams = null;

                    SetBroadcastState(BroadcastState.ReadyToBroadcast);

                    string err = Error.GetString(ret);
                    ReportError(string.Format("StartCallback got failure: {0}", err));
                }
            }
예제 #45
0
 protected void FireAuthTokenRequestComplete(ErrorCode result, AuthToken authToken)
 {
     try
     {
         if (m_BroadcastController.AuthTokenRequestComplete != null)
         {
             m_BroadcastController.AuthTokenRequestComplete(result, authToken);
         }
     }
     catch (Exception x)
     {
         ReportError(x.ToString());
     }
 }
예제 #46
0
 protected virtual void CheckError(ErrorCode err)
 {
 }
예제 #47
0
            void IChatChannelListener.ChatStatusCallback(string channelName, ErrorCode result)
            {
                if (Error.Succeeded(result))
                {
                    return;
                }

                // destroy the channel object
                Channels.Remove(m_ChannelName);

                DisconnectionComplete();
            }
예제 #48
0
 protected void CheckError(ErrorCode err)
 {
     m_ChatController.CheckError(err);
 }
예제 #49
0
 protected virtual void CheckError(ErrorCode err)
 {
 }
예제 #50
0
            void IStreamCallbacks.GetIngestServersCallback(ErrorCode result, IngestList ingestList)
            {
                if (Error.Succeeded(result))
                {
                    this.IngestList = ingestList;

                    // assume we're going to use the default ingest server unless overidden by the client
                    this.IngestServer = ingestList.DefaultServer;

                    SetBroadcastState(BroadcastState.ReceivedIngestServers);

                    FireIngestListReceived(ingestList);
                }
                else
                {
                    string err = Error.GetString(result);
                    ReportError(string.Format("IngestListCallback got failure: {0}", err));

                    // try again
                    SetBroadcastState(BroadcastState.LoggedIn);
                }
            }
예제 #51
0
            void IChatAPIListener.ChatInitializationCallback(ErrorCode result)
            {
                if (Error.Succeeded(result))
                {
                    Api.SetMessageFlushInterval(this.MessageFlushInterval);
                    Api.SetUserChangeEventInterval(this.UserChangeEventInterval);

                    m_ChatController.DownloadEmoticonData();

                    m_ChatController.SetChatState(ChatState.Initialized);
                }
                else
                {
                    m_ChatController.SetChatState(ChatState.Uninitialized);
                }

                try
                {
                    if (m_ChatController.InitializationComplete != null)
                    {
                        m_ChatController.InitializationComplete(result);
                    }
                }
                catch (Exception x)
                {
                    m_ChatController.ReportError(x.ToString());
                }
            }
예제 #52
0
            void IStreamCallbacks.GetGameNameListCallback(ErrorCode result, GameInfoList list)
            {
                if (Error.Failed(result))
                {
                    string err = Error.GetString(result);
                    ReportError(string.Format("GameNameListCallback got failure: {0}", err));
                }

                FireGameNameListReceived(result, list);
            }
예제 #53
0
 protected void FireFrameSubmissionIssue(ErrorCode ret)
 {
     try
     {
         if (this.FrameSubmissionIssue != null)
         {
             this.FrameSubmissionIssue(ret);
         }
     }
     catch (Exception x)
     {
         ReportError(x.ToString());
     }
 }
예제 #54
0
            void IStreamCallbacks.GetUserInfoCallback(ErrorCode result, UserInfo userInfo)
            {
                this.UserInfo = userInfo;

                if (Error.Failed(result))
                {
                    string err = Error.GetString(result);
                    ReportError(string.Format("UserInfoDoneCallback got failure: {0}", err));
                }
            }