Exemplo n.º 1
0
 private void writeSceIoStat(Stream dst, SceIoStat stats)
 {
     DataUtils.WriteUInt32(dst, Convert.ToUInt32(stats.Mode));
     DataUtils.WriteUInt32(dst, Convert.ToUInt32(stats.Attributes));
     DataUtils.WriteUInt64(dst, stats.Size);
     writeSceDateTime(dst, stats.CreationTime);
     writeSceDateTime(dst, stats.AccessTime);
     writeSceDateTime(dst, stats.ModificaionTime);
     foreach (UInt32 i in stats.Private)
     {
         DataUtils.WriteUInt32(dst, i);
     }
 }
Exemplo n.º 2
0
        private SceIoStat readStats()
        {
            SceIoStat stat = new SceIoStat();

            stat.Mode            = (Modes)readUInt32();
            stat.Attributes      = (AttributesEnum)readUInt32();
            stat.Size            = readUInt64();
            stat.CreationTime    = readDatetime();
            stat.AccessTime      = readDatetime();
            stat.ModificaionTime = readDatetime();
            for (int i = 0; i < stat.Private.Length; i++)
            {
                stat.Private[i] = readUInt32();
            }
            return(stat);
        }
Exemplo n.º 3
0
 private byte[] getHeader(SceIoStat stats, string ParentPath, string PathRel)
 {
     using (MemoryStream Header = new MemoryStream())
     {
         DataUtils.WriteInt64(Header, DateTime.UtcNow.Ticks);              // SysTime
         DataUtils.WriteInt64(Header, 0);                                  // Flags
         writeSceIoStat(Header, stats);
         writeStringWithPadding(Header, ParentPath, 256);                  // Parent Path
         DataUtils.WriteUInt32(Header, 1);                                 //unk_16C
         writeStringWithPadding(Header, PathRel, 256);                     //Relative Path
         writePadding(Header, 0x78, 904);                                  //'x'
         DataUtils.WriteString(Header, PSVIMGConstants.PSVIMG_HEADER_END); //EndOfHeader
         Header.Seek(0x00, SeekOrigin.Begin);
         return(Header.ToArray());
     }
 }
Exemplo n.º 4
0
        private SceIoStat sceIoStat(string path)
        {
            SceIoStat      stats     = new SceIoStat();
            FileAttributes attrbutes = File.GetAttributes(path);

            if (attrbutes.HasFlag(FileAttributes.Directory))
            {
                stats.Mode |= Modes.Directory;
                stats.Size  = 0;
            }
            else
            {
                stats.Mode |= Modes.File;
                stats.Size  = Convert.ToUInt64(new FileInfo(path).Length);
            }

            if (attrbutes.HasFlag(FileAttributes.ReadOnly))
            {
                stats.Mode |= Modes.GroupRead;

                stats.Mode |= Modes.OthersRead;

                stats.Mode |= Modes.UserRead;
            }
            else
            {
                stats.Mode |= Modes.GroupRead;
                stats.Mode |= Modes.GroupWrite;

                stats.Mode |= Modes.OthersRead;
                stats.Mode |= Modes.OthersWrite;

                stats.Mode |= Modes.UserRead;
                stats.Mode |= Modes.UserWrite;
            }

            stats.CreationTime    = dateTimeToSceDateTime(File.GetCreationTimeUtc(path));
            stats.AccessTime      = dateTimeToSceDateTime(File.GetLastAccessTimeUtc(path));
            stats.ModificaionTime = dateTimeToSceDateTime(File.GetLastWriteTimeUtc(path));

            return(stats);
        }