コード例 #1
0
        /// <summary>
        /// Helper function to validate the BuildTargets string. Excludes data file target
        /// from the string unless it is the only target, and optionally checks that the
        /// targets are available for building.
        /// </summary>
        private static string GetBuildTargetsString(string[] targets, bool checkAvailable)
        {
            if (targets.Length == 0)
            {
                return(BuildTargetsInfo.DATAFILE_TARGET_NAME);
            }
            List <string> availableTargets = null; // only retrieve available targets on request

            if (checkAvailable)
            {
                availableTargets = new List <string>(BuildTargetsInfo.GetAvailableBuildTargetNames());
            }
            List <string> resultTargetList = new List <string>(targets.Length);

            foreach (string targ in targets)
            {
                if ((!checkAvailable) || (availableTargets.Contains(targ)))
                {
                    // only include data file target if it is the only target
                    if ((targ != BuildTargetsInfo.DATAFILE_TARGET_NAME) || (targets.Length == 1))
                    {
                        resultTargetList.Add(targ);
                    }
                }
            }
            return(string.Join(BuildTargetUIEditor.Separators[0], resultTargetList.ToArray()));
        }
コード例 #2
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     return(base.EditValueHelper(context, provider, string.Format("{0}{1}{2}", BuildTargetsInfo.DATAFILE_TARGET_NAME,
                                                                  StringListUIEditor.Separators[0], value.ToString()),
                                 new List <string>(BuildTargetsInfo.GetAvailableBuildTargetNames())));
 }