Skip to content

Commit 5fa409f

Browse files
fix program
1 parent 045a48f commit 5fa409f

File tree

5 files changed

+194
-11
lines changed

5 files changed

+194
-11
lines changed

ASECII/ASECII.csproj

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<ApplicationManifest>app.manifest</ApplicationManifest>
5-
<OutputType>WinExe</OutputType>
5+
<OutputType>Exe</OutputType>
66
<TargetFramework>net9.0</TargetFramework>
77
<RootNamespace>ASECII</RootNamespace>
88
<AssemblyName>ASECII</AssemblyName>
@@ -61,6 +61,21 @@
6161
</Reference>
6262
</ItemGroup>
6363

64+
<ItemGroup>
65+
<Compile Update="Properties\Resources.Designer.cs">
66+
<DesignTime>True</DesignTime>
67+
<AutoGen>True</AutoGen>
68+
<DependentUpon>Resources.resx</DependentUpon>
69+
</Compile>
70+
</ItemGroup>
71+
72+
<ItemGroup>
73+
<EmbeddedResource Update="Properties\Resources.resx">
74+
<Generator>ResXFileCodeGenerator</Generator>
75+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
76+
</EmbeddedResource>
77+
</ItemGroup>
78+
6479
<ItemGroup>
6580
<None Update="Content\IBMCGA+.font">
6681
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

ASECII/Game.cs

+13-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
using SadConsole;
66
using SadConsole.UI;
77
using System.Diagnostics;
8+
using System;
9+
using System.Reflection;
810

911
namespace ASECII {
1012
public class Program {
@@ -19,30 +21,32 @@ private static void Main(string[] args) {
1921
//SadConsole.Settings.UnlimitedFPS = true;
2022
SadConsole.Settings.UseDefaultExtendedFont = true;
2123
Settings.WindowTitle = "ASECII";
22-
SadConsole.Game.Create(width, height, "Content/IBMCGA+.font", (args, k) => { });
24+
25+
SadConsole.Game.Create(width, height, $"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}/Content/IBMCGA+.font", (args, k) => { });
2326
SadConsole.Game.Instance.Started +=
2427
(a, k) => Init(args is [{ } path] ? path.Replace("\"", "") : null);
2528
SadConsole.Game.Instance.Run();
2629
SadConsole.Game.Instance.Dispose();
27-
}
30+
}
2831
private static void Init(string path = null) {
29-
if(path != null) {
32+
if(path != null) {
3033
Debug.WriteLine($"Opening {path}");
3134
var model = ASECIILoader.DeserializeObject<SpriteModel>(File.ReadAllText(path));
35+
if(model.filepath != path) {
36+
model.filepath = path;
37+
model.Save(null);
38+
}
3239
model.OnLoad();
3340
Game.Instance.Screen = new EditorMain(width, height, model);
3441
return;
3542
}
36-
3743
if(LoadState()) {
3844
return;
3945
}
40-
4146
// Create your console
42-
var firstConsole = new FileMenu(width, height, new LoadMode());
43-
44-
SadConsole.Game.Instance.Screen = firstConsole;
45-
firstConsole.FocusOnMouseClick = true;
47+
var c = new FileMenu(width, height, new LoadMode());
48+
SadConsole.Game.Instance.Screen = c;
49+
c.FocusOnMouseClick = true;
4650
}
4751
public static void SaveState(ProgramState state) {
4852
if (state != null) {

ASECII/Properties/Resources.Designer.cs

+63
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ASECII/Properties/Resources.resx

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 1.3
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">1.3</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1">this is my long string</data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
[base64 mime encoded serialized .NET Framework object]
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
[base64 mime encoded string representing a byte array form of the .NET Framework object]
27+
</data>
28+
29+
There are any number of "resheader" rows that contain simple
30+
name/value pairs.
31+
32+
Each data row contains a name, and value. The row also contains a
33+
type or mimetype. Type corresponds to a .NET class that support
34+
text/value conversion through the TypeConverter architecture.
35+
Classes that don't support this are serialized and stored with the
36+
mimetype set.
37+
38+
The mimetype is used for serialized objects, and tells the
39+
ResXResourceReader how to depersist the object. This is currently not
40+
extensible. For a given mimetype the value must be set accordingly:
41+
42+
Note - application/x-microsoft.net.object.binary.base64 is the format
43+
that the ResXResourceWriter will generate, however the reader can
44+
read any of the formats listed below.
45+
46+
mimetype: application/x-microsoft.net.object.binary.base64
47+
value : The object must be serialized with
48+
: System.Serialization.Formatters.Binary.BinaryFormatter
49+
: and then encoded with base64 encoding.
50+
51+
mimetype: application/x-microsoft.net.object.soap.base64
52+
value : The object must be serialized with
53+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
54+
: and then encoded with base64 encoding.
55+
56+
mimetype: application/x-microsoft.net.object.bytearray.base64
57+
value : The object must be serialized into a byte array
58+
: using a System.ComponentModel.TypeConverter
59+
: and then encoded with base64 encoding.
60+
-->
61+
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:element name="root" msdata:IsDataSet="true">
64+
<xsd:complexType>
65+
<xsd:choice maxOccurs="unbounded">
66+
<xsd:element name="data">
67+
<xsd:complexType>
68+
<xsd:sequence>
69+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
70+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
73+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
74+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
75+
</xsd:complexType>
76+
</xsd:element>
77+
<xsd:element name="resheader">
78+
<xsd:complexType>
79+
<xsd:sequence>
80+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
81+
</xsd:sequence>
82+
<xsd:attribute name="name" type="xsd:string" use="required" />
83+
</xsd:complexType>
84+
</xsd:element>
85+
</xsd:choice>
86+
</xsd:complexType>
87+
</xsd:element>
88+
</xsd:schema>
89+
<resheader name="resmimetype">
90+
<value>text/microsoft-resx</value>
91+
</resheader>
92+
<resheader name="version">
93+
<value>1.3</value>
94+
</resheader>
95+
<resheader name="reader">
96+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
97+
</resheader>
98+
<resheader name="writer">
99+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
100+
</resheader>
101+
</root>

ASECII/SpriteMenu.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ public SpriteModel(int width, int height) {
11921192

11931193
}
11941194
public void Save(Console renderer) {
1195-
var fileName = Path.GetFileNameWithoutExtension(filepath);
1195+
var fileName = Path.GetDirectoryName(filepath) + "/" + Path.GetFileNameWithoutExtension(filepath);
11961196
File.WriteAllText($"{fileName}.asc", ASECIILoader.SerializeObject(this));
11971197
File.WriteAllText($"{fileName}.dat", JsonConvert.SerializeObject(sprite.exportData, SFileMode.settings));
11981198
var preview = sprite.preview;

0 commit comments

Comments
 (0)