no more windows????

This commit is contained in:
lewd-alt
2025-05-07 15:37:30 -07:00
parent 433cb7475f
commit 300f10dbd7
6 changed files with 136 additions and 120 deletions

View File

@@ -20,7 +20,7 @@
<PackageReference Include="glfw-net" Version="3.3.1" /> <PackageReference Include="glfw-net" Version="3.3.1" />
<PackageReference Include="NETStandard.Library" Version="2.0.0" /> <PackageReference Include="NETStandard.Library" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="OpenGL.Net" Version="0.8.4" /> <PackageReference Include="Silk.NET.OpenGL" Version="2.22.0" />
<PackageReference Include="System.Collections" Version="4.3.0" /> <PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="System.Drawing.Common" Version="5.0.3" /> <PackageReference Include="System.Drawing.Common" Version="5.0.3" />
<PackageReference Include="System.Resources.Extensions" Version="7.0.1" /> <PackageReference Include="System.Resources.Extensions" Version="7.0.1" />

View File

@@ -39,7 +39,7 @@ namespace _2DGAMELIB
private byte a1; private byte a1;
private string ConfigPath = Directory.GetCurrentDirectory() + "\\Config.ini"; private string ConfigPath = Path.Combine(Directory.GetCurrentDirectory(), "Config.ini");
private bool FastText; private bool FastText;

View File

@@ -15,7 +15,7 @@ namespace _2DGAMELIB
//private System.Windows.Controls.Image hostedComponent1; //private System.Windows.Controls.Image hostedComponent1;
private string ConfigPath = Directory.GetCurrentDirectory() + "\\Config.ini"; private string ConfigPath = Path.Combine(Directory.GetCurrentDirectory(), "Config.ini");
private bool BigWindow; private bool BigWindow;

View File

