Exemplo n.º 1
0
        private static TestTitleData GetTestTitleData(string[] args)
        {
            TestTitleData testInputs = null;
            string        filename   = null;

            for (var i = 0; i < args.Length; i++)
            {
                if (args[i] == "-testInputsFile" && (i + 1) < args.Length)
                {
                    filename = args[i + 1];
                }
            }
            if (string.IsNullOrEmpty(filename))
            {
                filename = Environment.GetEnvironmentVariable("PF_TEST_TITLE_DATA_JSON");
            }
            if (File.Exists(filename))
            {
                var testInputsFile = File.ReadAllText(filename);
                testInputs = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <TestTitleData>(testInputsFile);
            }
            else
            {
                WriteConsoleColor("Loading testSettings file failed: " + filename, ConsoleColor.Red);
                WriteConsoleColor("From: " + Directory.GetCurrentDirectory(), ConsoleColor.Red);
            }
            return(testInputs);
        }
        private static TestTitleData GetTestTitleData(string[] args)
        {
            TestTitleData testInputs = null;
            string        filename   = null;

            for (var i = 0; i < args.Length; i++)
            {
                if (args[i] == "-testInputsFile" && (i + 1) < args.Length)
                {
                    filename = args[i + 1];
                }
            }
            if (string.IsNullOrEmpty(filename))
            {
                filename = Environment.GetEnvironmentVariable("PF_TEST_TITLE_DATA_JSON");
            }
            if (File.Exists(filename))
            {
                var testInputsFile = File.ReadAllText(filename);
                var serializer     = JsonSerializer.Create(PlayFabUtil.JsonSettings);
                testInputs = serializer.Deserialize <TestTitleData>(new JsonTextReader(new StringReader(testInputsFile)));
            }
            else
            {
                Console.WriteLine("Loading testSettings file failed: " + filename);
                Console.WriteLine("From: " + Directory.GetCurrentDirectory());
            }
            return(testInputs);
        }