master new
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
namespace FusionChartTest
{
public partial class SiteMaster : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
string current_file = Path.GetFileName(Request.Path); ///Path.GetFileName(Request.Path);
if (current_file == "default.aspx" || current_file == "Default.aspx")
{
//string inputString;
string[] lines1 = System.IO.File.ReadAllLines(Server.MapPath("~") + @"\sitemap.ini").Where(s => s.Trim() != string.Empty).ToArray();
foreach (string linetext in lines1)
{
string[] Content = linetext.Split('|');
string tag = Content[0].Substring(0, 2);
//index will get increase if the first position will not start with the - sign
if (Content[0].IndexOf('-') == -1)
{
string str = " ";
Label99.Text += str + "";
}
}
}
// at first time load only the main menu item(parent)
else
{
string parent = "";
string child = "";
string temp_parent = "";
string temp_child = "";
System.Diagnostics.Debug.WriteLine("filename: " + current_file);
string[] filename_ini = this.show_parent_nodes("sitemap.ini", current_file);
System.Diagnostics.Debug.WriteLine("filename_ini.Length : " + filename_ini);
foreach (string name in filename_ini)
{
if (name != null)
{
string[] datas = name.Split('|');
if (datas[0].Substring(0, 1) != "-")
{
parent = datas[1].Trim();
}
if (datas[0].Substring(0, 1) == "-")
{
child = datas[1].Trim();
}
}
//System.Diagnostics.Debug.WriteLine("got name: " + name);
System.Diagnostics.Debug.WriteLine("MAin parent: " + parent);
System.Diagnostics.Debug.WriteLine("mAin child: " + child);
}
//string[] lines = System.IO.File.ReadAllLines(Server.MapPath("~") + @"\sitemap.ini").Where(s => s.Trim() != string.Empty).ToArray();
string[] lines = System.IO.File.ReadAllLines(@Server.MapPath("~") + @"\sitemap.ini");
// int window_blank = 0;
string nav_subject = "";
string nav_link = "";
string submenu_link = "";
string menu_link = "";
string div = "";
foreach (string linetext in lines)
{
//Kommentare und Leerzeilen auslassen
//string line = linetext.Substring(0,-1);
string line = linetext;
if (line.Length > 2)
{
//echo $line."";
string line_cleaned = Regex.Replace(line, "^-|^--|^---", "");
line_cleaned = Regex.Replace(line_cleaned, "^-|^--|^---", "");
//Seitentitel/Title
if (line.IndexOf('|') != 0)
{
string[] Content = line_cleaned.Split('|');
nav_subject = Content[0];
}
else
{
nav_subject = line_cleaned;
}
//System.Diagnostics.Debug.WriteLine("nav_subject: " + nav_subject);
//Link auslesen/llink
if (line.IndexOf('|') != 0)
{
string[] Content = line_cleaned.Split('|');
nav_link = Content[1];
}
else
{
nav_link = "#";
}
//Link für Submenü zusammenbauen
if (nav_link == "#")
submenu_link = "
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
namespace FusionChartTest
{
public partial class SiteMaster : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
string current_file = Path.GetFileName(Request.Path); ///Path.GetFileName(Request.Path);
if (current_file == "default.aspx" || current_file == "Default.aspx")
{
//string inputString;
string[] lines1 = System.IO.File.ReadAllLines(Server.MapPath("~") + @"\sitemap.ini").Where(s => s.Trim() != string.Empty).ToArray();
foreach (string linetext in lines1)
{
string[] Content = linetext.Split('|');
string tag = Content[0].Substring(0, 2);
//index will get increase if the first position will not start with the - sign
if (Content[0].IndexOf('-') == -1)
{
string str = " ";
Label99.Text += str + "";
}
}
}
// at first time load only the main menu item(parent)
else
{
string parent = "";
string child = "";
string temp_parent = "";
string temp_child = "";
System.Diagnostics.Debug.WriteLine("filename: " + current_file);
string[] filename_ini = this.show_parent_nodes("sitemap.ini", current_file);
System.Diagnostics.Debug.WriteLine("filename_ini.Length : " + filename_ini);
foreach (string name in filename_ini)
{
if (name != null)
{
string[] datas = name.Split('|');
if (datas[0].Substring(0, 1) != "-")
{
parent = datas[1].Trim();
}
if (datas[0].Substring(0, 1) == "-")
{
child = datas[1].Trim();
}
}
//System.Diagnostics.Debug.WriteLine("got name: " + name);
System.Diagnostics.Debug.WriteLine("MAin parent: " + parent);
System.Diagnostics.Debug.WriteLine("mAin child: " + child);
}
//string[] lines = System.IO.File.ReadAllLines(Server.MapPath("~") + @"\sitemap.ini").Where(s => s.Trim() != string.Empty).ToArray();
string[] lines = System.IO.File.ReadAllLines(@Server.MapPath("~") + @"\sitemap.ini");
// int window_blank = 0;
string nav_subject = "";
string nav_link = "";
string submenu_link = "";
string menu_link = "";
string div = "";
foreach (string linetext in lines)
{
//Kommentare und Leerzeilen auslassen
//string line = linetext.Substring(0,-1);
string line = linetext;
if (line.Length > 2)
{
//echo $line."";
string line_cleaned = Regex.Replace(line, "^-|^--|^---", "");
line_cleaned = Regex.Replace(line_cleaned, "^-|^--|^---", "");
//Seitentitel/Title
if (line.IndexOf('|') != 0)
{
string[] Content = line_cleaned.Split('|');
nav_subject = Content[0];
}
else
{
nav_subject = line_cleaned;
}
//System.Diagnostics.Debug.WriteLine("nav_subject: " + nav_subject);
//Link auslesen/llink
if (line.IndexOf('|') != 0)
{
string[] Content = line_cleaned.Split('|');
nav_link = Content[1];
}
else
{
nav_link = "#";
}
//Link für Submenü zusammenbauen
if (nav_link == "#")
submenu_link = "
";
else
{
if (line.Substring(0, 3) == "---")
{
submenu_link = "
else
{
if (line.Substring(0, 3) == "---")
{
submenu_link = "
" + div + "" + "\n";
}
else
{
submenu_link = "
}
else
{
submenu_link = "
Comments
Post a Comment