コード例 #1
0
        public LimePerson(string name, string[] roles)
        {
            LimeLib.LifeTrace(this);

            Name  = name;
            Roles = roles;
        }
コード例 #2
0
        public LimePerson(int id, string name, string[] roles)
        {
            LimeLib.LifeTrace(this);

            TmdbId = id;
            Name   = name;
            Roles  = roles;
        }
コード例 #3
0
ファイル: LimeProperty.cs プロジェクト: Starwer/Lime
        /// <summary>
        /// Parameterless constructor to enable Xaml
        /// </summary>
        public LimeProperty()
        {
            LimeLib.LifeTrace(this);

            Source = null;
            PInfo  = null;
            Type   = null;
            Ident  = null;
            Name   = null;
            Desc   = null;
        }
コード例 #4
0
ファイル: LimeProperty.cs プロジェクト: Starwer/Lime
        // --------------------------------------------------------------------------------------------------
        #region ctors


        /// <summary>
        /// Construct a reference to a property in a class
        /// </summary>
        /// <param name="ident">identifier of the LimeProperty</param>
        /// <param name="source">Parent object of the class where the property belongs</param>
        /// <param name="pi">PropertyInfo of the property (null if not referenced)</param>
        /// <param name="attr">Configuration attributes attached to this property</param>
        /// <param name="name">User-friendly name of the object. Automatically taken from translation by default.</param>
        /// <param name="readOnly">Define readOnly attribute</param>
        /// <param name="visible">Define visibility to the user</param>
        private void Factory(string ident, object source, PropertyInfo pi, LimePropertyAttribute attr, string name = null, bool?readOnly = null, bool?visible = null)
        {
            LimeLib.LifeTrace(this);

            Source = source;
            string languageSection = IniLanguageSection;

            if (pi != null)
            {
                // Referenced source
                PInfo = pi;
                var vobj = pi.GetValue(Source);
                Type = vobj != null?vobj.GetType() : pi.PropertyType;

                Ident = ident ?? pi.Name;
            }
            else
            {
                // Unreferenced source
                Type  = source.GetType();
                Ident = ident;
            }

            // Implied attributes
            if (source is System.Windows.Input.ICommand)
            {
                ReadOnly        = true;
                languageSection = IniLanguageCommand;
            }

            // Copy attribute
            if (attr != null)
            {
                if (attr.GetType() != typeof(LimePropertyAttribute))
                {
                    attr = new LimePropertyAttribute(attr);
                }
                LimeLib.CopyPropertyValues(attr, this);
            }

            // Forced attributes
            if (readOnly != null)
            {
                ReadOnly = readOnly == true;
            }
            if (visible != null)
            {
                Visible = visible == true;
            }


            // Bind the object
            if (source is INotifyPropertyChanged src)
            {
                //LimeMsg.Debug("LimeProperty Factory: Subscribe {0} / {1}", Ident, src);
                src.PropertyChanged += SourcePropertyChanged;
            }

            if (Ident == null || name != null || !Visible)
            {
                Name = name ?? ident;
                Desc = null;
            }
            else
            {
                // Retrieve properties from LimeLanguage
                Name = LimeLanguage.Translate(languageSection, Ident + ".name", Ident);
                Desc = LimeLanguage.Translate(languageSection, Ident + ".desc", Name);
            }
        }
