Beispiel #1
0
 public Search AddTitleProperty(string alias)
 {
     if (!TitleProperties.Contains(alias))
     {
         TitleProperties = TitleProperties.Append(alias).ToArray();
     }
     return(this);
 }
Beispiel #2
0
 public Search RemoveTitleProperty(string alias)
 {
     if (!TitleProperties.Contains(alias))
     {
         TitleProperties = TitleProperties.Where(x => x != alias).ToArray();
     }
     return(this);
 }
Beispiel #3
0
        public void FlagTest()
        {
            var t = new TitleProperties();

            Assert.IsFalse(t.TextWasChanged);
            Assert.IsTrue(t.Text == String.Empty);
            t.Text = String.Empty;
            Assert.IsFalse(t.TextWasChanged);
            t.Text = "test";
            Assert.IsTrue(t.TextWasChanged);
        }
Beispiel #4
0
        /// <summary>
        /// Retrieves the Mod Loader Colour Configuration File.
        /// </summary>
        /// <param name="themeDirectory">The relative directory of the individual theme to Reloaded-Config/Themes. e.g. Default</param>
        public ThemeConfig ParseConfig(string themeDirectory)
        {
            try
            {
                // Check if theme exists, else reset theme.
                if (!Directory.Exists(LoaderPaths.GetModLoaderThemeDirectory() + "/" + themeDirectory))
                {
                    string themeDirectories = Directory.GetDirectories(LoaderPaths.GetModLoaderThemeDirectory())[0];
                    themeDirectory = Path.GetDirectoryName(themeDirectories);
                }

                // Instantiate a new configuration struct.
                ThemeConfig themeProperties = new ThemeConfig();

                // Read the mod loader configuration.
                themeProperties.ThemePropertyLocation = LoaderPaths.GetModLoaderThemeDirectory() + "/" + themeDirectory + "/Theme.ini";
                _iniData = _iniParser.ReadFile(themeProperties.ThemePropertyLocation);

                // Parse the title properties .
                TitleProperties titleProperties = new TitleProperties();
                titleProperties.LoaderTitle          = _iniData["Title"]["LoaderTitle"];
                titleProperties.LoaderTitleDelimiter = _iniData["Title"]["LoaderTitleDelimiter"];
                titleProperties.LoaderTitlePrefix    = bool.Parse(_iniData["Title"]["LoaderTitlePrefix"]);
                titleProperties.DelimiterHasSpaces   = bool.Parse(_iniData["Title"]["DelimiterHasSpaces"]);
                themeProperties.TitleProperties      = titleProperties;

                // Parse font style.
                themeProperties.TitleFontStyle    = ParseFontStyle("Title Font");
                themeProperties.CategoryFontStyle = ParseFontStyle("Category Font");
                themeProperties.TextFontStyle     = ParseFontStyle("Text Font");

                // Parse the border properties.
                themeProperties.BorderProperties = new BorderProperties();
                themeProperties.BorderProperties.BorderColour = ColourLoader.AARRGGBBToColor(_iniData["Border Properties"]["BorderColour"]);
                themeProperties.BorderProperties.BorderWidth  = Convert.ToInt32(_iniData["Border Properties"]["BorderWidth"]);

                // Parse the Main, Title and Category Colours.
                themeProperties.MainColours       = ParseColours("Main Colours");
                themeProperties.TitleColours      = ParseColours("Title Colours");
                themeProperties.CategoryColours   = ParseColours("Category Colours");
                themeProperties.BoxColours        = ParseColours("Box Colours");
                themeProperties.BorderlessColours = ParseColours("Borderless Colours");

                // Parse the Main, Title and Category Enter and Leave Animations
                themeProperties.CategoryEnterAnimation = ParseAnimations("Category Button Mouse Enter Animation");
                themeProperties.CategoryLeaveAnimation = ParseAnimations("Category Button Mouse Leave Animation");

                themeProperties.MainEnterAnimation = ParseAnimations("Main Button Mouse Enter Animation");
                themeProperties.MainLeaveAnimation = ParseAnimations("Main Button Mouse Leave Animation");

                themeProperties.TitleEnterAnimation = ParseAnimations("Title Button Mouse Enter Animation");
                themeProperties.TitleLeaveAnimation = ParseAnimations("Title Button Mouse Leave Animation");

                themeProperties.BoxEnterAnimation = ParseAnimations("Box Mouse Enter Animation");
                themeProperties.BoxLeaveAnimation = ParseAnimations("Box Mouse Leave Animation");

                themeProperties.BorderlessEnterAnimation = ParseAnimations("Borderless Mouse Enter Animation");
                themeProperties.BorderlessLeaveAnimation = ParseAnimations("Borderless Mouse Leave Animation");

                // Return the config file.
                return(themeProperties);
            }
            catch (Exception e)
            {
                MessageBox.Show($"Failed to parse theme: {themeDirectory}, Reloaded will try to instead load its in-library default theme.");
                return(_defaultTheme);
            }
        }