Пример #1
0
            static Settings()
            {
                Menu0 = Config.Menu.AddSubMenu("Draw");
                Draw.Initialize();

                Menu1 = Config.Menu.AddSubMenu("Anti-Gapcloser");
                AntiGapcloser.Initialize();

                Menu2 = Config.Menu.AddSubMenu("Interrupter");
                Interrupter.Initialize();

                Menu3 = Config.Menu.AddSubMenu("Items");
                Items.Initialize();

                Menu4 = Config.Menu.AddSubMenu("Auto-Shield");
                AutoShield.Initialize();

                Menu5 = Config.Menu.AddSubMenu("Combo");
                Combo.Initialize();

                Menu6 = Config.Menu.AddSubMenu("Flee");
                Flee.Initialize();

                Menu7 = Config.Menu.AddSubMenu("Harass");
                Harass.Initialize();

                Menu8 = Config.Menu.AddSubMenu("Humanizer");
                Humanizer.Initialize();

                Menu9 = Config.Menu.AddSubMenu("Skin Hack");
                SkinHack.Initialize();
            }
Пример #2
0
 public void Decamelize()
 {
     Assert.That(Humanizer.Decamelize("FooBar"),
                 Is.EqualTo("foo-bar"));
     Assert.That(Humanizer.Decamelize("fooBar"),
                 Is.EqualTo("foo-bar"));
 }
Пример #3
0
        private static void Loading_OnLoadingComplete(EventArgs args)
        {
            MainMenu.Init();

            UtilityManager.Initialize();
            Value.Init();
            var champion = Type.GetType("OKTRAIO.Champions." + Player.Instance.ChampionName);

            if (champion != null)
            {
                Console.WriteLine("[MarksmanAIO] " + Player.Instance.ChampionName + " Loaded");
                IconManager.Init();
                Champion = (AIOChampion)Activator.CreateInstance(champion);
                Events.Init();

                Value.Init();
                Champion.Init();
                //JsonSettings.Init();
                UtilityManager.Activator.LoadSpells();
                if (MainMenu.Menu["playsound"].Cast <CheckBox>().CurrentValue)
                {
                    PlayWelcome();
                }
                Chat.Print("MarksmanAIO: " + Player.Instance.ChampionName + " Loaded", Color.CornflowerBlue);
            }
            else
            {
                Chat.Print("MarksmanAIO doesn't support: " + Player.Instance.ChampionName);
            }

            Humanizer.Init();
        }
Пример #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            #region Validation

            if (Global.UpdateModel == null)
            {
                WhatsNewParagraph.Inlines.Add("Something wrong happened.");
                return;
            }

            #endregion

            try
            {
                //Detect if this is portable or installed. Download the proper file.
                IsChocolatey = AppDomain.CurrentDomain.BaseDirectory.EndsWith(@"Chocolatey\lib\screentogif\content\");
                IsInstaller  = Directory.EnumerateFiles(AppDomain.CurrentDomain.BaseDirectory).Any(x => x.ToLowerInvariant().EndsWith("screentogif.visualelementsmanifest.xml"));

                VersionRun.Text = "Version " + Global.UpdateModel.Version;
                SizeRun.Text    = Humanizer.BytesToString(IsInstaller ? Global.UpdateModel.InstallerSize : Global.UpdateModel.PortableSize);

                TypeRun.Text = IsInstaller ? LocalizationHelper.Get("Update.Installer") : LocalizationHelper.Get("Update.Portable");

                var splited = Global.UpdateModel.Description.Split(new[] { '#' }, StringSplitOptions.RemoveEmptyEntries);

                WhatsNewParagraph.Inlines.Add(splited[0].Replace(" What's new?\r\n\r\n", ""));
                FixesParagraph.Inlines.Add(splited.Length > 1 ? splited[1].Replace(" Bug fixes:\r\n\r\n", "") : "Aparently nothing.");
            }
            catch (Exception ex)
            {
                LogWriter.Log(ex, "Loading download informations");

                WhatsNewParagraph.Inlines.Add("Something wrong happened.");
            }
        }
Пример #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            #region Validation

            if (Element == null)
            {
                WhatsNewParagraph.Inlines.Add("Something wrong happened.");
                return;
            }

            #endregion

            try
            {
                VersionRun.Text = "Version " + Element.XPathSelectElement("tag_name").Value;
                SizeRun.Text    = Humanizer.BytesToString(Convert.ToInt32(Element.XPathSelectElement("assets").FirstNode.XPathSelectElement("size").Value));

                var body = Element.XPathSelectElement("body").Value;

                var splited = body.Split(new[] { '#' }, StringSplitOptions.RemoveEmptyEntries);

                WhatsNewParagraph.Inlines.Add(splited[0].Replace(" What's new?\r\n\r\n", ""));

                FixesParagraph.Inlines.Add(splited[1].Replace(" Bug fixes:\r\n\r\n", ""));
            }
            catch (Exception ex)
            {
                LogWriter.Log(ex, "Loading download informations");

                WhatsNewParagraph.Inlines.Add("Something wrong happened.");
            }
        }
