|
Hi all,
I am looking to extract data from an xml config file and place the values in an array.
Extract:-
<languages>
<key="english" value="eng">
<key="spanish" value="esp">
<key="ukranian" value="ukr">
.... ....
<languages>
I need to take the values an place in an array. So far I cannot even figure out how to acees the data in the <languages> section of the config file.
Any ideas???
Seán
|
|
|
|
|
Hi all,
I am looking to extract data from an xml config file and place the values in an array.
Extract:-
<languages>
<key="English" value="eng" />
<key="Spanish" value="esp" />
<key="Ukranian" value="ukr" />
.... ....
<languages/>
I need to take the values an place in an array. So far I cannot even figure out how to acees the data in the <languages> section of the config file.
Any ideas???
Seán
-- modified at 8:28 Thursday 11th May, 2006
|
|
|
|
|
Put them in the app settings part of the file.
|
|
|
|
|
I already have attributes in the app settings part of the file. For these particular att. I need to extract their values and put them into an array.
The number of attributes is not static so I cannot place them in an array using their keys.
Is there any other way???.
|
|
|
|
|
try this,
ArrayList array = new ArrayList();
XmlNode node = doc.SelectSingleNode("*/langauges");
foreach (XmlNode n in node.Nodes)
{
array.Add(n.InnerText);
}
Good luck!
eric feng
|
|
|
|
|
Hi
I am trying to create a socket for listening form my machine as a server.
Could somebody tell me why there is an exception "An invalid argument was supplied" in the last line below?
IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName());
IPAddress ipAddress = ipHostInfo.AddressList[0];
IPEndPoint localEndPoint = new IPEndPoint(ipAddress,myPort);
Socket listener = new Socket(AddressFamily.InterNetwork,
aSocketType.Stream, ProtocolType.Tcp);
listener.Bind(localEndPoint);
Socket acceptedSocket=listener.Accept();
Thanks
Ela
|
|
|
|
|
IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, myPort);
eric feng
|
|
|
|
|
Thank you, it works.
e_LA
|
|
|
|
|
|
hi
tray this
for(int i = this.checkedListBox1.Items.Count-1; i >= 0; i--)
{
string txt = (string)this.checkedListBox1.Items[i].ToString();
if (txt.Equals(string.Empty))
this.checkedListBox1.Items.RemoveAt(i);
}
regards
joe
|
|
|
|
|
Hi
iam new to c# , can any one help me in adding a panel of specific size automatically to a tabpage when a new tabpage is created .
thanks in advance
Regards
praveen
|
|
|
|
|
Do you mean programatically or at design time?
|
|
|
|
|
|
Hello, could use a bit of general advice. I’m working on a C# program with Managed DirectX visualization. The main program window is divided into the visualization part and some generic controls from System.Windows.Forms for input – text boxes, drop down combos, grids and the like.
The DirectX visualization is quite complex so the typical frame rate is quite low especially on lower-end machines. My problem is that input becomes very sluggish and unresponsive as the frame rate drops. In extreme cases, pressing a key will cause a repeating string of characters to appear in the text box after significant delay. The frame rate I don’t really care about but the input has to stay responsive even on slower machines.
My guess is that the rendering is prioritised over the handling of control evens such as typing text. I have tried two solutions: one is peppering the main rendering loop with Application.DoEvents() to process the input control events. This had almost no effect.
Second is separating the rendering into a different thread to the main UI (essentially the render loop runs in a separate thread). However, even after setting the thread priority on the render thread to lowest and on the UI to highest I still get very sluggish input. I’ve removed all of the lock() statements to make sure the threads were not waiting on each other with no effect.
Didn’t have much luck finding a solution on the net – although surely this must be a very common problem. Can anyone suggest a solution - preferably one that doesn’t involve multithreading or writing DirectX input controls?
Thanks very much for any suggestions, apologies if I've posted in the wrong forum.
|
|
|
|
|
We have a C# program that does 3D animation of using Managed DirectX 9. Like you we have a 3D visualization window and some other Windows Forms controls on the main application window. We have found our performace quite good with this setup.
Try rendering each frame on the UI thread. Try a tight game loop setup rendering a frame then w checking the message queue for mouse clicks, button pushes, etc. I would also recomment doing away with Application.DoEvents() and using P/Invoke to check the message queue. Application.DoEvents() leaks memory with each invocation. A loop looks like the following:
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public int x;
public int y;
}
[StructLayout(LayoutKind.Sequential)]
public struct MSG
{
public IntPtr hwnd;
public uint message;
public IntPtr wParam;
public IntPtr lParam;
public int time;
POINT pt;
};
public class RenderLoop
{
[DllImport("user32.dll")]
public static extern bool PeekMessage( out MSG msg, IntPtr hwnd, uint wMsgFilterIn, uint wMsgFilterOut, uint wRemoveMsg );
public RenderLoop()
{
Application.Idle += new EventHandler( this.Application_Idle );
}
private bool AppStillIdle
{
MSG msg;
return (!PeekMessage( out msg, IntPtr.Zero, 0, 0, 0 ) );
}
public void Application_Idle( object sender, EventArgs e )
{
while( AppStillIdle )
{
RenderFrame();
}
}
}
So each time your application gets an idle message you will render frames until the next UI event comes to your message queue. The application will process this event, then go back into the Application_Idle method and continue rendering frames until the next mouse click, etc.
I hope this helps.
Deus caritas est
|
|
|
|
|
Thanks. However - this is exactly the render loop I used to start with, from Tom Miller's blog. It works well down to 20-30 fps but the controls get sluggish when the frame rate drops below that and the whole thing grinds to a halt at 1-5 fps with input essentially no longer possible.
My understanding is that this is beacuse the whole thing is done in one thread - so once we start rendering, the next message is not processed until the rendering is complete. In other projects (where there was a background CPU intensive task running) I just separated the intensive task into a worker thread and the UI controls responded fine. I was wondering whether it was something DirectX specific that prevents threading from working correctly.
-- modified at 12:53 Thursday 11th May, 2006
|
|
|
|
|
I don't believe there is something with DirectX that prevents threading from working correctly. You should have a worker thread doing your extensive math calculations between each frame and render on the UI thread.
Deus caritas est
|
|
|
|
|
Thanks. Sorry - I wasn't entirely clear. If you put rendering and the UI on the same thread then no UI messages are processed while the rendering pass is going on. Yes, the rendering is not launched until all messages have been processed but once they have, the program waits until the rendering is done until processing the next batch. Thus the sluggish input for the cases when the rendering itself takes a long time (I think).
The idea was to put just the rendering in a separate thread to the UI. This causes all sorts of thread synchronization problems but once those are resolved you should be rendering and processing UI messages at the same time, making the controls respond instanteneously. This isn't happening, thus the question. Moreover, multithreading makes data management very tricky, which was why I was after a solution which would keep UI and rendering in the same thread but somehow give priority to processing UI control messages over rendering - not only between two render passes but also inside a single render pass.
Sigh, if only I could be sure that the users had a basic 20 pound AGP graphics card. But there's always those who want to run hi-res with all the fancy shaders on an integrated graphics chip. For these, I don't mind if the refresh rate on graphics is low as long as they can enter some data.
Cheers for any insight at all you can offer - utterly stuck for weeks now.
|
|
|
|
|
Ok. Sorry for my confusion. You may want to look into profiling you application to see where you are spending all of your time in the rendering. This may provide some useful insight into areas where you can improve rendering efficiency. One optimization you can make is to reduce the amount of device state changes such as material colors, etc. For example, you could render objects grouped by colors so you will minimize the number of color changes. Also, if you have alot of line geometry you can combine all lines of the same color into a single vertex buffer for rendering, etc. I think if you profile the app you will find things that you could do more efficiently.
I wish you luck.
Deus caritas est
|
|
|
|
|
Thank you. Optimisation is definitely high up on the list - especially for advanced features like shadows and fancy shaders. The vertex buffer number and material changes have already been cut to a minimum and framerate in full screen is hitting 300-400 fps on basic settings with a Radeon 9700 which hopefully will be almost minimum specification when the product comes out in a year.
Its the muppets with office computers and Intel's integrated graphics wanting to run it with all of the settings on. In any case, thanks for a second opinion - my current thinking is that putting UI and rendering in different threads will cause more problems that it would solve.
|
|
|
|
|
Yeah, that is a problem. People want a cheap office computer and expect optimum graphics performance. At some point you run up against performance limitations.
Good luck!
Deus caritas est
|
|
|
|
|
hi,
I have developed C# windows application, I need to build this application where there is .NET Framework v1.1 only. not having .NET IDE.
Can any one help me with step-by-step instructions.
Regards
KK
|
|
|
|
|
C# Compiler Options[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
I need .NET IDE for .NET 2003 which the link you have shown is .NET 2005
Could you suggest me where .NET 2003 IDE available for free of cost.
|
|
|
|
|
AFAIK the C# Compiler options haven't changed from version 1.1 to 2.0 of .NET framework. You get the compiler for free by downloading .NET framework SDK from Microsoft site. If you want to have a free IDE for Framework 1.0 and 1.1 try
Sharp Develop.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|