Пример #1
0
        void DefineInterfaces(SDInfo fi)
        {
            StringBuilder interfaces = new StringBuilder();

            SDInfo[] refFrags = fi.DirectReferencedFragments.ToArray();
            if (refFrags.Length > 0)
            {
                if (refFrags.Length == 1)
                {
                    interfaces
                    .AppendLine($": {CSMisc.InterfaceName(refFrags[0])}")
                    ;
                }
                else
                {
                    interfaces
                    .AppendLine($": {CSMisc.InterfaceName(refFrags[0])},")
                    ;
                    for (Int32 i = 1; i < refFrags.Length - 1; i++)
                    {
                        SDInfo refFrag = refFrags[i];
                        interfaces
                        .AppendLine($"        {CSMisc.InterfaceName(refFrag)},")
                        ;
                    }
                    interfaces
                    .AppendLine($"        {CSMisc.InterfaceName(refFrags[refFrags.Length - 1])}")
                    ;
                }
            }

            fi.InterfaceEditor.TryAddUserMacro("Interfaces", interfaces.ToString());
            fi.InterfaceEditor.Blocks.Find("*Header").Reload();
        }
Пример #2
0
        void SaveAll()
        {
            this.resourceFactoryEditor.Save();
            this.fc.Mark(this.resourceFactoryEditor.SavePath);
            foreach (SDInfo fi in this.SDFragments.Values)
            {
                this.Save(fi.InterfaceEditor, Path.Combine(this.OutputDir, "Generated", "Interfaces", $"{CSMisc.InterfaceName(fi)}.cs"));
                if (fi.ClassEditor != null)
                {
                    if (
                        (fi.IsFragment() == true) ||
                        (fi.StructDef.BaseDefinition == Global.ExtensionUrl)
                        )
                    {
                        this.Save(fi.ClassEditor, Path.Combine(this.OutputDir, "Generated", "Class", $"{CSMisc.ClassName(fi)}.txt"));
                    }
                    else
                    {
                        this.Save(fi.ClassEditor, Path.Combine(this.OutputDir, "Generated", "Class", $"{CSMisc.ClassName(fi)}.cs"));
                    }
                }
                if (fi.SubClassEditor != null)
                {
                    this.Save(fi.SubClassEditor, Path.Combine(this.OutputDir, "Generated", "Class", $"{CSMisc.ClassName(fi)}Local.cs"));
                }
            }

            foreach (CSInfo ci in this.CodeSystems.Values)
            {
                this.Save(ci.ClassCode, Path.Combine(this.OutputDir, "Generated", "CodeSystems", $"{CSMisc.CodeSystemName(ci)}.cs"));
            }

            foreach (VSInfo vi in this.ValueSets.Values)
            {
                this.Save(vi.ClassCode, Path.Combine(this.OutputDir, "Generated", "ValueSets", $"{CSMisc.ValueSetName(vi)}.cs"));
            }
        }