Example #1
0
        private static void Execute()
        {
            using (var context = new LatticeContext())
            {
                var layouts = (from layout in context.Layouts
                               select layout).ToList();

                foreach (var layout in layouts)
                {
                    Logger.Info("Processing Layout # " + layout.Id);

                    var cells = (from cell in layout.Cells
                                 select cell).ToList();

                    foreach (var cell in cells)
                    {
                        var originalContent = cell.Content;

                        if (Regex.IsMatch(originalContent, PublishSubscribeCell))
                        {
                            var extractor = new CommandExtractor(layout, context);
                            extractor.Extract(cell);
                        }
                    }
                }
            }
        }
Example #2
0
        private static void Link()
        {
            var context = new LatticeContext();

            var linker = new LayoutLinker(context);
            linker.Link();
            context.SaveChanges();
        }
Example #3
0
        public static void Build()
        {
            using (var context = new LatticeContext())
            {
                foreach (var callType in (LatticeEnum.Call[])System.Enum.GetValues(typeof(LatticeEnum.Call)))
                {
                    if (callType.ToString().Equals("None"))
                    {
                        continue;
                    }

                    var call = new Call
                    {
                        Signature = callType.ToString()
                    };

                    if (callType.ToString().Equals(LatticeEnum.Call.Sslpublishoverride.ToString()))
                    {
                        BuildSslpublishoverride(ref call);

                        call.CallType = LatticeEnum.CallType.Publish.ToString();
                    }
                     else if (callType.ToString().Equals(LatticeEnum.Call.Sslrecordpublish.ToString()))
                    {
                        call.CallType = LatticeEnum.CallType.Publish.ToString();
                    }
                     else if (callType.ToString().Equals(LatticeEnum.Call.Sslrequestpublish.ToString()))
                    {
                        call.CallType = LatticeEnum.CallType.Publish.ToString();
                    }
                     else if (callType.ToString().Equals(LatticeEnum.Call.Sslrecordrequest.ToString()))
                     {
                         BuildSslrecordrequest(ref call);

                        call.CallType = LatticeEnum.CallType.Subscribe.ToString();
                    }
                     else if (callType.ToString().Equals(LatticeEnum.Call.Sslcheckbox.ToString()))
                    {
                        call.CallType = LatticeEnum.CallType.Publish.ToString();
                    }
                     else if (callType.ToString().Equals(LatticeEnum.Call.Sslcombobox.ToString()))
                    {
                        call.CallType = LatticeEnum.CallType.Publish.ToString();
                    }
                    else if (callType.ToString().Equals(LatticeEnum.Call.Sslrecordinsert.ToString()))
                    {
                        call.CallType = LatticeEnum.CallType.Publish.ToString();
                    }
                    else if (callType.ToString().Equals(LatticeEnum.Call.Sslrecordinserttrigger.ToString()))
                    {
                        call.CallType = LatticeEnum.CallType.Publish.ToString();
                    }

                    context.Calls.Add(call);
                    context.SaveChanges();
                }
            }
        }
Example #4
0
        public void Parse(string filename)
        {
            logger.Info("Parsing File - " + filename);

            using (var context = new LatticeContext())
            {
                var layout = new Layout
                {
                    Cells = new List<Cell>(),
                    Filename = filename,
                    Title = Path.GetFileNameWithoutExtension(filename)
                };

                context.Layouts.Add(layout);
                context.SaveChanges();

                //read the file
                var lines =
                    System.IO.File.ReadAllLines(filename);

                for (int i = 0; i < lines.Count(); i++)
                {
                    //regex to check for a white space, a number, 2 or more white spaces then words after.
                    if (Regex.IsMatch(lines[i], StartCell))
                    {
                        var cell = new Cell
                        {
                            Row = Convert.ToInt32(Regex.Match(lines[i], @":(.*),").Groups[1].Value),
                            Column = Convert.ToInt32(Regex.Match(lines[i], @",(.*)\]").Groups[1].Value)
                        };

                        for (i++; i < lines.Count(); i++)
                        {
                            //ensure this line is not a title, else break out of it.
                            if (Regex.IsMatch(lines[i], EndCell))
                            {
                                break;
                            }

                            //if number only found, this is the start of a verse
                            if (Regex.IsMatch(lines[i], FormulaCell1))
                            {

                                cell.Content = Regex.Match(lines[i], FormulaCell1).Value;
                                layout.Cells.Add(cell);

                                break;
                            }
                            else if (Regex.IsMatch(lines[i], FormulaCell2))
                            {

                                cell.Content = Regex.Match(lines[i], FormulaCell2).Value;
                                layout.Cells.Add(cell);

                                break;
                            }

                        }

                    }
                }

                context.SaveChanges();
            }

            // Console.WriteLine("number of populated cells are {0}", layout.Cells.Count);
        }
Example #5
0
 public CommandExtractor(Layout layout, LatticeContext context)
 {
     Context = context;
     Layout = layout;
 }
Example #6
0
 public LayoutLinker(LatticeContext context)
 {
     Context = context;
 }
 public ArgumentExtractor(LatticeContext context)
 {
     Context = context;
 }