Example #1
0
File: Pi2.cs Project: habi/pi2
        /// <summary>
        /// Returns the name and path to the file that has been mapped to the given image, or an empty string if no mapping has been made.
        /// </summary>
        /// <param name="image"></param>
        /// <returns></returns>
        public string GetMapFile(Pi2Image image)
        {
            Pi2Value str = NewString();

            PiLib.RunAndCheck(Handle, $"getmapfile({image.Name}, {str.Name})");
            return(str);
        }
Example #2
0
File: Pi2.cs Project: habi/pi2
        /// <summary>
        /// Get a value of a metadata item.
        /// </summary>
        /// <param name="img"></param>
        /// <param name="name"></param>
        /// <param name="defaultValue"></param>
        /// <param name="i"></param>
        /// <param name="j"></param>
        /// <returns></returns>
        public string GetMeta(Pi2Image img, string name, string defaultValue, int i = 0, int j = 0)
        {
            Pi2Value value = NewString();

            PiLib.RunAndCheck(Handle, $"getmeta({img.Name}, {name}, {value.Name}, {i}, {j}, {defaultValue})");
            return(value.AsString());
        }
Example #3
0
File: Pi2.cs Project: habi/pi2
        /// <summary>
        /// Retrieves list of metadata item keys.
        /// </summary>
        /// <param name="img"></param>
        /// <returns></returns>
        public string[] ListMeta(Pi2Image img)
        {
            Pi2Value value = NewString();

            PiLib.RunAndCheck(Handle, $"listmeta({img.Name}, {value.Name})");
            string s = value.AsString();

            if (String.IsNullOrEmpty(s))
            {
                return(new string[0]);
            }
            return(s.Split(new string[] { ", " }, StringSplitOptions.None));
        }