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();
 }
Esempio n. 4
0
        public static string GetIncludeFlagStringUI(IncludeFlags flagValue)
        {
            switch (flagValue)
            {
            case IncludeFlags.UseDefault:
                return(_clearIncludeStrUI);

            case IncludeFlags.Exclude:
                return(_excludeStrUI);

            case IncludeFlags.Include:
                return(_includeStrUI);

            default:
                return(_clearIncludeStrUI);
            }
        }
Esempio n. 5
0
        internal PackageDependency(string id, string version, string?includeAssets = "All", string?excludeAssets = "None", string privateAssets = DefaultPrivateAssets)
        {
            Id      = id ?? throw new ArgumentNullException(nameof(id));
            Version = version ?? throw new ArgumentNullException(nameof(version));

            IncludeFlags include  = GetIncludeFlags(includeAssets);
            IncludeFlags exclude  = GetIncludeFlags(excludeAssets);
            IncludeFlags @private = GetIncludeFlags(privateAssets);

            IncludeFlags effectiveInclude = include & ~exclude & ~@private;

            ExcludeAssets = exclude.ToString();

            if ((NoContent & ~effectiveInclude) != IncludeFlags.None)
            {
                ExcludeAssets = (NoContent & ~effectiveInclude).ToString();
            }
        }
Esempio n. 6
0
        private IncludeFlags GetIncludeFlags(string?assets)
        {
            if (assets == null)
            {
                return(IncludeFlags.None);
            }

            IncludeFlags includeFlags = IncludeFlags.None;

            foreach (string?item in assets.Split(SplitChars, StringSplitOptions.RemoveEmptyEntries))
            {
                if (Enum.TryParse(item, out IncludeFlags value))
                {
                    includeFlags |= value;
                }
            }

            return(includeFlags);
        }