private void _generateToolTip() { string toolTip = "File not found."; if (Browser.BrowseMode == PathBrowser.BrowseModeType.Folder) { if (Filepath != null && _metaGrf != null && Directory.Exists(Filepath)) { toolTip = Filepath; } if (Filepath != null && !IOHelper.IsSystemFile(Filepath)) { toolTip = Filepath; } } else { if (Filepath != null && _metaGrf != null && _metaGrf.GetData(Filepath) != null) { if (File.Exists(Filepath)) { toolTip = Filepath; } else { TkPath path = _metaGrf.FindTkPath(Filepath); if (String.IsNullOrEmpty(path.RelativePath)) { toolTip = path.FilePath; } else { toolTip = path.FilePath + "\r\n" + path.RelativePath; } } } } _toolTip.Content = toolTip; }
public void BackupClient(string file, MultiGrfReader mGrf) { if (!SdeAppConfiguration.BackupsManagerState || !IsStarted || _backupThread.IsCrashed) { return; } if (file == null) { throw new ArgumentNullException("file"); } BackupClient(file, mGrf.GetData(file)); }
public static string GetSpritePathFromJob(MultiGrfReader grf, Job job, string spriteFormat, GenderType gender, string folder, string sprite, int level = 0) { if (sprite == PreviewHelper.SpriteNone) { return(PreviewHelper.SpriteNone); } spriteFormat = EncodingService.FromAnyToDisplayEncoding(spriteFormat); var dico = _getJobToPath(folder, gender); string subPath; Job current = job; // Remove baby jobs if (JobGroup.Baby2.Is(current.Upper)) { current = Job.Get(current.Id, JobGroup.Normal2); } if (JobGroup.Baby3.Is(current.Upper)) { current = Job.Get(current.Id, JobGroup.Normal3); } if (!dico.ContainsKey(current)) { // Find the job by its parent while (current != null) { // Remove trans jobs if (JobGroup.Trans2.Is(current.Upper)) { current = Job.Get(current.Id, JobGroup.Normal2); } if (JobGroup.Trans3.Is(current.Upper)) { current = Job.Get(current.Id, JobGroup.Normal3); } if (dico.ContainsKey(current)) { break; } if (current.Parent != null && current.Parent.Id != JobList.Novice.Id) { current = current.Parent; } else { break; } } } if (current == null || !dico.ContainsKey(current)) { subPath = job.SpriteName; } else { subPath = dico[current]; } string path = String.Format(spriteFormat, subPath); if (level == 0 && (grf.GetData(path + ".act") == null && job.Parent != null)) { if (job.Parent.Id != JobList.Novice.Id) { path = GetSpritePathFromJob(grf, job.Parent, spriteFormat, gender, folder, sprite, level + 1); if (grf.GetData(path + ".act") == null && job.Parent.Parent != null) { if (job.Parent.Parent.Id != JobList.Novice.Id) { path = GetSpritePathFromJob(grf, job.Parent.Parent, spriteFormat, gender, folder, sprite, level + 2); } } } } //if (level == 0) { // if (grf.GetData(path + ".act") == null) { // return PreviewHelper.SpriteMissing; // } //} return(path); }
private void _loadData() { try { var data1 = _multiGrf.GetData(ProjectConfiguration.SyncAccId); var data2 = _multiGrf.GetData(ProjectConfiguration.SyncAccName); var accId = new LuaParser(data1, true, p => new Lub(p).Decompile(), EncodingService.DetectEncoding(data1), EncodingService.DisplayEncoding); var accName = new LuaParser(data2, true, p => new Lub(p).Decompile(), EncodingService.DetectEncoding(data2), EncodingService.DisplayEncoding); var accIdT = LuaHelper.GetLuaTable(accId, "ACCESSORY_IDs"); var accNameT = LuaHelper.GetLuaTable(accName, "AccNameTable"); Dictionary <int, AccessoryItem> viewIds = new Dictionary <int, AccessoryItem>(); foreach (var pair in accIdT) { int ival; if (Int32.TryParse(pair.Value, out ival)) { viewIds[ival] = new AccessoryItem { Id = ival, AccId = pair.Key }; } } int notFound = -1; foreach (var pair in accNameT) { int ival; string key = pair.Key.Replace("ACCESSORY_IDs.", "").Trim('[', ']'); var bind = viewIds.Values.FirstOrDefault(p => p.AccId == key); string texture = pair.Value.Replace("\"_", "").Trim('\"'); if (bind.Id == 0 && bind.Texture == null && bind.AccId == null) { string id = pair.Key.Trim('[', ']'); if (Int32.TryParse(id, out ival)) { bind.Texture = texture; bind.Id = ival; viewIds[bind.Id] = bind; } else { viewIds[notFound] = new AccessoryItem { Id = notFound, AccId = key, Texture = texture }; notFound--; } } else { bind.Texture = texture; viewIds[bind.Id] = bind; } } _obItems = new ObservableCollection <AccessoryItemView>(viewIds.OrderBy(p => p.Key).ToList().Select(p => new AccessoryItemView(p.Value)).ToList()); _dataGrid.ItemsSource = _obItems; _dataGrid.CanUserAddRows = true; _dataGrid.CanUserDeleteRows = true; _dataGrid.IsReadOnly = false; _dataGrid.CanUserReorderColumns = false; _dataGrid.CanUserResizeColumns = false; _dataGrid.CanUserSortColumns = true; _dataGrid.SelectionMode = Microsoft.Windows.Controls.DataGridSelectionMode.Extended; _dataGrid.SelectionUnit = Microsoft.Windows.Controls.DataGridSelectionUnit.CellOrRowHeader; _dataGrid.CanUserResizeRows = false; _dataGrid.KeyDown += new KeyEventHandler(_dataGrid_KeyDown); if (_obItems.Count > 0) { _dataGrid.ScrollIntoView(_obItems.Last()); } } catch (Exception err) { ErrorHandler.HandleException("Couldn't load the table files.", err); } }