Beispiel #1
0
        public bool LoadNSR(BinaryReader binaryReader, ref NSR.NSR nsrFile)
        {
            LoadNSRPreview(binaryReader, ref nsrFile);
            nsrFile.RawSize = binaryReader.BaseStream.Length;

            try
            {
                // ghosts - keyframe
                while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length)
                {
                    NSR.KeyframeHeader keyframeHeader = new NSR.KeyframeHeader
                    {
                        RawPosition    = binaryReader.BaseStream.Position,
                        KeyframeOrder0 = binaryReader.ReadUInt16(),
                        KeyframeOrder1 = binaryReader.ReadUInt16(),
                        Length         = binaryReader.ReadUInt16(),
                        Unk0           = binaryReader.ReadUInt16(),
                        Id             = binaryReader.ReadBytes(8),
                        DataType       = binaryReader.ReadByte(),
                        Unk1           = binaryReader.ReadByte(),
                        DataCount      = binaryReader.ReadByte(),
                    };

                    keyframeHeader.Data             = new byte[keyframeHeader.Length - 11];
                    keyframeHeader.Data             = binaryReader.ReadBytes(keyframeHeader.Length - 11);
                    keyframeHeader.KeyframeType     = NSR.KeyframeHeader.MapKeyframeTypes(keyframeHeader.Id[0]);
                    keyframeHeader.KeyframePosition = nsrFile.KeyframeHeaders.Count;

                    nsrFile.KeyframeHeaders.Add(keyframeHeader);
                }
                // ghosts - keyframe
            }
            catch (EndOfStreamException exception)
            {
                string message = "";
                message += "Error reading GHOSTs. Would you like to attempt to still view successfully parsed ones?" + Environment.NewLine;
                message += Environment.NewLine + "---- GHOST ERROR ----" + Environment.NewLine + exception.Message + Environment.NewLine;
                message += exception.StackTrace + Environment.NewLine;

                if (MessageBox.Show(message, "Error readings Ghosts", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                {
                    // TODO: Perform specific ghost safe-load error handling if needed
                    // Currently returning what we have is good enough
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #2
0
        private void KeyframesListBox_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            NSR.KeyframeHeader tempKeyframeHeader = _cachedVisibleKeyframeList[e.ItemIndex];
            ListViewItem       listViewItem       = new ListViewItem
            {
                Text = tempKeyframeHeader.KeyframePosition + " - " + tempKeyframeHeader.KeyframeType
            };

            if (FilterComboBox.Text != "")
            {
                listViewItem.ForeColor = Color.Turquoise;
            }
            e.Item = listViewItem;
        }