update bdinfo portable targeting
This commit is contained in:
parent
fd04fddca0
commit
b5673f4e16
|
@ -2,7 +2,7 @@
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{88AE38DF-19D7-406F-A6A9-09527719A21E}</ProjectGuid>
|
<ProjectGuid>{88AE38DF-19D7-406F-A6A9-09527719A21E}</ProjectGuid>
|
||||||
|
@ -13,9 +13,8 @@
|
||||||
<DefaultLanguage>en-US</DefaultLanguage>
|
<DefaultLanguage>en-US</DefaultLanguage>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
<TargetFrameworkProfile>
|
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
|
||||||
</TargetFrameworkProfile>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
@ -61,6 +60,12 @@
|
||||||
<Compile Include="TSStreamClipFile.cs" />
|
<Compile Include="TSStreamClipFile.cs" />
|
||||||
<Compile Include="TSStreamFile.cs" />
|
<Compile Include="TSStreamFile.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
|
||||||
|
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
|
||||||
|
<Name>MediaBrowser.Model</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
107
BDInfo/BDROM.cs
107
BDInfo/BDROM.cs
|
@ -20,19 +20,22 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.TextEncoding;
|
||||||
|
|
||||||
namespace BDInfo
|
namespace BDInfo
|
||||||
{
|
{
|
||||||
public class BDROM
|
public class BDROM
|
||||||
{
|
{
|
||||||
public DirectoryInfo DirectoryRoot = null;
|
public FileSystemMetadata DirectoryRoot = null;
|
||||||
public DirectoryInfo DirectoryBDMV = null;
|
public FileSystemMetadata DirectoryBDMV = null;
|
||||||
public DirectoryInfo DirectoryBDJO = null;
|
public FileSystemMetadata DirectoryBDJO = null;
|
||||||
public DirectoryInfo DirectoryCLIPINF = null;
|
public FileSystemMetadata DirectoryCLIPINF = null;
|
||||||
public DirectoryInfo DirectoryPLAYLIST = null;
|
public FileSystemMetadata DirectoryPLAYLIST = null;
|
||||||
public DirectoryInfo DirectorySNP = null;
|
public FileSystemMetadata DirectorySNP = null;
|
||||||
public DirectoryInfo DirectorySSIF = null;
|
public FileSystemMetadata DirectorySSIF = null;
|
||||||
public DirectoryInfo DirectorySTREAM = null;
|
public FileSystemMetadata DirectorySTREAM = null;
|
||||||
|
|
||||||
public string VolumeLabel = null;
|
public string VolumeLabel = null;
|
||||||
public ulong Size = 0;
|
public ulong Size = 0;
|
||||||
|
@ -43,6 +46,8 @@ namespace BDInfo
|
||||||
public bool Is3D = false;
|
public bool Is3D = false;
|
||||||
public bool Is50Hz = false;
|
public bool Is50Hz = false;
|
||||||
|
|
||||||
|
private readonly IFileSystem _fileSystem;
|
||||||
|
|
||||||
public Dictionary<string, TSPlaylistFile> PlaylistFiles =
|
public Dictionary<string, TSPlaylistFile> PlaylistFiles =
|
||||||
new Dictionary<string, TSPlaylistFile>();
|
new Dictionary<string, TSPlaylistFile>();
|
||||||
public Dictionary<string, TSStreamClipFile> StreamClipFiles =
|
public Dictionary<string, TSStreamClipFile> StreamClipFiles =
|
||||||
|
@ -70,8 +75,9 @@ namespace BDInfo
|
||||||
public event OnPlaylistFileScanError PlaylistFileScanError;
|
public event OnPlaylistFileScanError PlaylistFileScanError;
|
||||||
|
|
||||||
public BDROM(
|
public BDROM(
|
||||||
string path)
|
string path, IFileSystem fileSystem, IEncoding textEncoding)
|
||||||
{
|
{
|
||||||
|
_fileSystem = fileSystem;
|
||||||
//
|
//
|
||||||
// Locate BDMV directories.
|
// Locate BDMV directories.
|
||||||
//
|
//
|
||||||
|
@ -85,7 +91,7 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryRoot =
|
DirectoryRoot =
|
||||||
DirectoryBDMV.Parent;
|
_fileSystem.GetDirectoryInfo(Path.GetDirectoryName(DirectoryBDMV.FullName));
|
||||||
DirectoryBDJO =
|
DirectoryBDJO =
|
||||||
GetDirectory("BDJO", DirectoryBDMV, 0);
|
GetDirectory("BDJO", DirectoryBDMV, 0);
|
||||||
DirectoryCLIPINF =
|
DirectoryCLIPINF =
|
||||||
|
@ -126,24 +132,24 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DirectoryBDJO != null &&
|
if (DirectoryBDJO != null &&
|
||||||
DirectoryBDJO.GetFiles().Length > 0)
|
_fileSystem.GetFiles(DirectoryBDJO.FullName).Any())
|
||||||
{
|
{
|
||||||
IsBDJava = true;
|
IsBDJava = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DirectorySNP != null &&
|
if (DirectorySNP != null &&
|
||||||
(DirectorySNP.GetFiles("*.mnv").Length > 0 || DirectorySNP.GetFiles("*.MNV").Length > 0))
|
GetFiles(DirectorySNP.FullName, ".mnv").Any())
|
||||||
{
|
{
|
||||||
IsPSP = true;
|
IsPSP = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DirectorySSIF != null &&
|
if (DirectorySSIF != null &&
|
||||||
DirectorySSIF.GetFiles().Length > 0)
|
_fileSystem.GetFiles(DirectorySSIF.FullName).Any())
|
||||||
{
|
{
|
||||||
Is3D = true;
|
Is3D = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (File.Exists(Path.Combine(DirectoryRoot.FullName, "FilmIndex.xml")))
|
if (_fileSystem.FileExists(Path.Combine(DirectoryRoot.FullName, "FilmIndex.xml")))
|
||||||
{
|
{
|
||||||
IsDBOX = true;
|
IsDBOX = true;
|
||||||
}
|
}
|
||||||
|
@ -154,54 +160,38 @@ namespace BDInfo
|
||||||
|
|
||||||
if (DirectoryPLAYLIST != null)
|
if (DirectoryPLAYLIST != null)
|
||||||
{
|
{
|
||||||
FileInfo[] files = DirectoryPLAYLIST.GetFiles("*.mpls");
|
FileSystemMetadata[] files = GetFiles(DirectoryPLAYLIST.FullName, ".mpls").ToArray();
|
||||||
if (files.Length == 0)
|
foreach (FileSystemMetadata file in files)
|
||||||
{
|
|
||||||
files = DirectoryPLAYLIST.GetFiles("*.MPLS");
|
|
||||||
}
|
|
||||||
foreach (FileInfo file in files)
|
|
||||||
{
|
{
|
||||||
PlaylistFiles.Add(
|
PlaylistFiles.Add(
|
||||||
file.Name.ToUpper(), new TSPlaylistFile(this, file));
|
file.Name.ToUpper(), new TSPlaylistFile(this, file, _fileSystem, textEncoding));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DirectorySTREAM != null)
|
if (DirectorySTREAM != null)
|
||||||
{
|
{
|
||||||
FileInfo[] files = DirectorySTREAM.GetFiles("*.m2ts");
|
FileSystemMetadata[] files = GetFiles(DirectorySTREAM.FullName, ".m2ts").ToArray();
|
||||||
if (files.Length == 0)
|
foreach (FileSystemMetadata file in files)
|
||||||
{
|
|
||||||
files = DirectoryPLAYLIST.GetFiles("*.M2TS");
|
|
||||||
}
|
|
||||||
foreach (FileInfo file in files)
|
|
||||||
{
|
{
|
||||||
StreamFiles.Add(
|
StreamFiles.Add(
|
||||||
file.Name.ToUpper(), new TSStreamFile(file));
|
file.Name.ToUpper(), new TSStreamFile(file, _fileSystem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DirectoryCLIPINF != null)
|
if (DirectoryCLIPINF != null)
|
||||||
{
|
{
|
||||||
FileInfo[] files = DirectoryCLIPINF.GetFiles("*.clpi");
|
FileSystemMetadata[] files = GetFiles(DirectoryCLIPINF.FullName, ".clpi").ToArray();
|
||||||
if (files.Length == 0)
|
foreach (FileSystemMetadata file in files)
|
||||||
{
|
|
||||||
files = DirectoryPLAYLIST.GetFiles("*.CLPI");
|
|
||||||
}
|
|
||||||
foreach (FileInfo file in files)
|
|
||||||
{
|
{
|
||||||
StreamClipFiles.Add(
|
StreamClipFiles.Add(
|
||||||
file.Name.ToUpper(), new TSStreamClipFile(file));
|
file.Name.ToUpper(), new TSStreamClipFile(file, _fileSystem, textEncoding));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DirectorySSIF != null)
|
if (DirectorySSIF != null)
|
||||||
{
|
{
|
||||||
FileInfo[] files = DirectorySSIF.GetFiles("*.ssif");
|
FileSystemMetadata[] files = GetFiles(DirectorySSIF.FullName, ".ssif").ToArray();
|
||||||
if (files.Length == 0)
|
foreach (FileSystemMetadata file in files)
|
||||||
{
|
|
||||||
files = DirectorySSIF.GetFiles("*.SSIF");
|
|
||||||
}
|
|
||||||
foreach (FileInfo file in files)
|
|
||||||
{
|
{
|
||||||
InterleavedFiles.Add(
|
InterleavedFiles.Add(
|
||||||
file.Name.ToUpper(), new TSInterleavedFile(file));
|
file.Name.ToUpper(), new TSInterleavedFile(file));
|
||||||
|
@ -209,6 +199,11 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IEnumerable<FileSystemMetadata> GetFiles(string path, string extension)
|
||||||
|
{
|
||||||
|
return _fileSystem.GetFiles(path).Where(i => string.Equals(i.Extension, extension, StringComparison.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
|
||||||
public void Scan()
|
public void Scan()
|
||||||
{
|
{
|
||||||
List<TSStreamClipFile> errorStreamClipFiles = new List<TSStreamClipFile>();
|
List<TSStreamClipFile> errorStreamClipFiles = new List<TSStreamClipFile>();
|
||||||
|
@ -328,10 +323,10 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DirectoryInfo GetDirectoryBDMV(
|
private FileSystemMetadata GetDirectoryBDMV(
|
||||||
string path)
|
string path)
|
||||||
{
|
{
|
||||||
DirectoryInfo dir = new DirectoryInfo(path);
|
FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path);
|
||||||
|
|
||||||
while (dir != null)
|
while (dir != null)
|
||||||
{
|
{
|
||||||
|
@ -339,21 +334,21 @@ namespace BDInfo
|
||||||
{
|
{
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
dir = dir.Parent;
|
dir = _fileSystem.GetDirectoryInfo(Path.GetDirectoryName(dir.FullName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDirectory("BDMV", new DirectoryInfo(path), 0);
|
return GetDirectory("BDMV", _fileSystem.GetDirectoryInfo(path), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DirectoryInfo GetDirectory(
|
private FileSystemMetadata GetDirectory(
|
||||||
string name,
|
string name,
|
||||||
DirectoryInfo dir,
|
FileSystemMetadata dir,
|
||||||
int searchDepth)
|
int searchDepth)
|
||||||
{
|
{
|
||||||
if (dir != null)
|
if (dir != null)
|
||||||
{
|
{
|
||||||
DirectoryInfo[] children = dir.GetDirectories();
|
FileSystemMetadata[] children = _fileSystem.GetDirectories(dir.FullName).ToArray();
|
||||||
foreach (DirectoryInfo child in children)
|
foreach (FileSystemMetadata child in children)
|
||||||
{
|
{
|
||||||
if (child.Name == name)
|
if (child.Name == name)
|
||||||
{
|
{
|
||||||
|
@ -362,7 +357,7 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
if (searchDepth > 0)
|
if (searchDepth > 0)
|
||||||
{
|
{
|
||||||
foreach (DirectoryInfo child in children)
|
foreach (FileSystemMetadata child in children)
|
||||||
{
|
{
|
||||||
GetDirectory(
|
GetDirectory(
|
||||||
name, child, searchDepth - 1);
|
name, child, searchDepth - 1);
|
||||||
|
@ -372,14 +367,14 @@ namespace BDInfo
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long GetDirectorySize(DirectoryInfo directoryInfo)
|
private long GetDirectorySize(FileSystemMetadata directoryInfo)
|
||||||
{
|
{
|
||||||
long size = 0;
|
long size = 0;
|
||||||
|
|
||||||
//if (!ExcludeDirs.Contains(directoryInfo.Name.ToUpper())) // TODO: Keep?
|
//if (!ExcludeDirs.Contains(directoryInfo.Name.ToUpper())) // TODO: Keep?
|
||||||
{
|
{
|
||||||
FileInfo[] pathFiles = directoryInfo.GetFiles();
|
FileSystemMetadata[] pathFiles = _fileSystem.GetFiles(directoryInfo.FullName).ToArray();
|
||||||
foreach (FileInfo pathFile in pathFiles)
|
foreach (FileSystemMetadata pathFile in pathFiles)
|
||||||
{
|
{
|
||||||
if (pathFile.Extension.ToUpper() == ".SSIF")
|
if (pathFile.Extension.ToUpper() == ".SSIF")
|
||||||
{
|
{
|
||||||
|
@ -388,8 +383,8 @@ namespace BDInfo
|
||||||
size += pathFile.Length;
|
size += pathFile.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryInfo[] pathChildren = directoryInfo.GetDirectories();
|
FileSystemMetadata[] pathChildren = _fileSystem.GetDirectories(directoryInfo.FullName).ToArray();
|
||||||
foreach (DirectoryInfo pathChild in pathChildren)
|
foreach (FileSystemMetadata pathChild in pathChildren)
|
||||||
{
|
{
|
||||||
size += GetDirectorySize(pathChild);
|
size += GetDirectorySize(pathChild);
|
||||||
}
|
}
|
||||||
|
@ -398,7 +393,7 @@ namespace BDInfo
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetVolumeLabel(DirectoryInfo dir)
|
private string GetVolumeLabel(FileSystemMetadata dir)
|
||||||
{
|
{
|
||||||
return dir.Name;
|
return dir.Name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ namespace BDInfo
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
/// <devdoc>
|
/// <devdoc>
|
||||||
/// <para>Provides a simple light bit vector with easy integer or Boolean access to
|
/// <para>Provides a simple light bit vector with easy integer or Boolean access to
|
||||||
|
@ -69,11 +68,6 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
#if DEBUG
|
|
||||||
if ((value & section.Mask) != value) {
|
|
||||||
Debug.Fail("Value out of bounds on BitVector32 Section Set!");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
value <<= section.Offset;
|
value <<= section.Offset;
|
||||||
int offsetMask = (0xFFFF & (int)section.Mask) << section.Offset;
|
int offsetMask = (0xFFFF & (int)section.Mask) << section.Offset;
|
||||||
data = (data & ~(uint)offsetMask) | ((uint)value & (uint)offsetMask);
|
data = (data & ~(uint)offsetMask) | ((uint)value & (uint)offsetMask);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
|
||||||
// TODO: Do more interesting things here...
|
// TODO: Do more interesting things here...
|
||||||
|
|
||||||
|
@ -25,10 +26,10 @@ namespace BDInfo
|
||||||
{
|
{
|
||||||
public class TSInterleavedFile
|
public class TSInterleavedFile
|
||||||
{
|
{
|
||||||
public FileInfo FileInfo = null;
|
public FileSystemMetadata FileInfo = null;
|
||||||
public string Name = null;
|
public string Name = null;
|
||||||
|
|
||||||
public TSInterleavedFile(FileInfo fileInfo)
|
public TSInterleavedFile(FileSystemMetadata fileInfo)
|
||||||
{
|
{
|
||||||
FileInfo = fileInfo;
|
FileInfo = fileInfo;
|
||||||
Name = fileInfo.Name.ToUpper();
|
Name = fileInfo.Name.ToUpper();
|
||||||
|
|
|
@ -22,12 +22,16 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.TextEncoding;
|
||||||
|
|
||||||
namespace BDInfo
|
namespace BDInfo
|
||||||
{
|
{
|
||||||
public class TSPlaylistFile
|
public class TSPlaylistFile
|
||||||
{
|
{
|
||||||
private FileInfo FileInfo = null;
|
private readonly IFileSystem _fileSystem;
|
||||||
|
private readonly IEncoding _textEncoding;
|
||||||
|
private FileSystemMetadata FileInfo = null;
|
||||||
public string FileType = null;
|
public string FileType = null;
|
||||||
public bool IsInitialized = false;
|
public bool IsInitialized = false;
|
||||||
public string Name = null;
|
public string Name = null;
|
||||||
|
@ -63,20 +67,24 @@ namespace BDInfo
|
||||||
|
|
||||||
public TSPlaylistFile(
|
public TSPlaylistFile(
|
||||||
BDROM bdrom,
|
BDROM bdrom,
|
||||||
FileInfo fileInfo)
|
FileSystemMetadata fileInfo, IFileSystem fileSystem, IEncoding textEncoding)
|
||||||
{
|
{
|
||||||
BDROM = bdrom;
|
BDROM = bdrom;
|
||||||
FileInfo = fileInfo;
|
FileInfo = fileInfo;
|
||||||
|
_fileSystem = fileSystem;
|
||||||
|
_textEncoding = textEncoding;
|
||||||
Name = fileInfo.Name.ToUpper();
|
Name = fileInfo.Name.ToUpper();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TSPlaylistFile(
|
public TSPlaylistFile(
|
||||||
BDROM bdrom,
|
BDROM bdrom,
|
||||||
string name,
|
string name,
|
||||||
List<TSStreamClip> clips)
|
List<TSStreamClip> clips, IFileSystem fileSystem, IEncoding textEncoding)
|
||||||
{
|
{
|
||||||
BDROM = bdrom;
|
BDROM = bdrom;
|
||||||
Name = name;
|
Name = name;
|
||||||
|
_fileSystem = fileSystem;
|
||||||
|
_textEncoding = textEncoding;
|
||||||
IsCustom = true;
|
IsCustom = true;
|
||||||
foreach (TSStreamClip clip in clips)
|
foreach (TSStreamClip clip in clips)
|
||||||
{
|
{
|
||||||
|
@ -221,7 +229,7 @@ namespace BDInfo
|
||||||
Dictionary<string, TSStreamFile> streamFiles,
|
Dictionary<string, TSStreamFile> streamFiles,
|
||||||
Dictionary<string, TSStreamClipFile> streamClipFiles)
|
Dictionary<string, TSStreamClipFile> streamClipFiles)
|
||||||
{
|
{
|
||||||
FileStream fileStream = null;
|
Stream fileStream = null;
|
||||||
BinaryReader fileReader = null;
|
BinaryReader fileReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -229,7 +237,7 @@ namespace BDInfo
|
||||||
Streams.Clear();
|
Streams.Clear();
|
||||||
StreamClips.Clear();
|
StreamClips.Clear();
|
||||||
|
|
||||||
fileStream = File.OpenRead(FileInfo.FullName);
|
fileStream = _fileSystem.OpenRead(FileInfo.FullName);
|
||||||
fileReader = new BinaryReader(fileStream);
|
fileReader = new BinaryReader(fileStream);
|
||||||
|
|
||||||
byte[] data = new byte[fileStream.Length];
|
byte[] data = new byte[fileStream.Length];
|
||||||
|
@ -1239,7 +1247,7 @@ namespace BDInfo
|
||||||
ref int pos)
|
ref int pos)
|
||||||
{
|
{
|
||||||
string val =
|
string val =
|
||||||
ASCIIEncoding.ASCII.GetString(data, pos, count);
|
_textEncoding.GetASCIIString(data, pos, count);
|
||||||
|
|
||||||
pos += count;
|
pos += count;
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,16 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.TextEncoding;
|
||||||
|
|
||||||
namespace BDInfo
|
namespace BDInfo
|
||||||
{
|
{
|
||||||
public class TSStreamClipFile
|
public class TSStreamClipFile
|
||||||
{
|
{
|
||||||
public FileInfo FileInfo = null;
|
private readonly IFileSystem _fileSystem;
|
||||||
|
private readonly IEncoding _textEncoding;
|
||||||
|
public FileSystemMetadata FileInfo = null;
|
||||||
public string FileType = null;
|
public string FileType = null;
|
||||||
public bool IsValid = false;
|
public bool IsValid = false;
|
||||||
public string Name = null;
|
public string Name = null;
|
||||||
|
@ -36,15 +40,17 @@ namespace BDInfo
|
||||||
new Dictionary<ushort,TSStream>();
|
new Dictionary<ushort,TSStream>();
|
||||||
|
|
||||||
public TSStreamClipFile(
|
public TSStreamClipFile(
|
||||||
FileInfo fileInfo)
|
FileSystemMetadata fileInfo, IFileSystem fileSystem, IEncoding textEncoding)
|
||||||
{
|
{
|
||||||
FileInfo = fileInfo;
|
FileInfo = fileInfo;
|
||||||
|
_fileSystem = fileSystem;
|
||||||
|
_textEncoding = textEncoding;
|
||||||
Name = fileInfo.Name.ToUpper();
|
Name = fileInfo.Name.ToUpper();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Scan()
|
public void Scan()
|
||||||
{
|
{
|
||||||
FileStream fileStream = null;
|
Stream fileStream = null;
|
||||||
BinaryReader fileReader = null;
|
BinaryReader fileReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -55,7 +61,7 @@ namespace BDInfo
|
||||||
#endif
|
#endif
|
||||||
Streams.Clear();
|
Streams.Clear();
|
||||||
|
|
||||||
fileStream = File.OpenRead(FileInfo.FullName);
|
fileStream = _fileSystem.OpenRead(FileInfo.FullName);
|
||||||
fileReader = new BinaryReader(fileStream);
|
fileReader = new BinaryReader(fileStream);
|
||||||
|
|
||||||
byte[] data = new byte[fileStream.Length];
|
byte[] data = new byte[fileStream.Length];
|
||||||
|
@ -64,7 +70,7 @@ namespace BDInfo
|
||||||
byte[] fileType = new byte[8];
|
byte[] fileType = new byte[8];
|
||||||
Array.Copy(data, 0, fileType, 0, fileType.Length);
|
Array.Copy(data, 0, fileType, 0, fileType.Length);
|
||||||
|
|
||||||
FileType = ASCIIEncoding.ASCII.GetString(fileType);
|
FileType = _textEncoding.GetASCIIString(fileType, 0, fileType.Length);
|
||||||
if (FileType != "HDMV0100" &&
|
if (FileType != "HDMV0100" &&
|
||||||
FileType != "HDMV0200")
|
FileType != "HDMV0200")
|
||||||
{
|
{
|
||||||
|
@ -161,7 +167,7 @@ namespace BDInfo
|
||||||
Array.Copy(clipData, streamOffset + 3,
|
Array.Copy(clipData, streamOffset + 3,
|
||||||
languageBytes, 0, languageBytes.Length);
|
languageBytes, 0, languageBytes.Length);
|
||||||
string languageCode =
|
string languageCode =
|
||||||
ASCIIEncoding.ASCII.GetString(languageBytes);
|
_textEncoding.GetASCIIString(languageBytes, 0, languageBytes.Length);
|
||||||
|
|
||||||
TSChannelLayout channelLayout = (TSChannelLayout)
|
TSChannelLayout channelLayout = (TSChannelLayout)
|
||||||
(clipData[streamOffset + 2] >> 4);
|
(clipData[streamOffset + 2] >> 4);
|
||||||
|
@ -192,7 +198,7 @@ namespace BDInfo
|
||||||
Array.Copy(clipData, streamOffset + 2,
|
Array.Copy(clipData, streamOffset + 2,
|
||||||
languageBytes, 0, languageBytes.Length);
|
languageBytes, 0, languageBytes.Length);
|
||||||
string languageCode =
|
string languageCode =
|
||||||
ASCIIEncoding.ASCII.GetString(languageBytes);
|
_textEncoding.GetASCIIString(languageBytes, 0, languageBytes.Length);
|
||||||
|
|
||||||
stream = new TSGraphicsStream();
|
stream = new TSGraphicsStream();
|
||||||
stream.LanguageCode = languageCode;
|
stream.LanguageCode = languageCode;
|
||||||
|
@ -212,7 +218,7 @@ namespace BDInfo
|
||||||
Array.Copy(clipData, streamOffset + 3,
|
Array.Copy(clipData, streamOffset + 3,
|
||||||
languageBytes, 0, languageBytes.Length);
|
languageBytes, 0, languageBytes.Length);
|
||||||
string languageCode =
|
string languageCode =
|
||||||
ASCIIEncoding.ASCII.GetString(languageBytes);
|
_textEncoding.GetASCIIString(languageBytes, 0, languageBytes.Length);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Debug.WriteLine(string.Format(
|
Debug.WriteLine(string.Format(
|
||||||
"\t{0} {1} {2}",
|
"\t{0} {1} {2}",
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
|
||||||
namespace BDInfo
|
namespace BDInfo
|
||||||
{
|
{
|
||||||
|
@ -152,7 +153,7 @@ namespace BDInfo
|
||||||
|
|
||||||
public class TSStreamFile
|
public class TSStreamFile
|
||||||
{
|
{
|
||||||
public FileInfo FileInfo = null;
|
public FileSystemMetadata FileInfo = null;
|
||||||
public string Name = null;
|
public string Name = null;
|
||||||
public long Size = 0;
|
public long Size = 0;
|
||||||
public double Length = 0;
|
public double Length = 0;
|
||||||
|
@ -170,9 +171,12 @@ namespace BDInfo
|
||||||
|
|
||||||
private List<TSPlaylistFile> Playlists = null;
|
private List<TSPlaylistFile> Playlists = null;
|
||||||
|
|
||||||
public TSStreamFile(FileInfo fileInfo)
|
private readonly IFileSystem _fileSystem;
|
||||||
|
|
||||||
|
public TSStreamFile(FileSystemMetadata fileInfo, IFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
FileInfo = fileInfo;
|
FileInfo = fileInfo;
|
||||||
|
_fileSystem = fileSystem;
|
||||||
Name = fileInfo.Name.ToUpper();
|
Name = fileInfo.Name.ToUpper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,7 +455,7 @@ namespace BDInfo
|
||||||
|
|
||||||
Playlists = playlists;
|
Playlists = playlists;
|
||||||
int dataSize = 16384;
|
int dataSize = 16384;
|
||||||
FileStream fileStream = null;
|
Stream fileStream = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string fileName;
|
string fileName;
|
||||||
|
@ -464,12 +468,12 @@ namespace BDInfo
|
||||||
{
|
{
|
||||||
fileName = FileInfo.FullName;
|
fileName = FileInfo.FullName;
|
||||||
}
|
}
|
||||||
fileStream = new FileStream(
|
fileStream = _fileSystem.GetFileStream(
|
||||||
fileName,
|
fileName,
|
||||||
FileMode.Open,
|
FileOpenMode.Open,
|
||||||
FileAccess.Read,
|
FileAccessMode.Read,
|
||||||
FileShare.Read,
|
FileShareMode.Read,
|
||||||
dataSize, false);
|
false);
|
||||||
|
|
||||||
Size = 0;
|
Size = 0;
|
||||||
Length = 0;
|
Length = 0;
|
||||||
|
|
|
@ -1,16 +1,7 @@
|
||||||
{
|
{
|
||||||
"supports": {
|
"supports": {},
|
||||||
"net46.app": {},
|
"dependencies": {},
|
||||||
"uwp.10.0.app": {},
|
|
||||||
"dnxcore50.app": {}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.NETCore": "5.0.0",
|
|
||||||
"Microsoft.NETCore.Portable.Compatibility": "1.0.1"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"dotnet": {
|
".NETPortable,Version=v4.5,Profile=Profile7": {}
|
||||||
"imports": "portable-net452+win81"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
18277
BDInfo/project.lock.json
18277
BDInfo/project.lock.json
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user