示例#1
0
        public void Setup()
        {
            var filePath = @"data\settings.json";

            if (!File.Exists(filePath))
            {
                var pfts = new PlayFabToolsSettings()
                {
                    CloudScriptRevision = 1,
                    CloudScriptVersion  = 1,
                    DeveloperSecretKey  = "[Add your developer secret key from playfab]",
                    DevelopmentMode     = true,
                    ModulesPath         = @"\modules",
                    RootPath            = @"data\files"
                };

                var settings = JsonConvert.SerializeObject(pfts);
                using (StreamWriter sw = File.CreateText(filePath))
                {
                    sw.WriteLine(settings);
                }
                Console.WriteLine("Settings File was created at data/settings.json");
                CommandManager.Prompt();
                return;
            }
            else
            {
                using (StreamReader sr = File.OpenText(filePath))
                {
                    var json     = sr.ReadToEnd();
                    var settings = JsonConvert.DeserializeObject <PlayFabToolsSettings>(json);
                    PlayFabSettings.DeveloperSecretKey        = settings.DeveloperSecretKey;
                    PlayFabSettings.ProductionEnvironmentURL  = settings.URI;
                    PlayFabSettings.DevelopmentEnvironmentURL = settings.URI;
                    PlayFabSettings.UseDevelopmentEnvironment = settings.DevelopmentMode;
                    ToolSettings = settings;
                }
            }
        }
        public void Setup()
        {
            var filePath = @"data\settings.json";
            if (!File.Exists(filePath))
            {
                var pfts = new PlayFabToolsSettings()
                {
                    CloudScriptRevision = 1,
                    CloudScriptVersion = 1,
                    DeveloperSecretKey = "[Add your developer secret key from playfab]",
                    DevelopmentMode = true,
                    ModulesPath = @"\modules",
                    RootPath = @"data\files"
                };

                var settings = JsonConvert.SerializeObject(pfts);
                using (StreamWriter sw = File.CreateText(filePath))
                {
                    sw.WriteLine(settings);
                }
                Console.WriteLine("Settings File was created at data/settings.json");
                CommandManager.Prompt();
                return;
            }
            else
            {
                using (StreamReader sr = File.OpenText(filePath))
                {
                    var json = sr.ReadToEnd();
                    var settings = JsonConvert.DeserializeObject<PlayFabToolsSettings>(json);
                    PlayFabSettings.DeveloperSecretKey = settings.DeveloperSecretKey;
                    PlayFabSettings.ProductionEnvironmentURL = settings.URI;
                    PlayFabSettings.DevelopmentEnvironmentURL = settings.URI;
                    PlayFabSettings.UseDevelopmentEnvironment = settings.DevelopmentMode;
                    ToolSettings = settings;
                }
            }
        }