Exemple #1
0
        private string OpenFileType(MediaFileType fileType, out EngineResourceFileTypes resFileType)
        {
            switch (fileType)
            {
            case MediaFileType.wav:
                resFileType = EngineResourceFileTypes.Audio;
                return("waveaudio");

            case MediaFileType.mid:
            case MediaFileType.midi:
                resFileType = EngineResourceFileTypes.Audio;
                return("sequencer");

            case MediaFileType.wma:             // audio
            case MediaFileType.mp3:             // audio
                resFileType = EngineResourceFileTypes.Audio;
                return("mpegvideo");

            case MediaFileType.avi:             // video
            case MediaFileType.ogg:             // video
            case MediaFileType.mpg:             // video
            case MediaFileType.mpeg:            // video
            case MediaFileType.wmv:             // video
            case MediaFileType.asx:             // video
            case MediaFileType.unknown:         // assume video
            default:
                resFileType = EngineResourceFileTypes.Video;
                return("mpegvideo");
            }
        }
Exemple #2
0
        public AssetViewer(Stream stream, EngineResourceFileTypes type, string nameTempFileAs = null)
            : this()
        {
            if (string.IsNullOrWhiteSpace(nameTempFileAs))
                nameTempFileAs = Guid.NewGuid().ToString();

            var file = string.Format("{0}\\{1}", Program.State.TempDirectory, nameTempFileAs);
            using (var fileStream = File.Create(file))
            {
                stream.Seek(0, SeekOrigin.Begin);
                stream.CopyTo(fileStream);
            }

            _file = file;
            _stream = stream;
            _type = type;

            try
            {
                DisplayAsset();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Viewing File", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #3
0
        public AssetViewer(Stream stream, EngineResourceFileTypes type, string nameTempFileAs = null)
            : this()
        {
            if (string.IsNullOrWhiteSpace(nameTempFileAs))
            {
                nameTempFileAs = Guid.NewGuid().ToString();
            }

            var file = string.Format("{0}\\{1}", Program.State.TempDirectory, nameTempFileAs);

            using (var fileStream = File.Create(file))
            {
                stream.Seek(0, SeekOrigin.Begin);
                stream.CopyTo(fileStream);
            }

            _file   = file;
            _stream = stream;
            _type   = type;

            try
            {
                DisplayAsset();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Viewing File", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void Add(EngineResourceFileTypes resType, string file)
        {
            var name = Path.GetFileNameWithoutExtension(file);

            using (var memStream = new MemoryStream())
            {
                using (var fileStream = File.OpenRead(file))
                {
                    fileStream.Position = 0;
                    fileStream.CopyTo(memStream);
                    Add(resType, name, memStream);
                }
            }
        }
Exemple #5
0
        public AssetViewer(string file, EngineResourceFileTypes type)
            : this()
        {
            _file = file;

            using (var stream = new FileStream(file, FileMode.Open))
            {
                _stream         = new MemoryStream();
                stream.Position = 0;
                stream.CopyTo(_stream);
                _type = type;
            }

            try
            {
                DisplayAsset();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Viewing File", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #6
0
        public AssetViewer(string file, EngineResourceFileTypes type)
            : this()
        {
            _file = file;

            using (var stream = new FileStream(file, FileMode.Open))
            {
                _stream = new MemoryStream();
                stream.Position = 0;
                stream.CopyTo(_stream);
                _type = type;
            }

            try
            {
                DisplayAsset();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Viewing File", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public void RemoveAll(EngineResourceFileTypes resType)
 {
     RemoveAll(resType.ToString() + "_");
 }
 public List <string> GetAllNames(EngineResourceFileTypes resType)
 {
     return(GetAllEntries(resType.ToString() + "_"));
 }
 public Stream this[EngineResourceFileTypes resType, string name]
 {
     get { return Get(resType, name); }
 }
 public void RemoveAll(EngineResourceFileTypes resType)
 {
     RemoveAll(resType.ToString() + "_");
 }
 public bool Remove(EngineResourceFileTypes resType, string name)
 {
     return Remove(resType.ToString() + "_");
 }
 public List<string> GetAllNames(EngineResourceFileTypes resType)
 {
     return GetAllEntries(resType.ToString() + "_");
 }
 public Dictionary<string, Stream> GetAll(EngineResourceFileTypes resType)
 {
     return ExtractAll(resType.ToString() + "_");
 }
 public Stream Get(EngineResourceFileTypes resType, string name)
 {
     return Extract(resType.ToString() + "_" + name);
 }
 public void Add(EngineResourceFileTypes resType, string name, Stream stream)
 {
     Zip(resType.ToString() + "_" + name, stream);
 }
 public Stream Get(EngineResourceFileTypes resType, string name)
 {
     return(Extract(resType.ToString() + "_" + name));
 }
 public Dictionary <string, Stream> GetAll(EngineResourceFileTypes resType)
 {
     return(ExtractAll(resType.ToString() + "_"));
 }
        public void Add(EngineResourceFileTypes resType, string file)
        {
            var name = Path.GetFileNameWithoutExtension(file);

            using (var memStream = new MemoryStream())
            {
                using (var fileStream = File.OpenRead(file))
                {
                    fileStream.Position = 0;
                    fileStream.CopyTo(memStream);
                    Add(resType, name, memStream);
                }
            }
        }
 public bool Remove(EngineResourceFileTypes resType, string name)
 {
     return(Remove(resType.ToString() + "_"));
 }
 public EngineResourceFileIdentifier(EngineResourceFile resFile, EngineResourceFileTypes resType, string entry)
 {
     ResourceFile = resFile;
     ResourceType = resType;
     ResourceName = entry;
 }
 public Stream this[EngineResourceFileTypes resType, string name]
 {
     get { return(Get(resType, name)); }
 }
 public EngineResourceFileIdentifier(EngineResourceFile resFile, EngineResourceFileTypes resType, string entry)
 {
     ResourceFile = resFile;
     ResourceType = resType;
     ResourceName = entry;
 }
 public void Add(EngineResourceFileTypes resType, string name, Stream stream)
 {
     Zip(resType.ToString() + "_" + name, stream);
 }
Exemple #24
0
        private string OpenFileType(MediaFileType fileType, out EngineResourceFileTypes resFileType)
        {
            switch (fileType)
            {
                case MediaFileType.wav:
                    resFileType = EngineResourceFileTypes.Audio;
                    return "waveaudio";

                case MediaFileType.mid:
                case MediaFileType.midi:
                    resFileType = EngineResourceFileTypes.Audio;
                    return "sequencer";

                case MediaFileType.wma:         // audio
                case MediaFileType.mp3:         // audio
                    resFileType = EngineResourceFileTypes.Audio;
                    return "mpegvideo";

                case MediaFileType.avi:         // video
                case MediaFileType.ogg:         // video
                case MediaFileType.mpg:         // video
                case MediaFileType.mpeg:        // video
                case MediaFileType.wmv:         // video
                case MediaFileType.asx:         // video
                case MediaFileType.unknown:     // assume video
                default:
                    resFileType = EngineResourceFileTypes.Video;
                    return "mpegvideo";
            }
        }