コード例 #5
0
ファイル: LimeMetadata.cs プロジェクト: Starwer/Lime
        /// <summary>
        /// Construct and retrieve Metadata from a directory/file path
        /// </summary>
        /// <param name="item">The <see cref="LimeItem"/> element to construct Metadata for.</param>
        /// <param name="coverOnly">Try to load only a cover, not the system icon</param>
        public LimeMetadata(LimeItem item, bool coverOnly) : this()
        {
            LimeLib.LifeTrace(this);

            // Disable modification detection
            _Modified = null;


            LimeMsg.Debug("LimeMetadata: {0}", item.Name);
            string path = item.Path;

            if (!coverOnly)
            {
                // Add Name
                Add("Name", item.Name, true, false);
                if (item.Link != null)
                {
                    // Link
                    path = item.Link;
                    Add("LinkLabel");
                }

                // Handle tasks
                if (item.Task)
                {
                    Add("Task", item.Name, true);
                }

                // Display path
                Add("Path", item, "Path", readOnly: item.Task);
            }

            // Retrieve Tags
            if (!item.Task && !item.Directory && !LimeLib.IsPIDL(path) && !LimeLib.IsSSPD(path))
            {
                LimeMsg.Debug("LimeMetadata: TagLib: {0}", item.Name);
                try
                {
                    TagLibFile = TagLib.File.Create(path, TagLib.ReadStyle.Average | TagLib.ReadStyle.PictureLazy);
                }
                catch
                {
                    LimeMsg.Debug("LimeMetadata: {0}: Failed TagLib.File.Create({1})", item.Name, path);
                }
            }

            // Extract Tags
            if (TagLibFile != null)
            {
                LimeMsg.Debug("LimeMetadata: TagLib done: {0}", item.Name);

                // Retrieve Type
                if (TagLibFile.Properties != null && TagLibFile.Properties.Codecs != null)
                {
                    TagLib.MediaTypes[] prioTypes = new TagLib.MediaTypes[] {
                        TagLib.MediaTypes.Video, TagLib.MediaTypes.Audio, TagLib.MediaTypes.Photo, TagLib.MediaTypes.Text
                    };

                    var codecs = TagLibFile.Properties.Codecs;
                    foreach (var codec in codecs)
                    {
                        if (codec != null)
                        {
                            TagLib.MediaTypes mask = codec.MediaTypes | (TagLib.MediaTypes)Type;

                            foreach (var typ in prioTypes)
                            {
                                if ((mask & typ) != 0)
                                {
                                    Type = (MediaType)typ;
                                    break;
                                }
                            }
                        }
                    }
                }
                else if (TagLibFile is TagLib.Image.NoMetadata.File)
                {
                    Type = MediaType.Image;
                }
            }

            // Handle Links
            if (!coverOnly && item.Link != null)
            {
                using (var link = new ShellShortcut(item.Path))
                {
                    Add("LinkWorkdir", link.WorkingDirectory);
                    //Add("LinkKey", link.Hotkey);
                    Add("LinkWindowStyle", (ShellLinkWindowStyle)link.WindowStyle);

                    if (Type == MediaType.None)
                    {
                        Add("LinkArguments", link.Arguments);
                    }

                    Add("LinkComment", link.Description);
                }


                Add("TagLabel");

                // Target Path
                if (LimeLib.IsPIDL(item.Link))
                {
                    // Retrieve name of the PIDL
                    try
                    {
                        var dInfo = new DirectoryInfoEx(new ShellDll.PIDL(LimeLib.GetPIDL(item.Link), true));
                        Add("LinkTarget", dInfo.Label, true);
                    }
                    catch { }
                }
                else
                {
                    Add("LinkTarget", item.Link, LimeLib.IsSSPD(item.Link));
                }
            }


            if (TagLibFile != null)
            {
                LimeMsg.Debug("LimeMetadata: TagLib done 2: {0}", item.Name);
                // Build the Properties
                BuildProperties();


                // Build the Pictures image
                BuildCover(coverOnly);
            }
            else if (!coverOnly)
            {
                // Build the Pictures image from the file icon
                using (var bmp = item.Bitmap(256))
                {
                    Pictures = LimeLib.ImageSourceFrom(bmp);
                }
            }

            if (!coverOnly)
            {
                // Finalize
                BuildToolTip();
            }

            // re-enable modification detection
            _Modified = false;
            LimeMsg.Debug("LimeMetadata End: {0}", item.Name);
        }
コード例 #6
0
        public LimePerson(string namerole)
        {
            LimeLib.LifeTrace(this);

            FromString(namerole, CultureInfo.CurrentCulture);
        }
コード例 #7
0
        // --------------------------------------------------------------------------------------------------
        #region ctors

        public LimePerson()
        {
            LimeLib.LifeTrace(this);
        }
コード例 #8
0
ファイル: LimePicture.cs プロジェクト: Starwer/Lime
        // --------------------------------------------------------------------------------------------------
        #region ctors

        /// <summary>
        /// Parameterless constructor
        /// </summary>
        public LimePicture()
        {
            LimeLib.LifeTrace(this);
        }