Пример #1
0
 //
 internal ListItem(string name) : base(name)
 {
     VideoStreamInfos    = new StreamInfos(StreamInfosType.Video, this);
     AudioStreamInfos    = new StreamInfos(StreamInfosType.Audio, this);
     SubtitleStreamInfos = new StreamInfos(StreamInfosType.Subtitle, this);
     Properties          = new ListItemProperties(this);
     ContextMenuItems    = new ContextMenu(this);
     Cast         = new Actors(this);
     SeasonsInfos = new Seasons(this);
     _name        = name;
 }
Пример #2
0
 public RhoStreamInfo GetStreamInfo(uint index)
 {
     return(StreamInfos.Find(x => x.Index == index));
 }
Пример #3
0
        //Modify Functions
        //Version 1.1

        public void ModifyDataStream(string FileName, string LocalFile)
        {
            JMDPackedFileInfo fileInfo = (JMDPackedFileInfo)Array.Find(NowFolderContent, x => x.Type == ObjectType.File && ((JMDPackedFileInfo)x).FileName == FileName);

            if (fileInfo == null)
            {
                throw new FileNotFoundException($"File: {FileName} is not found in \"{NowPath}\" folder.");
            }
            int        StreamIndex = StreamInfos.FindIndex(x => x.Index == fileInfo.Index);
            FileStream fs          = new FileStream(LocalFile, FileMode.Open);

            StreamInfos[StreamIndex].StreamMode = StreamMode.Local;
            switch (fileInfo.CryptMode)
            {
            case CryptMode.None:
                StreamInfos[StreamIndex].StreamAddition = new LocalStreamAddition
                {
                    FileName = LocalFile,
                    Key      = 0x00,
                    Length   = (int)fs.Length,
                    Offset   = 0x00
                };
                StreamInfos[StreamIndex].Size  = (uint)fs.Length;
                StreamInfos[StreamIndex].Size2 = (uint)fs.Length;
                break;

            case CryptMode.PartCryption:
                if (fs.Length <= 0x100)
                {
                    throw new NotSupportedException("This mode is not supported now,Sorry.");
                }
                StreamInfos[StreamIndex].StreamAddition = new LocalStreamAddition
                {
                    FileName = LocalFile,
                    Key      = KeyGenerator.GetDataKey(HeaderKey, fileInfo),
                    Length   = 0x100,
                    Offset   = 0x00
                };
                StreamInfos[StreamIndex + 1].StreamAddition = new LocalStreamAddition
                {
                    FileName = LocalFile,
                    Key      = 0x00,
                    Length   = (int)fs.Length - 0x100,
                    Offset   = 0x100
                };
                StreamInfos[StreamIndex].Size           = 0x100;
                StreamInfos[StreamIndex].Size2          = 0x100;
                StreamInfos[StreamIndex + 1].Size       = (uint)fs.Length - 0x100;
                StreamInfos[StreamIndex + 1].Size2      = (uint)fs.Length - 0x100;
                StreamInfos[StreamIndex + 1].StreamMode = StreamMode.Local;
                break;

            case CryptMode.FullCryption:
                StreamInfos[StreamIndex].StreamAddition = new LocalStreamAddition
                {
                    FileName = LocalFile,
                    Key      = KeyGenerator.GetDataKey(HeaderKey, fileInfo),
                    Length   = (int)fs.Length,
                    Offset   = 0x00
                };
                StreamInfos[StreamIndex].Size  = (uint)fs.Length;
                StreamInfos[StreamIndex].Size2 = (uint)fs.Length;
                break;
            }
            ModifiedFileInfos.Add(new ModifiedFileInfo()
            {
                FileIndex   = fileInfo.Index,
                FolderIndex = NowFolder.Index,
                NewFileSize = (uint)fs.Length
            });
            fs.Close();
        }