Skip to content

Commit

Permalink
Treeview is sorted, rightclick to go to wiki, entities categorized
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Nov 17, 2015
1 parent 84d5b3b commit 300ce89
Show file tree
Hide file tree
Showing 5 changed files with 502 additions and 502 deletions.
1 change: 0 additions & 1 deletion ARKcc/ARKcc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
<Content Include="entities.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="README.md" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
Binary file removed ARKcc/ARKcc.exe
Binary file not shown.
27 changes: 15 additions & 12 deletions ARKcc/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 49 additions & 25 deletions ARKcc/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public partial class Form1 : Form
private List<int> recentList = new List<int>();
private List<int> recentKindList = new List<int>();
private List<Entity> entities = new List<Entity>();
private int maxRecently = 30;
private int maxRecently = 100;

public Form1()
{
Expand All @@ -29,7 +29,7 @@ public Form1()
private void Form1_Load(object sender, EventArgs e)
{
// read entities from file
string path = @"entities.txt";
string path = "entities.txt";

// check if file exists
if (!File.Exists(path))
Expand Down Expand Up @@ -108,7 +108,10 @@ private void Form1_Load(object sender, EventArgs e)
}
if (!nodeExists)
{
nodes.Add(categories[n]);
// add new node alphabetically
int nn = 0;
while (nn < nodes.Count && String.Compare(nodes[nn].Text, categories[n], true) < 0) { nn++; }
nodes.Insert(nn, categories[n]);
break;
}
}
Expand All @@ -120,7 +123,7 @@ private void Form1_Load(object sender, EventArgs e)
if (parameters.Count() > 1)
{
int n = 1;
this.entities.Add(new Entity() { name = parameters[0].Trim(), id = parameters[1].Trim(), bp = (parameters.Count() > 2 ? parameters[2].Trim() : ""), category = String.Join("\\", categories), maxstack = (parameters.Count() > 3 ? (int.TryParse(parameters[3].Trim(), out n) ? n : 1) : 1) });
this.entities.Add(new Entity() { name = parameters[0].Trim() + (parameters[1].Trim().Length + (parameters.Count() > 2 ? parameters[2].Trim().Length : 0) == 0 ? " (NO ID OR BP GIVEN!)" : ""), id = parameters[1].Trim(), bp = (parameters.Count() > 2 ? parameters[2].Trim() : ""), category = string.Join("\\", categories), maxstack = (parameters.Count() > 3 ? (int.TryParse(parameters[3].Trim(), out n) ? n : 1) : 1) });
i++;
}
}
Expand Down Expand Up @@ -186,15 +189,18 @@ private void buttonClearCommand_Click(object sender, EventArgs e)

private void buttonCopy_Click(object sender, EventArgs e)
{
Clipboard.SetText(textBoxCommand.Text);
if (textBoxCommand.Text.Length > 0)
{
Clipboard.SetText(textBoxCommand.Text);
}
}

private string createCommand(int list, int index)
{
switch (list)
{
case 1:
return this.entities[index].id;
return (this.checkBoxAdmincheat.Checked ? "Admincheat " : "") + this.entities[index].id;
break;
case 2:
if (this.checkBoxExact.Checked)
Expand Down Expand Up @@ -242,25 +248,28 @@ private void addCommand(int list, int index)
if (eIndex >= 0)
{
string command = createCommand(list, eIndex);
string name = this.entities[eIndex].name;
this.textBoxCommand.Text += (this.textBoxCommand.Text.Length > 0 ? "|" : "") + command;
int pos = this.listBoxRecent.Items.IndexOf(name);
if (pos == -1)
if (command.Length > 0)
{
this.recentList.Insert(0, eIndex);
this.recentKindList.Insert(0, list);
this.listBoxRecent.Items.Insert(0, name);
updateRecentlyList();
}
else if (pos > 0)
{
this.recentList.RemoveAt(pos);
this.recentKindList.RemoveAt(pos);
this.listBoxRecent.Items.RemoveAt(pos);
this.recentList.Insert(0, eIndex);
this.recentKindList.Insert(0, list);
this.listBoxRecent.Items.Insert(0, name);
updateRecentlyList();
string name = this.entities[eIndex].name;
this.textBoxCommand.Text += (this.textBoxCommand.Text.Length > 0 ? "|" : "") + command;
int pos = this.listBoxRecent.Items.IndexOf(name);
if (pos == -1)
{
this.recentList.Insert(0, eIndex);
this.recentKindList.Insert(0, list);
this.listBoxRecent.Items.Insert(0, name);
updateRecentlyList();
}
else if (pos > 0)
{
this.recentList.RemoveAt(pos);
this.recentKindList.RemoveAt(pos);
this.listBoxRecent.Items.RemoveAt(pos);
this.recentList.Insert(0, eIndex);
this.recentKindList.Insert(0, list);
this.listBoxRecent.Items.Insert(0, name);
updateRecentlyList();
}
}
}
}
Expand Down Expand Up @@ -336,6 +345,21 @@ private void filterList(int list, string cats)
}
}
}


private void listBox_MouseUp(object sender, MouseEventArgs e)
{
ListBox lb = sender as ListBox;
if (lb != null)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
int index = lb.IndexFromPoint(e.Location);
if (index != System.Windows.Forms.ListBox.NoMatches)
{
System.Diagnostics.Process.Start("http://ark.gamepedia.com/" + lb.Items[index].ToString().Replace(' ', '_'));
}
}
}
}
}
}
Loading

0 comments on commit 300ce89

Please sign in to comment.