Click here to Skip to main content
15,905,316 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to simulate click button on win32 form ? Pin
Rick Shaub18-Jan-10 3:31
Rick Shaub18-Jan-10 3:31 
Question"Unescape" ISO string Pin
Keith Barrow18-Jan-10 0:48
professionalKeith Barrow18-Jan-10 0:48 
AnswerRe: "Unescape" ISO string Pin
PIEBALDconsult18-Jan-10 3:22
mvePIEBALDconsult18-Jan-10 3:22 
GeneralRe: "Unescape" ISO string Pin
Keith Barrow18-Jan-10 3:35
professionalKeith Barrow18-Jan-10 3:35 
GeneralRe: "Unescape" ISO string Pin
mdirkes18-Jan-10 3:52
mdirkes18-Jan-10 3:52 
GeneralRe: "Unescape" ISO string Pin
Keith Barrow18-Jan-10 4:12
professionalKeith Barrow18-Jan-10 4:12 
GeneralRe: "Unescape" ISO string Pin
PIEBALDconsult18-Jan-10 12:40
mvePIEBALDconsult18-Jan-10 12:40 
AnswerAnswer: But I feel dirty, and not in a good way..... Pin
Keith Barrow18-Jan-10 5:27
professionalKeith Barrow18-Jan-10 5:27 
XmlWriter has a WriteCharEntity method, which converts chars into their element/escaped equivalents, so all I need to do is convert chars not in the range "space" to "tilde" (ie non-latin characters) to determine this

static bool CharacterNeedsEscape(char c)
static bool CharacterNeedsEscape(char c)
{
    return c > '~' || c < ' ';
}pre>

Now the text node handling code checks each character in turn, if an escape is not needed the raw character is written, otherwise the <code>WriteCharEntity</code> method is called.

<pre>if (reader.NodeType == XmlNodeType.Text)
{
    string startingString = SecurityElement.Escape(reader.Value);
    char[] chars = startingString.ToCharArray();

    for (int i = 0; i < chars.Length; i++)
    {
        char c = chars[i];
        if (!CharacterNeedsEscape(c))
            writer.WriteRaw(chars, i, 1);
        else
            writer.WriteCharEntity(c);
    }
    return;
}


The code isn't pretty, but it is fast enough for my purposes....

CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks

AnswerRe: "Unescape" ISO string Pin
mav.northwind7-May-10 4:51
mav.northwind7-May-10 4:51 
QuestionExecute and exe from WinService in C# [modified] Pin
Sunil G18-Jan-10 0:40
Sunil G18-Jan-10 0:40 
AnswerRe: Execute and exe from WinService in C# Pin
#realJSOP18-Jan-10 1:03
professional#realJSOP18-Jan-10 1:03 
GeneralRe: Execute and exe from WinService in C# Pin
Sunil G18-Jan-10 1:08
Sunil G18-Jan-10 1:08 
GeneralRe: Execute and exe from WinService in C# Pin
#realJSOP18-Jan-10 2:49
professional#realJSOP18-Jan-10 2:49 
GeneralRe: Execute and exe from WinService in C# Pin
Sunil G18-Jan-10 2:53
Sunil G18-Jan-10 2:53 
GeneralRe: Execute and exe from WinService in C# Pin
Md. Marufuzzaman18-Jan-10 3:33
professionalMd. Marufuzzaman18-Jan-10 3:33 
GeneralRe: Execute and exe from WinService in C# Pin
#realJSOP18-Jan-10 3:35
professional#realJSOP18-Jan-10 3:35 
QuestionWriting to Excel without installation of MS Excel Pin
Priya Prk18-Jan-10 0:11
Priya Prk18-Jan-10 0:11 
AnswerRe: Writing to Excel without installation of MS Excel Pin
OriginalGriff18-Jan-10 0:17
mveOriginalGriff18-Jan-10 0:17 
GeneralRe: Writing to Excel without installation of MS Excel Pin
Priya Prk18-Jan-10 1:03
Priya Prk18-Jan-10 1:03 
GeneralRe: Writing to Excel without installation of MS Excel Pin
OriginalGriff18-Jan-10 1:37
mveOriginalGriff18-Jan-10 1:37 
AnswerRe: Writing to Excel without installation of MS Excel Pin
Dan Mos18-Jan-10 7:39
Dan Mos18-Jan-10 7:39 
AnswerRe: Writing to Excel without installation of MS Excel Pin
DaveyM6918-Jan-10 12:25
professionalDaveyM6918-Jan-10 12:25 
QuestionError while sending mail using System.Net.Mail in C# Pin
WinCrs17-Jan-10 23:09
WinCrs17-Jan-10 23:09 
AnswerRe: Error while sending mail using System.Net.Mail in C# Pin
Md. Marufuzzaman18-Jan-10 3:46
professionalMd. Marufuzzaman18-Jan-10 3:46 
QuestionEnable button on form1 while inside form2 Pin
tonyonlinux17-Jan-10 22:35
tonyonlinux17-Jan-10 22:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.