Ejemplo n.º 1
0
        public void Read(string Name)
        {
            mBasePath = Name.Substring(0, Name.LastIndexOf('.'));

            Offset = StartOffset;
            using (FileStream fs = File.OpenRead(Name)) {
                Buffer = new byte[(int)fs.Length];
                fs.Read(Buffer, 0, (int)fs.Length);
            }

            mFiles = new ShaiyaDataEntryList();

            mFiles.AddRange(ReadFiles(""));
            mFiles.AddRange(ReadDirs(""));

            // cleanup
            Offset = 0;
            Buffer = null;
        }
Ejemplo n.º 2
0
        private ShaiyaDataEntry SearchName(string ID, ShaiyaDataEntryList List)
        {
            ShaiyaDataEntry e = null;

            for (int i = 0; i < List.Count; i++)
            {
                if (List[i].ID == ID)
                {
                    return(List[i]);
                }
                if (List[i].IsDir == false)
                {
                    continue;
                }

                if ((e = SearchName(ID, List[i].Entrys)) != null)
                {
                    return(e);
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
        private bool _UpdateEntry(string ID, ShaiyaDataEntry NewEntry, ShaiyaDataEntryList List)
        {
            bool returnResult = false;

            for (int i = 0; i < List.Count; i++)
            {
                if (List[i].ID == ID)
                {
                    List[i] = NewEntry;
                    return(true);
                }

                if (List[i].IsDir == false)
                {
                    continue;
                }
                if ((returnResult = _UpdateEntry(ID, NewEntry, List[i].Entrys)) == true)
                {
                    return(true);
                }
            }

            return(false);
        }