Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Hoorah, my first progam. What a fucking mess.
- */
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.IO;
- namespace WindowsFormsApplication1
- {
- public partial class ARUI : Form
- {
- //Default settings for RAIL in a very ugly array. Gotta be a better way to do this.
- string[] whatToWrite = new string[] {
- /* 0 */"rail_state = {}",
- "rail_state[\"DebugLevel\"] = 50",
- "rail_state[\"AssistOptions\"] = {}",
- "rail_state[\"AssistOptions\"][\"Other\"] = \"indifferent\"",
- "rail_state[\"AssistOptions\"][\"Owner\"] = \"indifferent\"",
- /* 5 */"rail_state[\"AssistOptions\"][\"Friend\"] = \"indifferent\"",
- "rail_state[\"ActorOptions\"] = {}",
- "rail_state[\"ActorOptions\"][\"ByID\"] = {}",
- "rail_state[\"ActorOptions\"][\"Default\"] = {}",
- "rail_state[\"ActorOptions\"][\"Default\"][\"Name\"] = \"unknown\"",
- /* 10 */"rail_state[\"ActorOptions\"][\"Default\"][\"KiteDistance\"] = -1",
- "rail_state[\"ActorOptions\"][\"Default\"][\"Priority\"] = 1",
- "rail_state[\"ActorOptions\"][\"Default\"][\"KiteMode\"] = \"always\"",
- "rail_state[\"ActorOptions\"][\"Default\"][\"DefendOnly\"] = false",
- "rail_state[\"ActorOptions\"][\"ByType\"] = {}",
- /* 15 */"rail_state[\"DelayFirstAction\"] = 0",
- "rail_state[\"MobIDMode\"] = \"automatic\"",
- "rail_state[\"DefendOptions\"] = {}",
- "rail_state[\"DefendOptions\"][\"DefendWhilePassive\"] = true",
- "rail_state[\"DefendOptions\"][\"FriendThreshold\"] = 4",
- /* 20 */"rail_state[\"IdleMovement\"] = {}",
- "rail_state[\"IdleMovement\"][\"MoveType\"] = \"none\"",
- "rail_state[\"MaintainTargetsWhilePassive\"] = true",
- "rail_state[\"ProfileMark\"] = 20000",
- "rail_state[\"RunAhead\"] = false",
- /* 25 */"rail_state[\"MaxDistance\"] = 13",
- "rail_state[\"AttackWhileChasing\"] = false",
- "rail_state[\"Aggressive\"] = false",
- "rail_state[\"AutoPassive\"] = {}",
- "rail_state[\"AutoPassive\"][\"HPEnter\"] = 0",
- /* 30 */"rail_state[\"AutoPassive\"][\"OwnerSPisPercent\"] = false",
- "rail_state[\"AutoPassive\"][\"OwnerHPisPercent\"] = false",
- "rail_state[\"AutoPassive\"][\"OwnerHPEnter\"] = 0",
- "rail_state[\"AutoPassive\"][\"HPisPercent\"] = false",
- "rail_state[\"AutoPassive\"][\"SPisPercent\"] = false",
- /* 35 */"rail_state[\"AutoPassive\"][\"OwnerSPEnter\"] = 0",
- "rail_state[\"AttackAllowed\"] = true",
- "rail_state[\"SkillsAllowed\"] = true",
- "rail_state[\"DefendOnly\"] = false",
- "rail_state[\"DisableChase\"] = false",
- /* 40 */"rail_state[\"update\"] = false",
- };
- public ARUI()
- {
- InitializeComponent();
- }
- private void ApplyChanges(object sender, EventArgs e)
- {
- StreamWriter SW;
- SW = File.CreateText("RAIL_State.homu.lua");
- foreach (string x in whatToWrite)
- {
- SW.WriteLine(x);
- }
- SW.Close();
- this.Close();
- }
- // Checkbox checker that checks is the checkbox is checked
- private void boxCheckar(object sender, EventArgs e)
- {
- CheckBox box = (CheckBox)sender;
- int boxID = Convert.ToInt16(box.AccessibleName);
- if (box.Checked)
- { // Yes I know I could have used radio buttons for this but I didn't want to
- if (box == AggressiveStance)
- {
- DefendOnlyCheck.Checked = false;
- whatToWrite[boxID] = whatToWrite[boxID].Replace("false", "true");
- }
- if (box == DefendOnlyCheck)
- {
- AggressiveStance.Checked = false;
- whatToWrite[boxID] = whatToWrite[boxID].Replace("false", "true");
- }
- whatToWrite[boxID] = whatToWrite[boxID].Replace("false", "true");
- }
- else
- {
- whatToWrite[boxID] = whatToWrite[boxID].Replace("true", "false");
- }
- // for testing purposes
- InfoText.Text = whatToWrite[boxID];
- }
- // Tooltip function - remember to add it to all mouseovers... D:
- private void itxt_MouseHover(object sender, EventArgs e)
- {
- Control rawr = (Control)sender;
- InfoText.Text = rawr.AccessibleDescription;
- }
- private void readTheFile()
- {
- int counter = 0;
- string line;
- // Read the file and display it line by line.
- System.IO.StreamReader file =
- new System.IO.StreamReader("MyFile.lua");
- while ((line = file.ReadLine()) != null)
- {
- Console.WriteLine(line);
- counter++;
- }
- InfoText.Text = line;
- file.Close();
- // Suspend the screen.
- Console.ReadLine();
- }
- private void clickedOnBrowse(object sender, EventArgs e)
- {
- string[] lines = System.IO.File.ReadAllLines(@"myFile.lua");
- string[] configArr = new string[lines.Count()];
- int count = 0;
- foreach (string line in lines)
- {
- configArr[count] = "\t" + line;
- InfoText.Text = configArr[count];
- count++;
- }
- }
- public static string[] GetStringInBetween(string strBegin,
- string strEnd, string strSource,
- bool includeBegin, bool includeEnd)
- {
- string[] result = { "", "" };
- int iIndexOfBegin = strSource.IndexOf(strBegin);
- if (iIndexOfBegin != -1)
- {
- // include the Begin string if desired
- if (includeBegin)
- iIndexOfBegin -= strBegin.Length;
- strSource = strSource.Substring(iIndexOfBegin
- + strBegin.Length);
- int iEnd = strSource.IndexOf(strEnd);
- if (iEnd != -1)
- {
- // include the End string if desired
- if (includeEnd)
- iEnd += strEnd.Length;
- result[0] = strSource.Substring(0, iEnd);
- // advance beyond this segment
- if (iEnd + strEnd.Length < strSource.Length)
- result[1] = strSource.Substring(iEnd
- + strEnd.Length);
- }
- }
- else
- // stay where we are
- result[1] = strSource;
- return result;
- }
- private void browseDialog_FileOk(object sender, CancelEventArgs e)
- {
- }
- }
- }
Add Comment
Please, Sign In to add comment