Ejemplo n.º 1
0
        public static void SetCardFormat(string[] args)
        {
            bool success = true;

            ETGSettings.Save();
            if (args == null || args.Length < 1)
            {
                Log("You must enter a value");
                success = false;
            }
            switch (args[0])
            {
            case "lite":
            case "LITE":
            case "Lite":
            {
                var card = new ItemCardFormat(ItemCardFormat.LITE);
                ETGSettings.SetCurrentFormat(card);
                break;
            }

            case "full":
            case "FULL":
            case "Full":
            {
                var card = new ItemCardFormat(ItemCardFormat.FULL);
                ETGSettings.SetCurrentFormat(card);
                break;
            }

            default:
                try
                {
                    string text   = File.ReadAllText("mods/ItemCardFormats/" + args[0] + ".txt");
                    var    format = new ItemCardFormat(text);
                    ETGSettings.SetCurrentFormat(format);
                }
                catch (System.IO.IOException e)
                {
                    Log("Failed to load file \"" + args[0] + ".\"\n Format files should be installed in mods/ItemCardFormats");
                    success = false;
                }
                catch (ItemCardFormat.ItemCardFormatException e)
                {
                    Log("Invalid Format");
                    success = false;
                }
                break;
            }
            if (success)
            {
                Log("Item card format set:");
                Log(ETGSettings.CurrentFormat.format);
            }
        }
Ejemplo n.º 2
0
 public static void SetCurrentFormat(ItemCardFormat format)
 {
     Instance.currentFormat = format;
     Instance.format        = format.format;
     Save();
 }