Example #1
0
        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;
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
 // -------------------------------------------------------------------
 // Constructor
 // -------------------------------------------------------------------
 public CompileContent(AddonEntry addon, CarbonFile absolute, CarbonFile relative)
 {
     this.Addon = addon;
     this.AbsoluteFile = absolute;
     this.RelativeFile = relative;
 }