コード例 #1
0
        public CodeGenerator(string idlJsonPath, string outputPath, string configPath)
        {
            this.outputPath = outputPath;
            this.idlLib     = JsonConvert.DeserializeObject <IdlLib>(File.ReadAllText(idlJsonPath));
            this.config     = JsonConvert.DeserializeObject <Config>(File.ReadAllText(configPath));

            this.idlLib.Namespace  = config.Namespace;
            this.idlLib.Interfaces = this.idlLib.Interfaces
                                     .Where(t => !this.config.IgnoreInterface.Contains(t.Name))
                                     .Where(t => !t.OriginalName.EndsWith(RawSuffix))
                                     .ToList();

            var interfaceMap = this.idlLib.Interfaces.ToDictionary(itf => itf.Name);

            foreach (var itf in this.idlLib.Interfaces)
            {
                var ancestors = new List <Interface>();
                var pivot     = itf;
                while (pivot.Base != "IUnknown")
                {
                    ancestors.Add(interfaceMap[pivot.Base]);
                }

                ancestors.Reverse();
                itf.Ancestors = ancestors;
            }

            this.idlLib.CoClasses = this.idlLib.CoClasses
                                    .Where(t => !this.config.IgnoreClass.Contains(t.Name))
                                    .ToList();
        }
コード例 #2
0
ファイル: CodeGenerator.cs プロジェクト: pengyz/OpenPAL3
        public CodeGenerator(string idlJsonPath, string outputPath, string configPath)
        {
            this.outputPath = outputPath;
            this.idlLib     = JsonConvert.DeserializeObject <IdlLib>(File.ReadAllText(idlJsonPath));
            this.config     = JsonConvert.DeserializeObject <Config>(File.ReadAllText(configPath));

            this.idlLib.Namespace  = config.Namespace;
            this.idlLib.Interfaces = this.idlLib.Interfaces
                                     .Where(t => !this.config.IgnoreInterface.Contains(t.Name))
                                     .Where(t => !t.OriginalName.EndsWith(RawSuffix))
                                     .ToList();
            this.idlLib.CoClasses = this.idlLib.CoClasses
                                    .Where(t => !this.config.IgnoreClass.Contains(t.Name))
                                    .ToList();
        }