RemoteTech.RTUtils.containsField C# (CSharp) Méthode

containsField() public static méthode

public static containsField ( PartModule module, string fieldName ) : bool
module PartModule
fieldName string
Résultat bool
        public static bool containsField(PartModule module, string fieldName)
        {
            try
            {
                return module.Fields.GetValue(fieldName) != null;
            }
            catch { return false; }
        }

Usage Example

Exemple #1
0
 public static bool IsComsat(Vessel v)
 {
     if (v.loaded)
     {
         foreach (Part p in v.parts)
         {
             foreach (PartModule m in p.Modules)
             {
                 if (RTUtils.containsField(m, "isRemoteCommand"))
                 {
                     return(true);
                 }
             }
         }
     }
     else
     {
         foreach (ProtoPartSnapshot p in v.protoVessel.protoPartSnapshots)
         {
             foreach (ProtoPartModuleSnapshot s in p.modules)
             {
                 ConfigNode n = new ConfigNode();
                 s.Save(n);
                 if (n.HasValue("isRemoteCommand"))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
All Usage Examples Of RemoteTech.RTUtils::containsField