Пример #6
0
        ContentTypeGroupResponseItem GetItem(ContentTypeGroupDescriptor contentTypeGroup)
        {
            var    name = contentTypeGroup.Type.GetCustomAttribute <DisplayAttribute>()?.Name ?? contentTypeGroup.Type.Name;
            string pluralName;

            if (name.Contains(':') && !contentTypeGroup.Id.Contains(':'))
            {
                var nameSplit = name.Split(':');

                name       = nameSplit.First();
                pluralName = nameSplit.Last();
            }
            else
            {
                if (name.Length >= 2 && name.StartsWith('I') && char.IsUpper(name[1]))
                {
                    name = name.Substring(1);
                }

                name       = Humanizer.Humanize(name);
                pluralName = Pluralizer.Pluralize(name);
            }

            var item = new ContentTypeGroupResponseItem
            {
                Id                  = contentTypeGroup.Id,
                Name                = name,
                LowerCaseName       = name.Substring(0, 1).ToLower() + name.Substring(1),
                PluralName          = pluralName,
                LowerCasePluralName = pluralName.Substring(0, 1).ToLower() + pluralName.Substring(1),
                ContentTypes        = ContentTypeGroupMatcher.GetContentTypesFor(contentTypeGroup.Id).Select(t => t.Id).ToList().AsReadOnly(),
            };

            return(item);
        }
Пример #7
0
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is not long length)
        {
            return(DependencyProperty.UnsetValue);
        }

        return(Humanizer.BytesToString(length));
    }
Пример #8
0
 public void Humanize()
 {
     Assert.That(Humanizer.Humanize("foo-bar_baz bazz"),
                 Is.EqualTo("Foo bar baz bazz"));
     Assert.That(Humanizer.Humanize("foo-bar_baz bazz", false),
                 Is.EqualTo("foo bar baz bazz"));
     Assert.That(Humanizer.Humanize("foo_bar_baz bazz", true, true),
                 Is.EqualTo("Foo Bar Baz Bazz"));
 }
Пример #9
0
 public void Camelize()
 {
     Assert.That(Humanizer.Camelize("foo-bar_baz bazz"),
                 Is.EqualTo("FooBarBazBazz"));
     Assert.That(Humanizer.Camelize("foo-bar_baz bazz", false),
                 Is.EqualTo("fooBarBazBazz"));
     Assert.That(Humanizer.Camelize("foo_bar_baz bazz"),
                 Is.EqualTo("FooBarBazBazz"));
 }
        public void GetRelativeTime_DigitsAfterDecimalPoint(String startLdt, String endLdt, int digitsAfterDecimalPoint, String expectedResult)
        {
            var start = LocalDateTimePattern.ExtendedIsoPattern.Parse(startLdt).Value;
            var end   = LocalDateTimePattern.ExtendedIsoPattern.Parse(endLdt).Value;

            var result = new Humanizer(new HumanizerParameters.Builder().DigitsAfterDecimalPoint(digitsAfterDecimalPoint).Build()).GetRelativeTime(start, end);

            Assert.AreEqual(expectedResult, result);
        }
        public void GetRelativeTime(String startLdt, String endLdt, String expectedResult)
        {
            var start = LocalDateTimePattern.ExtendedIsoPattern.Parse(startLdt).Value;
            var end   = LocalDateTimePattern.ExtendedIsoPattern.Parse(endLdt).Value;

            var result = new Humanizer().GetRelativeTime(start, end);

            Assert.AreEqual(expectedResult, result);
        }
        public void GetRelativeTime_MaxiumumNumberOfUnitsToDisplay(String startLdt, String endLdt, int maxiumumNumberOfUnitsToDisplay, String expectedResult)
        {
            var start = LocalDateTimePattern.ExtendedIsoPattern.Parse(startLdt).Value;
            var end   = LocalDateTimePattern.ExtendedIsoPattern.Parse(endLdt).Value;

            var result = new Humanizer(maxiumumNumberOfUnitsToDisplay).GetRelativeTime(start, end);

            Assert.AreEqual(expectedResult, result);
        }
        public void GetRelativeTime_UnitsToDisplay_MaximumUnitsToDisplay_DigitsAfterDecimalPoint(String startLdt, String endLdt, PeriodUnits unitsToDisplay, int maxiumumNumberOfUnitsToDisplay, int digitsAfterDecimalPoint, String expectedResult)
        {
            var start = LocalDateTimePattern.ExtendedIsoPattern.Parse(startLdt).Value;
            var end   = LocalDateTimePattern.ExtendedIsoPattern.Parse(endLdt).Value;

            var result = new Humanizer(unitsToDisplay, maxiumumNumberOfUnitsToDisplay, new HumanizerParameters.Builder().DigitsAfterDecimalPoint(digitsAfterDecimalPoint).Build()).GetRelativeTime(start, end);

            Assert.AreEqual(expectedResult, result);
        }
Пример #14
0
        public IEnumerable <FieldResponse> GetAllForForm(string id)
        {
            var result = new List <FieldResponse>();

            foreach (var field in FieldProvider.GetAllFor(id))
            {
                if (!field.AutoGenerate)
                {
                    continue;
                }

                var control        = ControlMatcher.GetFor(field.Type, field.UIHints);
                var embeddedFormId = FormProvider.GetAll().FirstOrDefault(f => f.Type == field.Type);

                if (control == null && embeddedFormId == null)
                {
                    Logger.LogInformation($"Could not find control for {id} {field.Id}");
                    continue;
                }

                var label = field.Label;

                if (label == null)
                {
                    label = field.Id;
                    label = Humanizer.Humanize(field.Id);

                    if (label.EndsWith(" ids"))
                    {
                        label = label.Substring(0, label.Length - " ids".Length);
                        label = Pluralizer.Pluralize(label);
                    }
                    else if (label.EndsWith(" id"))
                    {
                        label = label.Substring(0, label.Length - " id".Length);
                    }
                }

                var singularLabel = Singularizer.Singularize(label);

                result.Add(new FieldResponse
                {
                    Id             = field.Id,
                    Label          = label,
                    SingularLabel  = singularLabel,
                    CamelCaseId    = CamelCaseNamingStrategy.GetPropertyName(field.Id, false),
                    Control        = control,
                    EmbeddedFormId = embeddedFormId?.Id,
                    IsSortable     = field.IsSortable,
                    Group          = field.Group,
                });
            }

            return(result);
        }
