From 300f10dbd76698f1acc184ad7576493aa648936d Mon Sep 17 00:00:00 2001 From: lewd-alt <210463139+lewd-alt@users.noreply.github.com> Date: Wed, 7 May 2025 15:37:30 -0700 Subject: [PATCH] no more windows???? --- 2DGAMELIB/2DGAMELIB.csproj | 2 +- 2DGAMELIB/_2DGAMELIB/Tex.cs | 2 +- 2DGAMELIB/_2DGAMELIB/UI.cs | 2 +- 2DGAMELIB/_2DGAMELIB/WPFImage.cs | 139 ++++++++++-------- .../SlaveMatrix/GameClasses/GameText.cs | 41 +++--- SlaveMatrix/SlaveMatrix/GameClasses/Sta.cs | 70 ++++----- 6 files changed, 136 insertions(+), 120 deletions(-) diff --git a/2DGAMELIB/2DGAMELIB.csproj b/2DGAMELIB/2DGAMELIB.csproj index a05377f..6f15fff 100644 --- a/2DGAMELIB/2DGAMELIB.csproj +++ b/2DGAMELIB/2DGAMELIB.csproj @@ -20,7 +20,7 @@ - + diff --git a/2DGAMELIB/_2DGAMELIB/Tex.cs b/2DGAMELIB/_2DGAMELIB/Tex.cs index bcbd07c..5527fc8 100644 --- a/2DGAMELIB/_2DGAMELIB/Tex.cs +++ b/2DGAMELIB/_2DGAMELIB/Tex.cs @@ -39,7 +39,7 @@ namespace _2DGAMELIB private byte a1; - private string ConfigPath = Directory.GetCurrentDirectory() + "\\Config.ini"; + private string ConfigPath = Path.Combine(Directory.GetCurrentDirectory(), "Config.ini"); private bool FastText; diff --git a/2DGAMELIB/_2DGAMELIB/UI.cs b/2DGAMELIB/_2DGAMELIB/UI.cs index 802432a..cecbba8 100644 --- a/2DGAMELIB/_2DGAMELIB/UI.cs +++ b/2DGAMELIB/_2DGAMELIB/UI.cs @@ -15,7 +15,7 @@ namespace _2DGAMELIB //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; diff --git a/2DGAMELIB/_2DGAMELIB/WPFImage.cs b/2DGAMELIB/_2DGAMELIB/WPFImage.cs index 9ed23a8..5ff75f7 100644 --- a/2DGAMELIB/_2DGAMELIB/WPFImage.cs +++ b/2DGAMELIB/_2DGAMELIB/WPFImage.cs @@ -1,5 +1,5 @@ using GLFW; -using OpenGL; +using Silk.NET.OpenGL; using System; using System.Drawing; using System.Drawing.Imaging; @@ -20,6 +20,8 @@ namespace _2DGAMELIB public class GlImage { + Silk.NET.OpenGL.GL gl; + //yeah this is a little bit sketchy public static unsafe GLFW.Window PtrToWindow(IntPtr source) { @@ -30,6 +32,15 @@ namespace _2DGAMELIB 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; private uint shader_program; private uint texture; @@ -86,40 +97,55 @@ namespace _2DGAMELIB if (Glfw.WindowShouldClose(window)) Closing(); } - public void SetBitmap(Bitmap bmp) + public unsafe void SetBitmap(Bitmap bmp) { - Gl.UseProgram(shader_program); - Gl.Viewport(0, 0, bmp.Width, bmp.Height); + gl.UseProgram(shader_program); + gl.Viewport(new Size(bmp.Width, bmp.Height)); - Gl.ActiveTexture(TextureUnit.Texture0); - Gl.BindTexture(TextureTarget.Texture2d, texture); + gl.ActiveTexture(Silk.NET.OpenGL.GLEnum.Texture0); + 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); - 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); - int res_pos = Gl.GetUniformLocation(shader_program, "res"); - Gl.Uniform2(res_pos, (float)bmp.Width, (float)bmp.Height); - Gl.BindBuffer(BufferTarget.ArrayBuffer, vertex_buf); - uint vert_pos = (uint)Gl.GetAttribLocation(shader_program, "vertPos"); - Gl.EnableVertexAttribArray(vert_pos); + int res_pos = gl.GetUniformLocation(shader_program, "res"); + gl.Uniform2(res_pos, (float)bmp.Width, (float)bmp.Height); - Gl.BindVertexArray(vao); - Gl.VertexAttribPointer( + gl.BindBuffer(GLEnum.ArrayBuffer, vertex_buf); + uint vert_pos = (uint)gl.GetAttribLocation(shader_program, "vertPos"); + gl.EnableVertexAttribArray(vert_pos); + + + gl.BindVertexArray(vao); + gl.VertexAttribPointer( vert_pos, 2, - VertexAttribType.Float, + GLEnum.Float, false, 0, IntPtr.Zero ); - Gl.DrawArrays(PrimitiveType.TriangleStrip, 0, 4); + + gl.DrawArrays(GLEnum.TriangleStrip, 0, 4); Glfw.SwapBuffers(window); } - public void BitmapSetting(Bitmap bmp) + public unsafe void BitmapSetting(Bitmap bmp) { Glfw.WindowHint(Hint.ClientApi, ClientApi.OpenGL); Glfw.WindowHint(Hint.ContextVersionMajor, 3); @@ -140,11 +166,11 @@ namespace _2DGAMELIB GCHandle handle = GCHandle.Alloc(this); 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 precision mediump float; @@ -155,10 +181,9 @@ void main() { gl_Position = vec4(vertPos, 0.0, 1.0); } -" - }; +"; - string[] fragmentShaderSource = { + string fragmentShaderSource = @" #version 100 precision mediump float; @@ -173,55 +198,46 @@ void main() gl_FragColor = texture2D(sTexture, tc); } -" - }; +"; - uint vertexShader = Gl.CreateShader(ShaderType.VertexShader); - Gl.ShaderSource(vertexShader, vertexShaderSource); - Gl.CompileShader(vertexShader); + uint vertexShader = gl.CreateShader(Silk.NET.OpenGL.GLEnum.VertexShader); + gl.ShaderSource(vertexShader, vertexShaderSource); + gl.CompileShader(vertexShader); - uint fragmentShader = Gl.CreateShader(ShaderType.FragmentShader); - Gl.ShaderSource(fragmentShader, fragmentShaderSource); - Gl.CompileShader(fragmentShader); + uint fragmentShader = gl.CreateShader(Silk.NET.OpenGL.GLEnum.FragmentShader); + gl.ShaderSource(fragmentShader, fragmentShaderSource); + gl.CompileShader(fragmentShader); - shader_program = Gl.CreateProgram(); - Gl.AttachShader(shader_program, vertexShader); - Gl.AttachShader(shader_program, fragmentShader); - Gl.LinkProgram(shader_program); + shader_program = gl.CreateProgram(); + gl.AttachShader(shader_program, vertexShader); + gl.AttachShader(shader_program, fragmentShader); + 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(); + + System.Diagnostics.Debug.WriteLine(gl.GetShaderInfoLog(fragmentShader)); + System.Diagnostics.Debug.WriteLine(gl.GetShaderInfoLog(vertexShader)); + System.Diagnostics.Debug.WriteLine(gl.GetProgramInfoLog(shader_program)); - Gl.UseProgram(shader_program); + gl.UseProgram(shader_program); + gl.Uniform1(gl.GetUniformLocation(shader_program, "sTexture"), 0); - Gl.Uniform1(Gl.GetUniformLocation(shader_program, "sTexture"), 0); + texture = gl.GenTexture(); - - texture = Gl.GenTexture(); - - Gl.ActiveTexture(TextureUnit.Texture0); - Gl.BindTexture(TextureTarget.Texture2d, texture); - Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureWrapS, TextureWrapMode.ClampToEdge); - Gl.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureWrapT, TextureWrapMode.ClampToEdge); - 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 }; - vertex_buf = Gl.GenBuffer(); - Gl.BindBuffer(BufferTarget.ArrayBuffer, vertex_buf); - Gl.BufferData(BufferTarget.ArrayBuffer, (uint)(sizeof(float) * buf.Length), buf, BufferUsage.StaticDraw); + vertex_buf = gl.GenBuffer(); + gl.BindBuffer(Silk.NET.OpenGL.GLEnum.ArrayBuffer, vertex_buf); + 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); } - } */ } \ No newline at end of file diff --git a/SlaveMatrix/SlaveMatrix/GameClasses/GameText.cs b/SlaveMatrix/SlaveMatrix/GameClasses/GameText.cs index 007da03..5f01693 100644 --- a/SlaveMatrix/SlaveMatrix/GameClasses/GameText.cs +++ b/SlaveMatrix/SlaveMatrix/GameClasses/GameText.cs @@ -1,84 +1,85 @@ using System.Collections.Generic; using System.Linq; +using System.IO; using _2DGAMELIB; namespace SlaveMatrix { 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") 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("//") select e).ToArray(); @@ -1165,7 +1166,7 @@ namespace SlaveMatrix { this.Med = Med; 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 list = (from e in array[0].Replace("\r", "").Split('\n') where !string.IsNullOrWhiteSpace(e) && !e.StartsWith("//") select e).ToList(); diff --git a/SlaveMatrix/SlaveMatrix/GameClasses/Sta.cs b/SlaveMatrix/SlaveMatrix/GameClasses/Sta.cs index ef9b00e..d578ece 100644 --- a/SlaveMatrix/SlaveMatrix/GameClasses/Sta.cs +++ b/SlaveMatrix/SlaveMatrix/GameClasses/Sta.cs @@ -934,17 +934,17 @@ namespace SlaveMatrix IEnumerable source = Directory.EnumerateFiles(SavePath); return new string[10] { - source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\0: ")), - source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\1: ")), - source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\2: ")), - source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\3: ")), - source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\4: ")), - source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\5: ")), - source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\6: ")), - source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\7: ")), - source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\8: ")), - source.FirstOrDefault((string e) => e.StartsWith(SavePath + "\\9: ")) - }; + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "0: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "1: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "2: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "3: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "4: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "5: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "6: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "7: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "8: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(SavePath, "9: "))) + }; } public static void GDSave(int i) @@ -1066,31 +1066,31 @@ namespace SlaveMatrix 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") where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//") 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") where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//") 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") where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//") 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") where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//") 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") where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//") 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") where !string.IsNullOrWhiteSpace(g) && !g.StartsWith("//") 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("//") select g).ToArray(); } @@ -1474,16 +1474,16 @@ namespace SlaveMatrix ブーツ初期化 = default(ブーツ情報); CurrentDirectory = Directory.GetCurrentDirectory(); GameData = new GameState(); - SavePath = CurrentDirectory + "\\save"; - ImiPath = CurrentDirectory + "\\text\\Basement\\Training\\Imitation.txt"; - PanPath = CurrentDirectory + "\\text\\Basement\\Training\\Pant"; + SavePath = Path.Combine(CurrentDirectory, "save"); + ImiPath = Path.Combine(CurrentDirectory, "text", "Basement", "Training", "Imitation.txt"); + PanPath = Path.Combine(CurrentDirectory, "text", "Basement", "Training", "Pant"); /* po3 = new ParallelOptions { MaxDegreeOfParallelism = 3 };*/ - ConfigPath = CurrentDirectory + "\\Config.ini"; + ConfigPath = Path.Combine(CurrentDirectory, "Config.ini"); SimpleMating = false; AutoSort = false; } @@ -1494,7 +1494,7 @@ namespace SlaveMatrix { 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); if (TranslateJson) { @@ -1504,26 +1504,26 @@ namespace SlaveMatrix public static string[] JSDPaths() { - JsonSavePath = CurrentDirectory + "\\save\\json"; + JsonSavePath = Path.Combine(CurrentDirectory, "save", "json"); IEnumerable source = Directory.EnumerateFiles(JsonSavePath); return new string[10] { - source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\0: ")), - source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\1: ")), - source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\2: ")), - source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\3: ")), - source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\4: ")), - source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\5: ")), - source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\6: ")), - source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\7: ")), - source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\8: ")), - source.FirstOrDefault((string e) => e.StartsWith(JsonSavePath + "\\9: ")) + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "0: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "1: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "2: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "3: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "4: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "5: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "6: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "7: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "8: "))), + source.FirstOrDefault((string e) => e.StartsWith(Path.Combine(JsonSavePath, "9: "))) }; } 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>(TranslateJsonFile); string input = File.ReadAllText(Path); switch (Mode)