コード例 #1
0
        public HomeController()
        {
            Model      = new HomeModel();
            gameConfig = ConfigManagerFactory.Create(ManagerFile.GameConfig);
            var _1 = gameConfig["GameArea"];

            Model.GameArea = gameConfig["GameArea"];
            Model.Account  = gameConfig["Account"];
            Model.Putong   = gameConfig["PuTong"].ToInt();
            Model.CuiCan   = gameConfig["CuiCan"].ToInt();

            //var _2 = Global.DatasTitle;
            //foreach (var item in _2)
            //{
            //    try
            //    {
            //        string url = "http://ossweb-img.qq.com/images/lol/appskin/{0}.jpg";
            //        string filename = null;
            //        if (item.Key.ToInt() < 1000)
            //        {
            //            filename = item.Key + "000";
            //            url = string.Format(url, filename);
            //        }
            //        else
            //        {
            //            filename = item.Key;
            //            url = string.Format(url, item.Key);
            //        }
            //        filename = filename + ".jpg";
            //        var webRequest = WebRequest.Create(url) as HttpWebRequest;
            //        webRequest.ProtocolVersion = HttpVersion.Version10;
            //        using (var webResponse = webRequest.GetResponse())
            //        {
            //            using (var responseSteam = webResponse.GetResponseStream())
            //            {
            //                using (var fs = new FileStream("F:\\1\\" + filename, FileMode.Create))
            //                {
            //                    responseSteam.CopyTo(fs);
            //                }
            //            }
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        Console.WriteLine(item.Key);
            //    }
            //}
            //Console.WriteLine("下载完成!");
            CreateCardGetterData("shenmi");
            CreateCardGetterData("putong");
            CreateCardGetterData("CuiCan");
        }
コード例 #2
0
        private ConfigProvider()
        {
            _localConfigRoot = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory())
                               .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                               .AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true)
                               .Build();

            var ConfigManager = ConfigManagerFactory <ConfigWrapper> .CreateConfigManager(
                GetGlobalConfiguration,
                Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.json"),
                new List <SchemaEntry>
            {
                SchemaEntry.Create <OrganizationSchema>()
            });

            _configManager = new CachingConfigManagerDecorator <ConfigWrapper>(ConfigManager);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: isabella232/ccme
        private static async Task RunAsync(Options opts, string usageReportContent)
        {
            var azureEnvironmentHelper = new AzureEnvironmentHelper(opts.AzureEnvironmentName);

            ParsedUsageReport usageReport = null;
            string            accessToken = null;

            if (usageReportContent == null)
            {
                var authenticationResult = await TokenProvider.AcquireTokenAsync(
                    azureEnvironmentHelper.AuthenticationEndpoint,
                    opts.TenantId,
                    azureEnvironmentHelper.ResourceManagerEndpoint);

                accessToken = authenticationResult.AccessToken;
            }
            else
            {
                usageReport = UsageFileHelper.Parse(usageReportContent);
            }

            var context = new AssessmentContext(
                usageReport: usageReport,
                subscriptionNames: opts.SubscriptionNames,
                subscriptionIds: opts.SubscriptionIds,
                resourceGroupNames: opts.ResourceGroupNames,
                accessToken: accessToken,
                armBaseUri: azureEnvironmentHelper.ResourceManagerEndpoint,
                resourceCachePath: opts.ResourceCachePath,
                configManager: ConfigManagerFactory.CreateStorageAccountConfigManager(Settings.Default.ConnectionString),
                telemetryManager: new TelemetryManager(
                    new AppInsightsTelemetryProvider(ConfigurationManager.AppSettings["ApplicationInsightsKey"]),
                    new Dictionary <string, string>
            {
                { "DeploymentId", $"console_debug_{Environment.MachineName}" }
            }));

            var assessmentService = new AssessmentService();
            var assessmentReport  = await assessmentService.GenerateReportAsync(context, opts.TargetLocation);

            if (File.Exists(assessmentReport.ReportFilePath))
            {
                Process.Start(assessmentReport.ReportFilePath);
            }
        }
コード例 #4
0
ファイル: AssessmentHelper.cs プロジェクト: isabella232/ccme
 private static IConfigManager GetConfigManager()
 {
     return(ConfigManagerFactory.CreateStorageAccountConfigManager(
                ConfigHelper.ConfigStorageAccountConnectionString));
 }