Example #1
0
        public bool Load()
        {
            UnloadUop();

            bool bReturn = true;

            try
            {
                using (FileStream fsToParse = new FileStream(m_UopPath, FileMode.Open))
                {
                    using (BinaryReader brToParse = new BinaryReader(fsToParse))
                    {
                        m_UopFile = UOPFile.FromBinary(brToParse);
                    }
                }
            }
            catch
            {
                m_UopFile = null;
                bReturn = false;
            }

            GC.Collect();
            return bReturn;
        }
Example #2
0
        public override bool Equals(object obj)
        {
            if (!obj.GetType().Equals(this.GetType()))
            {
                return(false);
            }

            UOPFile objCurrent = (UOPFile)obj;

            if (!m_Header.Equals(m_Header))
            {
                return(false);
            }

            if (m_Content.Count != objCurrent.m_Content.Count)
            {
                return(false);
            }

            for (int i = 0; i < m_Content.Count; i++)
            {
                if (!m_Content[i].Equals(objCurrent.m_Content[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
Example #3
0
        public static UOPFile FromBinary(System.IO.BinaryReader bStream)
        {
            UOPFile toReturn = new UOPFile();

            toReturn.m_Header = UOPGeneralHeader.FromBinary(bStream);

            bool repeatRead = true;

            while (repeatRead)
            {
                UOPIndexBlockHeader uopIBHCurrent = UOPIndexBlockHeader.FromBinary(bStream);
                toReturn.m_Content.Add(uopIBHCurrent);

                if (uopIBHCurrent.m_OffsetNextIndex == 0)
                {
                    repeatRead = false;
                }
                else
                {
                    bStream.BaseStream.Seek((long)(uopIBHCurrent.m_OffsetNextIndex), System.IO.SeekOrigin.Begin);
                }
            }

            return(toReturn);
        }
Example #4
0
 private void UnloadUop()
 {
     if (m_UopFile != null)
     {
         m_UopFile.Dispose();
         m_UopFile = null;
     }
 }
Example #5
0
 public UopManager()
 {
     m_UopPath = null;
     m_UopFile = null;
 }
Example #6
0
        public static UOPFile FromBinary(System.IO.BinaryReader bStream)
        {
            UOPFile toReturn = new UOPFile();

            toReturn.m_Header = UOPGeneralHeader.FromBinary(bStream);

            bool repeatRead = true;
            while (repeatRead)
            {
                UOPIndexBlockHeader uopIBHCurrent = UOPIndexBlockHeader.FromBinary(bStream);
                toReturn.m_Content.Add(uopIBHCurrent);

                if (uopIBHCurrent.m_OffsetNextIndex == 0)
                {
                    repeatRead = false;
                }
                else
                {
                    bStream.BaseStream.Seek((long)(uopIBHCurrent.m_OffsetNextIndex), System.IO.SeekOrigin.Begin);
                }
            }

            return toReturn;
        }