@@ -1,5 +1,5 @@
using GLFW; using GLFW;
using OpenGL; using Silk.NET.OpenGL;
using System; using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
@@ -20,6 +20,8 @@ namespace _2DGAMELIB
public class GlImage public class GlImage
{ {
Silk.NET.OpenGL.GL gl;
//yeah this is a little bit sketchy //yeah this is a little bit sketchy
public static unsafe GLFW.Window PtrToWindow(IntPtr source) public static unsafe GLFW.Window PtrToWindow(IntPtr source)
{ {
@@ -30,6 +32,15 @@ namespace _2DGAMELIB
return __refvalue(destRef, GLFW.Window); return __refvalue(destRef, GLFW.Window);
} }
public static unsafe IntPtr WindowToPtr(Window source)
{
var sourceRef = __makeref(source);
var dest = default(IntPtr);
var destRef = __makeref(dest);
*(IntPtr*)&destRef = *(IntPtr*)&sourceRef;
return __refvalue(destRef, IntPtr);
}
public GLFW.Window window; public GLFW.Window window;
private uint shader_program; private uint shader_program;
private uint texture; private uint texture;
@@ -86,40 +97,55 @@ namespace _2DGAMELIB
if (Glfw.WindowShouldClose(window)) if (Glfw.WindowShouldClose(window))
Closing(); Closing();
} }
public void SetBitmap(Bitmap bmp) public unsafe void SetBitmap(Bitmap bmp)
{ {
Gl.UseProgram(shader_program); gl.UseProgram(shader_program);
Gl.Viewport(0, 0, bmp.Width, bmp.Height); gl.Viewport(new Size(bmp.Width, bmp.Height));
Gl.ActiveTexture(TextureUnit.Texture0); gl.ActiveTexture(Silk.NET.OpenGL.GLEnum.Texture0);
Gl.BindTexture(TextureTarget.Texture2d, texture); gl.BindTexture(Silk.NET.OpenGL.GLEnum.Texture2D, texture);
BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Gl.TexImage2D(TextureTarget.Texture2d, 0, InternalFormat.Rgba8, bmp.Width, bmp.Height, 0, OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);
gl.TexImage2D(
Silk.NET.OpenGL.GLEnum.Texture2D,
0,
InternalFormat.Rgba8,
(uint)bmp.Width,
(uint)bmp.Height,
0,
Silk.NET.OpenGL.GLEnum.Bgra,
Silk.NET.OpenGL.GLEnum.UnsignedByte,
(void*)data.Scan0
);
bmp.UnlockBits(data); bmp.UnlockBits(data);
int res_pos = Gl.GetUniformLocation(shader_program, "res");
Gl.Uniform2(res_pos, (float)bmp.Width, (float)bmp.Height);
Gl.BindBuffer(BufferTarget.ArrayBuffer, vertex_buf); int res_pos = gl.GetUniformLocation(shader_program, "res");
uint vert_pos = (uint)Gl.GetAttribLocation(shader_program, "vertPos"); gl.Uniform2(res_pos, (float)bmp.Width, (float)bmp.Height);
Gl.EnableVertexAttribArray(vert_pos);
Gl.BindVertexArray(vao); gl.BindBuffer(GLEnum.ArrayBuffer, vertex_buf);
Gl.VertexAttribPointer( uint vert_pos = (uint)gl.GetAttribLocation(shader_program, "vertPos");
gl.EnableVertexAttribArray(vert_pos);
gl.BindVertexArray(vao);
gl.VertexAttribPointer(
vert_pos, vert_pos,
2, 2,
VertexAttribType.Float, GLEnum.Float,
false, false,
0, 0,
IntPtr.Zero IntPtr.Zero
); );
Gl.DrawArrays(PrimitiveType.TriangleStrip, 0, 4);
gl.DrawArrays(GLEnum.TriangleStrip, 0, 4);
Glfw.SwapBuffers(window); Glfw.SwapBuffers(window);
} }
public void BitmapSetting(Bitmap bmp) public unsafe void BitmapSetting(Bitmap bmp)
{ {
Glfw.WindowHint(Hint.ClientApi, ClientApi.OpenGL); Glfw.WindowHint(Hint.ClientApi, ClientApi.OpenGL);
Glfw.WindowHint(Hint.ContextVersionMajor, 3); Glfw.WindowHint(Hint.ContextVersionMajor, 3);
@@ -140,11 +166,11 @@ namespace _2DGAMELIB
GCHandle handle = GCHandle.Alloc(this); GCHandle handle = GCHandle.Alloc(this);
Glfw.SetWindowUserPointer(window, GCHandle.ToIntPtr(handle)); Glfw.SetWindowUserPointer(window, GCHandle.ToIntPtr(handle));
Gl.Initialize();
Glfw.MakeContextCurrent(window); Glfw.MakeContextCurrent(window);
gl = Silk.NET.OpenGL.GL.GetApi(Glfw.GetProcAddress);
string[] vertexShaderSource = { string vertexShaderSource =
@" @"
#version 100 #version 100
precision mediump float; precision mediump float;
@@ -155,10 +181,9 @@ void main()
{ {
gl_Position = vec4(vertPos, 0.0, 1.0); gl_Position = vec4(vertPos, 0.0, 1.0);
} }
" ";
};
string[] fragmentShaderSource = { string fragmentShaderSource =
@" @"
#version 100 #version 100
precision mediump float; precision mediump float;
@@ -173,55 +198,46 @@ void main()
gl_FragColor = texture2D(sTexture, tc); gl_FragColor = texture2D(sTexture, tc);
} }
" ";
};
uint vertexShader = Gl.CreateShader(ShaderType.VertexShader); uint vertexShader = gl.CreateShader(Silk.NET.OpenGL.GLEnum.VertexShader);
Gl.ShaderSource(vertexShader, vertexShaderSource); gl.ShaderSource(vertexShader, vertexShaderSource);
Gl.CompileShader(vertexShader); gl.CompileShader(vertexShader);
uint fragmentShader = Gl.CreateShader(ShaderType.FragmentShader); uint fragmentShader = gl.CreateShader(Silk.NET.OpenGL.GLEnum.FragmentShader);
Gl.ShaderSource(fragmentShader, fragmentShaderSource); gl.ShaderSource(fragmentShader, fragmentShaderSource);
Gl.CompileShader(fragmentShader); gl.CompileShader(fragmentShader);
shader_program = Gl.CreateProgram(); shader_program = gl.CreateProgram();
Gl.AttachShader(shader_program, vertexShader); gl.AttachShader(shader_program, vertexShader);
Gl.AttachShader(shader_program, fragmentShader); gl.AttachShader(shader_program, fragmentShader);
Gl.LinkProgram(shader_program); gl.LinkProgram(shader_program);
int length;
StringBuilder stringBuilder = new StringBuilder(10000);
Gl.GetShaderInfoLog(fragmentShader, 10000, out length, stringBuilder);
System.Diagnostics.Debug.WriteLine(stringBuilder);
stringBuilder.Clear();
Gl.GetShaderInfoLog(vertexShader, 10000, out length, stringBuilder);
System.Diagnostics.Debug.WriteLine(stringBuilder);
stringBuilder.Clear();
Gl.GetProgramInfoLog(shader_program, 10000, out length, stringBuilder);
System.Diagnostics.Debug.WriteLine(stringBuilder);
stringBuilder.Clear();
Gl.UseProgram(shader_program);
Gl.Uniform1(Gl.GetUniformLocation(shader_program, "sTexture"), 0);
texture = Gl.GenTexture(); System.Diagnostics.Debug.WriteLine(gl.GetShaderInfoLog(fragmentShader));
System.Diagnostics.Debug.WriteLine(gl.GetShaderInfoLog(vertexShader));
System.Diagnostics.Debug.WriteLine(gl.GetProgramInfoLog(shader_program));
Gl.ActiveTexture(TextureUnit.Texture0); gl.UseProgram(shader_program);
Gl.BindTexture(TextureTarget.Texture2d, texture); gl.Uniform1(gl.GetUniformLocation(shader_program, "sTexture"), 0);
Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureWrapS, TextureWrapMode.ClampToEdge);
Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureWrapT, TextureWrapMode.ClampToEdge); texture = gl.GenTexture();
Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMagFilter, TextureMagFilter.Nearest);
Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMinFilter, TextureMagFilter.Nearest); gl.ActiveTexture(Silk.NET.OpenGL.GLEnum.Texture0);
gl.BindTexture(Silk.NET.OpenGL.GLEnum.Texture2D, texture);
gl.TexParameterI(Silk.NET.OpenGL.GLEnum.Texture2D, Silk.NET.OpenGL.GLEnum.TextureWrapS, new int[] {(int)TextureWrapMode.ClampToEdge});
gl.TexParameterI(Silk.NET.OpenGL.GLEnum.Texture2D, Silk.NET.OpenGL.GLEnum.TextureWrapT, new int[] {(int)TextureWrapMode.ClampToEdge});
gl.TexParameterI(Silk.NET.OpenGL.GLEnum.Texture2D, Silk.NET.OpenGL.GLEnum.TextureMagFilter, new int[] {(int)TextureMagFilter.Nearest});
gl.TexParameterI(Silk.NET.OpenGL.GLEnum.Texture2D, Silk.NET.OpenGL.GLEnum.TextureMinFilter, new int[] {(int)TextureMinFilter.Nearest});
float[] buf = { 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f }; float[] buf = { 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f };
vertex_buf = Gl.GenBuffer(); vertex_buf = gl.GenBuffer();
Gl.BindBuffer(BufferTarget.ArrayBuffer, vertex_buf); gl.BindBuffer(Silk.NET.OpenGL.GLEnum.ArrayBuffer, vertex_buf);
Gl.BufferData(BufferTarget.ArrayBuffer, (uint)(sizeof(float) * buf.Length), buf, BufferUsage.StaticDraw); fixed (float* buf_ = buf) gl.BufferData(Silk.NET.OpenGL.GLEnum.ArrayBuffer, (uint)(sizeof(float) * buf.Length), buf_, Silk.NET.OpenGL.GLEnum.StaticDraw);
vao = Gl.GenVertexArray(); vao = gl.GenVertexArray();
} }
} }
@@ -320,7 +336,6 @@ void main()
gl_img.BitmapSetting(bmp); gl_img.BitmapSetting(bmp);
} }
} }
*/ */
} }

