コード例 #1
0
ファイル: AddonScanner.cs プロジェクト: Craiel/CarbonProjects
        private static AddonEntry ReadToc(CompileContext context, CarbonFile file)
        {
            var entry = new AddonEntry(file);
            context.CurrentScanEntry = entry;
            using (var stream = file.OpenRead())
            {
                using (var reader = new StreamReader(stream))
                {
                    while (!reader.EndOfStream)
                    {
                        var line = reader.ReadLine();
                        ParseTocLine(context, line);
                    }
                }
            }

            context.FinalizeScannedEntry();
            return entry;
        }
コード例 #2
0
ファイル: Compiler.cs プロジェクト: Craiel/CarbonProjects
        private static void AssembleContentRecursive(CompileContext context, AddonEntry addon, AddonContent currentContent)
        {
            foreach (AddonContent subContent in currentContent.SubContent)
            {
                AssembleContentRecursive(context, addon, subContent);
            }

            CarbonFile absoluteFile = currentContent.RootDirectory.ToFile(currentContent.File);
            if (!absoluteFile.Exists)
            {
                Diagnostic.Warning("Content File {0} does not exist! ({1})", absoluteFile, currentContent.File);
                return;
            }

            var content = new CompileContent(addon, absoluteFile, absoluteFile.ToRelative<CarbonFile>(context.Source.ToDirectory(addon.Name)));
            using (var stream = absoluteFile.OpenRead())
            {
                byte[] md5 = HashUtils.GetMd5(stream);
                content.Md5 = HashUtils.Md5ToString(md5);
            }

            context.FullContentList.Add(content);
        }
コード例 #3
0
ファイル: AddonEntry.cs プロジェクト: Craiel/CarbonProjects
        public void AddDependency(AddonEntry dependencyEntry)
        {
            if (this.Dependencies.Contains(dependencyEntry))
            {
                Diagnostic.Warning("Addon {0} already contains dependency on {1}, ignoring", this.Name, dependencyEntry.Name);
                return;
            }

            this.Dependencies.Add(dependencyEntry);
        }
コード例 #4
0
 // -------------------------------------------------------------------
 // Constructor
 // -------------------------------------------------------------------
 public CompileContent(AddonEntry addon, CarbonFile absolute, CarbonFile relative)
 {
     this.Addon = addon;
     this.AbsoluteFile = absolute;
     this.RelativeFile = relative;
 }