|
See Harolds response.
Also google for '.NET obfuscator'. Obfuscators mess with the code, don't worry it still runs, in a way that makes it difficult for others to read. Which is sort of what you want to achieve.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
Here i want to improve display of node attributes such that only node name is added to tree and attributes of clicked node appear in GUI controls on right hand side of form.
NodeType is of enumarated type XmlNodeType, yet the values are compared as strings.What should be there instead of strings?How to use enumerated data types?
How to get rid of While loop in Treeview1_AfterSelect(), it may go in infinite loop?
Please help out in providing right part of code to be used..
Thanks in advance..
public partial class TreeDisplay : Form
{
public string Filename
{ get { return filename; } }
protected string filename;
private void initiatingTree(string nameofFile)
{
treeView1.Nodes.Clear();
if (xmlDocument.DocumentElement != null) treeView1.Nodes.Add(new TreeNode (xmlDocument.DocumentElement.Name));
TreeNode tNodeObj = treeView1.Nodes[0];
XmlNode xNode = xmlDocument.DocumentElement;
AddingNodesToTree(xNode,tNodeObj);
treeView1.Nodes[0].Expand();
treeView1.CollapseAll();
}
private static void AddingNodesToTree(XmlNode xmlNode,TreeNode tnode)
{
if (xmlNode.HasChildNodes)
{
XmlNodeList nodeList = xmlNode.ChildNodes;
for (int i = 0; i <= nodeList.Count - 1; i++)
{ XmlNode xmladdtreeNode = xmlNode.ChildNodes[i];
String nodetype = "" + xmladdtreeNode.NodeType;
if (nodetype.Equals("Text") || nodetype.Equals("Comment"))
{
tnode.Nodes.Add(new TreeNode(xmladdtreeNode.InnerText));
}
else
{
String name = "<" + xmladdtreeNode.Name;
XmlAttributeCollection attCol = xmladdtreeNode.Attributes;
foreach (XmlAttribute xmlatt in attCol)
{
name += " " + xmlatt.Name + "=\"" + xmlatt.Value + "\"";
}
name += ">";
TreeNode tn = new TreeNode(xmladdtreeNode.Name);
tn.Text = name;
tnode.Nodes.Add(tn);
TreeNode treeNode = tnode.Nodes[i];
AddingNodesToTree(xmladdtreeNode,treeNode);
}
}
}
else
{ tnode.Text = xmlNode.OuterXml.Trim();
}
}
private void treeView1_AfterSelect(object sender,TreeViewEventArgs e)
{
listBox1.Items.Clear();
TreeNode treenode = e.Node;
String text = treenode.Text;
String relevent = text;
Boolean flag = true;
while (flag)
{ int SpaceIndex = relevent.IndexOf(" ");
if (SpaceIndex != -1)
{ int indexofEqual = relevent.IndexOf('=', SpaceIndex);
if (indexofEqual != -1)
{ int indexOFValue = relevent.IndexOf("\"", indexofEqual + 2);
if (indexOFValue != -1)
{
String attribute = relevent.Substring(SpaceIndex + 1, indexofEqual - SpaceIndex - 1);
String value = relevent.Substring(indexofEqual + 2, indexOFValue - indexofEqual - 2);
listBox1.Items.Add("Attribute:" + attribute + "Value:" +value);
releventreleventreleventrelevent = relevent.Substring(indexOFValue);
}
else
{ listBox1.Items.Add("Bad format of the xml file for this node");
flag = false;
} }
else
{ flag = false;
} }
else
{ flag = false; }
} }
}
|
|
|
|
|
hello,
i developed a c# program which unfortunatly cannot run on WINDOWS95 , 98 etc.
is there a way to fish the windows version as soon as i start my application ?
coz if its not the right one i'll just abort. better than letting the software spread its wings and fly..
thanks in advance,
avi
|
|
|
|
|
|
Additionally, I don't think the .Net framework can run on Windows 95 anyway, so there's no need to check for that in the OSVersion property
|
|
|
|
|
Well he also said "etc"
|
|
|
|
|
tnx guys,
anyways , what will happen if the prog will try to run
on an OS without the FrameWork installed?
will fireworks accur or will it pop up something ?
|
|
|
|
|
It will give a very cryptic error message that none of my customers every understood.
The fireworks will come from the user who screams at you "what the heck is this 2 point whateverthefuckitwas and how do I get it??"
|
|
|
|
|
shabya wrote: is there a way to fish the windows version as soon as i start my application ?
Imho, the only failsafe way to do this successfully on all platforms would be to write a loader app that runs on all platforms. The loader app will check the version of Windows (and the presence of other pre-requisites, if necessary) and start the real app only if everything's OK.
/ravi
|
|
|
|
|
I want to run a strip progress bar on winform using background thread while uploading a file from my hard disk.i am getting an exception on xmlDocument.Load(txtFileName.Text) saying " System.ArgumentException was unhandled by user code Message="Illegal characters in path."
public partial class TreeDisplay : Form
{
public string Filename
{ get { return filename; } }
protected string filename;
public TreeDisplay()
{
InitializeComponent();
this.Text = "Tree View of XML File";
}
private void initiatingTree(string nameofFile)
{
try
{
treeView1.Nodes.Clear();
if (xmlDocument.DocumentElement != null) treeView1.Nodes.Add(new TreeNode(xmlDocument.DocumentElement.Name));
TreeNode tNodeObj = treeView1.Nodes[0];
XmlNode xNode = xmlDocument.DocumentElement;
AddingNodesToTree(xNode,tNodeObj);
toolStripStatusLabel1.Text = "Opened file " + nameofFile;
treeView1.Nodes[0].Expand();
treeView1.CollapseAll();
}
catch (XmlException xmlex)
{
MessageBox.Show(xmlex.Message, "Error");
}
catch (Exception exp)
{
txtFileName.Text = exp.Message;
}
}
private void btnBrowse_Click(object sender,EventArgs e)
{
bgWorker1.RunWorkerAsync();
StripProgressBar.Value = 0;
toolStripStatusLabel1.Text = "Browsing for a Xml file";
OpenFileDialog open = new OpenFileDialog();
if (open.ShowDialog(this) == DialogResult.OK)
{
txtFileName.Text = open.FileName;
initiatingTree(open.FileName);
}
while (this.bgWorker1.IsBusy)
{
StripProgressBar.Increment(1);
Application.DoEvents();
}
}
private void bgWorker1_DoWork(object sender, DoWorkEventArgs e)
{
xmlDocument = new XmlDocument();
Thread.Sleep(5000);
xmlDocument.Load(txtFileName.Text);
btnBrowse.Enabled = false;
}
private void bgworker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
StripProgressBar.Value = 100;
if (e.Error == null)
{
MessageBox.Show(xmlDocument.InnerXml, "Download Complete");
}
else
{
MessageBox.Show("Failed to download file");
}
this.btnBrowse.Enabled = true;
StripProgressBar.Value = 0;
toolStripStatusLabel1.Text = "work finished processing request.";
}
}
Please help me in removing the exception.
Thanks..
|
|
|
|
|
rasingh1 wrote: i am getting an exception
Where?
/ravi
|
|
|
|
|
Hi Ravi,
i have written it in my Text that i am getting an exception in this line xmlDocument.Load(txtFileName.Text); Can you help me in removing this exception.
Thanks & Regards
Rach
|
|
|
|
|
Try checking the inner exception or view the file in IE to find the offending line. Looks like the file may contain badly formed XML.
/ravi
|
|
|
|
|
Hi Ravi,
How to check inner exception? The message in exception is "Illegal characters in path".
If i open this xml file without using background worker then it is showing me the file nicely in treeview without any exception.
But i want to add a progress bar (and background worker if possible) to tell the user that the file is being in the process of display in treeview.
The xml file does not contain any illegal characters ,it is in the right format,i checked it.
Otherwise can you tell me how i can run a progress bar on winform to tell the user to wait till the xml file is being uploaded in treeview on winform.If possible can u provide me a link or part of code to do this function?I searched a lot on net then i have written this part of code.
If any help is provided that will be appreciated.
Waiting to hear from you..
Thanks
|
|
|
|
|
rasingh1 wrote: How to check inner exception?
See the properties of the Exception class. Although in this case, I suspect it's null .
rasingh1 wrote: The message in exception is "Illegal characters in path".
Seems like the filespec passed to xmlDocument.Load() contains illegal characters.
/ravi
|
|
|
|
|
How to check this out??
|
|
|
|
|
rasingh1 wrote: How to check this out??
What do you mean by "this"?
/ravi
|
|
|
|
|
i mean these.....
properties of the Exception class. Although in this case, I suspect it's null.
Seems like the filespec passed to xmlDocument.Load() contains illegal characters.
|
|
|
|
|
Hi,
Is there any options provided by .Net framework to implement caching effectively? I want to capture files in that for some time.
Thanks in advance ...
|
|
|
|
|
Isn't the file caching that Windows does enough?
|
|
|
|
|
I know this may not be the appropriate place for me to ask about this quesiton, but I don't know
where can I ask this,I am really confused with the default page for the Html help workshop, I do believe someone who has used HTML help workshop can give me one hint:
I am using html help workshop to create the .chm for one c# application.
I try to set the default page by change "project options" and set "default file", but it does not work.
when I open the .chm and it always display "This program cannot display the webpage" on the first page. it does not display the default page I set. I don't know the reason.
by the way, except this problem, .chm works fine.
anyone has used html help workshop and please give me one hint for it.
Many thanks!!
|
|
|
|
|
Seraph_summer wrote: "This program cannot display the webpage"
This is a well known problem. Unfortunately, it is so long since I used Help 2.0 that I cannot remember the solution.
What I did do however is to google "This program cannot display the webpage" Help 2.0 and I got loads of relevant hits.
Go on, give it a try. You know you want to.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
hi , how to do the custom deployment of vb.net windows applications project . for example after completing deployment project application , when we install .exe file i want to show two options
.custom install
.typical install
after when i click custom install it should be showing modules but i cont see modules how to add modules in custom installation .
please send me step by step how to custom install deployment of c#.net windows application.
|
|
|
|
|
|
thanks for giving url , its very usefull
|
|
|
|