Ejemplo n.º 1
0
 public static GiftInterest ToGiftInterest(this ScriptEnum val)
 {
     if (val == null)
     {
         return(ToGiftInterest(String.Empty));
     }
     return(ToGiftInterest(val.ToString()));
 }
Ejemplo n.º 2
0
 public static SchematicResearchChance ToSchematicResearchChance(this ScriptEnum val)
 {
     if (val == null)
     {
         return(ToSchematicResearchChance(String.Empty));
     }
     return(ToSchematicResearchChance(val.ToString()));
 }
Ejemplo n.º 3
0
 public static EnhancementSubCategory ToEnhancementSubCategory(this ScriptEnum val)
 {
     if (val == null)
     {
         return(ToEnhancementSubCategory(String.Empty));
     }
     return(ToEnhancementSubCategory(val.ToString()));
 }
Ejemplo n.º 4
0
 public static ProfessionSubtype ToProfessionSubtype(this ScriptEnum val)
 {
     if (val == null)
     {
         return(ToProfessionSubtype(String.Empty));
     }
     return(ToProfessionSubtype(val.ToString()));
 }
Ejemplo n.º 5
0
 public static ItemBindingRule ToBindingRule(this ScriptEnum val)
 {
     if (val == null)
     {
         return(ToBindingRule(String.Empty));
     }
     return(ToBindingRule(val.ToString()));
 }
Ejemplo n.º 6
0
 public static Toughness ToToughness(this ScriptEnum val)
 {
     if (val == null)
     {
         return(Toughness.None);
     }
     return(ToToughness((int)val.Value));
 }
Ejemplo n.º 7
0
 public static QuestDifficulty ToQuestDifficulty(this ScriptEnum val)
 {
     if (val == null)
     {
         return(ToQuestDifficulty(String.Empty));
     }
     return(ToQuestDifficulty(val.ToString()));
 }
Ejemplo n.º 8
0
 public static GiftRank ToGiftRank(this ScriptEnum val)
 {
     if (val == null)
     {
         return(ToGiftRank(String.Empty));
     }
     return(ToGiftRank(val.ToString()));
 }
Ejemplo n.º 9
0
 public static Workstation ToWorkstation(this ScriptEnum val)
 {
     if (val == null)
     {
         return(ToWorkstation(String.Empty));
     }
     return(ToWorkstation(val.ToString()));
 }
Ejemplo n.º 10
0
        private string ReadScript(ScriptEnum kind)
        {
            var shortname = scriptsDictionary[kind];
            var fullname  = TryGetMappedScriptName(shortname);
            var script    = TryReadResourceScript(fullname);

            return(script);
        }
Ejemplo n.º 11
0
 public static Gender ToGender(this ScriptEnum val)
 {
     if (val == null)
     {
         return(Gender.Male);
     }
     return(ToGender(val.ToString()));
 }
Ejemplo n.º 12
0
 public static TargetRule ToTargetRule(this ScriptEnum val)
 {
     if (val == null)
     {
         return(TargetRule.Self);
     }
     return(val.ToString().ToTargetRule());
 }
Ejemplo n.º 13
0
 public static ItemQuality ToItemQuality(this ScriptEnum val)
 {
     if (val == null)
     {
         return(ToItemQuality(String.Empty));
     }
     return(ToItemQuality(val.ToString()));
 }
Ejemplo n.º 14
0
 public static SlotType ToSlotType(this ScriptEnum val)
 {
     if (val == null)
     {
         return(ToSlotType(String.Empty));
     }
     return(ToSlotType(val.ToString()));
 }
Ejemplo n.º 15
0
 public static Stat ToStat(this ScriptEnum val)
 {
     if (val == null)
     {
         return(ToStat(String.Empty));
     }
     return(ToStat(val.ToString()));
 }
