Skip to content

Commit 3fe878a

Browse files
committed
Add project files.
1 parent da2a1a7 commit 3fe878a

28 files changed

+1407
-0
lines changed

Ray2StringEd.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29609.76
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ray2StringEd", "Ray2StringEd\Ray2StringEd.csproj", "{0AFAF13A-5951-4B29-A55A-1561B7005D6B}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{0AFAF13A-5951-4B29-A55A-1561B7005D6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{0AFAF13A-5951-4B29-A55A-1561B7005D6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{0AFAF13A-5951-4B29-A55A-1561B7005D6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{0AFAF13A-5951-4B29-A55A-1561B7005D6B}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {F52BBAE5-0EA7-46DA-BD0B-ADBD2038D186}
24+
EndGlobalSection
25+
EndGlobal

Ray2StringEd/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
5+
</startup>
6+
</configuration>

Ray2StringEd/App.xaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<Application x:Class="Ray2StringEd.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:Ray2StringEd"
5+
xmlns:converters="clr-namespace:Ray2StringEd.Converters"
6+
StartupUri="MainWindow.xaml">
7+
<Application.Resources>
8+
9+
<converters:SubtractConverter x:Key="SubtractConverter" />
10+
<converters:NotNullConverter x:Key="NotNullConverter" />
11+
12+
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
13+
<Setter Property="Padding" Value="5 2" />
14+
</Style>
15+
16+
<Style TargetType="MenuItem" x:Key="MenuBarItem">
17+
<Setter Property="Padding" Value="8 2" />
18+
</Style>
19+
20+
<Style TargetType="ListViewItem">
21+
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
22+
</Style>
23+
24+
</Application.Resources>
25+
</Application>

Ray2StringEd/App.xaml.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System.Windows;
2+
3+
namespace Ray2StringEd
4+
{
5+
/// <summary>
6+
/// Interaction logic for App.xaml
7+
/// </summary>
8+
public partial class App : Application
9+
{
10+
}
11+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows.Data;
4+
5+
namespace Ray2StringEd.Converters
6+
{
7+
public class NotNullConverter : IValueConverter
8+
{
9+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10+
{
11+
return value != null;
12+
}
13+
14+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
15+
{
16+
throw new NotImplementedException();
17+
}
18+
}
19+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Linq;
4+
using System.Windows.Data;
5+
6+
namespace Ray2StringEd.Converters
7+
{
8+
public class SubtractConverter : IMultiValueConverter
9+
{
10+
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
11+
{
12+
if (values.Length <= 0) return 0;
13+
14+
int total = 0;
15+
16+
if (values[0] is int first)
17+
{
18+
total = first;
19+
20+
foreach (object value in values.Skip(1))
21+
{
22+
if (value is int valueInt)
23+
total -= valueInt;
24+
}
25+
}
26+
27+
return total;
28+
}
29+
30+
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
31+
{
32+
throw new NotImplementedException();
33+
}
34+
}
35+
}

Ray2StringEd/FixManager.cs

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Text;
5+
6+
namespace Ray2StringEd
7+
{
8+
public class FixManager
9+
{
10+
public FixManager(string path, int offset = 0x7051F4)
11+
{
12+
Path = path;
13+
Offset = offset;
14+
}
15+
16+
private string Path { get; }
17+
private int Offset { get; }
18+
19+
public IEnumerable<FixString> ReadFix()
20+
{
21+
using (FileStream file = new FileStream(Path, FileMode.Open, FileAccess.Read))
22+
{
23+
file.Seek(Offset, SeekOrigin.Begin);
24+
25+
using (BinaryReader reader = new BinaryReader(file))
26+
{
27+
long fileLength = file.Length;
28+
long position;
29+
30+
while ((position = reader.BaseStream.Position) != fileLength)
31+
{
32+
int length = reader.ReadInt32();
33+
34+
if (length > 0x200 || length <= 0)
35+
continue;
36+
37+
byte[] bytes = reader.ReadBytes((length - 1) * 4);
38+
string text = Encoding.GetEncoding(1252).GetString(bytes).Trim('\0');
39+
40+
yield return new FixString(text, length, position);
41+
}
42+
}
43+
}
44+
}
45+
46+
public void WriteFix(IEnumerable<FixString> strings)
47+
{
48+
using (FileStream file = new FileStream(Path, FileMode.Open, FileAccess.Write))
49+
{
50+
using (BinaryWriter writer = new BinaryWriter(file))
51+
{
52+
foreach (FixString s in strings)
53+
{
54+
file.Seek(s.Offset, SeekOrigin.Begin);
55+
56+
string text = s.Text + '\0';
57+
byte[] bytes = Encoding.GetEncoding(1252).GetBytes(text);
58+
59+
writer.Write(s.DwordLength);
60+
writer.Write(bytes);
61+
62+
int freeLength = s.ByteLength - bytes.Length - 4;
63+
if (freeLength > 0)
64+
{
65+
byte[] freeBytes = new byte[freeLength];
66+
writer.Write(freeBytes);
67+
}
68+
}
69+
}
70+
}
71+
}
72+
}
73+
}

Ray2StringEd/FixString.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace Ray2StringEd
2+
{
3+
public class FixString
4+
{
5+
public FixString(string text, int dwordLength, long offset)
6+
{
7+
Text = text;
8+
DwordLength = dwordLength;
9+
Offset = offset;
10+
}
11+
12+
public string Text { get; set; }
13+
public int DwordLength { get; }
14+
public long Offset { get; }
15+
16+
public int ByteLength => DwordLength * 4;
17+
public int MaxTextLength => ByteLength - 5;
18+
}
19+
}

Ray2StringEd/FodyWeavers.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
2+
<PropertyChanged />
3+
<Costura />
4+
</Weavers>

Ray2StringEd/FodyWeavers.xsd

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
3+
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
4+
<xs:element name="Weavers">
5+
<xs:complexType>
6+
<xs:all>
7+
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
8+
<xs:complexType>
9+
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
10+
<xs:annotation>
11+
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
12+
</xs:annotation>
13+
</xs:attribute>
14+
<xs:attribute name="EventInvokerNames" type="xs:string">
15+
<xs:annotation>
16+
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
17+
</xs:annotation>
18+
</xs:attribute>
19+
<xs:attribute name="CheckForEquality" type="xs:boolean">
20+
<xs:annotation>
21+
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
22+
</xs:annotation>
23+
</xs:attribute>
24+
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
25+
<xs:annotation>
26+
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
27+
</xs:annotation>
28+
</xs:attribute>
29+
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
30+
<xs:annotation>
31+
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
32+
</xs:annotation>
33+
</xs:attribute>
34+
</xs:complexType>
35+
</xs:element>
36+
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
37+
<xs:complexType>
38+
<xs:all>
39+
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
40+
<xs:annotation>
41+
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
42+
</xs:annotation>
43+
</xs:element>
44+
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
45+
<xs:annotation>
46+
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
47+
</xs:annotation>
48+
</xs:element>
49+
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
50+
<xs:annotation>
51+
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
52+
</xs:annotation>
53+
</xs:element>
54+
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
55+
<xs:annotation>
56+
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
57+
</xs:annotation>
58+
</xs:element>
59+
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
60+
<xs:annotation>
61+
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
62+
</xs:annotation>
63+
</xs:element>
64+
</xs:all>
65+
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
66+
<xs:annotation>
67+
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
68+
</xs:annotation>
69+
</xs:attribute>
70+
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
71+
<xs:annotation>
72+
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
73+
</xs:annotation>
74+
</xs:attribute>
75+
<xs:attribute name="DisableCompression" type="xs:boolean">
76+
<xs:annotation>
77+
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
78+
</xs:annotation>
79+
</xs:attribute>
80+
<xs:attribute name="DisableCleanup" type="xs:boolean">
81+
<xs:annotation>
82+
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
83+
</xs:annotation>
84+
</xs:attribute>
85+
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
86+
<xs:annotation>
87+
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
88+
</xs:annotation>
89+
</xs:attribute>
90+
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
91+
<xs:annotation>
92+
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
93+
</xs:annotation>
94+
</xs:attribute>
95+
<xs:attribute name="ExcludeAssemblies" type="xs:string">
96+
<xs:annotation>
97+
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
98+
</xs:annotation>
99+
</xs:attribute>
100+
<xs:attribute name="IncludeAssemblies" type="xs:string">
101+
<xs:annotation>
102+
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
103+
</xs:annotation>
104+
</xs:attribute>
105+
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
106+
<xs:annotation>
107+
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
108+
</xs:annotation>
109+
</xs:attribute>
110+
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
111+
<xs:annotation>
112+
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
113+
</xs:annotation>
114+
</xs:attribute>
115+
<xs:attribute name="PreloadOrder" type="xs:string">
116+
<xs:annotation>
117+
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
118+
</xs:annotation>
119+
</xs:attribute>
120+
</xs:complexType>
121+
</xs:element>
122+
</xs:all>
123+
<xs:attribute name="VerifyAssembly" type="xs:boolean">
124+
<xs:annotation>
125+
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
126+
</xs:annotation>
127+
</xs:attribute>
128+
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
129+
<xs:annotation>
130+
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
131+
</xs:annotation>
132+
</xs:attribute>
133+
<xs:attribute name="GenerateXsd" type="xs:boolean">
134+
<xs:annotation>
135+
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
136+
</xs:annotation>
137+
</xs:attribute>
138+
</xs:complexType>
139+
</xs:element>
140+
</xs:schema>

0 commit comments

Comments
 (0)