Пример #1
0
 void LibTable_RowChanged(object sender, DataRowChangeEventArgs e)
 {
     int SelectedIndex = dataLib.SelectedIndex;
     if (SelectedIndex == -1)
         return;
     LibTable.RowChanged -= LibTable_RowChanged;
     if (SelectedIndex > Lib.Count())
     {
         ArrayList a = new ArrayList(Lib);
         libraryies l = new libraryies();
         l.name = e.Row["name"].ToString();
         l.url = e.Row["url"].ToString();
         if (string.IsNullOrEmpty(l.url))
             l.url = null;
         a.Add(l);
         Lib = a.ToArray(typeof(libraryies)) as libraryies[];
         LibTable.RowChanged+=LibTable_RowChanged;
     }
     else
     {
         Lib[SelectedIndex].name = e.Row["name"].ToString();
         Lib[SelectedIndex].url = e.Row["url"].ToString();
         if (string.IsNullOrEmpty(Lib[SelectedIndex].url))
             Lib[SelectedIndex].url = null;
     }
     LibTable.RowChanged += LibTable_RowChanged;
     changed = true;
 }
Пример #2
0
 public FrmLibraries(libraryies[] gamelibraries)
 {
     InitializeComponent();
     this.Lib = gamelibraries.Clone() as libraryies[];
     LibTable.Columns.Add("name");
     LibTable.Columns.Add("url");
     for (int i = 0; i < gamelibraries.Count(); i++)
     {
         LibTable.Rows.Add(gamelibraries[i].name, gamelibraries[i].url);
     }
     LibTable.RowChanged += LibTable_RowChanged;
     this.dataLib.ItemsSource = LibTable.DefaultView;
 }
Пример #3
0
 /// <summary>
 /// 获取native文件的绝对路径
 /// </summary>
 /// <param name="lib"></param>
 /// <returns></returns>
 public static string BuildNativePath(libraryies lib)
 {
     var libp = new StringBuilder(Environment.CurrentDirectory + @"\.minecraft\libraries\");
     string[] split = lib.name.Split(':');//0 包;1 名字;2 版本
     libp.Append(split[0].Replace('.', '\\'));
     libp.Append("\\");
     libp.Append(split[1]).Append("\\");
     libp.Append(split[2]).Append("\\");
     libp.Append(split[1]).Append("-").Append(split[2]).Append("-").Append(lib.natives.windows);
     libp.Append(".jar");
     if (split[0] == "tv.twitch")
     {
         libp.Replace("${arch}", Environment.Is64BitOperatingSystem ? "64" : "32");
     }
     return libp.ToString();
 }
Пример #4
0
 /// <summary>
 /// 获取lib文件的绝对路径
 /// </summary>
 /// <param name="lib"></param>
 /// <returns></returns>
 public static string BuildLibPath(libraryies lib)
 {
     var libp = new StringBuilder(Environment.CurrentDirectory + @"\.minecraft\libraries\");
     string[] split = lib.name.Split(':');//0 包;1 名字;2 版本
     if (split.Count() != 3)
     {
         throw new UnSupportVersionException();
     }
     libp.Append(split[0].Replace('.', '\\'));
     libp.Append("\\");
     libp.Append(split[1]).Append("\\");
     libp.Append(split[2]).Append("\\");
     libp.Append(split[1]).Append("-");
     libp.Append(split[2]).Append(".jar");
     return libp.ToString();
 }
Пример #5
0
 private static libraryies[] MixLibraries(libraryies[] lib1, libraryies[] lib2)
 {
     return lib1.Concat(lib2).ToArray();
 }