static void Main(string[] args)
        {
            try
            {
                SheetRow[] rows = null;

                if (usingExcel)
                {
                    Console.WriteLine("Using .xlsx Excel sheet for data....");
                    rows = new XLSXDataSource(EXCEL_SHEET_PATH).GetRows();
                }
                else
                {
                    Console.WriteLine("Using Google sheet (on Google Drive) for data....");
                    rows = new GoogleDataSource().GetRows();
                }

                Script script = new Script(rows);
                Console.WriteLine("Saving xml data file...");
                script.GetXML().Save("SceneBreakdown.xml");
                Console.WriteLine("Application finished.");
                Console.WriteLine("press any key to terminate...");
                Console.ReadKey();
            }
            catch (Exception e)
            {
                Console.WriteLine("Catastrophic failure occured:");
                Console.WriteLine("If this continues contact [email protected]");
                Console.WriteLine("press any key to terminate...");
                Console.ReadKey();
                return;
            }
        }
        public void GetXML()
        {
            XLSXDataSource data = new XLSXDataSource(TEST_DATA_PATH_1);
            SheetRow[] rows = data.GetRows();
            Script script = new Script(rows);
            XmlDocument doc = script.GetXML();

            Assert.AreEqual(2, doc.SelectNodes("script/act").Count);
            Assert.AreEqual(3, doc.SelectNodes("script/act[@number='1']/scene").Count);
            Assert.AreEqual(4, doc.SelectNodes("script/act[@number='2']/scene[@number='3']/moment").Count);
            Assert.AreEqual("We will need to shut down her ", doc.SelectSingleNode("script /act[@number='2']/scene[@number='3']/moment[@title='Planning Dialogue, Leo joins']/@line").Value);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            string tableName = "LarData";

            string[]        mappingColumnNames = new string[] { "ent", "rec_no", "msa", "perc_min", "trct_incm", "app_incm", "ltv", "purpose", "fed_grn", "race", "co_race", "sex", "co_sex", "no_unit", "aff_catg" };
            IFileDataSource dataSource         = new XLSXDataSource();

            dataSource.FileName  = @"D:\tmp\Book2.xlsx";
            dataSource.sheetName = "sheet1$";
            using (var import = new Import(dataSource))
            {
                import.DoImport(tableName, mappingColumnNames);
            }
        }
        public void ScriptTest2()
        {
            XLSXDataSource data = new XLSXDataSource(TEST_DATA_PATH_1);
            SheetRow[] rows = data.GetRows();
            Script script = new Script(rows);

            Assert.AreEqual("01:30:00", script.TotalTime);
            Assert.AreEqual(2, script.Acts.Length);
            Assert.AreEqual(3, script.Acts[0].Scenes.Length);
            Assert.AreEqual(3, script.Acts[1].Scenes.Length);

            Assert.AreEqual(12, script.Acts[0].Scenes[0].Moments.Length);
            Assert.AreEqual("FIRST SET : INTRO", script.Acts[0].Scenes[0].Moments[0].Title);
            Assert.AreEqual("", script.Acts[0].Scenes[0].Moments[0].Duration);

            Moment momentUnderTest = script.Acts[1].Scenes[1].Moments[6];
            Assert.AreEqual("Out of sex scene", momentUnderTest.Title);
            Assert.AreEqual("Guess you're not in Kansas any more", momentUnderTest.Line);
            Assert.AreEqual("", momentUnderTest.Duration);
            Assert.AreEqual("", momentUnderTest.Location);
            Assert.AreEqual("", momentUnderTest.SFX);
        }
 public void TestInit()
 {
     _dataSource = new XLSXDataSource(TEST_DATA_PATH_1);
     _privateDataSource = new PrivateObject(_dataSource);
 }