示例#1
0
        public static TestAutomationConfig Load()
        {
            TestAutomationConfig config = null;

            if (!File.Exists(configPath))
            {
                config = new TestAutomationConfig();
                config.Save();
            }
            else
            {
                config = JsonConvert.DeserializeObject <TestAutomationConfig>(File.ReadAllText(configPath));
            }

            return(config);
        }
示例#2
0
        public static TestAutomationConfig Load()
        {
            TestAutomationConfig config = null;

            if (!File.Exists(configPath))
            {
                config = new TestAutomationConfig();
                config.Save();
            }
            else
            {
                config = JsonConvert.DeserializeObject <TestAutomationConfig>(File.ReadAllText(configPath));
            }

            // if no com port set, issue instructions on how to set it
            if (string.IsNullOrEmpty(config.MCPort) || string.IsNullOrEmpty(config.Printer))
            {
                throw new Exception("You must set the port and printer in: " + configPath);
            }

            return(config);
        }
		public static TestAutomationConfig Load()
		{
			TestAutomationConfig config = null;

			if (!File.Exists(configPath))
			{
				config = new TestAutomationConfig();
				config.Save();
			}
			else
			{
				config = JsonConvert.DeserializeObject<TestAutomationConfig>(File.ReadAllText(configPath));
			}

			// if no com port set, issue instructions on how to set it
			if (string.IsNullOrEmpty(config.MCPort) || string.IsNullOrEmpty(config.Printer))
			{
				throw new Exception("You must set the port and printer in: " + configPath);
			}

			return config;
		}