コード例 #1
0
        public static void WriteRelationships(TopicRequest request)
        {
            var @ns       = Path.GetFileName(request.RootDirectory);
            var className = request.TopicName + "TopicRegistry";

            var writer = new StringWriter();

            writer.WriteLine("namespace {0}", @ns);
            writer.WriteLine("{");
            writer.WriteLine("    public class {0} : {1}", className, typeof(TopicRegistry).FullName);
            writer.WriteLine("    {");

            writer.WriteLine("        public {0}()", className);
            writer.WriteLine("        {");

            writeRelationships(writer, request);

            writer.WriteLine("        }");
            writer.WriteLine("    }");
            writer.WriteLine("}");

            var path = request.RootDirectory.AppendPath(className + ".cs");

            Console.WriteLine("Writing the topic registry to " + path);
            new FileSystem().WriteStringToFile(path, writer.ToString());
        }
コード例 #2
0
        public void SetUp()
        {
            document = new XmlDocument();
            document.Load("Topics.xml");

            var parser = new TopicParser();
            theTop = parser.Parse(theRootDirectory, document);
        }
コード例 #3
0
        public TopicRequest AddTopic(XmlElement element)
        {
            var request = new TopicRequest
            {
                Title         = element.GetAttribute("title"),
                Namespace     = CurrentNamespace,
                RootDirectory = _directory,
                TopicName     = element.GetAttribute("name")
            };

            if (_topics.Any())
            {
                _topics.Peek().Children.Add(request);
            }

            return(request);
        }
コード例 #4
0
        private static void writeRelationships(StringWriter writer, TopicRequest request)
        {
            if (!request.Children.Any())
            {
                return;
            }

            request.Children.Each(child => {
                writer.WriteLine("            For<{0}>().Append<{1}>();", request.FullTopicClassName, child.FullTopicClassName);
            });

            writer.WriteLine();

            request.Children.Each(child => {
                writeRelationships(writer, child);
            });
        }
コード例 #5
0
ファイル: TopicParser.cs プロジェクト: mtscout6/FubuWorld
 public void PushTopic(TopicRequest request)
 {
     _topics.Push(request);
 }
コード例 #6
0
ファイル: TopicParser.cs プロジェクト: mtscout6/FubuWorld
        public TopicRequest AddTopic(XmlElement element)
        {
            var request = new TopicRequest
            {
                Title = element.GetAttribute("title"),
                Namespace = CurrentNamespace,
                RootDirectory = _directory,
                TopicName = element.GetAttribute("name")
            };

            if (_topics.Any())
            {
                _topics.Peek().Children.Add(request);
            }

            return request;
        }
コード例 #7
0
 public void PushTopic(TopicRequest request)
 {
     _topics.Push(request);
 }
コード例 #8
0
        private void writeRequest(TopicRequest request)
        {
            request.WriteFiles();

            request.Children.Each(writeRequest);
        }