public TkPathView(TkPath path) { if (path == null) throw new ArgumentNullException("path"); Path = path; ImageSource image; if (path.FilePath.IsExtension(".grf")) { image = (ImageSource) ApplicationManager.PreloadResourceImage("grf-16.png"); } else if (path.FilePath.IsExtension(".gpf")) { image = (ImageSource)ApplicationManager.PreloadResourceImage("gpf-16.png"); } else if (path.FilePath.IsExtension(".rgz")) { image = (ImageSource)ApplicationManager.PreloadResourceImage("rgz-16.png"); } else { image = (ImageSource)ApplicationManager.PreloadResourceImage("folderClosed.png"); } DataImage = image; }
public void SetData(string relativePath, string dataPath) { relativePath = relativePath.ToLower(); if (File.Exists(relativePath)) { File.WriteAllBytes(relativePath, File.ReadAllBytes(dataPath)); } else if (_resourcePaths.ContainsKey(relativePath)) { TkPath path = new TkPath(_resourcePaths[relativePath]); try { if (String.IsNullOrEmpty(path.RelativePath)) { File.WriteAllBytes(path.FilePath, File.ReadAllBytes(dataPath)); } else { _openedGrfs[path.FilePath].StoreAndExecute(new AddFiles <FileEntry>(Path.GetDirectoryName(relativePath), dataPath)); } } catch (Exception err) { ErrorHandler.HandleException(err); } } }
public override FileEntry this[string fileName] { get { fileName = fileName.ToLower(); string tkPath = _grf[fileName]; if (tkPath != null) { TkPath path = new TkPath(tkPath); if (String.IsNullOrEmpty(path.RelativePath)) { FileEntry tempEntry = new FileEntry(); tempEntry.SetModificationFlags(Modification.Added); tempEntry.SourceFilePath = path.FilePath; tempEntry.Header = _header; return(tempEntry); } return(_grf.Grfs.First(p => p.FileName == path.FilePath).FileTable[path.RelativePath]); } return(null); } }
public TkPathView(TkPath path) { if (path == null) { throw new ArgumentNullException("path"); } Path = path; ImageSource image; if (path.FilePath.IsExtension(".grf")) { image = (ImageSource)ApplicationManager.PreloadResourceImage("grf-16.png"); } else if (path.FilePath.IsExtension(".gpf")) { image = (ImageSource)ApplicationManager.PreloadResourceImage("gpf-16.png"); } else if (path.FilePath.IsExtension(".rgz")) { image = (ImageSource)ApplicationManager.PreloadResourceImage("rgz-16.png"); } else { image = (ImageSource)ApplicationManager.PreloadResourceImage("folderClosed.png"); } DataImage = image; }
private byte[] _getData(TkPath path) { try { if (File.Exists(path.FilePath) && String.IsNullOrEmpty(path.RelativePath)) { return(File.ReadAllBytes(path.FilePath)); } return(_openedGrfs[path.FilePath].GetDecompressedData(_openedGrfs[path.FilePath].FileTable[path.RelativePath])); } catch (Exception) { //ErrorHandler.HandleException(err); return(null); } }
private void _items_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (_items.SelectedItem != null) { object selectedItem = _items.SelectedItem; string displayFileName = ((FileEntry)selectedItem).DisplayRelativePath; SelectedPath = _metaGrf.FindTkPath(Path.Combine(_explorerPath, displayFileName)); _wrapper.Image = ImageProvider.GetImage(_metaGrf.GetData(Path.Combine(_explorerPath, displayFileName)), Path.GetExtension(displayFileName)); _imagePreview.Tag = displayFileName; _imagePreview.Source = _wrapper.Image.Cast <BitmapSource>(); } } catch { _wrapper.Image = null; _imagePreview.Source = null; } }
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; }
private void _generateToolTip() { string toolTip = "File not found."; if (Browser.BrowseMode == PathBrowser.BrowseModeType.Folder) { if (Filepath != null && _metaGrf != null && Directory.Exists(Filepath)) { toolTip = Filepath; } } else { if (Filepath != null && _metaGrf != null && _metaGrf.GetData(Filepath) != null) { if (File.Exists(Filepath)) { toolTip = Filepath; } else { TkPath path = new TkPath(_metaGrf[Filepath]); if (String.IsNullOrEmpty(path.RelativePath)) { toolTip = path.FilePath; } else { toolTip = path.FilePath + "\r\n" + path.RelativePath; } } } } _toolTip.Content = toolTip; }
public override FileEntry this[string fileName] { get { fileName = fileName.ToLower(); string tkPath = _grf[fileName]; if (tkPath != null) { TkPath path = new TkPath(tkPath); if (String.IsNullOrEmpty(path.RelativePath)) { FileEntry tempEntry = new FileEntry(); tempEntry.SetModificationFlags(Modification.Added); tempEntry.SourceFilePath = path.FilePath; tempEntry.Header = _header; return tempEntry; } return _grf.Grfs.First(p => p.FileName == path.FilePath).FileTable[path.RelativePath]; } return null; } }
private byte[] _getData(TkPath path) { try { if (File.Exists(path.FilePath) && String.IsNullOrEmpty(path.RelativePath)) { return File.ReadAllBytes(path.FilePath); } return _openedGrfs[path.FilePath].GetDecompressedData(_openedGrfs[path.FilePath].FileTable[path.RelativePath]); } catch (Exception) { //ErrorHandler.HandleException(err); return null; } }
public void SetData(string relativePath, string dataPath) { relativePath = relativePath.ToLower(); if (File.Exists(relativePath)) { File.WriteAllBytes(relativePath, File.ReadAllBytes(dataPath)); } else if (_resourcePaths.ContainsKey(relativePath)) { TkPath path = new TkPath(_resourcePaths[relativePath]); try { if (String.IsNullOrEmpty(path.RelativePath)) { File.WriteAllBytes(path.FilePath, File.ReadAllBytes(dataPath)); } else { _openedGrfs[path.FilePath].StoreAndExecute(new AddFiles<FileEntry>(Path.GetDirectoryName(relativePath), dataPath)); } } catch (Exception err) { ErrorHandler.HandleException(err); } } }