public static void ConnectNodes(Project project, CppReferenceNode node, Project graph, bool connectNamespaces) { for (int i = 0; i < node.FileLookups.Count; i++) { string lookup = node.FileLookups[i]; FileDescriptor file = FileDescriptor.Create(graph.Location, lookup); ReferenceNode @ref = graph.Files.Nodes.FirstOrDefault(x => x.File == file); if (@ref != null) { node.AddDependency(@ref); if (project != graph) { lock (project) { if (!project.References.Contains(graph)) { project.References.Add(graph); } node.FileLookups.RemoveAt(i); i--; continue; } } } } }
private static bool Include(CodeProcessorContext context, Stream data, List <FileDescriptor> referenceFiles, List <string> fileLookups, TokenStream nodes) { if (!Preprocessor.Whitespace(context, data, nodes)) { return(Preprocessor.ThrowError(context, PreprocessorCodes.UnexpectedCharacter)); } TokenStream target = new TokenStream(); Lazy <HashSet <UInt32> > stack = new Lazy <HashSet <UInt32> >(); while (!Preprocessor.LineBreak(context, data, target)) { Preprocessor.Process(context, data, target, stack, true); } if (Preprocessor.IncludeHeader(context, target, target)) { fileLookups.Add(Encoding.UTF8.GetString(target.Buffer.ToArray())); } else if (Preprocessor.IncludeSource(context, target, target)) { string path = Encoding.UTF8.GetString(target.Buffer.ToArray()); FileDescriptor file = FileDescriptor.Create(context.File.Location, path); if (file.Exists()) { referenceFiles.Add(file); } else { fileLookups.Add(path); } } else { return(Preprocessor.ThrowError(context, PreprocessorCodes.ExpressionExpected)); } return(true); }
public StfsFile(Stream stream) : this() { EndianReader reader = new EndianReader(stream, Endianness.BigEndian); Header = PackageHeader.Create(reader); if (Header == null) { throw new FormatException(); } reader.ReadBytes(ContentID); EntryID = reader.ReadUInt32(); ContentType = (ContentTypes)reader.ReadUInt32(); MetadataVersion = reader.ReadUInt32(); ContentSize = reader.ReadUInt64(); MediaID = reader.ReadUInt32(); Version = reader.ReadUInt32(); BaseVersion = reader.ReadUInt32(); TitleID = reader.ReadUInt32(); Platform = reader.ReadByte(); ExecutableType = reader.ReadByte(); DiscNumber = reader.ReadByte(); DiscInSet = reader.ReadByte(); SaveGameID = reader.ReadUInt32(); reader.ReadBytes(ConsoleID); ProfileID = reader.ReadUInt64(); Descriptor = PackageDescriptor.Create(reader); DataFiles = reader.ReadUInt32(); DataFileSize = reader.ReadUInt64(); Reserved = reader.ReadUInt64(); reader.ReadBytes(Padding); reader.ReadBytes(DeviceID); for (int i = 0; i < DisplayName.Length; i++) { DisplayName[i] = ReadString(reader); } for (int i = 0; i < DisplayDescription.Length; i++) { DisplayDescription[i] = ReadString(reader); } Publisher = ReadString(reader); TitleName = ReadString(reader); TransferFlags = reader.ReadByte(); ThumbnailSize = reader.ReadUInt32(); TitleThumbnailSize = reader.ReadUInt32(); Thumbnail = new Bitmap(new Substream(stream, 0x171A, ThumbnailSize)); TitleThumbnail = new Bitmap(new Substream(stream, 0x571A, TitleThumbnailSize)); // None of this seems right, I'm hardcoding 0x0C // BaseBlock = ((EntryID + 0xFFF) & 0xF000) / BlockSize; // BaseBlock = (uint)(Util.RoundUp(EntryID, BlockSize) / BlockSize) + 1; Stream = new BlockStream(this, stream); Stream.SeekBlock(Descriptor.FileTableBlock); EndianReader blockreader = new EndianReader(Stream, Endianness.BigEndian); while (true) { FileDescriptor file = FileDescriptor.Create(blockreader, Stream); if (file.IsNull()) { break; } Files.Add(file); } }