public void SetSettings(IniParserShop iniParserShop)
    {
        try
        {
            Easy.ProductCount = iniParserShop.Get <int>(ShopEasy, productCount);
        }
        catch (IniParserDictionaryDoesNotContainsKey e)
        {
            Debug.Log(e.Message);
            Easy.ProductCount = 0;
        }
        try
        {
            Easy.PrepareTime = iniParserShop.Get <double>(ShopEasy, prepareTime);
        }
        catch (IniParserDictionaryDoesNotContainsKey e)
        {
            Debug.Log(e.Message);
            Easy.PrepareTime = 0;
        }

        try
        {
            Medium.ProductCount = iniParserShop.Get <int>(ShopMedium, productCount);
        }
        catch (IniParserDictionaryDoesNotContainsKey e)
        {
            Debug.Log(e.Message);
            Medium.ProductCount = 0;
        }
        try
        {
            Medium.PrepareTime = iniParserShop.Get <double>(ShopMedium, prepareTime);
        }
        catch (IniParserDictionaryDoesNotContainsKey e)
        {
            Debug.Log(e.Message);
            Medium.PrepareTime = 0;
        }

        try
        {
            Hard.ProductCount = iniParserShop.Get <int>(ShopHard, productCount);
        }
        catch (IniParserDictionaryDoesNotContainsKey e)
        {
            Debug.Log(e.Message);
            Hard.ProductCount = 0;
        }
        try
        {
            Hard.PrepareTime = iniParserShop.Get <double>(ShopHard, prepareTime);
        }
        catch (IniParserDictionaryDoesNotContainsKey e)
        {
            Debug.Log(e.Message);
            Hard.PrepareTime = 0;
        }
    }
Esempio n. 2
0
    public void Reload()
    {
        iniReader = new IniReader();
        iniParser = new IniParser();

        iniParserShop        = new IniParserShop(iniParser.Parse(iniReader.ReadIni()));
        scenarioShopSettings = new ScenarioShopSettings();
        scenarioShopSettings.SetSettings(iniParserShop);

        iniParserPark        = new IniParserPark(iniParser.Parse(iniReader.ReadIni()));
        scenarioParkSettings = new ScenarioParkSettings();
        scenarioParkSettings.SetSettings(iniParserPark);

        iniParserCity        = new IniParserCity(iniParser.Parse(iniReader.ReadIni()));
        scenarioCitySettings = new ScenarioCitySettings();
        scenarioCitySettings.SetSettings(iniParserCity);
    }
 public void ShopParse_DoubleGet_DictionaryDoesNotContainsKeyException()
 {
     iniParserShop = new IniParserShop(iniContentCorrectDict);
     Assert.Throws <IniParserDictionaryDoesNotContainsKey>(() => iniParserShop.Get <double>(ScenarioShopSettings.ShopEasy, ScenarioShopSettings.prepareTime + "A"));
 }
 public void ShopParse_DoubleGetNoException()
 {
     iniParserShop = new IniParserShop(iniContentCorrectDict);
     Assert.DoesNotThrow(() => iniParserShop.Get <double>(ScenarioShopSettings.ShopEasy, ScenarioShopSettings.prepareTime));
 }
 public void ShopParse_IntGet_CorrectReturnValue()
 {
     iniParserShop = new IniParserShop(iniContentCorrectDict);
     Assert.AreEqual(iniParserShop.Get <int>(ScenarioShopSettings.ShopEasy, ScenarioShopSettings.productCount), 5);
 }
 public void ShopParse_IntGet_CantParseToIntException1()
 {
     iniParserShop = new IniParserShop(iniContentIncorrectDict1);
     Assert.Throws <IniParserCantParseToInt>(() => iniParserShop.Get <int>(ScenarioShopSettings.ShopEasy, ScenarioShopSettings.productCount));
 }
 public void ShopParse_IntGet_GenericParameterIsNotCorrectException()
 {
     iniParserShop = new IniParserShop(iniContentCorrectDict);
     Assert.Throws <IniParserGenericParameterIsNotCorrect>(() => iniParserShop.Get <double>(ScenarioShopSettings.ShopEasy, ScenarioShopSettings.productCount));
 }
 public void ShopParse_IntGet_DictionaryDoesNotContainsKeyException()
 {
     iniParserShop = new IniParserShop(iniContentCorrectDict);
     Assert.Throws <IniParserDictionaryDoesNotContainsKey>(() => iniParserShop.Get <int>(ScenarioShopSettings.ShopEasy, ScenarioShopSettings.productCount + "A"));
 }
 public void ShopParse_IntGetNoException()
 {
     iniParserShop = new IniParserShop(iniContentCorrectDict);
     Assert.DoesNotThrow(() => iniParserShop.Get <int>(ScenarioShopSettings.ShopEasy, ScenarioShopSettings.productCount));
 }
Esempio n. 10
0
 public void ShopParse_DoubleGet_CorrectReturnValue()
 {
     iniParserShop = new IniParserShop(iniContentCorrectDict);
     Assert.AreEqual(iniParserShop.Get <double>(ScenarioShopSettings.ShopEasy, ScenarioShopSettings.prepareTime), 5.5);
 }
Esempio n. 11
0
 public void ShopParse_DoubleGet_CantParseToDoubleException1()
 {
     iniParserShop = new IniParserShop(iniContentIncorrectDict1);
     Assert.Throws <IniParserCantParseToDouble>(() => iniParserShop.Get <double>(ScenarioShopSettings.ShopEasy, ScenarioShopSettings.prepareTime));
 }
Esempio n. 12
0
 public void ShopParse_DoubleGet_GenericParameterIsNotCorrectException()
 {
     iniParserShop = new IniParserShop(iniContentCorrectDict);
     Assert.Throws <IniParserGenericParameterIsNotCorrect>(() => iniParserShop.Get <float>(ScenarioShopSettings.ShopEasy, ScenarioShopSettings.prepareTime));
 }