コード例 #1
0
        public void Update(IUsageProvider provider)
        {
/*			if (providerTasks == null)
 *                              return;
 *                      providerUsages [provider] = new List<DocumentLocation> (provider.Usages);
 *                      OnTaskProviderUpdated (EventArgs.Empty);*/
        }
コード例 #2
0
 public void Update(IUsageProvider provider)
 {
     if (providerTasks == null)
     {
         return;
     }
     providerUsages [provider] = new List <Usage> (provider.Usages);
     OnTaskProviderUpdated(EventArgs.Empty);
 }
コード例 #3
0
ファイル: Updater.cs プロジェクト: z93blom/adventofcode
        public async Task Update(int year, int day, IEnumerable <Type> solvers, IUsageProvider usageProvider)
        {
            if (!System.Environment.GetEnvironmentVariables().Contains("SESSION"))
            {
                throw new Exception("Specify SESSION environment variable");
            }

            var cookieContainer = new CookieContainer();

            using (var client = new HttpClient(
                       new HttpClientHandler {
                CookieContainer = cookieContainer,
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
            })
                   ) {
                var baseAddress = new Uri("https://adventofcode.com/");
                client.BaseAddress = baseAddress;
                cookieContainer.Add(baseAddress, new Cookie("session", System.Environment.GetEnvironmentVariable("SESSION")));

                var calendar = await DownloadCalendar(client, year);

                var problem = await DownloadProblem(client, year, day);

                var dir = Dir(year, day);
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                // var years = Assembly.GetEntryAssembly().GetTypes()
                //     .Where(t => t.GetTypeInfo().IsClass && typeof(ISolver).IsAssignableFrom(t))
                //     .Select(tsolver => SolverExtensions.Year(tsolver));
                var years = solvers.Select(tsolver => SolverExtensions.Year(tsolver));

                if (years.Any())
                {
                    UpdateProjectReadme(years.Min(), years.Max(), usageProvider);
                }
                UpdateReadmeForYear(calendar);
                UpdateSplashScreen(calendar);
                UpdateReadmeForDay(problem);
                UpdateInput(problem);
                UpdateRefout(problem);
                UpdateSolutionTemplate(problem);
            }
        }
コード例 #4
0
        public string Generate(int firstYear, int lastYear, IUsageProvider usageProvider)
        {
            return($@"
               > # Advent of Code ({firstYear}-{lastYear})
               > My C# solutions to the advent of code problems. (My solutions are in the ""solutions"" branch. The master branch contains the scaffolding).
               > Check out http://adventofcode.com.

               > ## Dependencies

               > - This library is built for `.Net Standard 2.0`. It should work on Windows, Linux and OS X.
               > - `Newtonsoft.Json` for JSON parsing
               > - `HtmlAgilityPack` is used for problem download.

               > ## Setting the session variable
               > The application depends on an environment variable. To get your identifier, you need to
               > look at the request headers for your daily data, and take the session identifier from
               > the cookie in the Request Headers (for example https://adventofcode.com/2018/day/1/input)

               > Then you can set it:

               > ```
               > Powershell: $Env:SESSION = {'"'}...{'"'}
               > 
               > Command Prompt: set SESSION = ...
               > ```

               > ## Running

               > To run the project:

               > 1. Install .NET Core
               > 2. Clone the repo
               > 3. Get help with `dotnet run`
               > ```
               > {usageProvider.Usage()}
               > ```
               > ".StripMargin("> "));
        }
コード例 #5
0
ファイル: Updater.cs プロジェクト: z93blom/adventofcode
        void UpdateProjectReadme(int firstYear, int lastYear, IUsageProvider usageProvider)
        {
            var file = Path.Combine("README.md");

            WriteFile(file, new ProjectReadmeGenerator().Generate(firstYear, lastYear, usageProvider));
        }
コード例 #6
0
			public void AddUsageProvider (IUsageProvider p)
			{
				p.UsagesUpdated += (sender, e) => strip.Update (p);
			}
コード例 #7
0
		public void AddUsageTaskProvider (IUsageProvider provider)
		{
			usageProvider.Add (provider);
			mainsw.AddUsageProvider (provider); 
			if (secondsw != null)
				secondsw.AddUsageProvider (provider);
		}
コード例 #8
0
			public void AddUsageProvider (IUsageProvider p)
			{
				if (!strip.Visible) {
					strip.VAdjustment = scrolledWindow.Vadjustment;
					scrolledWindow.ReplaceVScrollBar (strip);
				}
				p.UsagesUpdated += (sender, e) => strip.Update (p);
			}
コード例 #9
0
ファイル: QuickTaskStrip.cs プロジェクト: Kalnor/monodevelop
		public void Update (IUsageProvider provider)
		{
			if (providerTasks == null)
				return;
			providerUsages [provider] = new List<Usage> (provider.Usages);
			OnTaskProviderUpdated (EventArgs.Empty);
		}
コード例 #10
0
		public void Update (IUsageProvider provider)
		{
/*			if (providerTasks == null)
				return;
			providerUsages [provider] = new List<DocumentLocation> (provider.Usages);
			OnTaskProviderUpdated (EventArgs.Empty);*/
		}
コード例 #11
0
 public ConsoleWriter(TextWriter writer, IUsageProvider usageProvider)
 {
     this.writer        = writer;
     this.usageProvider = usageProvider;
 }
コード例 #12
0
 public ConsoleWriter(IUsageProvider usageProvider) : this(Console.Out, usageProvider)
 {
 }