public override void LoadMenu()
 {
     Config = new Menu("EU - " + ModName, "eu." + ModName.Replace(" ", string.Empty).ToLowerInvariant() + new Random().Next(0, 133333337), true);
     Config.AddItem(new MenuItem("eu.Skin Changer.enabled", "Enabled").SetValue(new StringList(new[] { " Disabled " })));
     Config.AddItem(new MenuItem("version" + new Random().Next(0, 133333337), "Version: " + ModVersion));
     Config.AddItem(new MenuItem("site" + new Random().Next(0, 133333337), "Visit joduska.me!"));
     Config.AddToMainMenu();
 }
 public override void LoadMenu()
 {
     Config = new Menu("EU - " + ModName, "eu." + ModName.Replace(" ", string.Empty).ToLowerInvariant() + new Random().Next(0, 133333337), true);
     Config.AddItem(new MenuItem("eu.Anti Flame.enabled", "Enabled [DISABLED FEATURE]"));
     Config.AddItem(new MenuItem("caps", "Filter Caps").SetValue(true));
     Config.AddItem(new MenuItem("version" + new Random().Next(0, 133333337), "Version: " + ModVersion));
     Config.AddItem(new MenuItem("site" + new Random().Next(0, 133333337), "Visit joduska.me!"));
     Config.AddToMainMenu();
 }
Exemple #3
0
        private void RefreshNameAndImageForDisabledState()
        {
            if (string.IsNullOrEmpty(Mod.ImagePath))
            {
                ModImage = "pack://application:,,,/Titanfall-2-Icepick;component/Images/icepick-logo.png";
            }
            else
            {
                ModImage = Mod.ImagePath;
            }

            if (Mod.Enabled)
            {
                ModName = ModName.Replace("(Disabled) ", "");
            }
            else
            {
                WriteableBitmap iconBitmap = new WriteableBitmap((BitmapImage)ModDisplayImage.Source);

                // convert to grayscale
                unsafe
                {
                    iconBitmap.Lock();

                    // https://dzone.com/articles/how-convert-image-gray-scale
                    // todo: make this use 30% red, 59% green, 11% blue, might look nicer idk
                    byte *pBuff = (byte *)iconBitmap.BackBuffer.ToPointer();
                    for (int y = 0; y < iconBitmap.PixelHeight; y++)
                    {
                        byte *row = pBuff + (y * iconBitmap.BackBufferStride);
                        for (int x = 0; x < iconBitmap.PixelWidth; x++)
                        {
                            byte grayscale = (byte)((row[x * 4 + 1] + row[x * 4 + 2] + row[x * 4 + 3]) / 3);
                            row[x * 4]     = grayscale;
                            row[x * 4 + 1] = grayscale;
                            row[x * 4 + 2] = grayscale;
                            row[x * 4 + 3] = grayscale;
                        }
                    }

                    iconBitmap.AddDirtyRect(new Int32Rect(0, 0, iconBitmap.PixelWidth, iconBitmap.PixelHeight));
                    iconBitmap.Unlock();
                }

                ModDisplayImage.Source = iconBitmap;
                ModName = "(Disabled) " + ModName;
            }
        }
        public void CleanupConfig(string thisPath)
        {
            if (String.IsNullOrEmpty(ModName))
            {
                ModName = "Reloaded Application Name";
            }

            if (String.IsNullOrEmpty(ModId))
            {
                ModId = ModName.Replace(" ", ".");
            }

            if (!String.IsNullOrEmpty(thisPath))
            {
                string imagePath = Path.Combine(Path.GetDirectoryName(thisPath), ModImage);
                if (!File.Exists(imagePath))
                {
                    ModImage = "";
                }
            }

            ModDependencies = ConfigCleanupUtility.FilterNonexistingModIds(ModDependencies).ToArray();
        }