Exemplo n.º 1
0
        private void CopyFilesToAssets()
        {
            if (EngineState == null)
                return;

            foreach (var tilesheet in new List<Tilesheet>(EngineState.Tilesheets.Values))
            {
                if (tilesheet.ResourceIdentifier != null)
                    continue;

                if (Path.GetDirectoryName(tilesheet.ImageFilePath) != Path.GetDirectoryName(AssetsDirectory))
                {
                    string destFile = AssetsDirectory + Path.GetFileName(tilesheet.ImageFilePath);
                    File.Copy(tilesheet.ImageFilePath, destFile, true);
                    var tmpTilesheet = new Tilesheet(tilesheet, tilesheet.Name, destFile);      // this will replace original Tilesheet
                    this.IsDirty = true;
                }
            }

            foreach (var mediaFile in new List<MediaFile>(EngineState.MediaFiles.Values))
            {
                if (mediaFile.ResourceIdentifier != null)
                    continue;

                if (Path.GetDirectoryName(mediaFile.FileName) != Path.GetDirectoryName(AssetsDirectory))
                {
                    string destFile = AssetsDirectory + Path.GetFileName(mediaFile.FileName);
                    File.Copy(mediaFile.FileName, destFile, true);
                    var tmpMediaFile = new MediaFile(mediaFile, mediaFile.Alias, destFile, mediaFile.FileType);     // this will replace original MediaFile
                    this.IsDirty = true;
                }
            }

            foreach (var resourceFile in new List<Resource.EngineResourceFile>(EngineState.ResourceFiles))
            {
                if (Path.GetDirectoryName(resourceFile.FilePath) != Path.GetDirectoryName(AssetsDirectory))
                {
                    string sourceFile = resourceFile.FilePath;
                    string destFile = AssetsDirectory + Path.GetFileName(sourceFile);
                    string password = resourceFile.Password;
                    bool isEcnrypted = resourceFile.IsEncrypted;

                    resourceFile.Dispose();

                    File.Copy(sourceFile, destFile, true);
                    var tmpResourceFile = new Resource.EngineResourceFile(destFile, password, isEcnrypted);
                    this.IsDirty = true;
                }
            }
        }
 public EngineResourceFileIdentifier(EngineResourceFile resFile, EngineResourceFileTypes resType, string entry)
 {
     ResourceFile = resFile;
     ResourceType = resType;
     ResourceName = entry;
 }
Exemplo n.º 3
0
 public EngineResourceFileIdentifier(EngineResourceFile resFile, EngineResourceFileTypes resType, string entry)
 {
     ResourceFile = resFile;
     ResourceType = resType;
     ResourceName = entry;
 }