diff --git a/.gitignore b/.gitignore index 61c5d57..96fed5d 100644 --- a/.gitignore +++ b/.gitignore @@ -388,3 +388,4 @@ FodyWeavers.xsd .idea/ *.sln.iml +roomstitcher/roomstitcher/output diff --git a/roomstitcher/roomstitcher.sln b/roomstitcher/roomstitcher.sln new file mode 100644 index 0000000..6c9614f --- /dev/null +++ b/roomstitcher/roomstitcher.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31205.134 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "roomstitcher", "roomstitcher\roomstitcher.csproj", "{40E3C8D1-FD10-4F7F-B48C-12922F246147}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {40E3C8D1-FD10-4F7F-B48C-12922F246147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {40E3C8D1-FD10-4F7F-B48C-12922F246147}.Debug|Any CPU.Build.0 = Debug|Any CPU + {40E3C8D1-FD10-4F7F-B48C-12922F246147}.Release|Any CPU.ActiveCfg = Release|Any CPU + {40E3C8D1-FD10-4F7F-B48C-12922F246147}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F9D3665A-9898-4B97-8365-1D3D149F2BDB} + EndGlobalSection +EndGlobal diff --git a/roomstitcher/roomstitcher/App.config b/roomstitcher/roomstitcher/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/roomstitcher/roomstitcher/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/roomstitcher/roomstitcher/Program.cs b/roomstitcher/roomstitcher/Program.cs new file mode 100644 index 0000000..f5113cd --- /dev/null +++ b/roomstitcher/roomstitcher/Program.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ImageMagick; +using System.IO; + +namespace roomstitcher +{ + class Program + { + static Random _random = new Random(); + + /// + /// Shuffle the array. + /// + /// Array element type. + /// Array to shuffle. + static void Shuffle(T[] array) + { + int n = array.Length; + for (int i = 0; i < (n - 1); i++) + { + // Use Next on random instance with an argument. + // ... The argument is an exclusive bound. + // So we will not go past the end of the array. + int r = i + _random.Next(n - i); + T t = array[r]; + array[r] = array[i]; + array[i] = t; + } + } + static void Main(string[] args) + { + int TIMES_TO_OUTPUT = 50; + for (int outputNumber = 0; outputNumber < TIMES_TO_OUTPUT; ++outputNumber) + { + string roomsFolder = System.AppContext.BaseDirectory.Replace("bin\\Debug\\", "") + "rooms\\"; + string randomRoomsFolder = roomsFolder + "random\\"; + string[] randomRooms = Directory.GetFiles(randomRoomsFolder); + Shuffle(randomRooms); + + string[] roomsToUse = new string[7]; + roomsToUse[0] = roomsFolder + "key1.png"; + roomsToUse[1] = roomsFolder + "key2.png"; + roomsToUse[2] = roomsFolder + "key3.png"; + roomsToUse[3] = randomRooms[0]; + roomsToUse[4] = randomRooms[1]; + roomsToUse[5] = randomRooms[2]; + roomsToUse[6] = randomRooms[3]; + Shuffle(roomsToUse); + + MagickImageCollection images = new MagickImageCollection(); + Random random = new Random(); + + int currentRoomIndex = 0; + for (int i = 0; i < 9; ++i) + { + string room; + if (i == 2) + room = roomsFolder + "end.png"; + else if (i == 6) + room = roomsFolder + "start.png"; + else + { + room = roomsToUse[currentRoomIndex]; + currentRoomIndex++; + } + + MagickImage newImage = new MagickImage(room); + images.Add(newImage); + } + + + MontageSettings montageSettings = new MontageSettings() + { + BackgroundColor = MagickColors.None, // -background none + Shadow = true, // -shadow + Geometry = new MagickGeometry(1, 1, 0, 0), // -geometry +5+5 + TileGeometry = new MagickGeometry(string.Format("{0}x{1}", 3, 3)) + }; + + var result = images.Montage(montageSettings); + //Console.WriteLine(System.AppContext.BaseDirectory); + result.Write(roomsFolder + "\\..\\output\\stitch" + outputNumber + ".png"); + } + + Console.WriteLine("Press a key to exit"); + Console.ReadKey(); + + } + } +} + diff --git a/roomstitcher/roomstitcher/Properties/AssemblyInfo.cs b/roomstitcher/roomstitcher/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..de9b7de --- /dev/null +++ b/roomstitcher/roomstitcher/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("roomstitcher")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("roomstitcher")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("40e3c8d1-fd10-4f7f-b48c-12922f246147")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/roomstitcher/roomstitcher/packages.config b/roomstitcher/roomstitcher/packages.config new file mode 100644 index 0000000..041b79b --- /dev/null +++ b/roomstitcher/roomstitcher/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/roomstitcher/roomstitcher/rooms/end.png b/roomstitcher/roomstitcher/rooms/end.png new file mode 100644 index 0000000..0d28885 Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/end.png differ diff --git a/roomstitcher/roomstitcher/rooms/key1.png b/roomstitcher/roomstitcher/rooms/key1.png new file mode 100644 index 0000000..5a62a5a Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/key1.png differ diff --git a/roomstitcher/roomstitcher/rooms/key2.png b/roomstitcher/roomstitcher/rooms/key2.png new file mode 100644 index 0000000..04209ae Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/key2.png differ diff --git a/roomstitcher/roomstitcher/rooms/key3.png b/roomstitcher/roomstitcher/rooms/key3.png new file mode 100644 index 0000000..e3ab607 Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/key3.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/1.png b/roomstitcher/roomstitcher/rooms/random/1.png new file mode 100644 index 0000000..735b536 Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/1.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/10.png b/roomstitcher/roomstitcher/rooms/random/10.png new file mode 100644 index 0000000..3ad27e6 Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/10.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/11.png b/roomstitcher/roomstitcher/rooms/random/11.png new file mode 100644 index 0000000..46b54cf Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/11.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/12.png b/roomstitcher/roomstitcher/rooms/random/12.png new file mode 100644 index 0000000..6b04c54 Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/12.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/2.png b/roomstitcher/roomstitcher/rooms/random/2.png new file mode 100644 index 0000000..1d77d0e Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/2.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/3.png b/roomstitcher/roomstitcher/rooms/random/3.png new file mode 100644 index 0000000..f35a35d Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/3.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/4.png b/roomstitcher/roomstitcher/rooms/random/4.png new file mode 100644 index 0000000..e39a102 Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/4.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/5.png b/roomstitcher/roomstitcher/rooms/random/5.png new file mode 100644 index 0000000..2cbcd2c Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/5.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/6.png b/roomstitcher/roomstitcher/rooms/random/6.png new file mode 100644 index 0000000..1520bf8 Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/6.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/7.png b/roomstitcher/roomstitcher/rooms/random/7.png new file mode 100644 index 0000000..13715bf Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/7.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/8.png b/roomstitcher/roomstitcher/rooms/random/8.png new file mode 100644 index 0000000..0de958c Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/8.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/9.png b/roomstitcher/roomstitcher/rooms/random/9.png new file mode 100644 index 0000000..0ea25f1 Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/9.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/gold1.png b/roomstitcher/roomstitcher/rooms/random/gold1.png new file mode 100644 index 0000000..969f611 Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/gold1.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/gold2.png b/roomstitcher/roomstitcher/rooms/random/gold2.png new file mode 100644 index 0000000..134d71b Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/gold2.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/gold3.png b/roomstitcher/roomstitcher/rooms/random/gold3.png new file mode 100644 index 0000000..d110068 Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/gold3.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/gold4.png b/roomstitcher/roomstitcher/rooms/random/gold4.png new file mode 100644 index 0000000..8ee24ed Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/gold4.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/gold5.png b/roomstitcher/roomstitcher/rooms/random/gold5.png new file mode 100644 index 0000000..a42b55f Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/gold5.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/gold6.png b/roomstitcher/roomstitcher/rooms/random/gold6.png new file mode 100644 index 0000000..a6d8352 Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/gold6.png differ diff --git a/roomstitcher/roomstitcher/rooms/random/gold7.png b/roomstitcher/roomstitcher/rooms/random/gold7.png new file mode 100644 index 0000000..c6a862d Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/random/gold7.png differ diff --git a/roomstitcher/roomstitcher/rooms/start.png b/roomstitcher/roomstitcher/rooms/start.png new file mode 100644 index 0000000..c2c2bc9 Binary files /dev/null and b/roomstitcher/roomstitcher/rooms/start.png differ diff --git a/roomstitcher/roomstitcher/roomstitcher.csproj b/roomstitcher/roomstitcher/roomstitcher.csproj new file mode 100644 index 0000000..0a4891c --- /dev/null +++ b/roomstitcher/roomstitcher/roomstitcher.csproj @@ -0,0 +1,69 @@ + + + + + Debug + AnyCPU + {40E3C8D1-FD10-4F7F-B48C-12922F246147} + Exe + roomstitcher + roomstitcher + v4.7.2 + 512 + true + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Magick.NET-Q16-AnyCPU.12.2.2\lib\netstandard20\Magick.NET-Q16-AnyCPU.dll + + + ..\packages\Magick.NET.Core.12.2.2\lib\netstandard20\Magick.NET.Core.dll + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file