Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 3 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,16 @@ root = true

[*]
charset = utf-8
end_of_line = lf
end_of_line = crlf
insert_final_newline = true
indent_style = space
indent_size = 4
tab_size = 4

[*.md]
end_of_line = crlf

[*.sln]
end_of_line = crlf

[*.csproj]
end_of_line = crlf
[*.sh]
end_of_line = lf

[*.cs]
end_of_line = lf
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/format-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Format code
on:
push:
pull_request:
jobs:
format-code:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download formatting tool
run: dotnet tool install -g dotnet-format
- name: Format source code
run: |
export PATH="$PATH:/github/home/.dotnet/tools"
dotnet format
- name: Check if files have been modified
id: git-check
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)
- name: Push changes
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'Formatting bot'
git config --global user.email 'xeeynamo@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "Format code"
git push
40 changes: 20 additions & 20 deletions IteEditor/IteEntry.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OpenKh.Bbs.SystemData;

namespace OpenKh.Tools.IteEditor
{
public partial class IteEntry : UserControl
{
public IteEntry()
{
InitializeComponent();
ItemComboBox.DataSource = Enum.GetValues(typeof(Item.Type));
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OpenKh.Bbs.SystemData;
namespace OpenKh.Tools.IteEditor
{
public partial class IteEntry : UserControl
{
public IteEntry()
{
InitializeComponent();
ItemComboBox.DataSource = Enum.GetValues(typeof(Item.Type));
}
}
}
186 changes: 93 additions & 93 deletions IteEditor/MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,93 +1,93 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using OpenKh.Bbs;
using OpenKh.Bbs.SystemData;

namespace OpenKh.Tools.IteEditor
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}

public Ite ite = new Ite();
Stream iteFile;

private void UpdateParameters(Ite ite)
{
int cnt = 1;
for(int i = 0; i < ite.header.WeaponDataCount; i++)
{
IteEntry itEntry = new IteEntry();
itEntry.ITE_GBox.Text = "ITC Entry " + cnt;
itEntry.ItemComboBox.SelectedItem = (Item.Type)ite.WeaponList[i].ItemID;
FlowWeapons.Controls.Add(itEntry);
cnt++;
}

for (int i = 0; i < ite.header.FlavorDataCount; i++)
{
IteEntry itEntry = new IteEntry();
itEntry.ITE_GBox.Text = "ITC Entry " + cnt;
itEntry.ItemComboBox.SelectedItem = (Item.Type)ite.FlavorList[i].ItemID;
FlowFlavors.Controls.Add(itEntry);
cnt++;
}

for (int i = 0; i < ite.header.KeyItemDataCount; i++)
{
IteEntry itEntry = new IteEntry();
itEntry.ITE_GBox.Text = "ITC Entry " + cnt;
itEntry.ItemComboBox.SelectedItem = (Item.Type)ite.KeyItemList[i].ItemID;
FlowKeyItem.Controls.Add(itEntry);
cnt++;
}

for (int i = 0; i < ite.header.KeyItemHideDataCount; i++)
{
IteEntry itEntry = new IteEntry();
itEntry.ITE_GBox.Text = "ITC Entry " + cnt;
itEntry.ItemComboBox.SelectedItem = (Item.Type)ite.KeyItemHideList[i].ItemID;
FlowKeyItemHide.Controls.Add(itEntry);
cnt++;
}

for (int i = 0; i < ite.header.SynthesisDataCount; i++)
{
IteEntry itEntry = new IteEntry();
itEntry.ITE_GBox.Text = "ITC Entry " + cnt;
itEntry.ItemComboBox.SelectedItem = (Item.Type)ite.SynthesisList[i].ItemID;
FlowSynthesis.Controls.Add(itEntry);
cnt++;
}

}

private void LoadITEButton_Click(object sender, EventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter = "Item files (*.ite)|*.ite|All files (*.*)|*.*";
DialogResult result = dialog.ShowDialog();

if (result == DialogResult.OK)
{
if (iteFile != null)
iteFile.Close();
iteFile = File.OpenRead(dialog.FileName);
ite = Ite.Read(iteFile);
UpdateParameters(ite);
//SaveITEButton.Enabled = true;
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using OpenKh.Bbs;
using OpenKh.Bbs.SystemData;
namespace OpenKh.Tools.IteEditor
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
public Ite ite = new Ite();
Stream iteFile;
private void UpdateParameters(Ite ite)
{
int cnt = 1;
for (int i = 0; i < ite.header.WeaponDataCount; i++)
{
IteEntry itEntry = new IteEntry();
itEntry.ITE_GBox.Text = "ITC Entry " + cnt;
itEntry.ItemComboBox.SelectedItem = (Item.Type)ite.WeaponList[i].ItemID;
FlowWeapons.Controls.Add(itEntry);
cnt++;
}
for (int i = 0; i < ite.header.FlavorDataCount; i++)
{
IteEntry itEntry = new IteEntry();
itEntry.ITE_GBox.Text = "ITC Entry " + cnt;
itEntry.ItemComboBox.SelectedItem = (Item.Type)ite.FlavorList[i].ItemID;
FlowFlavors.Controls.Add(itEntry);
cnt++;
}
for (int i = 0; i < ite.header.KeyItemDataCount; i++)
{
IteEntry itEntry = new IteEntry();
itEntry.ITE_GBox.Text = "ITC Entry " + cnt;
itEntry.ItemComboBox.SelectedItem = (Item.Type)ite.KeyItemList[i].ItemID;
FlowKeyItem.Controls.Add(itEntry);
cnt++;
}
for (int i = 0; i < ite.header.KeyItemHideDataCount; i++)
{
IteEntry itEntry = new IteEntry();
itEntry.ITE_GBox.Text = "ITC Entry " + cnt;
itEntry.ItemComboBox.SelectedItem = (Item.Type)ite.KeyItemHideList[i].ItemID;
FlowKeyItemHide.Controls.Add(itEntry);
cnt++;
}
for (int i = 0; i < ite.header.SynthesisDataCount; i++)
{
IteEntry itEntry = new IteEntry();
itEntry.ITE_GBox.Text = "ITC Entry " + cnt;
itEntry.ItemComboBox.SelectedItem = (Item.Type)ite.SynthesisList[i].ItemID;
FlowSynthesis.Controls.Add(itEntry);
cnt++;
}
}
private void LoadITEButton_Click(object sender, EventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter = "Item files (*.ite)|*.ite|All files (*.*)|*.*";
DialogResult result = dialog.ShowDialog();
if (result == DialogResult.OK)
{
if (iteFile != null)
iteFile.Close();
iteFile = File.OpenRead(dialog.FileName);
ite = Ite.Read(iteFile);
UpdateParameters(ite);
//SaveITEButton.Enabled = true;
}
}
}
}
46 changes: 23 additions & 23 deletions IteEditor/Program.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace OpenKh.Tools.IteEditor
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OpenKh.Tools.IteEditor
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
Loading