Ejemplo n.º 1
0
        public plugin_mod_list ReadModInfo(string path)
        {
            if (!Directory.Exists(path + @"\mods\"))
            {
                MessageBox.Show("未找到mods文件夹");
                return(null);
            }
            string[]        files = Directory.GetFiles(path + @"mods\", "*.jar");
            plugin_mod_list list  = new plugin_mod_list();

            foreach (string file in files)
            {
                plugin_mod_save save = GetModsInfo(path, file);
                if (list.list.Contains(save) == false)
                {
                    list.list.Add(save);
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
 //选项卡被选择
 private void tabControl1_SelectingAsync(object sender, TabControlCancelEventArgs e)
 {
     if (e.TabPage == tabPage_serverSet)
     {
         server server = new server();
         config.SelectedObject = server.ReadMCServerConfig(server_save);
     }
     else if (e.TabPage == tabPage_serverPlugin && plugins_run == false)
     {
         plugins_run = true;
         plugins_mod plugins = new plugins_mod();
         Task.Factory.StartNew(() =>
         {
             plugin_mod_list list = plugins.ReadPluginsInfo(server_save.server_local);
             if (list != null)
             {
                 Action <int> action = (data) =>
                 {
                     listView_plugins.Items.Clear();
                     foreach (plugin_mod_save save in list.list)
                     {
                         ListViewItem test = new ListViewItem(save.name);
                         test.SubItems.Add(save.version);
                         test.SubItems.Add(save.auth);
                         test.SubItems.Add(save.file);
                         listView_plugins.Items.Add(test);
                     }
                 };
                 Invoke(action, 0);
             }
             plugins_run = false;
         });
     }
     else if (e.TabPage == tabPage_serverMod && mods_run == false)
     {
         mods_run = true;
         plugins_mod mod = new plugins_mod();
         Task.Factory.StartNew(() =>
         {
             plugin_mod_list list = mod.ReadModInfo(server_save.server_local);
             if (list != null)
             {
                 Action <int> action = (data) =>
                 {
                     listView_mods.Items.Clear();
                     foreach (plugin_mod_save save in list.list)
                     {
                         ListViewItem test = new ListViewItem(save.name);
                         test.SubItems.Add(save.version);
                         test.SubItems.Add(save.auth);
                         test.SubItems.Add(save.file);
                         listView_mods.Items.Add(test);
                     }
                 };
                 Invoke(action, 0);
             }
             mods_run = false;
         });
     }
     else if (e.TabPage == tabPage_serverTask)
     {
         Task.Factory.StartNew(() =>
         {
             server server = new server();
             server.ReadTaskInfo(server_save);
         });
     }
 }