Пример #1
0
        internal IEnumerable <OnlineScript> ReadScripts()
        {
            if (ActiveStream.DataAvailable)
            {
                BeginRead();
            }
            else
            {
                yield break;
            }

            while (CanRead)
            {
                int    OriginalReadBufferPos = ReadBufferPos;
                string ScriptName            = null;

                OnlineScript NewScript;

                try
                {
                    ScriptName = ReadString();
                    OnlineScript ReadScript = DicOnlineScripts[ScriptName].Copy();

                    ReadScript.Read(this);
                    NewScript = ReadScript;
                }
                catch (Exception ex)
                {
                    if (!string.IsNullOrEmpty(ScriptName))
                    {
                        Trace.TraceError(DateTimeOffset.Now + " - Reading [" + ScriptName + "] : " + ex.Message);
                    }
                    else
                    {
                        Trace.TraceError(DateTimeOffset.Now + " - Reading " + ex.Message);
                    }

                    Trace.TraceError(DateTimeOffset.Now + " - Reading " + ex.StackTrace);
                    Trace.Flush();
                    ReadBufferPos = OriginalReadBufferPos;
                    yield break;
                }

                if (NewScript == null)
                {
                    yield break;
                }
                else
                {
                    yield return(NewScript);
                }
            }
        }
Пример #2
0
        internal List <OnlineScript> ReadAllScripts()
        {
            List <OnlineScript> ListReadScript = new List <OnlineScript>();

            if (ActiveStream.DataAvailable)
            {
                BeginRead();
            }
            else
            {
                return(ListReadScript);
            }

            while (CanRead)
            {
                int    OriginalReadBufferPos = ReadBufferPos;
                string ScriptName            = null;

                try
                {
                    ScriptName = ReadString();
                    OnlineScript NewScript = DicOnlineScripts[ScriptName].Copy();

                    NewScript.Read(this);

                    ListReadScript.Add(NewScript);
                }
                catch (Exception ex)
                {
                    if (!string.IsNullOrEmpty(ScriptName))
                    {
                        Trace.TraceError(DateTimeOffset.Now + " - Reading [" + ScriptName + "] : " + ex.Message);
                    }
                    else
                    {
                        Trace.TraceError(DateTimeOffset.Now + " - Reading " + ex.Message);
                    }

                    Trace.TraceError(DateTimeOffset.Now + " - Reading " + ex.StackTrace);
                    Trace.Flush();
                    ReadBufferPos = OriginalReadBufferPos;
                    return(ListReadScript);
                }
            }

            return(ListReadScript);
        }
Пример #3
0
        internal IEnumerable <OnlineScript> ReadScripts()
        {
            if (ActiveStream.DataAvailable)
            {
                BeginRead();
            }
            else
            {
                yield break;
            }

            while (CanRead)
            {
                string       ScriptName = ReadString();
                OnlineScript NewScript  = DicOnlineScripts[ScriptName].Copy();

                NewScript.Read(this);

                yield return(NewScript);
            }
        }
Пример #4
0
        internal OnlineScript ReadScript()
        {
            if (ActiveStream.DataAvailable)
            {
                BeginRead();
            }
            else
            {
                return(null);
            }

            while (CanRead)
            {
                string       ScriptName = ReadString();
                OnlineScript NewScript  = DicOnlineScripts[ScriptName].Copy();

                NewScript.Read(this);

                return(NewScript);
            }

            return(null);
        }