Beispiel #1
0
            public GcfFileInfo(Gcf gcf, string path)
            {
                Gcf  = gcf;
                Path = path;

                path = Gcf.Path.GetFullPath(path);

                string[] names = path.Split(Gcf.Path.DirectorySeparatorChars);

                Packaging.DirectoryInfo dir = Gcf.Root;

                for (int i = 0; i < names.Length - 1; ++i)
                {
                    var children = dir.GetDirectories(names[i]);

                    if (children.Length != 1)
                    {
                        dir = null;
                        break;
                    }

                    dir = children[0];
                }

                if (dir != null)
                {
                    var children = dir.GetFiles(names[names.Length - 1]);

                    if (children.Length != 1)
                    {
                        Index       = 0xFFFFFFFF;
                        ParentIndex = 0xFFFFFFFF;
                        ItemSize    = 0;
                    }
                    else
                    {
                        GcfFileInfo gcffile = children[0] as GcfFileInfo;

                        Index       = gcffile.Index;
                        ParentIndex = gcffile.ParentIndex;
                        ItemSize    = gcffile.ItemSize;
                    }
                }
                else
                {
                    Index       = 0xFFFFFFFF;
                    ParentIndex = 0xFFFFFFFF;
                    ItemSize    = 0;
                }
            }
Beispiel #2
0
            public GcfDirectoryInfo(Gcf gcf, string path)
            {
                Gcf  = gcf;
                Path = path;

                path = Gcf.Path.GetFullPath(path);

                string[] names = path.Split(Gcf.Path.DirectorySeparatorChars);

                Packaging.DirectoryInfo dir = Gcf.Root;

                for (int i = 0; i < names.Length; ++i)
                {
                    var children = dir.GetDirectories(names[i]);

                    if (children.Length != 1)
                    {
                        dir = null;
                        break;
                    }

                    dir = children[0];
                }

                GcfDirectoryInfo gcfdir = dir as GcfDirectoryInfo;

                if (gcfdir != null)
                {
                    Index       = gcfdir.Index;
                    ParentIndex = gcfdir.ParentIndex;
                }
                else
                {
                    Index       = 0xFFFFFFFF;
                    ParentIndex = 0xFFFFFFFF;
                }
            }