示例#1
0
        /// <summary>
        /// Converts a <paramref name="cando"/> value to a string compatible with VST.
        /// </summary>
        /// <param name="cando">The value to convert to string.</param>
        /// <returns>Returns the string value for the <paramref name="cando"/>.</returns>
        public static string ToString(VstHostCanDo cando)
        {
            string result = cando.ToString();

            // lower case on first character
            result = char.ToLowerInvariant(result[0]) + result.Substring(1);

            return(result);
        }
示例#2
0
        public void Test_VstCanDoHelper_HostCanDo_ToString()
        {
            VstHostCanDo cando  = VstHostCanDo.EditFile;
            string       actual = VstCanDoHelper.ToString(cando);

            Assert.AreEqual("editFile", actual, "HostCanDo.EditFile failed.");

            cando  = VstHostCanDo.SupplyIdle;
            actual = VstCanDoHelper.ToString(cando);
            Assert.AreEqual("supplyIdle", actual, "HostCanDo.SupplyIdle failed.");
        }
示例#3
0
        public void Test_VstCanDoHelper_ParseHostCanDo()
        {
            string       cando  = "editFile";
            VstHostCanDo actual = VstCanDoHelper.ParseHostCanDo(cando);

            Assert.AreEqual(VstHostCanDo.EditFile, actual, "HostCanDo.EditFile failed.");

            cando  = "supplyIdle";
            actual = VstCanDoHelper.ParseHostCanDo(cando);
            Assert.AreEqual(VstHostCanDo.SupplyIdle, actual, "HostCanDo.SupplyIdle failed.");
        }
示例#4
0
        public void Test_VstCanDoHelper_HostCanDo_ToString()
        {
            VstHostCanDo cando  = VstHostCanDo.EditFile;
            var          actual = VstCanDoHelper.ToString(cando);

            actual.Should().Be("editFile");

            cando  = VstHostCanDo.SupplyIdle;
            actual = VstCanDoHelper.ToString(cando);
            actual.Should().Be("supplyIdle");
        }
示例#5
0
        /// <summary>
        /// Attempts to parse the <paramref name="cando"/> string.
        /// </summary>
        /// <param name="cando">Must not be null or empty.</param>
        /// <returns>Returns <see cref="VstHostCanDo.None"/> when string did not match an enum value.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="cando"/> is not set to an instance of an object.</exception>
        /// <exception cref="ArgumentException">Thrown when <paramref name="cando"/> is an empty string.</exception>
        public static VstHostCanDo ParseHostCanDo(string cando)
        {
            Throw.IfArgumentIsNullOrEmpty(cando, "cando");

            VstHostCanDo result   = VstHostCanDo.None;
            Type         enumType = typeof(VstHostCanDo);

            foreach (string name in Enum.GetNames(enumType))
            {
                if (name.Equals(cando, StringComparison.InvariantCultureIgnoreCase))
                {
                    result = (VstHostCanDo)Enum.Parse(enumType, cando, true);
                    break;
                }
            }

            return(result);
        }
示例#6
0
 public VstCanDoResult CanDo(VstHostCanDo cando)
 {
     return(VstCanDoResult.Unknown);
 }
示例#7
0
 public VstCanDoResult CanDo(VstHostCanDo cando)
 {
     return VstCanDoResult.Unknown;
 }