static void Main(string[] args) { var testCase = new List <string> { "L.LL.LL.LL", "LLLLLLL.LL", "L.L.L..L..", "LLLL.LL.LL", "L.LL.LL.LL", "L.LLLLL.LL", "..L.L.....", "LLLLLLLLLL", "L.LLLLLL.L", "L.LLLLL.LL" }; Seat[,] testGrid = GridifyInput(testCase); var roundExecutorTest = new RoundExecutor(testGrid); Console.WriteLine(roundExecutorTest.GetEquilibriumOccupiedSeatCount()); SeatGrid = GridifyInput(Retriever.Retrieve(@"..//..//..//Day11PuzzleInput.txt")); Console.WriteLine(); Console.WriteLine("Part 1 Solution: "); var roundExecutor = new RoundExecutor(SeatGrid); Console.WriteLine(roundExecutor.GetEquilibriumOccupiedSeatCount()); }
static void Main(string[] args) { var testInput = new List <string> { "mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X", "mem[8] = 11", "mem[7] = 101", "mem[8] = 0" }; List <ICommand> testProgram = ConvertToInitProgram(testInput); var testInitialiser = new Initialiser(testProgram); testInitialiser.Part1Initialise(); Console.WriteLine(testInitialiser.GetMemorySum()); List <string> puzzleInput = Retriever.Retrieve(@"..//..//..//Day14PuzzleInput.txt"); List <ICommand> initProgram = ConvertToInitProgram(puzzleInput); var initialiser = new Initialiser(initProgram); initialiser.Part1Initialise(); Console.WriteLine(initialiser.GetMemorySum()); }
/// <summary> /// Loads the entity of the specified type with the provided ID and assigns it to the DataSource property. /// </summary> /// <param name="id">The ID of the entity to load.</param> /// <returns>The loaded and activated entity.</returns> public IEntity Load(Guid id) { using (LogGroup logGroup = LogGroup.StartDebug("Loading entity with the ID: " + id.ToString())) { Load(Retriever.Retrieve("ID", id)); } return(DataSource); }
/// <summary> /// Loads the entity of the specified type with the provided ID and assigns it to the DataSource property. /// </summary> /// <param name="uniqueKey">The unique key of the entity to load.</param> /// <returns>The loaded and activated entity.</returns> public IEntity Load(string uniqueKey) { using (LogGroup logGroup = LogGroup.StartDebug("Loading entity with the unique key: " + uniqueKey)) { Load(Retriever.Retrieve("UniqueKey", uniqueKey)); } return(DataSource); }
static void Main(string[] args) { List <string> puzzleInput = Retriever.Retrieve(@"..//..//..//Day12PuzzleInput.txt"); List <IInstruction> instructions = ConvertToInstructions(puzzleInput); Navigation navigation = new Navigation(instructions); Console.WriteLine(navigation.GetPart1ManhattanDistance()); Console.WriteLine(navigation.GetPart2ManhattanDistance()); }
public override void Install() { Console.WriteLine(""); Console.WriteLine("Installing csAnt..."); Console.WriteLine(""); Console.WriteLine("Destination:"); Console.WriteLine(" " + DestinationPath); Console.WriteLine(""); Console.WriteLine("Clear: " + Clear.ToString()); Console.WriteLine("Overwrite: " + Overwrite.ToString()); Console.WriteLine(""); Console.WriteLine("Clone: " + Clone.ToString()); Console.WriteLine("Clone source:"); Console.WriteLine(" " + CloneSource); Console.WriteLine(""); Console.WriteLine("Import: " + Import.ToString()); Console.WriteLine("Import path: "); Console.WriteLine(" " + ImportPath); if (Clear) { ClearFiles(); } Retriever.Retrieve(PackageName, Version, Status); Unpacker.Unpack( DestinationPath, // TODO: Make this configurable PackageName, Version, Overwrite ); if (Import) { ImportFiles(); } if (Clone) { CloneFiles(); } EnsureNode(); RaiseInstallEvent(); }
static void Main(string[] args) { List <string> puzzleInput = Retriever.Retrieve(@"..//..//..//Day13PuzzleInput.txt"); // Part 1 int earliestTimestamp = int.Parse(puzzleInput[0]); List <int> busIds = GetPart1BusIds(puzzleInput[1]); var busTimetable = new BusTimetable(earliestTimestamp, busIds); Console.WriteLine(busTimetable.GetPart1Result()); // Part 2 List <Bus> testBuses1 = GetPart2Buses("17,x,13,19"); var test1 = new BusContest(testBuses1); Console.WriteLine(test1.GetPart2ResultEfficient()); List <Bus> testBuses2 = GetPart2Buses("67,7,59,61"); var test2 = new BusContest(testBuses2); Console.WriteLine(test2.GetPart2ResultEfficient()); List <Bus> testBuses3 = GetPart2Buses("67,x,7,59,61"); var test3 = new BusContest(testBuses3); Console.WriteLine(test3.GetPart2ResultEfficient()); List <Bus> testBuses4 = GetPart2Buses("67,7,x,59,61"); var test4 = new BusContest(testBuses4); Console.WriteLine(test4.GetPart2ResultEfficient()); List <Bus> testBuses5 = GetPart2Buses("1789,37,47,1889"); var test5 = new BusContest(testBuses5); Console.WriteLine(test5.GetPart2ResultEfficient()); List <Bus> buses = GetPart2Buses(puzzleInput[1]); var busContest = new BusContest(buses); Console.WriteLine(busContest.GetPart2ResultEfficient()); }
/// <summary> /// Loads the specified entity and prepares it for viewing. /// </summary> /// <param name="uniqueKey">The unique key of the entity to load and prepare.</param> /// <returns>The entity with the specified unique key.</returns> public virtual IEntity LoadEntity(string uniqueKey) { IEntity entity = null; using (LogGroup logGroup = LogGroup.Start("Loading entity from unique key.", NLog.LogLevel.Debug)) { LogWriter.Debug("Unique key: " + uniqueKey); DataSource = entity = Retriever.Retrieve(uniqueKey); if (entity == null) { throw new ArgumentException("Entity of type '" + Command.TypeName + "' not found with unique key '" + uniqueKey + "'. Check that the entity and the factory retrieve method are properly configured."); } LoadEntity(entity); } return(entity); }
/// <summary> /// Loads the specified entity and prepares it for viewing. /// </summary> /// <param name="id">The ID of the entity to load and prepare.</param> /// <returns>The entity with the specified ID.</returns> public virtual IEntity LoadEntity(Guid id) { IEntity entity = null; using (LogGroup logGroup = LogGroup.Start("Loading entity from unique key.", NLog.LogLevel.Debug)) { LogWriter.Debug("ID: " + id.ToString()); entity = Retriever.Retrieve(id); if (entity == null) { throw new ArgumentException("Entity of type '" + Command.TypeName + "' not found with ID '" + id.ToString() + "'. Check that the entity and the factory retrieve method are properly configured."); } LogWriter.Debug("Entity: " + entity.ToString()); LoadEntity(entity); } return(entity); }
/// <summary> /// Loads the entity specified by the query string. /// </summary> /// <returns></returns> public virtual T Load <T>() where T : IEntity { T entity = default(T); using (LogGroup logGroup = LogGroup.Start("Loading the entity specified in the query string.", NLog.LogLevel.Debug)) { Guid id = QueryStrings.GetID(typeof(T).Name); string uniqueKey = QueryStrings.GetUniqueKey(typeof(T).Name); LogWriter.Debug("Entity ID: " + id.ToString()); LogWriter.Debug("Unique key: " + uniqueKey); if (id != Guid.Empty) { entity = Retriever.Retrieve <T>(id); } else if (uniqueKey != String.Empty) { entity = Retriever.Retrieve <T>(uniqueKey); } else { throw new Exception("No ID or unique key found in the URL."); } if (entity == null) { LogWriter.Debug("Entity: [null]"); } else { LogWriter.Debug("Entity: " + entity.GetType().FullName); } } return(entity); }
public T Load <T>(Guid guid) where T : Aggregate { return(Retriever.Retrieve <T>(guid)); }
public void Deploy(string source, string destination) { Retriever.Retrieve(source, destination); SetupLauncher.Launch(source, destination); }