public void TestMethod3() { var dir = @"D:\avatar_new\image"; foreach (var prof in pairs.Keys) { foreach (var part in part_array) { var file = $@"{dir}\{prof}\{part}"; var path = $"d:/avatar_ex/image/{prof}/{part}"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } var list = NpkCoder.Load(file); foreach (var img in list) { var tables = img.Tables; var match = Regex.Match(img.Name, "\\d+"); if (match.Success) { var code = int.Parse(match.Value); for (var i = 0; i < tables.Count; i++) { img.TableIndex = i; var image = img[pairs[prof]]; ImageToJson(path, prof, part, img.Name, Avatars.CompleteCode(code + i), image); } } } } } }
public void Do(params object[] args) { _array = args as Album[]; if (_array == null || _array.Length <= 0) { return; } var regex = new Regex("\\d+"); var match = regex.Match(_array[0].Name); if (!match.Success) { return; } var code = int.Parse(match.Value); var codeStr = Avatars.CompleteCode(code / 100 * 100); _album = _array[0].Clone(); _album.ConvertTo(ImgVersion.Ver6); _album.Adjust(); _album.Tables.Clear(); _album.Path = _array[0].Path.Replace(match.Value, codeStr); var max = 0; var table = new List <Color>(); foreach (var al in _array) { if (al.CurrentTable.Count > max) { max = al.CurrentTable.Count; table = al.CurrentTable; } _album.Tables.Add(al.CurrentTable); } foreach (var tl in _album.Tables) { if (tl.Count < max) { tl.AddRange(table.GetRange(tl.Count, max - tl.Count)); } } Connector.RemoveFile(_array); Connector.AddFile(false, _album); }
public void GetWeapon() { var dir = @"D:\avatar_new\image"; var prof_list = GetProfession(); foreach (var prof in prof_list) { foreach (var part in prof.WeaponNames) { var file = $"{dir}/{prof}/weapon/{part}.NPK"; var path = $"d:/avatar_ex/image/{prof}/weapon/{part}"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } var list = NpkCoder.Load(file); foreach (var img in list) { var tables = img.Tables; var match = Regex.Match(img.Name, "\\d+"); if (match.Success) { var code = int.Parse(match.Value); for (var i = 0; i < tables.Count; i++) { img.TableIndex = i; var image = img[pairs[prof.Name]]; ImageToJson(path, prof.Name, part, img.Name, Avatars.CompleteCode(code + i), image); } } } } } }