Пример #15
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var lenght = value as long?;

            if (!lenght.HasValue)
            {
                return(DependencyProperty.UnsetValue);
            }

            return(Humanizer.BytesToString(lenght.Value));
        }
        public static void AddToMenu(Menu menu)
        {
            menu.Name = "sfx.ts";
            Menu      = menu;

            Drawings.AddToMainMenu();
            Weights.AddToMainMenu();
            Priorities.AddToMainMenu();
            Selected.Focus.AddToMainMenu();
            Humanizer.AddToMainMenu();
            Modes.AddToMainMenu();
        }
Пример #17
0
        private string BuildBody(string title, string message, string email, bool issue, bool suggestion)
        {
            var sb = new StringBuilder();

            sb.Append("<html xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\">");
            sb.Append("<head><meta content=\"en-us\" http-equiv=\"Content-Language\" />" +
                      "<meta content=\"text/html; charset=utf-16\" http-equiv=\"Content-Type\" />" +
                      "<title>Screen To Gif - Feedback</title>" +
                      "</head>");

            sb.AppendFormat("<style>{0}</style>", Util.Other.GetTextResource("ScreenToGif.Resources.Style.css"));

            sb.Append("<body>");
            sb.AppendFormat("<h1>{0}</h1>", title);
            sb.Append("<div id=\"content\"><div>");
            sb.Append("<h2>Overview</h2>");
            sb.Append("<div id=\"overview\"><table><tr>");
            sb.Append("<th>User</th>");

            if (email.Length > 0)
            {
                sb.Append("<th>Mail</th>");
            }

            sb.Append("<th>Version</th>");
            sb.Append("<th>Windows</th>");
            sb.Append("<th>Instruction Size</th>");
            sb.Append("<th>Working Memory</th>");
            sb.Append("<th>Issue?</th>");
            sb.Append("<th>Suggestion?</th></tr>");
            sb.AppendFormat("<tr><td class=\"textcentered\">{0}</td>", Environment.UserName);

            if (email.Length > 0)
            {
                sb.AppendFormat("<td class=\"textcentered\">{0}</td>", email);
            }

            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Assembly.GetExecutingAssembly().GetName().Version.ToString(4));
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Environment.OSVersion.Version);
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Environment.Is64BitOperatingSystem ? "64 bits" : "32 Bits");
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Humanizer.BytesToString(Environment.WorkingSet));
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", issue ? "Yes" : "No");
            sb.AppendFormat("<td class=\"textcentered\">{0}</td></tr></table></div></div>", suggestion ? "Yes" : "No");

            sb.Append("<h2>Details</h2><div><div><table>");
            sb.Append("<tr id=\"ProjectNameHeaderRow\"><th class=\"messageHeader\">Message</th></tr>");
            sb.Append("<tr name=\"MessageRowClassProjectName\">");
            sb.AppendFormat("<td class=\"messageCell\">{0}</td></tr></table>", message);
            sb.Append("</div></div></div></body></html>");

            return(sb.ToString());
        }
Пример #18
0
        public static void Initialize()
        {
            MainMenu = EloBuddy.SDK.Menu.MainMenu.AddMenu("Item Swapper Buddy", "ItemSwapperBuddy");
            MainMenu.AddGroupLabel("Changelog");
            MainMenu.AddLabel("  6.17.0.1");
            MainMenu.AddLabel("    <font color=\"#716842\">- Added a Menu and a Humanizer.</font>", 23);
            MainMenu.AddLabel("  6.17.0.0");
            MainMenu.AddLabel("    - Added \"Reverse - Swapping\".", 23);
            MainMenu.AddLabel("  6.16.0.0 - \"Back on track!\"");
            MainMenu.AddLabel("    - Fixed in case it didn't work.", 23);
            MainMenu.AddLabel("  1.0.0.0");
            MainMenu.AddLabel("    - First Release.", 23);

            HowToUse.Initialize();
            Humanizer.Initialize();
        }