View File

@@ -1,84 +1,85 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.IO;
using _2DGAMELIB; using _2DGAMELIB;
namespace SlaveMatrix namespace SlaveMatrix
{ {
public static class GameText public static class GameText
{ {
private static string[] Race = (from e in (Sta.CurrentDirectory + "\\text\\System\\Race.txt").ReadLines() private static string[] Race = (from e in Path.Combine(Sta.CurrentDirectory, "text", "System", "Race.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Attr = (from e in (Sta.CurrentDirectory + "\\text\\System\\Attribute.txt").ReadLines() private static string[] Attr = (from e in Path.Combine(Sta.CurrentDirectory, "text", "System", "Attribute.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Comm = (from e in (Sta.CurrentDirectory + "\\text\\System\\Common.txt").ReadLines() private static string[] Comm = (from e in Path.Combine(Sta.CurrentDirectory, "text", "System", "Common.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Base = (from e in (Sta.CurrentDirectory + "\\text\\Basement\\Basement.txt").ReadLines() private static string[] Base = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Basement", "Basement.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Trai = (from e in (Sta.CurrentDirectory + "\\text\\Basement\\Training\\Training.txt").ReadLines() private static string[] Trai = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Basement", "Training", "Training.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Targ = (from e in (Sta.CurrentDirectory + "\\text\\Basement\\Target.txt").ReadLines() private static string[] Targ = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Basement", "Target.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Bles = (from e in (Sta.CurrentDirectory + "\\text\\Basement\\Blessing.txt").ReadLines() private static string[] Bles = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Basement", "Blessing.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Offi = (from e in (Sta.CurrentDirectory + "\\text\\Office\\Office.txt").ReadLines() private static string[] Offi = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Office", "Office.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Bebt = (from e in (Sta.CurrentDirectory + "\\text\\Office\\Bebt.txt").ReadLines() private static string[] Bebt = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Office", "Bebt.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Slav = (from e in (Sta.CurrentDirectory + "\\text\\Office\\Slave.txt").ReadLines() private static string[] Slav = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Office", "Slave.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Tool = (from e in (Sta.CurrentDirectory + "\\text\\Office\\Tool.txt").ReadLines() private static string[] Tool = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Office", "Tool.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] OP0 = (from e in (Sta.CurrentDirectory + "\\text\\Event\\OP0.txt").ReadLines() private static string[] OP0 = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Event", "OP0.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] OP1 = (from e in (Sta.CurrentDirectory + "\\text\\Event\\OP1.txt").ReadLines() private static string[] OP1 = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Event", "OP1.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Desc = (from e in (Sta.CurrentDirectory + "\\text\\Event\\Description.txt").ReadLines() private static string[] Desc = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Event", "Description.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Firs = (from e in (Sta.CurrentDirectory + "\\text\\Event\\First office.txt").ReadLines() private static string[] Firs = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Event", "First office.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Repa1 = (from e in (Sta.CurrentDirectory + "\\text\\Event\\Repayment1.txt").ReadLines() private static string[] Repa1 = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Event", "Repayment1.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Repa2 = (from e in (Sta.CurrentDirectory + "\\text\\Event\\Repayment2.txt").ReadLines() private static string[] Repa2 = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Event", "Repayment2.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] Repa3 = (from e in (Sta.CurrentDirectory + "\\text\\Event\\Repayment3.txt").ReadLines() private static string[] Repa3 = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Event", "Repayment3.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
private static string[] VBle = (from e in (Sta.CurrentDirectory + "\\text\\Event\\Blessing.txt").ReadLines() private static string[] VBle = (from e in Path.Combine(Sta.CurrentDirectory, "text", "Event", "Blessing.txt").ReadLines()
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToArray(); select e).ToArray();
@@ -1165,7 +1166,7 @@ namespace SlaveMatrix
{ {
this.Med = Med; this.Med = Med;
this.ip = ip; this.ip = ip;
string[] array = (Sta.CurrentDirectory + "\\text\\System\\SubInnfo.txt").FromText().Split(','); string[] array = Path.Combine(Sta.CurrentDirectory, "text", "System", "SubInnfo.txt").FromText().Split(',');
List<string> list = (from e in array[0].Replace("\r", "").Split('\n') List<string> list = (from e in array[0].Replace("\r", "").Split('\n')
where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//")
select e).ToList(); select e).ToList();

View File

@@ -934,16 +934,16 @@ namespace SlaveMatrix
IEnumerable<string> source = Directory.EnumerateFiles(SavePath); IEnumerable<string> source = Directory.EnumerateFiles(SavePath);
return new string[10] return new string[10]
{ {
source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\0 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "0 "))),
source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\1 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "1 "))),
source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\2 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "2 "))),
source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\3 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "3 "))),
source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\4 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "4 "))),
source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\5 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "5 "))),
source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\6 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "6 "))),
source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\7 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "7 "))),
source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\8 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "8 "))),
source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\9 ")) source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "9 ")))
}; };
} }
@@ -1066,31 +1066,31 @@ namespace SlaveMatrix
public static void Set喘ぎ() public static void Set喘ぎ()
{ {
a = (from f in (PanPath + "\\a.txt").FromText().Split(',') a = (from f in Path.Combine(PanPath, "a.txt").FromText().Split(',')
select (from g in f.Split("\r\n") select (from g in f.Split("\r\n")
where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//") where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//")
select g).ToArray()).ToArray(); select g).ToArray()).ToArray();
i = (from f in (PanPath + "\\i.txt").FromText().Split(',') i = (from f in Path.Combine(PanPath, "i.txt").FromText().Split(',')
select (from g in f.Split("\r\n") select (from g in f.Split("\r\n")
where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//") where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//")
select g).ToArray()).ToArray(); select g).ToArray()).ToArray();
u = (from f in (PanPath + "\\u.txt").FromText().Split(',') u = (from f in Path.Combine(PanPath, "u.txt").FromText().Split(',')
select (from g in f.Split("\r\n") select (from g in f.Split("\r\n")
where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//") where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//")
select g).ToArray()).ToArray(); select g).ToArray()).ToArray();
e = (from f in (PanPath + "\\e.txt").FromText().Split(',') e = (from f in Path.Combine(PanPath, "e.txt").FromText().Split(',')
select (from g in f.Split("\r\n") select (from g in f.Split("\r\n")
where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//") where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//")
select g).ToArray()).ToArray(); select g).ToArray()).ToArray();
o = (from f in (PanPath + "\\o.txt").FromText().Split(',') o = (from f in Path.Combine(PanPath, "o.txt").FromText().Split(',')
select (from g in f.Split("\r\n") select (from g in f.Split("\r\n")
where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//") where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//")
select g).ToArray()).ToArray(); select g).ToArray()).ToArray();
n = (from f in (PanPath + "\\n.txt").FromText().Split(',') n = (from f in Path.Combine(PanPath, "n.txt").FromText().Split(',')
select (from g in f.Split("\r\n") select (from g in f.Split("\r\n")
where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//") where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//")
select g).ToArray()).ToArray(); select g).ToArray()).ToArray();
end = (from g in (PanPath + "\\end.txt").FromText().Split("\r\n") end = (from g in Path.Combine(PanPath, "end.txt").FromText().Split("\r\n")
where !g.StartsWith("//") where !g.StartsWith("//")
select g).ToArray(); select g).ToArray();
} }
@@ -1474,16 +1474,16 @@ namespace SlaveMatrix
= default(); = default();
CurrentDirectory = Directory.GetCurrentDirectory(); CurrentDirectory = Directory.GetCurrentDirectory();
GameData = new GameState(); GameData = new GameState();
SavePath = CurrentDirectory + "\\save"; SavePath = Path.Combine(CurrentDirectory, "save");
ImiPath = CurrentDirectory + "\\text\\Basement\\Training\\Imitation.txt"; ImiPath = Path.Combine(CurrentDirectory, "text", "Basement", "Training", "Imitation.txt");
PanPath = CurrentDirectory + "\\text\\Basement\\Training\\Pant"; PanPath = Path.Combine(CurrentDirectory, "text", "Basement", "Training", "Pant");
/* /*
po3 = new ParallelOptions po3 = new ParallelOptions
{ {
MaxDegreeOfParallelism = 3 MaxDegreeOfParallelism = 3
};*/ };*/
ConfigPath = CurrentDirectory + "\\Config.ini"; ConfigPath = Path.Combine(CurrentDirectory, "Config.ini");
SimpleMating = false; SimpleMating = false;
AutoSort = false; AutoSort = false;
} }
@@ -1494,7 +1494,7 @@ namespace SlaveMatrix
{ {
GameData.Gen[j].Buf.Clear(); GameData.Gen[j].Buf.Clear();
} }
string path = JsonSavePath + "\\" + i + " " + GameData.GetSaveDateString().Replace("/", "_") + ".json"; string path = Path.Combine(JsonSavePath, i + " " + GameData.GetSaveDateString().Replace("/", "_") + ".json");
GameData.ToJson(path); GameData.ToJson(path);
if (TranslateJson) if (TranslateJson)
{ {
@@ -1504,26 +1504,26 @@ namespace SlaveMatrix
public static string[] JSDPaths() public static string[] JSDPaths()
{ {
JsonSavePath = CurrentDirectory + "\\save\\json"; JsonSavePath = Path.Combine(CurrentDirectory, "save", "json");
IEnumerable<string> source = Directory.EnumerateFiles(JsonSavePath); IEnumerable<string> source = Directory.EnumerateFiles(JsonSavePath);
return new string[10] return new string[10]
{ {
source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\0 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "0 "))),
source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\1 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "1 "))),
source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\2 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "2 "))),
source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\3 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "3 "))),
source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\4 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "4 "))),
source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\5 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "5 "))),
source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\6 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "6 "))),
source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\7 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "7 "))),
source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\8 ")), source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "8 "))),
source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\9 ")) source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "9 ")))
}; };
} }
public static string Translate(string Path, int Mode) public static string Translate(string Path, int Mode)
{ {
TranslateJsonFile = CurrentDirectory + "\\text\\Translate.json"; TranslateJsonFile = System.IO.Path.Combine(CurrentDirectory, "text", "Translate.json");
TranslateDict = Ser.UnJson<Dictionary<string, string>>(TranslateJsonFile); TranslateDict = Ser.UnJson<Dictionary<string, string>>(TranslateJsonFile);
string input = File.ReadAllText(Path); string input = File.ReadAllText(Path);
switch (Mode) switch (Mode)