Esempio 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");
            }
        }
Esempio 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);
        }
Esempio n. 3
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();
 }
        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());
        }
Esempio n. 5
0
        public static string GetThreeWayFlagString(ThreeWayFlags flagValue)
        {
            switch (flagValue)
            {
            case ThreeWayFlags.UseDefault:
                return(_defaultString);

            case ThreeWayFlags.False:
                return(_noString);

            case ThreeWayFlags.True:
                return(_yesString);

            default:
                return(_defaultString);
            }
        }
Esempio n. 6
0
        public static bool EvaluateFlags(bool defaultFlag, ThreeWayFlags imageFlag)
        {
            switch (imageFlag)
            {
            case ThreeWayFlags.UseDefault:
                return(defaultFlag);

            case ThreeWayFlags.False:
                return(false);

            case ThreeWayFlags.True:
                return(true);

            default:
                return(false);
            }
        }