Пример #19
0
        // -- Static methods ---------------------------------------------------------------------

        public static void PreInitialize( )
        {
            foreach (EName name in System.Enum.GetValues(typeof(EName)))
            {
                var namestring = name.ToString( );
                if ((int)name >= (int)EName.SchemeNames)
                {
                    namestring = Humanizer.Decamelize(namestring);
                }
                var nameindex = (int)name;
                int hashIndex = GetStrigHash(name.ToString( )) & HashTableIndexMask;
                Names.Add(new NameEntry(namestring, NamesHash[hashIndex]));
                NamesHash[hashIndex] = nameindex;
                MemorySizeForNames  += namestring.Length;
            }
            Initialized = true;
        }
        public static IEnumerable <Obj_AI_Hero> GetTargets(float range,
                                                           DamageType damageType = DamageType.True,
                                                           bool ignoreShields    = true,
                                                           Vector3 from          = default(Vector3),
                                                           IEnumerable <Obj_AI_Hero> ignoredChampions = null)
        {
            try
            {
                Weights.Range = Math.Max(range, Weights.Range);

                var selectedTarget = Selected.GetTarget(range, damageType, ignoreShields, from);
                if (selectedTarget != null)
                {
                    return(new List <Obj_AI_Hero> {
                        selectedTarget
                    });
                }

                range = Mode == TargetSelectorModeType.Weights && ForceFocus ? Weights.Range : range;

                var targets =
                    Humanizer.FilterTargets(Targets.Items, from, range)
                    .Where(
                        h => ignoredChampions == null || ignoredChampions.All(i => i.NetworkId != h.Hero.NetworkId))
                    .Where(h => IsValidTarget(h.Hero, range, damageType, ignoreShields, from))
                    .ToList();

                if (targets.Count > 0)
                {
                    var t = GetOrderedChampions(targets).ToList();
                    if (t.Count > 0)
                    {
                        if (Selected.Target != null && Focus && t.Count > 1)
                        {
                            t = t.OrderByDescending(x => x.Hero.NetworkId.Equals(Selected.Target.NetworkId)).ToList();
                        }
                        return(t.Select(h => h.Hero).ToList());
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(new List <Obj_AI_Hero>());
        }
Пример #21
0
        private static void Loading_OnLoadingComplete(EventArgs args)
        {
            var champion = Type.GetType("OKTRAIO.Champions." + Player.Instance.ChampionName);

            if (champion != null)
            {
                Console.Write("[MarksmanAIO] " + Player.Instance.ChampionName + " Loaded");
                Champion = (AIOChampion)Activator.CreateInstance(champion);
                Events.Init();
                MainMenu.Init();
                UtilityMenu.Init();
                Champion.Init();
                JsonSettings.Init();
                Utility.Activator.LoadSpells();
                Utility.Activator.Init();
                Humanizer.Init();
                SkinManagement.Init();
                if (MainMenu._menu["playsound"].Cast <CheckBox>().CurrentValue)
                {
                    PlayWelcome();
                }
                Chat.Print("MarksmanAIO: " + Player.Instance.ChampionName + " Loaded", Color.CornflowerBlue);
            }
            else
            {
                Chat.Print("MarksmanAIO doesn't support: " + Player.Instance.ChampionName);
            }

            if (RandomUlt.IsCompatibleChamp() && champion == null)
            {
                UtilityMenu.Init();
            }
            if (BaseUlt.IsCompatibleChamp())
            {
                UtilityMenu.BaseUltMenu();
                BaseUlt.Initialize();
            }
            if (RandomUlt.IsCompatibleChamp())
            {
                UtilityMenu.RandomUltMenu();
                RandomUlt.Initialize();
            }
            Value.Init();
        }
Пример #22
0
        /// <summary>
        /// Return the table from list of strings similar as result of: 'ls' command in bash
        /// </summary>
        /// <param name="words"></param>
        /// <param name="resultWidth"></param>
        /// <param name="colSpan"></param>
        /// <returns></returns>
        public static string[] BuildTable(string[] words, int colNum, int colWidth, int colSpan)
        {
            UnityEngine.Debug.Assert(colNum > 0);
            UnityEngine.Debug.Assert(colWidth > 0);
            var fullColWidth = colWidth + colSpan;

            // Note: shorter tat 4 characters words will not work with truncating
            // because: truncating add ellipse string to te end '...'
            UnityEngine.Debug.Assert(colWidth > 3);
            var nRows = words.Length / colNum;

            if (nRows * colNum < words.Length)
            {
                nRows++;
            }
            var result   = new string[nRows];
            var rowcount = 0;
            var colcount = 0;
            var sentence = string.Empty;

            foreach (var word in words)
            {
                if (word.Length > colWidth)
                {
                    sentence += Humanizer.Truncate(word, colWidth).PadRight(fullColWidth);
                }
                else
                {
                    sentence += word.PadRight(fullColWidth);
                }

                if (++colcount >= colNum)
                {
                    colcount           = 0;
                    result[rowcount++] = sentence;
                    sentence           = string.Empty;
                }
            }
            if (rowcount < result.Length)
            {
                result[rowcount] = sentence;
            }
            return(result);
        }
        public static void AddToMenu(Menu menu)
        {
            try
            {
                _menu = menu;

                var drawingMenu = _menu.AddSubMenu(new Menu("Drawings", menu.Name + ".drawing"));

                drawingMenu.AddItem(
                    new MenuItem(drawingMenu.Name + ".circle-thickness", "Circle Thickness").SetShared()
                    .SetValue(new Slider(5, 1, 10)));

                Selected.AddToMenu(_menu, drawingMenu);
                Weights.AddToMenu(_menu, drawingMenu);
                Priorities.AddToMenu(_menu);

                _menu.AddItem(new MenuItem(_menu.Name + ".focus", "Focus Selected Target").SetShared().SetValue(true));
                _menu.AddItem(
                    new MenuItem(_menu.Name + ".force-focus", "Only Attack Selected Target").SetShared().SetValue(false));

                Humanizer.AddToMenu(_menu);

                _menu.AddItem(
                    new MenuItem(menu.Name + ".mode", "Mode").SetShared()
                    .SetValue(
                        new StringList(
                            new[]
                {
                    "Weigths", "Priorities", "Less Attacks To Kill", "Most Ability Power",
                    "Most Attack Damage", "Closest", "Near Mouse", "Less Cast Priority", "Least Health"
                }))).ValueChanged +=
                    delegate(object sender, OnValueChangeEventArgs args)
                {
                    Mode = GetModeBySelectedIndex(args.GetNewValue <StringList>().SelectedIndex);
                };

                Mode = GetModeBySelectedIndex(_menu.Item(menu.Name + ".mode").GetValue <StringList>().SelectedIndex);
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
        public static IEnumerable <Obj_AI_Hero> GetTargets(float range,
                                                           DamageType damageType = DamageType.True,
                                                           bool ignoreShields    = true,
                                                           Vector3 from          = default(Vector3),
                                                           IEnumerable <Obj_AI_Hero> ignoreChampions = null)
        {
            Weights.Range = Math.Max(range, Weights.Range);

            var selectedTarget = Selected.GetTarget(range, damageType, ignoreShields, from);

            if (selectedTarget != null)
            {
                return(new List <Obj_AI_Hero> {
                    selectedTarget
                });
            }

            range = Modes.Current.Mode == Mode.Weights && Selected.Focus.Enabled && Selected.Focus.Force
                ? Weights.Range
                : range;

            var targets =
                Humanizer.FilterTargets(Targets.Items)
                .Where(h => ignoreChampions == null || ignoreChampions.All(i => i.NetworkId != h.Hero.NetworkId))
                .Where(h => Utils.IsValidTarget(h.Hero, range, damageType, ignoreShields, from))
                .ToList();

            if (targets.Count > 0)
            {
                var t = Modes.GetOrderedChampions(targets).ToList();
                if (t.Count > 0)
                {
                    if (Selected.Target != null && Selected.Focus.Enabled && t.Count > 1)
                    {
                        t = t.OrderByDescending(x => x.Hero.NetworkId.Equals(Selected.Target.NetworkId)).ToList();
                    }
                    return(t.Select(h => h.Hero).ToList());
                }
            }
            return(new List <Obj_AI_Hero>());
        }
Пример #25
0
        ContentTypeResponseItem GetItem(ContentTypeDescriptor contentType)
        {
            var    name = contentType.Type.GetCustomAttribute <DisplayAttribute>()?.Name ?? contentType.Type.Name;
            string pluralName;

            if (name.Contains(':') && !contentType.Id.Contains(':'))
            {
                var nameSplit = name.Split(':');

                name       = nameSplit.First();
                pluralName = nameSplit.Last();
            }
            else
            {
                name       = Humanizer.Humanize(name);
                pluralName = Pluralizer.Pluralize(name);
            }

            var singleton = SingletonProvider.Get(contentType.Id);

            var item = new ContentTypeResponseItem
            {
                Id                       = contentType.Id,
                Name                     = name,
                LowerCaseName            = name.Substring(0, 1).ToLower() + name.Substring(1),
                PluralName               = pluralName,
                LowerCasePluralName      = pluralName.Substring(0, 1).ToLower() + pluralName.Substring(1),
                IsNameable               = typeof(INameable).IsAssignableFrom(contentType.Type),
                NameablePropertyName     = typeof(INameable).IsAssignableFrom(contentType.Type) ? CamelCaseNamingStrategy.GetPropertyName(NameExpressionParser.Parse(contentType.Type), false) : null,
                IsImageable              = typeof(IImageable).IsAssignableFrom(contentType.Type),
                ImageablePropertyName    = typeof(IImageable).IsAssignableFrom(contentType.Type) ? CamelCaseNamingStrategy.GetPropertyName(ImageExpressionParser.Parse(contentType.Type), false) : null,
                IsRoutable               = typeof(IRoutable).IsAssignableFrom(contentType.Type),
                IsSingleton              = singleton != null,
                Count                    = -1,
                ContentTypeActionModules = ContentTypeActionModuleProvider.GetContentTypeActionModulesFor(contentType.Id),
                ListActionModules        = ListActionModuleProvider.GetListActionModulesFor(contentType.Id),
                ContentTypeGroups        = ContentTypeGroupMatcher.GetContentTypeGroupsFor(contentType.Id).Select(t => t.Id).ToList().AsReadOnly(),
            };

            return(item);
        }
Пример #26
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            #region Validation

            if (Element == null)
            {
                WhatsNewParagraph.Inlines.Add("Something wrong happened.");
                return;
            }

            #endregion

            try
            {
                //Detect if this is portable or installed. Download the proper file.
                IsChocolatey = AppDomain.CurrentDomain.BaseDirectory.EndsWith(@"Chocolatey\lib\screentogif\content\");
                IsInstaller  = Directory.EnumerateFiles(AppDomain.CurrentDomain.BaseDirectory).Any(x => x.EndsWith("ScreenToGif.visualelementsmanifest.xml"));

                VersionRun.Text = "Version " + Element.XPathSelectElement("tag_name").Value;
                SizeRun.Text    = Humanizer.BytesToString(Convert.ToInt32((IsInstaller ? Element.XPathSelectElement("assets").LastNode :
                                                                           Element.XPathSelectElement("assets").FirstNode).XPathSelectElement("size").Value));

                TypeRun.Text = IsInstaller ? this.TextResource("Update.Installer") : this.TextResource("Update.Portable");

                var body = Element.XPathSelectElement("body").Value;

                var splited = body.Split(new[] { '#' }, StringSplitOptions.RemoveEmptyEntries);

                WhatsNewParagraph.Inlines.Add(splited[0].Replace(" What's new?\r\n\r\n", ""));
                FixesParagraph.Inlines.Add(splited.Length > 1 ? splited[1].Replace(" Bug fixes:\r\n\r\n", "") : "Aparently, nothing.");
            }
            catch (Exception ex)
            {
                LogWriter.Log(ex, "Loading download informations");

                WhatsNewParagraph.Inlines.Add("Something wrong happened.");
            }
        }
Пример #27
0
            static Settings()
            {
                Menu0 = Menu.AddSubMenu("Draw");
                Draw.Initialize();

                Menu1 = Menu.AddSubMenu("Anti-Gapcloser");
                AntiGapcloser.Initialize();

                Menu2 = Menu.AddSubMenu("Interrupter");
                Interrupter.Initialize();

                Menu3 = Menu.AddSubMenu("Items");
                Items.Initialize();

                Menu4 = Menu.AddSubMenu("Auto-Shield");
                AutoShield.Initialize();

                Menu5 = Menu.AddSubMenu("Combo");
                Combo.Initialize();

                Menu6 = Menu.AddSubMenu("Flee");
                Flee.Initialize();

                Menu7 = Menu.AddSubMenu("Harass");
                Harass.Initialize();

                Menu10 = Menu.AddSubMenu("Lane Clear");
                LaneClear.Initialize();

                Menu11 = Menu.AddSubMenu("Jungle Clear");
                JungleClear.Initialize();

                Menu8 = Menu.AddSubMenu("Humanizer");
                Humanizer.Initialize();

                Menu9 = Menu.AddSubMenu("Skin Hack");
                SkinHack.Initialize();
            }
Пример #28
0
        public static void OnLoad()
        {
            if (Player.ChampionName != "Kalista")
            {
                return;
            }

            Console.WriteLine(@"S+ Class Kalista Loading Core...");
            Core.Champion.Load();
            Console.WriteLine(@"S+ Class Kalista Loading Humanizer...");
            Humanizer.Load();
            Console.WriteLine(@"S+ Class Kalista Loading Drawing...");
            DrawingHandler.Load();
            Console.WriteLine(@"S+ Class Kalista Loading Orbwalker...");
            OrbwalkHandler.Load();
            Console.WriteLine(@"S+ Class Kalista Loading Auto Events...");
            RendHandler.Load();
            SentinelHandler.Load();
            Console.WriteLine(@"S+ Class Kalista Loading ManaManager...");
            // ManaHandler.Load();
            Console.WriteLine(@"S+ Class Kalista Loading Trinkets...");
            TrinketHandler.Load();
            Console.WriteLine(@"S+ Class Kalista Loading Items...");
            ItemHandler.Load();
            Console.WriteLine(@"S+ Class Kalista Loading Levels...");
            LevelHandler.Load();
            Console.WriteLine(@"S+ Class Kalista Loading SoulBound...");
            SoulBoundHandler.Load();
            Console.WriteLine(@"S+ Class Kalista Loading Debugger...");
            DebugHandler.Load();
            Console.WriteLine(@"S+ Class Kalista Finalizing Menu...");
            SMenu.AddSubMenu(new Menu("Credits: By Kallen", "doesnotMatterMenu"));
            Core.SMenu.AddToMainMenu();

            Console.WriteLine(@"S+ Class Kalista Load Completed");
        }
Пример #29
0
        private string BuildBody(string title, string message, string email, bool issue, bool suggestion)
        {
            var sb = new StringBuilder();

            sb.Append("<html xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\">");
            sb.Append("<head><meta content=\"en-us\" http-equiv=\"Content-Language\" />" +
                      "<meta content=\"text/html; charset=utf-16\" http-equiv=\"Content-Type\" />" +
                      "<title>ScreenToGif - Feedback</title>" +
                      "</head>");

            sb.AppendFormat("<style>{0}</style>", Util.Other.GetTextResource("ScreenToGif.Resources.Style.css"));

            sb.Append("<body>");
            sb.AppendFormat("<h1>{0}</h1>", (title ?? "").Length > 0 ? title : "Title of the feedback");
            sb.Append("<div id=\"content\"><div>");
            sb.Append("<h2>Overview</h2>");
            sb.Append("<div id=\"overview\"><table>");

            //First overview row.
            sb.Append("<tr><th>User</th>");
            sb.Append("<th>Machine</th>");
            sb.Append("<th>Startup</th>");
            sb.Append("<th>Date</th>");
            sb.Append("<th>Running</th>");
            sb.Append("<th>Version</th></tr>");

            var culture = new CultureInfo("pt-BR");

            sb.AppendFormat("<tr><td class=\"textcentered\">{0}</td>", Environment.UserName);
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Environment.MachineName);
            sb.AppendFormat(culture, "<td class=\"textcentered\">{0:g}</td>", Global.StartupDateTime);
            sb.AppendFormat(culture, "<td class=\"textcentered\">{0:g}</td>", DateTime.Now);
            sb.AppendFormat(culture, "<td class=\"textcentered\">{0:d':'hh':'mm':'ss}</td>", Global.StartupDateTime != DateTime.MinValue ? DateTime.Now - Global.StartupDateTime : TimeSpan.Zero);
            sb.AppendFormat("<td class=\"textcentered\">{0}</td></tr>", Assembly.GetExecutingAssembly().GetName().Version.ToString(4));

            //Second overview row.
            sb.Append("<tr><th colspan=\"2\">Windows</th>");
            sb.Append("<th>Architecture</th>");
            sb.Append("<th>Used</th>");
            sb.Append("<th>Available</th>");
            sb.Append("<th>Total</th></tr>");

            var status = new Util.Native.MemoryStatusEx(true);

            Util.Native.GlobalMemoryStatusEx(ref status);

            sb.AppendFormat("<td class=\"textcentered\" colspan=\"2\">{0}</td>", Environment.OSVersion.Version);
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Environment.Is64BitOperatingSystem ? "64 bits" : "32 Bits");
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Humanizer.BytesToString(Environment.WorkingSet));
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Humanizer.BytesToString(status.AvailablePhysicalMemory));
            sb.AppendFormat("<td class=\"textcentered\">{0}</td></tr>", Humanizer.BytesToString(status.TotalPhysicalMemory));

            //Third overview row.
            sb.Append("<tr><th colspan=\"3\">E-mail</th>");
            sb.Append("<th>.Net version</th>");
            sb.Append("<th>Issue?</th>");
            sb.Append("<th>Suggestion?</th></tr>");

            sb.AppendFormat("<td colspan=\"3\" class=\"textcentered\">{0}</td>", (email ?? "").Length > 0 ? email : "*****@*****.**");
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", FrameworkHelper.QueryFrameworkVersion());
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", issue ? "Yes" : "No");
            sb.AppendFormat("<td class=\"textcentered\">{0}</td></tr></table></div></div>", suggestion ? "Yes" : "No");

            //Processors.
            sb.Append("<br><h2>Processors</h2><table>");
            sb.Append(GetProcessor());
            sb.Append(GetGraphicsAdapter());
            sb.Append("</table>");

            //System.Windows.Forms.SystemInformation.PowerStatus.BatteryChargeStatus == System.Windows.Forms.BatteryChargeStatus.NoSystemBattery

            //Monitors.
            sb.Append("<br><h2>Monitors</h2><table>");
            sb.Append("<tr><th>Name</th>");
            sb.Append("<th>Bounds</th>");
            sb.Append("<th>Working area</th>");
            sb.Append("<th>DPI/Scale</th>");
            sb.Append("<th>Graphics adapter</th>");
            sb.Append("<th>Primary?</th></tr>");

            foreach (var monitor in Monitor.AllMonitors)
            {
                sb.AppendFormat("<td class=\"textcentered\">{0} ({1})</td>", monitor.FriendlyName, monitor.Name);
                sb.AppendFormat("<td class=\"textcentered\">{0}:{1} • {2}x{3}</td>", monitor.Bounds.Left, monitor.Bounds.Top, monitor.Bounds.Width, monitor.Bounds.Height);
                sb.AppendFormat("<td class=\"textcentered\">{0}:{1} • {2}x{3}</td>", monitor.WorkingArea.Left, monitor.WorkingArea.Top, monitor.WorkingArea.Width, monitor.WorkingArea.Height);
                sb.AppendFormat("<td class=\"textcentered\">{0}dpi / {1:#00}%</td>", monitor.Dpi, monitor.Dpi / 96d * 100d);
                sb.AppendFormat("<td class=\"textcentered\">{0}</td>", monitor.AdapterName);
                sb.AppendFormat("<td class=\"textcentered\">{0}</td></tr>", monitor.IsPrimary ? "Yes" : "No");
            }

            sb.Append("</table>");

            if (Monitor.AllMonitors.Count > 0)
            {
                sb.AppendFormat("");

                //sb.Append("<svg>" +
                //          "<circle cx=\"40\" cy=\"40\" r=\"24\" style=\"stroke:#006600; fill:#00cc00\"/>" +
                //          "<rect id=\"box\" x=\"0\" y=\"0\" width=\"50\" height=\"50\" style=\"stroke:#006600; fill:#00cc00\"/>" +
                //          "</svg>");
            }

            //Drives.
            sb.Append("<br><h2>Drives</h2><table>");
            sb.Append("<tr><th>Root</th>");
            sb.Append("<th>Used</th>");
            sb.Append("<th>Free</th>");
            sb.Append("<th>Total</th>");
            sb.Append("<th>Format</th>");
            sb.Append("<th>Type</th>");
            sb.Append("<th>Ready?</th></tr>");

            foreach (var drive in DriveInfo.GetDrives())
            {
                #region Try get the size

                var total     = 0L;
                var available = 0L;
                var format    = "";

                try
                {
                    total     = drive.TotalSize;
                    available = drive.AvailableFreeSpace;
                    format    = drive.DriveFormat;
                }
                catch (Exception e)
                {
                    //LogWriter.Log(e, "Not possible to get driver details");
                }

                #endregion

                var used     = total - available;
                var usedPerc = Math.Round(Util.Other.CrossMultiplication(total, used, null), 1);
                var avaiPerc = Math.Round(Util.Other.CrossMultiplication(total, available, null), 1);

                sb.AppendFormat("<td class=\"textcentered\">{0}</td>", drive.Name);
                sb.AppendFormat("<td class=\"textRight\">({0} %) {1}</td>", usedPerc, Humanizer.BytesToString(used, "N1"));
                sb.AppendFormat("<td class=\"textRight\">({0} %) {1}</td>", avaiPerc, Humanizer.BytesToString(available, "N1"));
                sb.AppendFormat("<td class=\"textRight\">{0}</td>", Humanizer.BytesToString(total, "N1"));
                sb.AppendFormat("<td class=\"textcentered\">{0}</td>", format);
                sb.AppendFormat("<td class=\"textcentered\">{0}</td>", drive.DriveType);
                sb.AppendFormat("<td class=\"textcentered\">{0}</td></tr>", drive.IsReady ? "Yes" : "No");
            }

            sb.Append("<table>");

            //Details.
            sb.Append("<br><h2>Details</h2><div><div><table>");
            sb.Append("<tr id=\"ProjectNameHeaderRow\"><th class=\"messageHeader\">Message</th></tr>");
            sb.Append("<tr name=\"MessageRowClassProjectName\">");
            sb.AppendFormat("<td class=\"messageCell\">{0}</td></tr></table>", message.Replace(Environment.NewLine, "<br>"));
            sb.Append("</div></div></div></body></html>");

            return(sb.ToString());
        }
Пример #30
0
    private async void Window_Loaded(object sender, RoutedEventArgs e)
    {
        #region Validation

        if (Global.UpdateAvailable == null)
        {
            WhatsNewParagraph.Inlines.Add("Something wrong happened. No update was found.");
            return;
        }

        if (Global.UpdateAvailable.MustDownloadManually)
        {
            StatusBand.Warning(LocalizationHelper.Get("S.Updater.NoNewRelease.Info"));
        }

        #endregion

        try
        {
            //Detect if this is portable or installed. Download the proper file.
            IsChocolatey = AppDomain.CurrentDomain.BaseDirectory.EndsWith(@"Chocolatey\lib\screentogif\content\");
            IsInstaller  = Directory.EnumerateFiles(AppDomain.CurrentDomain.BaseDirectory).Any(x => x.ToLowerInvariant().EndsWith("screentogif.visualelementsmanifest.xml"));

            VersionRun.Text = $"{LocalizationHelper.Get("S.Updater.Version")} {Global.UpdateAvailable.Version}";
            SizeRun.Text    = !UserSettings.All.PortableUpdate ? (Global.UpdateAvailable.InstallerSize > 0 ? Humanizer.BytesToString(Global.UpdateAvailable.InstallerSize) : "") :
                              (Global.UpdateAvailable.PortableSize > 0 ? Humanizer.BytesToString(Global.UpdateAvailable.PortableSize) : "");
            TypeRun.Text = IsInstaller ? LocalizationHelper.Get("S.Updater.Installer") : LocalizationHelper.Get("S.Updater.Portable");

            //Details.
            if (Global.UpdateAvailable.IsFromGithub)
            {
                //From Github, the description is available.
                var splited = Global.UpdateAvailable.Description.Split(new[] { '#' }, StringSplitOptions.RemoveEmptyEntries);

                WhatsNewParagraph.Inlines.Add(splited[0].Replace(" What's new?\r\n\r\n", ""));
                FixesParagraph.Inlines.Add(splited.Length > 1 ? splited[1].Replace(" Bug fixes:\r\n\r\n", "").Replace(" Fixed:\r\n\r\n", "") : "Aparently nothing.");
            }
            else
            {
                //If the release detail was obtained by querying Fosshub, no release note is available.
                MainFlowDocument.Blocks.Remove(WhatsNewParagraphTitle);
                MainFlowDocument.Blocks.Remove(FixesParagraphTitle);
                MainFlowDocument.Blocks.Remove(FixesParagraph);

                var run = new Run();
                run.SetResourceReference(Run.TextProperty, "S.Updater.Info.NewVersionAvailable");
                WhatsNewParagraph.Inlines.Add(run);
            }

            DocumentViewer.UpdateLayout();

            //If set to force the download the portable version of the app, check if it was downloaded.
            if (UserSettings.All.PortableUpdate)
            {
                //If the update was already downloaded.
                if (File.Exists(Global.UpdateAvailable.PortablePath))
                {
                    //If it's still downloading, wait for it to finish before displaying "Open".
                    if (Global.UpdateAvailable.IsDownloading)
                    {
                        Global.UpdateAvailable.TaskCompletionSource = new TaskCompletionSource <bool>();
                        await Global.UpdateAvailable.TaskCompletionSource.Task;

                        if (!IsLoaded)
                        {
                            return;
                        }
                    }

                    DownloadButton.SetResourceReference(ExtendedButton.TextProperty, "S.Updater.InstallManually");
                }

                return;
            }

            //If set to download automatically, check if the installer was downloaded.
            if (UserSettings.All.InstallUpdates)
            {
                //If the update was already downloaded.
                if (File.Exists(Global.UpdateAvailable.InstallerPath))
                {
                    //If it's still downloading, wait for it to finish before displaying "Install".
                    if (Global.UpdateAvailable.IsDownloading)
                    {
                        Global.UpdateAvailable.TaskCompletionSource = new TaskCompletionSource <bool>();
                        await Global.UpdateAvailable.TaskCompletionSource.Task;

                        if (!IsLoaded)
                        {
                            return;
                        }
                    }

                    DownloadButton.SetResourceReference(ExtendedButton.TextProperty, "S.Updater.Install");

                    //When the update was prompted manually, the user can set the installer to run the app afterwards.
                    if (WasPromptedManually)
                    {
                        RunAfterwardsCheckBox.Visibility = Visibility.Visible;
                        RunAfterwardsCheckBox.IsChecked  = true;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            LogWriter.Log(ex, "Impossible to load the download details");
            StatusBand.Error(LocalizationHelper.Get("S.Updater.Warning.Show"));
        }
        finally
        {
            Height        = ActualHeight;
            SizeToContent = SizeToContent.Width;
            Width         = ActualWidth;
            SizeToContent = SizeToContent.Manual;

            MaxHeight = double.PositiveInfinity;
            MaxWidth  = double.PositiveInfinity;

            CenterOnScreen();
        }
    }