Browse Source

working

master
Josh 2 years ago
parent
commit
21fcb8bd6b
  1. 1
      .gitignore
  2. 25
      roomstitcher/roomstitcher.sln
  3. 6
      roomstitcher/roomstitcher/App.config
  4. 95
      roomstitcher/roomstitcher/Program.cs
  5. 36
      roomstitcher/roomstitcher/Properties/AssemblyInfo.cs
  6. 5
      roomstitcher/roomstitcher/packages.config
  7. BIN
      roomstitcher/roomstitcher/rooms/end.png
  8. BIN
      roomstitcher/roomstitcher/rooms/key1.png
  9. BIN
      roomstitcher/roomstitcher/rooms/key2.png
  10. BIN
      roomstitcher/roomstitcher/rooms/key3.png
  11. BIN
      roomstitcher/roomstitcher/rooms/random/1.png
  12. BIN
      roomstitcher/roomstitcher/rooms/random/10.png
  13. BIN
      roomstitcher/roomstitcher/rooms/random/11.png
  14. BIN
      roomstitcher/roomstitcher/rooms/random/12.png
  15. BIN
      roomstitcher/roomstitcher/rooms/random/2.png
  16. BIN
      roomstitcher/roomstitcher/rooms/random/3.png
  17. BIN
      roomstitcher/roomstitcher/rooms/random/4.png
  18. BIN
      roomstitcher/roomstitcher/rooms/random/5.png
  19. BIN
      roomstitcher/roomstitcher/rooms/random/6.png
  20. BIN
      roomstitcher/roomstitcher/rooms/random/7.png
  21. BIN
      roomstitcher/roomstitcher/rooms/random/8.png
  22. BIN
      roomstitcher/roomstitcher/rooms/random/9.png
  23. BIN
      roomstitcher/roomstitcher/rooms/random/gold1.png
  24. BIN
      roomstitcher/roomstitcher/rooms/random/gold2.png
  25. BIN
      roomstitcher/roomstitcher/rooms/random/gold3.png
  26. BIN
      roomstitcher/roomstitcher/rooms/random/gold4.png
  27. BIN
      roomstitcher/roomstitcher/rooms/random/gold5.png
  28. BIN
      roomstitcher/roomstitcher/rooms/random/gold6.png
  29. BIN
      roomstitcher/roomstitcher/rooms/random/gold7.png
  30. BIN
      roomstitcher/roomstitcher/rooms/start.png
  31. 69
      roomstitcher/roomstitcher/roomstitcher.csproj

1
.gitignore

@ -388,3 +388,4 @@ FodyWeavers.xsd
.idea/
*.sln.iml
roomstitcher/roomstitcher/output

25
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

6
roomstitcher/roomstitcher/App.config

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

95
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();
/// <summary>
/// Shuffle the array.
/// </summary>
/// <typeparam name="T">Array element type.</typeparam>
/// <param name="array">Array to shuffle.</param>
static void Shuffle<T>(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();
}
}
}

36
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")]

5
roomstitcher/roomstitcher/packages.config

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Magick.NET.Core" version="12.2.2" targetFramework="net472" />
<package id="Magick.NET-Q16-AnyCPU" version="12.2.2" targetFramework="net472" />
</packages>

BIN
roomstitcher/roomstitcher/rooms/end.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

BIN
roomstitcher/roomstitcher/rooms/key1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
roomstitcher/roomstitcher/rooms/key2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
roomstitcher/roomstitcher/rooms/key3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
roomstitcher/roomstitcher/rooms/random/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
roomstitcher/roomstitcher/rooms/random/10.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
roomstitcher/roomstitcher/rooms/random/11.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
roomstitcher/roomstitcher/rooms/random/12.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
roomstitcher/roomstitcher/rooms/random/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
roomstitcher/roomstitcher/rooms/random/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
roomstitcher/roomstitcher/rooms/random/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
roomstitcher/roomstitcher/rooms/random/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
roomstitcher/roomstitcher/rooms/random/6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
roomstitcher/roomstitcher/rooms/random/7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
roomstitcher/roomstitcher/rooms/random/8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

BIN
roomstitcher/roomstitcher/rooms/random/9.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
roomstitcher/roomstitcher/rooms/random/gold1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
roomstitcher/roomstitcher/rooms/random/gold2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
roomstitcher/roomstitcher/rooms/random/gold3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
roomstitcher/roomstitcher/rooms/random/gold4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
roomstitcher/roomstitcher/rooms/random/gold5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
roomstitcher/roomstitcher/rooms/random/gold6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
roomstitcher/roomstitcher/rooms/random/gold7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
roomstitcher/roomstitcher/rooms/start.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

69
roomstitcher/roomstitcher/roomstitcher.csproj

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{40E3C8D1-FD10-4F7F-B48C-12922F246147}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>roomstitcher</RootNamespace>
<AssemblyName>roomstitcher</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Magick.NET-Q16-AnyCPU, Version=12.2.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=MSIL">
<HintPath>..\packages\Magick.NET-Q16-AnyCPU.12.2.2\lib\netstandard20\Magick.NET-Q16-AnyCPU.dll</HintPath>
</Reference>
<Reference Include="Magick.NET.Core, Version=12.2.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=MSIL">
<HintPath>..\packages\Magick.NET.Core.12.2.2\lib\netstandard20\Magick.NET.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Magick.NET-Q16-AnyCPU.12.2.2\build\netstandard20\Magick.NET-Q16-AnyCPU.targets" Condition="Exists('..\packages\Magick.NET-Q16-AnyCPU.12.2.2\build\netstandard20\Magick.NET-Q16-AnyCPU.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Magick.NET-Q16-AnyCPU.12.2.2\build\netstandard20\Magick.NET-Q16-AnyCPU.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Magick.NET-Q16-AnyCPU.12.2.2\build\netstandard20\Magick.NET-Q16-AnyCPU.targets'))" />
</Target>
</Project>
Loading…
Cancel
Save