Ejemplo n.º 1
0
        protected ImageItem(SerializationInfo info, StreamingContext context)
        {
            _includeFlag      = (IncludeFlags)info.GetInt32("IncludeFlag");
            _fileName         = info.GetString("FileName");
            _filePath         = info.GetString("FilePath");
            _stretchType      = (StretchTypes)info.GetInt32("StretchType");
            _textDisplayFlag  = (ThreeWayFlags)info.GetInt32("TextDisplayFlag");
            _recursiveDirFlag = info.GetBoolean("RecursiveDirFlag");
            _offset           = (Point)info.GetValue("Offset", typeof(Point));
            _scaleFactor      = (float)info.GetDouble("ScaleFactor");
            _keywordList      = (ArrayList)info.GetValue("KeywordList", typeof(ArrayList));
// ??		_previewScaleFactor = (float) info.GetDouble("PreviewScaleFactor");

            SetPathAndFilename(_filePath + _fileName);
            _appLog = new TSOP.AppLog();
            try
            {
                tf = new ThumbnailFile(this.GetThumbnailPathAndFileName());
                //_imageObj = Image.FromFile(PathAndFileName);
            }
            catch (Exception ex)
            {
                _appLog.LogError("failed to deserialize image item", ex, "ImageItem", "Constructor");
            }
        }
Ejemplo n.º 2
0
        public bool Deserialize(BinaryReader br, bool readKeywords)
        {
            try
            {
                //_appLog.LogInfo("Starting deserialize", null, "ImageItem", "Deserialize()");
                _includeFlag      = (IncludeFlags)br.ReadInt32();
                _fileName         = br.ReadString();
                _filePath         = br.ReadString();
                _stretchType      = (StretchTypes)br.ReadInt32();
                _textDisplayFlag  = (ThreeWayFlags)br.ReadInt32();
                _recursiveDirFlag = br.ReadBoolean();
                int x = br.ReadInt32();
                int y = br.ReadInt32();
                _offset = new Point(x, y);
                float sf = br.ReadSingle();
                if (sf != 0.0f)
                {
                    _scaleFactor = sf;
                }
                else
                {
                    _scaleFactor = 1.0f;
                }
                //_appLog.LogInfo("Reading Keyword String", null, "ImageItem", "Deserialize()");
                KeywordString = br.ReadString();

                SetPathAndFilename(_filePath + _fileName);
                //_appLog.LogInfo("Constructing Thumbnail", null, "ImageItem", "Deserialize()");
                tf = new ThumbnailFile(this.GetThumbnailPathAndFileName());
                if (readKeywords)
                {
                    //_appLog.LogInfo("Loading Keywords", null, "ImageItem", "Deserialize()");
                    tf.Load();
                    _stretchType     = tf.StretchType;
                    _textDisplayFlag = tf.TextDisplayEnum;
                    //_appLog.LogInfo("Getting keyword string", null, "ImageItem", "Deserialize()");
                    _keywordList.Clear();
                    KeywordString = tf.KeywordString;
                    _offset       = tf.Offset;
                    if (tf.ScaleFactor != 0.0f)
                    {
                        _scaleFactor = tf.ScaleFactor;
                    }
                    else
                    {
                        _scaleFactor = 1.0f;
                    }
                }
                //_appLog.LogInfo("Getting Image Object", null, "ImageItem", "Deserialize()");
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                _appLog.LogError("failed to deserialize ImageItem", ex, "ImageItem", "Deserialize");
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
 public void Init()
 {
     _stretchDefault         = StretchTypes.NoStretch;
     _intervalTime           = 5;
     _scriptFileList         = new ScriptFileCollection();
     _randomize              = false;
     _mouseWakeup            = false;
     _displayTextDefault     = false;
     _displayFileInfoDefault = false;
     _appLog = new AppLog();
 }
Ejemplo n.º 4
0
 private void Init()
 {
     this._keywordList        = new ArrayList();
     this._includeFlag        = IncludeFlags.UseDefault;
     this._offset             = new Point(0, 0);
     this._recursiveDirFlag   = false;
     this._scaleFactor        = 1.0f;
     this._stretchType        = StretchTypes.UseDefault;
     this._textDisplayFlag    = ThreeWayFlags.UseDefault;
     this._previewScaleFactor = 1.0f;
     this._imageObj           = null;
     this._index  = -1;
     this._appLog = new TSOP.AppLog();
 }
Ejemplo n.º 5
0
        public bool Save(string keywordString, StretchTypes stretchType, ThreeWayFlags textFlag, System.Drawing.Point offset, float scaleFactor)
        {
            _keywordString = keywordString;

            StretchType = stretchType;

            TextDisplayEnum = textFlag;

            Offset = offset;

            ScaleFactor = scaleFactor;

            return(Save());
        }
Ejemplo n.º 6
0
        public bool Deserialize(BinaryReader br, ProgressChangedEventHandler updateProgress)
        {
            try
            {
                _updateProgress = updateProgress;

                // read the file
                string header = br.ReadString();                // (file header)
                if (header != _fileHeader)                      // for now, force the file header to be the same.  in the future, implement versioning.
                {
                    return(false);
                }
                _stretchDefault = (StretchTypes)br.ReadInt32();
                _intervalTime   = br.ReadUInt32();
                string scriptFileListString = br.ReadString();
                _randomize              = br.ReadBoolean();
                _mouseWakeup            = br.ReadBoolean();
                _displayTextDefault     = br.ReadBoolean();
                _displayFileInfoDefault = br.ReadBoolean();
                _readKeywords           = br.ReadBoolean();

                if (_updateProgress != null)
                {
                    _updateProgress(5);
                }

                // parse the script file string and load each script file
                string[] scriptFileNames = scriptFileListString.Split('|');
                ProgressChangedEventHandler updateImageProgress = new ProgressChangedEventHandler(UpdateImageLevelProgress);
                for (int i = 0; i < scriptFileNames.GetLength(0); i++)
                {
                    ScriptFile sf = new ScriptFile(scriptFileNames[i]);
                    _startProgress = (int)((float)i / (float)scriptFileNames.GetLength(0) * 90) + 5;
                    _endProgress   = (int)((float)(i + 1) / (float)scriptFileNames.GetLength(0) * 90) + 5;
                    sf.Load(_readKeywords, updateImageProgress);
                    _scriptFileList.Add(sf);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                _appLog.LogError("failed to deserialize config file", ex, "ConfigFile", "Deserialize");
                return(false);
            }

            return(true);
        }
Ejemplo n.º 7
0
        private void _comboBoxStretchType_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            StretchTypes stretchType = (StretchTypes)Enum.Parse(typeof(StretchTypes), _comboBoxStretchType.Text);

            foreach (ImageItem i in _images)
            {
                i.StretchType = stretchType;
            }

            if (stretchType == StretchTypes.ScaleFactor)
            {
                this._textBoxScaleFactor.Enabled = true;
            }
            else
            {
                this._textBoxScaleFactor.Enabled = false;
            }
        }
Ejemplo n.º 8
0
        public static string GetStretchTypeString(StretchTypes stretch)
        {
            switch (stretch)
            {
            case StretchTypes.NoStretch:
                return(_noStretchString);

            case StretchTypes.ScaleFactor:
                return(_scaleFactorString);

            case StretchTypes.StretchKeepAspectRatio:
                return(_KARString);

            case StretchTypes.StretchToFit:
                return(_toFitString);

            case StretchTypes.UseDefault:
                return(_defaultString);

            default:
                return(_defaultString);
            }
        }