Ejemplo n.º 16
0
 private static void AddEnumValue(ScriptEnum insideEnumDefinition, FastString script, string lastWord)
 {
     if ((lastWord.Length > 0) && (Char.IsLetter(lastWord[0])))
     {
         if (!DoesCurrentLineHaveToken(script, AUTO_COMPLETE_IGNORE))
         {
             insideEnumDefinition.EnumValues.Add(lastWord);
         }
     }
 }
Ejemplo n.º 17
0
        public override object ReadData(GomBinaryReader reader)
        {
            ScriptEnum result = new ScriptEnum();

            byte val = (byte)reader.ReadNumber();

            result.Value    = val;
            result.EnumType = this.DomEnum;

            return(result);
        }
Ejemplo n.º 18
0
 private string TryReadScript(ScriptEnum kind)
 {
     try
     {
         return(ReadScript(kind));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Ejemplo n.º 19
0
 private Dictionary <string, ScriptEnum> m_Enums;                 //如果是枚举的话 所有枚举的值
 public ScriptUserdataEnum(Script script, Type value) : base(script)
 {
     this.m_Value     = value;
     this.m_ValueType = value;
     m_Enums          = new Dictionary <string, ScriptEnum>();
     //此处获取枚举列表不能使用 Enum.GetValues 此函数在UWP平台下的master模式会报错
     string[] names = Enum.GetNames(ValueType);
     foreach (var name in names)
     {
         m_Enums[name] = new ScriptEnum(m_Script, Enum.Parse(ValueType, name));
     }
 }
Ejemplo n.º 20
0
 private Collection <string> ExecuteTextRows(ScriptEnum kind, Object @params = null)
 {
     using (PowerShell PSInst = PowerShell.Create())
     {
         var psText = TryReadScript(kind);
         PSInst.AddScript(psText);
         if (@params != null)
         {
             var props = @params.GetType().GetProperties();
             foreach (var property in props)
             {
                 var val = property.GetValue(@params);
                 PSInst.AddParameter(property.Name, val);
             }
         }
         Collection <string> POut = PSInst.Invoke <string>();
         return(POut);
     }
 }
Ejemplo n.º 21
0
        public static AuctionHouseNetwork ToAuctionHouseNetwork(ScriptEnum val)
        {
            if (val == null)
            {
                return(AuctionHouseNetwork.None);
            }

            switch (val.Value)
            {
            case 0: return(AuctionHouseNetwork.None);

            case 2: return(AuctionHouseNetwork.Empire);

            case 3: return(AuctionHouseNetwork.Republic);

            case 4: return(AuctionHouseNetwork.Neutral);

            default:
                throw new InvalidOperationException("Unknown AuctionHouseNetwork Value: " + val.Value);
            }
        }
Ejemplo n.º 22
0
        public static EnhancementStationType ToEnhancementStationType(ScriptEnum val)
        {
            if (val == null)
            {
                return(EnhancementStationType.None);
            }

            switch (val.ToString())
            {
            case "itmEnhancementStationTypeNone": return(EnhancementStationType.None);

            case "itmEnhancementStationTypeGeneral": return(EnhancementStationType.General);

            case "itmEnhancementStationTypeArmor": return(EnhancementStationType.Armor);

            case "itmEnhancementStationTypeLightsaber": return(EnhancementStationType.Lightsaber);

            case "itmEnhancementStationTypeBlaster": return(EnhancementStationType.Blaster);

            default: throw new InvalidOperationException("Unknown EnhancementStationType: " + val.ToString());
            }
        }
Ejemplo n.º 23
0
 private static void AddEnumValue(ScriptEnum insideEnumDefinition, FastString script, string lastWord)
 {
     if ((lastWord.Length > 0) && (Char.IsLetter(lastWord[0])))
     {
         if (!DoesCurrentLineHaveToken(script, AUTO_COMPLETE_IGNORE))
         {
             insideEnumDefinition.EnumValues.Add(lastWord);
         }
     }
 }