Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Diagnostics;
  6. using System.Drawing;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12.  
  13. namespace SiderMANAGER
  14. {
  15. public partial class Form1 : Form
  16. {
  17. public Form1()
  18. {
  19. InitializeComponent();
  20. }
  21.  
  22.  
  23.  
  24. public void reload()
  25. {
  26.  
  27.  
  28. listBox1.Items.Clear();
  29. listBox2.Items.Clear();
  30. listBox3.Items.Clear();
  31.  
  32. string[] lines = File.ReadAllLines("sider.ini");
  33.  
  34. int i = 0;
  35. foreach (string s in lines)
  36. {
  37. string ss = s;
  38. if (s.Contains("lua.module"))
  39. {
  40. if (s.StartsWith(";"))
  41. {
  42. ss = "[INACTIVE]" + s;
  43.  
  44. }
  45. listBox1.Items.Add(ss);
  46. listBox2.Items.Add(i.ToString());
  47. }
  48. i = i + 1;
  49. }
  50.  
  51.  
  52. string[] modules = Directory.GetFiles("modules", "*.lua");
  53. foreach (string s in modules)
  54. {
  55. listBox3.Items.Add(s);
  56.  
  57. }
  58.  
  59. }
  60.  
  61.  
  62.  
  63. private void Form1_Load(object sender, EventArgs e)
  64. {
  65. if (!File.Exists("sider.exe"))
  66. {
  67. MessageBox.Show("Missing sider.exe");
  68. }
  69.  
  70. else {
  71. var versionInfo = FileVersionInfo.GetVersionInfo("sider.dll");
  72. string version = versionInfo.FileVersion;
  73. svr.Text = "sider.dll version is " + version;
  74. }
  75.  
  76. reload();
  77.  
  78.  
  79.  
  80. }
  81.  
  82. private void listBox1_DoubleClick(object sender, EventArgs e)
  83. {
  84. listBox2.SelectedIndex= listBox1.SelectedIndex;
  85. List<string> quotelist = File.ReadAllLines("sider.ini").ToList();
  86. string firstItem = quotelist[0];
  87. quotelist.RemoveAt(int.Parse(listBox2.SelectedItem.ToString()));
  88. File.WriteAllLines("sider.ini", quotelist.ToArray());
  89.  
  90. reload();
  91.  
  92.  
  93. }
  94.  
  95. private void listBox3_DoubleClick(object sender, EventArgs e)
  96. {
  97. List<string> quotelist = File.ReadAllLines("sider.ini").ToList();
  98. string firstItem = quotelist[0];
  99. string name = listBox3.SelectedItem.ToString().Remove(0,8);
  100. quotelist.Insert(int.Parse(listBox2.Items[listBox2.Items.Count - 1].ToString()) + 1, "lua.module = \""+name + "\"");
  101. File.WriteAllLines("sider.ini", quotelist.ToArray());
  102.  
  103. reload();
  104. }
  105. }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement