mirror of
https://github.com/mii443/SaveEditor.git
synced 2025-12-03 19:28:32 +00:00
途中コミット
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Converter.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\MainKt.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\SaveEditor.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\Data.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_Byte.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_Compound.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_End.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_Int.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_Long.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_Short.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_String.class
|
||||
D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\ByteConvertExtensionKt.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Converter.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\MainKt.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\SaveEditor.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\Data.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_Byte.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_Compound.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_End.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_Int.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_Long.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_Short.class;D:\Git\SaveEditor\build\classes\kotlin\main\codes\mii\SaveEditor\Types\NBT_String.class
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,2 @@
|
||||
57
|
||||
45
|
||||
73
|
||||
60
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
<EFBFBD>;<3B>)<29>)<29>)<29>"<22>!<21>!<21><17><1D><15><18><17><17><16><14><14><14><15><15><17><15><10><10><0F>
|
||||
<EFBFBD>;<3B>)<29>)<29>)<29>"<22>!<21>!<21><17><1D><15><18><17><17><16><14><14><14><15><15><17><15><10><10><0F><EFBFBD><12><0E><0E><0F><15><0F>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
24
src/main/kotlin/codes/mii/SaveEditor/ByteConvertExtension.kt
Normal file
24
src/main/kotlin/codes/mii/SaveEditor/ByteConvertExtension.kt
Normal file
@@ -0,0 +1,24 @@
|
||||
package codes.mii.SaveEditor
|
||||
|
||||
import codes.mii.SaveEditor.Types.NBT_String
|
||||
|
||||
val converter = Converter()
|
||||
|
||||
@ExperimentalUnsignedTypes
|
||||
fun ByteArray.toNBT_String(position: Int): Pair<NBT_String, Int> {
|
||||
var readingPosition = position
|
||||
|
||||
val nowByte = this[readingPosition]
|
||||
val nameLength = converter.readMultiByteHex(this, readingPosition, 2).toInt()
|
||||
readingPosition += 2
|
||||
val name = converter.byteToString(this, readingPosition, nameLength)
|
||||
readingPosition += nameLength
|
||||
|
||||
val textLength = converter.readMultiByteHex(this, readingPosition, 2).toInt()
|
||||
readingPosition += 2
|
||||
|
||||
val text = converter.byteToString(this, readingPosition, textLength)
|
||||
readingPosition += textLength
|
||||
|
||||
return NBT_String(nameLength.toByte(), name, textLength.toByte(), text) to 4 + nameLength + textLength
|
||||
}
|
||||
@@ -18,16 +18,13 @@ class Converter {
|
||||
|
||||
val nowByte = byte[readingPosition]
|
||||
var nameLength = 0
|
||||
val name = StringBuilder()
|
||||
var name = ""
|
||||
|
||||
if (nowByte != 0.toByte()) {
|
||||
nameLength = readMultiByte(byte, readingPosition, 2).toInt()
|
||||
nameLength = readMultiByteHex(byte, readingPosition, 2).toInt()
|
||||
readingPosition += 2
|
||||
|
||||
repeat(nameLength) {
|
||||
readingPosition++
|
||||
name.append(hexToAscii(byte[readingPosition].toString(16)))
|
||||
}
|
||||
name = byteToString(byte, readingPosition, nameLength)
|
||||
readingPosition += nameLength
|
||||
}
|
||||
|
||||
when (nowByte) {
|
||||
@@ -38,35 +35,28 @@ class Converter {
|
||||
|
||||
1.toByte() -> { // BYTE
|
||||
readingPosition++
|
||||
result.data.add(NBT_Byte(nameLength.toByte(), name.toString(), byte[readingPosition]))
|
||||
result.data.add(NBT_Byte(nameLength.toByte(), name, byte[readingPosition]))
|
||||
}
|
||||
|
||||
2.toByte(), 3.toByte(), 4.toByte() -> {
|
||||
val n = when(nowByte) {
|
||||
3.toByte() -> { 4 }
|
||||
4.toByte() -> { 8 }
|
||||
else -> { 2 }
|
||||
3.toByte() -> 4
|
||||
4.toByte() -> 8
|
||||
else -> 2
|
||||
}
|
||||
result.data.add(NBT_Short(nameLength.toByte(), name.toString(), readMultiByte(byte, readingPosition, n).toInt()))
|
||||
result.data.add(NBT_Short(nameLength.toByte(), name, readMultiByteHex(byte, readingPosition, n).toInt()))
|
||||
readingPosition += n
|
||||
}
|
||||
|
||||
8.toByte() -> { // STRING
|
||||
|
||||
val textLength = readMultiByte(byte, readingPosition, 2).toInt()
|
||||
readingPosition += 2
|
||||
|
||||
val text = StringBuilder()
|
||||
repeat(textLength) {
|
||||
readingPosition++
|
||||
text.append(hexToAscii(byte[readingPosition].toString(16)))
|
||||
}
|
||||
|
||||
result.data.add(NBT_String(nameLength.toByte(), name.toString(), textLength.toByte(), text.toString()))
|
||||
readingPosition -= nameLength + 2
|
||||
val res = byte.toNBT_String(readingPosition)
|
||||
readingPosition += res.second
|
||||
result.data.add(res.first)
|
||||
}
|
||||
|
||||
10.toByte() -> { // COMPOUND
|
||||
result.data.add(NBT_Compound(nameLength.toByte(), name.toString()))
|
||||
result.data.add(NBT_Compound(nameLength.toByte(), name))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +69,8 @@ class Converter {
|
||||
return result
|
||||
}
|
||||
|
||||
fun readMultiByte(byte: ByteArray, position: Int, count: Int): Long {
|
||||
@ExperimentalUnsignedTypes
|
||||
fun readMultiByteHex(byte: ByteArray, position: Int, count: Int): Long {
|
||||
var readingPosition = position
|
||||
val multiByteText = StringBuilder()
|
||||
repeat(count) {
|
||||
@@ -94,15 +85,6 @@ class Converter {
|
||||
return multiByteText.toString().toLong(16)
|
||||
}
|
||||
|
||||
fun byteToString(byte: ByteArray, readingPosition: Int) {
|
||||
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun convertFile(file: File): ByteArray? {
|
||||
return Files.readAllBytes(file.toPath())
|
||||
}
|
||||
|
||||
private fun hexToAscii(hexStr: String): String? {
|
||||
val output = StringBuilder("")
|
||||
var i = 0
|
||||
@@ -113,4 +95,21 @@ class Converter {
|
||||
}
|
||||
return output.toString()
|
||||
}
|
||||
|
||||
fun byteToString(byte: ByteArray, position: Int, count: Int): String {
|
||||
var readingPosition = position
|
||||
val name = StringBuilder()
|
||||
|
||||
repeat(count) {
|
||||
readingPosition++
|
||||
name.append(hexToAscii(byte[readingPosition].toString(16)))
|
||||
}
|
||||
|
||||
return name.toString()
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun convertFile(file: File): ByteArray? {
|
||||
return Files.readAllBytes(file.toPath())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package codes.mii.SaveEditor.Types
|
||||
|
||||
class NBT_Int_Array(override val nameLength: Byte, override val name: String) : Data {
|
||||
override val typeByte: Byte = 11
|
||||
}
|
||||
Reference in New Issue
Block a user