예제 #1
0
 public string ConvertToString(BuildActionConverter buildActionConverter, object value)
 {
     switch ((VSLangProj.prjBuildAction)value)
     {
     case VSLangProj.prjBuildAction.prjBuildActionCompile:
         return "Compile";
     case VSLangProj.prjBuildAction.prjBuildActionContent:
         return "Content";
     case VSLangProj.prjBuildAction.prjBuildActionEmbeddedResource:
         return "EmbeddedResource";
     case VSLangProj.prjBuildAction.prjBuildActionNone:
         return "None";
     default:
         if (buildActionConverter != null)
         {
             // Not standard buildAction, so must have been registered.
             // Convert it to the name of the BuildAction at position index in the StandardValues from the BuildActionConverter
             int index = (int)value;
             var actions = buildActionConverter.RegisteredBuildActions;
             if (index >= 0 && index < actions.Count)
             {
                 return actions[index].Name;
             }
         }
         return "None";
     }
 }
예제 #2
0
 public object ConvertFromString(BuildActionConverter buildActionConverter, string value)
 {
     if (value.Equals("Compile", StringComparison.OrdinalIgnoreCase))
     {
         return VSLangProj.prjBuildAction.prjBuildActionCompile;
     }
     else if (value.Equals("Content", StringComparison.OrdinalIgnoreCase))
     {
         return VSLangProj.prjBuildAction.prjBuildActionContent;
     }
     else if (value.Equals("EmbeddedResource", StringComparison.OrdinalIgnoreCase))
     {
         return VSLangProj.prjBuildAction.prjBuildActionEmbeddedResource;
     }
     else if (value.Equals("None", StringComparison.OrdinalIgnoreCase))
     {
         return VSLangProj.prjBuildAction.prjBuildActionNone;
     }
     else
     {
         if (buildActionConverter != null)
         {
             // Not standard buildAction, so must have been registered.
             // Convert it to the index in the StandardValues from the BuildActionConverter.
             var actions = buildActionConverter.RegisteredBuildActions;
             var reply = actions.ToList().FindIndex(i => value.Equals(i.Name, StringComparison.OrdinalIgnoreCase));
             if (reply != -1) return (VSLangProj.prjBuildAction)reply;
         }
     }
     return VSLangProj.prjBuildAction.prjBuildActionNone;
 }
예제 #3
0
 /// <summary>
 /// Constructor.  Copy the base property descriptor and also hold a pointer
 /// to it for calling its overridden abstract methods.
 /// </summary>
 internal BuildActionPropertyDescriptor(PropertyDescriptor prop, BuildActionConverter converter)
     : base(prop)
 {
     this.converter = converter;
 }