Exemplo n.º 1
0
 internal Usage(UsagePage page, ushort id, string name, UsageTypes types)
 {
     Page  = page;
     Id    = id;
     Name  = name;
     Types = UsageType.Get(types);
 }
Exemplo n.º 2
0
 private void SaveUsage(UsageTypes usageType, Data.Models.Usage usage)
 {
     usage.UsageEnd  = DateTime.Now;
     usage.IsCurrent = false;
     usageTypesMap.Remove(usageType);
     repository.SaveNewEntity(usage);
 }
Exemplo n.º 3
0
 private UsageType(UsageTypes usageTypes, UsageTypeGroup usageTypeGroup, string name, string description)
 {
     UsageTypes               = usageTypes;
     UsageTypeGroup           = usageTypeGroup;
     Name                     = name;
     Description              = description;
     s_usageTypes[usageTypes] = new[] { this };
 }
Exemplo n.º 4
0
        public void NewUsage(UsageTypes usageType)
        {
            Ensure.Condition <InvalidOperationException>(usageTypesMap.ContainsKey(usageType) == false, "Usage type exists");
            var usage = new Data.Models.Usage(trackingService.UserID, usageType)
            {
                SelfUsageID = trackingService.UsageID
            };

            usageTypesMap.Add(usageType, usage);
        }
Exemplo n.º 5
0
        public void UsageEnded(UsageTypes usageType)
        {
            if (usageTypesMap.ContainsKey(usageType) == false)
            {
                return;
            }

            var usage = usageTypesMap[usageType];

            SaveUsage(usageType, usage);
        }
Exemplo n.º 6
0
 public ModifierInfo(string modifier, string modClass, string modifierType, string translation, bool percent)
 {
     Target              = "";
     ModifierClass       = modClass;
     Modifier            = modifier;
     ModifierType        = modifierType;
     ModifierTranslation = translation;
     Percent             = percent;
     ApplicationType     = ApplicationTypes.ApplyToEntity;
     UsageType           = UsageTypes.Multiply;
     Amount              = 1;
 }
Exemplo n.º 7
0
        public void Parse(string lua)
        {
            string ext = "";

            if (Extension != "")
            {
                ext = @"\[""" + Extension + @"""\]";
            }
            Match m = Regex.Match(lua, ext + @"(\[""area_effect""\]\[""weapon_damage""\])?\[""" + ModifierClass + @"""\]\[""" + Modifier + @"""\](\[""modifier""\])?\[""application_type""\]\s=\sReference\(\[\[type_modifierapplicationtype\\(?<applicationType>.*).lua\]\]\)");

            if (m.Success)
            {
                ApplicationType = GetApplicationType(m.Groups["applicationType"].Value);
            }
            m = Regex.Match(lua, ext + @"(\[""area_effect""\]\[""weapon_damage""\])?\[""" + ModifierClass + @"""\]\[""" + Modifier + @"""\](\[""modifier""\])?\[""usage_type""\]\s=\sReference\(\[\[type_modifierusagetype\\(?<usageType>.*).lua\]\]\)");
            if (m.Success)
            {
                UsageType = GetUsageType(m.Groups["usageType"].Value);
            }
            m = Regex.Match(lua, ext + @"(\[""area_effect""\]\[""weapon_damage""\])?\[""" + ModifierClass + @"""\]\[""" + Modifier + @"""\](\[""modifier""\])?\[""target_type_name""\]\s=\s""(?<target>.*)""");
            if (m.Success)
            {
                Target = m.Groups["target"].Value;
            }
            m = Regex.Match(lua, ext + @"(\[""area_effect""\]\[""weapon_damage""\])?\[""" + ModifierClass + @"""\]\[""" + Modifier + @"""\](\[""modifier""\])?\[""value""\]\s=\s(?<value>.*)");
            if (m.Success)
            {
                Amount = System.Convert.ToDouble(m.Groups["value"].Value, LuaParser.NumberFormat);
            }

            m = Regex.Match(lua, ext + @"(\[""area_effect""\]\[""weapon_damage""\])?\[""" + ModifierClass + @"""\]\[""" + Modifier + @"""\](\[""max_lifetime""\])\s=\s(?<lifeTime>.*)");
            if (m.Success)
            {
                try
                {
                    LifeTime = System.Convert.ToDouble(m.Groups["lifeTime"].Value, LuaParser.NumberFormat);
                }
                catch {}
            }
            m = Regex.Match(lua, ext + @"(\[""area_effect""\]\[""weapon_damage""\])?\[""" + ModifierClass + @"""\]\[""" + Modifier + @"""\]\[""modifier""\]?\[""exclusive""\]\s=\strue");
            if (m.Success)
            {
                DoNotStacks = true;
            }
        }
Exemplo n.º 8
0
        public static string ToExtendedString(this UsageTypes type)
        {
            switch (type)
            {
            case UsageTypes.Login:
                return("USER LOGGED IN");

            case UsageTypes.Idle:
                return("USER IDLE");

            case UsageTypes.Locked:
                return("SYSTEM LOCKED");

            case UsageTypes.Stopped:
                return("LOGGING STOPPED");

            default:
                return(string.Empty);
            }
        }
Exemplo n.º 9
0
 public Usage(int userID, UsageTypes usageType)
     : this(userID)
 {
     UsageType = usageType;
 }