Exemple #1
0
        internal static bool IsValid(string[] paraResults, out int amountPerDay)
        {
            amountPerDay = 0;
            try
            {
                if (paraResults.Length != 1)
                {
                    //TODO Show Message Box with error of incorrect parameters
                    QuickLogger.Message(string.Format(FCSDeepDrillerBuildable.IncorrectAmountOfParameterFormat(), "1", paraResults.Length), true);
                    return(false);
                }

                if (int.TryParse(paraResults[0], out var result))
                {
                    amountPerDay = Convert.ToInt32(result);
                }
                else
                {
                    QuickLogger.Message(string.Format(FCSDeepDrillerBuildable.IncorrectParameterFormat(), "INT", "OS.OresPerDay(10);"), true);
                    return(false);
                }
            }
            catch (Exception e)
            {
                //TODO Show Message Box with error of incorrect parameters
                QuickLogger.Error(e.Message);
                QuickLogger.Error(e.StackTrace);
                return(false);
            }

            return(true);
        }
        internal static bool IsValid(string[] paraResults, out Tuple <TechType, int> data)
        {
            data = null;
            try
            {
                if (paraResults.Length != 2)
                {
                    //TODO Show Message Box with error of incorrect parameters
                    QuickLogger.Message(string.Format(FCSDeepDrillerBuildable.IncorrectAmountOfParameterFormat(), "2", paraResults.Length), true);
                    return(false);
                }

                int amount;
                if (int.TryParse(paraResults[1], out var result))
                {
                    amount = Convert.ToInt32(result);
                }
                else
                {
                    QuickLogger.Message(string.Format(FCSDeepDrillerBuildable.IncorrectParameterFormat(), "TechType,INT", "OS.MaxOreCount(Silver,10);"), true);
                    return(false);
                }

                TechType techType;
                if (BiomeManager.IsApproved(paraResults[0].ToTechType()))
                {
                    techType = paraResults[0].ToTechType();
                }
                else
                {
                    QuickLogger.Message(string.Format(FCSDeepDrillerBuildable.NotOreErrorFormat(), paraResults[0]), true);
                    return(false);
                }

                data = new Tuple <TechType, int>(techType, amount);
            }
            catch (Exception e)
            {
                //TODO Show Message Box with error of incorrect parameters
                QuickLogger.Error(e.Message);
                QuickLogger.Error(e.StackTrace);
                return(false);
            }

            return(true);
        }