Пример #1
0
        public bool Load(bool readKeywords, ProgressChangedEventHandler updateProgress)
        {
            FileStream fs = new FileStream(PathAndFileName, FileMode.Open, FileAccess.Read);

            try
            {
                using (fs)
                {
                    BinaryReader br = new BinaryReader(fs);

                    using (br)
                    {
                        string header = br.ReadString();
                        _name = br.ReadString();

                        _imageItemCollection = new ImageItemList();

                        while (br.BaseStream.Position < br.BaseStream.Length)
                        {
                            ImageItem ii = new ImageItem();
                            //_appLog.LogWarning("loading new image", null, "ScriptFile", "Load()");
                            ii.Deserialize(br, readKeywords);
                            _imageItemCollection.AddImageItem(ii);
                            if (updateProgress != null)
                            {
                                updateProgress((int)((float)br.BaseStream.Position / (float)br.BaseStream.Length * 100));
                            }
                        }

                        br.Close();
                    }

                    fs.Close();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                _appLog.LogError("failed to load script file", ex, "ScriptFile", "Load");
                return(false);
            }

            return(true);
        }
        private void _slideTimer_Tick(object sender, System.EventArgs e)
        {
            int i = DateTime.Now.Second % 4;

            try
            {
                if (_processor != null)
                {
                    CleanupImageMemory();
                    _currentImage = _processor.GetNextImage();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
                TSOP.AppLog appLog = new TSOP.AppLog();
                appLog.LogError("failed to get next image", ex, "ScreenSaverForm", "_slideTimer_Tick");
            }
            Refresh();
        }