Exemplo n.º 1
0
        public void Create()
        {
            if (Directory.Exists(hxsDir) == true)
            {
                Directory.Delete(hxsDir, true);
            }

            Directory.CreateDirectory(hxsDir);
            Directory.CreateDirectory(withinHxsDir);

            foreach (string file in Directory.GetFiles(rawDir))
            {
                File.Copy(file, Path.Combine(withinHxsDir, Path.GetFileName(file)), true);
            }

            foreach (DataRow row in contentDataSet.Tables[TableNames.ITEM].Rows)
            {
                //if (Int32.Parse(row["Size"].ToString()) != 0)
                //{
                    Transform(row[ColumnNames.CONTENTID].ToString(),
                        row["Metadata"].ToString(),
                        row["Annotations"].ToString(),
                        row["VersionId"].ToString(),
                        row["Title"].ToString(),
                        contentDataSet);
                //}
            }

            // Create TOC
            Hxt hxt = new Hxt(Path.Combine(hxsDir, baseFilename + ".hxt"), Encoding.UTF8);
            CreateHxt(this.nodes, hxt, contentDataSet);
            hxt.Close();

            CreateHxks(baseFilename);

            WriteExtraFiles();

            Hxf hxf = new Hxf(Path.Combine(hxsDir, baseFilename + ".hxf"), Encoding.UTF8);

            string[] files = Directory.GetFiles(hxsDir, "*", SearchOption.AllDirectories);

            foreach (string file in files)
            {
                hxf.WriteLine(file.Replace(hxsDir, ""));
            }

            hxf.Close();

            string lcid = new CultureInfo(locale).LCID.ToString();
            Hxc hxc = new Hxc(baseFilename, title, lcid, "1.0", copyright, hxsDir, Encoding.UTF8);

            int numHtmlFiles = Directory.GetFiles(hxsDir, "*.htm", SearchOption.AllDirectories).Length;
            int numFiles = Directory.GetFiles(hxsDir, "*", SearchOption.AllDirectories).Length;

            // This gives the number of information lines output by the compiler. It
            // was determined experimentally, and should give some means of making an
            // accurate progress bar during a compile.
            // Actual equation is numInfoLines = 2*numHtmlFiles + (numFiles - numHtmlFiles) + 6
            // After factoring, we get this equation
            expectedLines = numHtmlFiles + numFiles + 6;
        }
Exemplo n.º 2
0
        public void Create()
        {
            if (Directory.Exists(hxsDir) == true)
            {
                Directory.Delete(hxsDir, true);
            }

            Directory.CreateDirectory(hxsDir);
            Directory.CreateDirectory(withinHxsDir);

            foreach (string file in Directory.GetFiles(rawDir))
            {
                File.Copy(file, Path.Combine(withinHxsDir, Path.GetFileName(file)), true);
            }


            foreach (DataRow row in contentDataSet.Tables[TableNames.ITEM].Rows)
            {
                //if (Int32.Parse(row["Size"].ToString()) != 0)
                //{
                Transform(row[ColumnNames.CONTENTID].ToString(),
                          row["Metadata"].ToString(),
                          row["Annotations"].ToString(),
                          row["VersionId"].ToString(),
                          row["Title"].ToString(),
                          contentDataSet);
                //}
            }


            // Create TOC
            Hxt hxt = new Hxt(Path.Combine(hxsDir, baseFilename + ".hxt"), Encoding.UTF8);

            CreateHxt(this.nodes, hxt, contentDataSet);
            hxt.Close();


            CreateHxks(baseFilename);

            WriteExtraFiles();

            Hxf hxf = new Hxf(Path.Combine(hxsDir, baseFilename + ".hxf"), Encoding.UTF8);

            string[] files = Directory.GetFiles(hxsDir, "*", SearchOption.AllDirectories);

            foreach (string file in files)
            {
                hxf.WriteLine(file.Replace(hxsDir, ""));
            }

            hxf.Close();


            string lcid = new CultureInfo(locale).LCID.ToString();
            Hxc    hxc  = new Hxc(baseFilename, title, lcid, "1.0", copyright, hxsDir, Encoding.UTF8);

            int numHtmlFiles = Directory.GetFiles(hxsDir, "*.htm", SearchOption.AllDirectories).Length;
            int numFiles     = Directory.GetFiles(hxsDir, "*", SearchOption.AllDirectories).Length;

            // This gives the number of information lines output by the compiler. It
            // was determined experimentally, and should give some means of making an
            // accurate progress bar during a compile.
            // Actual equation is numInfoLines = 2*numHtmlFiles + (numFiles - numHtmlFiles) + 6
            // After factoring, we get this equation
            expectedLines = numHtmlFiles + numFiles + 6;
        }