Пример #1
0
        private void LoadConfigs()
        {
            IJsonApi jsonApi = this.GetCoreApi().GetJsonApi();

            // Load configs
            this.MainConfig     = jsonApi.ReadOrCreate <ConfigMain>("config.json");
            this.TreasureConfig = jsonApi.ReadOrCreate <ConfigTreasure>("treasure.json", this.MainConfig.MinifyConfigs);
            this.FishConfig     = jsonApi.ReadOrCreate("fish.json", () => {
                // Populate fish data
                ConfigFish config = new ConfigFish();
                config.PopulateData();
                return(config);
            }, this.MainConfig.MinifyConfigs);
            this.FishTraitsConfig = jsonApi.ReadOrCreate("fishTraits.json", () => {
                // Populate fish traits data
                ConfigFishTraits config = new ConfigFishTraits();
                config.PopulateData();
                return(config);
            }, this.MainConfig.MinifyConfigs);

            // Load config values
            FishingRod.maxTackleUses = ModFishing.Instance.MainConfig.DifficultySettings.MaxTackleUses;
        }
Пример #2
0
        private void LoadArguments(string[] args)
        {
            int apiversion = 2;

            if (args.Length < 1 || args.Contains("-help") || args.Contains("/help") || args.Contains("-?") ||
                args.Contains("/?"))
            {
                PrintUsage();
                return;
            }


            for (byte i = 0; i < args.Length; i++)
            {
                try
                {
                    String key;
                    String value = "";
                    if (args[i].Contains(Splitter))
                    {
                        key   = args[i].Split(Splitter)[0];
                        value = args[i].Split(Splitter)[1];
                    }
                    else
                    {
                        key = args[i];
                    }

                    switch (key)
                    {
                    case "-u":
                        _username = value;
                        break;

                    case "-p":
                        _password = value;
                        break;

                    case "-s":
                        _salt = value;
                        break;

                    case "-host":
                        _host = value;
                        break;

                    case "-port":
                        _port = Convert.ToUInt16(value);
                        break;

                    case "-background":
                        ShowConsole = false;
                        break;

                    case "-api=1":
                        apiversion = 1;
                        break;

                    case "-filter":
                        _filter = true;
                        break;

                    default:
                        throw new ArgumentException();
                    }
                }
                catch (Exception)
                {
                    PrintUsage();
                }
            }

            switch (apiversion)
            {
            case 1:
                Api = new JsonApiV1(_username, _password, _salt, _host, _port, _filter);
                break;

            default:
                Api = new JsonApiV2(_username, _password, _host, _port, _filter);
                break;
            }
        }
Пример #3
0
        private void LoadArguments(string[] args)
        {
            int apiversion = 2;

            if (args.Length < 1 || args.Contains("-help") || args.Contains("/help") || args.Contains("-?") ||
                args.Contains("/?"))
            {
                PrintUsage();
                return;
            }


            for (byte i = 0; i < args.Length; i++)
            {
                try
                {
                    String key;
                    String value = "";
                    if (args[i].Contains(Splitter))
                    {
                        key = args[i].Split(Splitter)[0];
                        value = args[i].Split(Splitter)[1];
                    }
                    else
                    {
                        key = args[i];
                    }

                    switch (key)
                    {
                        case "-u":
                            _username = value;
                            break;
                        case "-p":
                            _password = value;
                            break;
                        case "-s":
                            _salt = value;
                            break;
                        case "-host":
                            _host = value;
                            break;
                        case "-port":
                            _port = Convert.ToUInt16(value);
                            break;
                        case "-background":
                            ShowConsole = false;
                            break;
                        case "-api=1":
                            apiversion = 1;
                            break;
                        case "-filter":
                            _filter = true;
                            break;
                        default:
                            throw new ArgumentException();
                    }
                }
                catch (Exception)
                {
                    PrintUsage();
                }
            }

            switch (apiversion)
            {
                case 1:
                    Api = new JsonApiV1(_username, _password, _salt, _host, _port, _filter);
                    break;
                default:
                    Api = new JsonApiV2(_username, _password, _host, _port, _filter);
                    break;
            }
        }