コード例 #1
0
ファイル: AFS2_File.cs プロジェクト: Atsuraelu/XV2-Tools
        //Undoable
        public List <IUndoRedo> AddEntry(byte[] bytes, bool reuseExistingEntries, out ushort newAwbId)
        {
            List <IUndoRedo> undos = new List <IUndoRedo>();

            ushort existingEntry = GetExistingEntry(bytes);

            if (existingEntry != ushort.MaxValue)
            {
                newAwbId = existingEntry;
            }
            else
            {
                ushort newId    = (ushort)NextID();
                var    newEntry = new AFS2_AudioFile()
                {
                    AwbId = newId,
                    bytes = bytes
                };
                Entries.Add(newEntry);
                undos.Add(new UndoableListAdd <AFS2_AudioFile>(Entries, newEntry));

                newAwbId = newId;
            }

            return(undos);
        }
コード例 #2
0
ファイル: AFS2_File.cs プロジェクト: Atsuraelu/XV2-Tools
        public ushort GetExistingEntry(AFS2_AudioFile entry)
        {
            foreach (var _entry in Entries)
            {
                if (Utils.CompareArray(_entry.bytes, entry.bytes))
                {
                    return(_entry.AwbId);
                }
            }

            return(ushort.MaxValue);
        }
コード例 #3
0
ファイル: AFS2_File.cs プロジェクト: Atsuraelu/XV2-Tools
        public ushort AddEntry(AFS2_AudioFile entry, bool reuseExistingEntries)
        {
            ushort existingEntry = GetExistingEntry(entry);

            if (existingEntry != ushort.MaxValue)
            {
                return(existingEntry);
            }
            else
            {
                ushort newId = (ushort)NextID();
                Entries.Add(new AFS2_AudioFile()
                {
                    AwbId = newId,
                    bytes = entry.bytes
                });

                return(newId);
            }
        }