示例#1
0
        public void CreateHxt(TreeNodeCollection nodeCollection, Hxt hxt, Content contentDataSet)
        {
            bool opened = false; // Keep track of opening or closing of TOC entries in the .hxt

            foreach (TreeNode node in nodeCollection)
            {
                if (node.Checked == true)
                {
                    MtpsNode mtpsNode = node.Tag as MtpsNode;

                    DataRow row = contentDataSet.Tables[TableNames.ITEM].Rows.Find(mtpsNode.TargetAssetId);
                    string  Url;

                    //if (Int32.Parse(row["Size"].ToString()) == 0)
                    //    Url = null;
                    //else
                    Url = Path.Combine(hxsSubDir,
                                       row[ColumnNames.CONTENTID].ToString() + ApplicationStrings.FILE_EXTENSION_HTM);


                    hxt.WriteStartNode(mtpsNode.Title, Url);

                    opened = true;
                }
                if (node.Nodes.Count != 0 || node.Tag != null)
                {
                    CreateHxt(node.Nodes, hxt, contentDataSet);
                }
                if (opened)
                {
                    opened = false;
                    hxt.WriteEndNode();
                }
            }
        }
示例#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;
        }
示例#3
0
        public void CreateHxt(TreeNodeCollection nodeCollection, Hxt hxt, Content contentDataSet)
        {
            bool opened = false; // Keep track of opening or closing of TOC entries in the .hxt

            foreach (TreeNode node in nodeCollection)
            {
                if (node.Checked == true)
                {
                    MtpsNode mtpsNode = node.Tag as MtpsNode;

                    DataRow row = contentDataSet.Tables[TableNames.ITEM].Rows.Find(mtpsNode.TargetAssetId);
                    string Url;

                    //if (Int32.Parse(row["Size"].ToString()) == 0)
                    //    Url = null;
                    //else
                        Url = Path.Combine(hxsSubDir,
                            row[ColumnNames.CONTENTID].ToString() + ApplicationStrings.FILE_EXTENSION_HTM);

                    hxt.WriteStartNode(mtpsNode.Title, Url);

                    opened = true;
                }
                if (node.Nodes.Count != 0 || node.Tag != null)
                {
                    CreateHxt(node.Nodes, hxt, contentDataSet);
                }
                if (opened)
                {
                    opened = false;
                    hxt.WriteEndNode();
                }
            }
        }
示例#4
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;
        }