コード例 #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");
            }
        }
コード例 #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);
        }
コード例 #3
0
 public ImageItem(String fileName)
 {
     Init();
     SetPathAndFilename(fileName);
     try
     {
         tf = new ThumbnailFile(this.GetThumbnailPathAndFileName());
         //_imageObj = Image.FromFile(fileName);
     }
     catch (Exception ex)
     {
         _appLog.LogError("failed to get thumbnail file or image file", ex, "ImageItem", "Constructor");
     }
 }