Skip to content

Commit

Permalink
Initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
lehieugch68 committed Jun 11, 2021
0 parents commit dace539
Show file tree
Hide file tree
Showing 12 changed files with 765 additions and 0 deletions.
225 changes: 225 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
# The following command works for downloading when using Git for Windows:
# curl -LOf http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
#
# Download this file using PowerShell v3 under Windows with the following comand:
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
#
# or wget:
# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results
[Dd]ebug/
[Rr]elease/
x64/
[Bb]in/
[Oo]bj/
# build folder is nowadays used for build scripts and should not be ignored
#build/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# OS generated files #
.DS_Store*
Icon?

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
modulesbin/
tempbin/

# EPiServer Site file (VPP)
AppData/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# vim
*.txt~
*.swp
*.swo

# Temp files when opening LibreOffice on ubuntu
.~lock.*

# svn
.svn

# CVS - Source Control
**/CVS/

# Remainings from resolving conflicts in Source Control
*.orig

# SQL Server files
**/App_Data/*.mdf
**/App_Data/*.ldf
**/App_Data/*.sdf


#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

# =========================
# Windows detritus
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac desktop service store files
.DS_Store

# SASS Compiler cache
.sass-cache

# Visual Studio 2014 CTP
**/*.sln.ide

# Visual Studio temp something
.vs/

# dotnet stuff
project.lock.json

# VS 2015+
*.vc.vc.opendb
*.vc.db

# Rider
.idea/

# Visual Studio Code
.vscode/

# Output folder used by Webpack or other FE stuff
**/node_modules/*
**/wwwroot/*

# SpecFlow specific
*.feature.cs
*.feature.xlsx.*
*.Specs_*.html

#####
# End of core ignore list, below put you custom 'per project' settings (patterns or path)
#####
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Lê Hiếu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
25 changes: 25 additions & 0 deletions NieR-Text-Tool.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31402.337
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NieR-Text-Tool", "NieR-Text-Tool\NieR-Text-Tool.csproj", "{6EDB4357-2F91-48EE-8A54-0998F025C8C1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6EDB4357-2F91-48EE-8A54-0998F025C8C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6EDB4357-2F91-48EE-8A54-0998F025C8C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EDB4357-2F91-48EE-8A54-0998F025C8C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6EDB4357-2F91-48EE-8A54-0998F025C8C1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3E022B72-1C99-4507-83D6-CCB5420A9CA4}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions NieR-Text-Tool/App.config
Original file line number Diff line number Diff line change
@@ -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>
56 changes: 56 additions & 0 deletions NieR-Text-Tool/CSV.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Microsoft.VisualBasic.FileIO;

namespace NieR_Text_Tool
{
public static class CSV
{
public static string ToCSV(byte[] input)
{
string str = Encoding.UTF8.GetString(input);
string[] lines = str.Split(new string[] { "\r\n" }, StringSplitOptions.None);
List<string> strings = new List<string>();
for (int i = 0; i < lines.Length; i++)
{
string[] line = lines[i].Replace("\n", "<LF>").Split(new string[] { "\t" }, StringSplitOptions.None).Select(entry => $"\"{entry.Replace("\"", "\"\"")}\"").ToArray();
strings.Add(string.Join(",", line));
}
string result = string.Join("\r\n", strings.ToArray());
Dictionary<string, byte[]> gameCode = GameCode.GetGameCode();
foreach (KeyValuePair<string, byte[]> entry in gameCode)
{
result = result.Replace(Encoding.UTF8.GetString(entry.Value), entry.Key);
}
return result;
}

public static byte[] ToGameFormat(string input)
{
List<string> strings = new List<string>();
using (TextFieldParser parser = new TextFieldParser(input))
{
parser.TextFieldType = FieldType.Delimited;
parser.SetDelimiters(",");
parser.TrimWhiteSpace = false;
while (!parser.EndOfData)
{
string[] fields = parser.ReadFields();
strings.Add(string.Join("\t", fields));
}
}
string result = string.Join("\r\n", strings.ToArray());
result = result.Replace("<LF>", "\n");
Dictionary<string, byte[]> gameCode = GameCode.GetGameCode();
foreach (KeyValuePair<string, byte[]> entry in gameCode)
{
result = result.Replace(entry.Key, Encoding.UTF8.GetString(entry.Value));
}
return Encoding.UTF8.GetBytes(result);
}
}
}
Loading

0 comments on commit dace539

Please sign in to comment.