Click here to Skip to main content
15,895,011 members
Home / Discussions / C#
   

C#

 
GeneralRe: chatting between c# and asp.net Pin
_beginner_30-Aug-07 8:44
_beginner_30-Aug-07 8:44 
Questioncan any one tell me how to encrypt the connection stirng Pin
prasadbuddhika30-Aug-07 2:21
prasadbuddhika30-Aug-07 2:21 
AnswerRe: can any one tell me how to encrypt the connection stirng Pin
snorkie30-Aug-07 2:28
professionalsnorkie30-Aug-07 2:28 
AnswerRe: can any one tell me how to encrypt the connection stirng Pin
Not Active30-Aug-07 2:28
mentorNot Active30-Aug-07 2:28 
QuestionNeed help with an exception Pin
MicealG30-Aug-07 2:21
MicealG30-Aug-07 2:21 
AnswerRe: Need help with an exception Pin
Alaric_30-Aug-07 2:28
professionalAlaric_30-Aug-07 2:28 
GeneralRe: Need help with an exception Pin
MicealG30-Aug-07 3:54
MicealG30-Aug-07 3:54 
Questionhow to add new line Pin
Situ1430-Aug-07 1:33
Situ1430-Aug-07 1:33 
hello

when i compiling this code its appended allthe lines in one line..

I want to keep the file as it is and want to add comment where there is assemblyVersionInfo string...


String strPathToFile = "Put here the path to the .cs file";
System.IO.StreamReader sr = new System.IO.StreamReader(strPathToFile);
System.Text.StringBuilder strAllText = new System.Text.StringBuilder();
bool AlreadyCommented = false;
do
{
if(sr.Peek() == -1) break;
String line = sr.ReadLine();
if(line.IndexOf("AssemblyVersion") > -1 && line.IndexOf("//") > -1) AlreadyCommented = true;
strAllText.Append(line);
}
sr.Close();
if(AlreadyCommented) return;
System.IO.FileInfo fi = new System.IO.FileInfo(strPathToFile);
fi.CopyTo(strPathToFile + ".bak"); //backup copy of the old file
int posOfAssemblyVersion = strAllText.ToString().IndexOf("AssemblyVersion");
//Look for the closing bracket "]"
int posOfClosingBracket = strAllText.ToString().IndexOf("]", posOfAssemblyVersion);
string strComments = "//Put there the desired comments";
strAllText = strAllText.Insert(posOfClosingBracket, strComments);
System.IO.StreamWriter sw = new System.IO.StreamWriter(strPathToFile, false); //overwrites the original
sw.Write(strAllText.ToString());
sw.Close();

if you have any ans then plz reply as soon as

thanks

AnswerRe: how to add new line Pin
ChrisKo31-Aug-07 13:16
ChrisKo31-Aug-07 13:16 
Questionupdate chart source data at runtime Pin
A M SOMAN30-Aug-07 1:28
A M SOMAN30-Aug-07 1:28 
Questionsealed class Pin
Sonia Gupta30-Aug-07 1:02
Sonia Gupta30-Aug-07 1:02 
AnswerRe: sealed class Pin
jith - iii30-Aug-07 1:28
jith - iii30-Aug-07 1:28 
GeneralRe: sealed class Pin
Sonia Gupta30-Aug-07 1:34
Sonia Gupta30-Aug-07 1:34 
GeneralRe: sealed class Pin
jith - iii30-Aug-07 1:42
jith - iii30-Aug-07 1:42 
GeneralRe: sealed class Pin
Sonia Gupta30-Aug-07 1:48
Sonia Gupta30-Aug-07 1:48 
QuestionHow to set local time by code ? Pin
nesaver8530-Aug-07 0:51
nesaver8530-Aug-07 0:51 
AnswerRe: How to set local time by code ? Pin
Martin#30-Aug-07 1:15
Martin#30-Aug-07 1:15 
AnswerRe: How to set local time by code ? Pin
PIEBALDconsult30-Aug-07 5:51
mvePIEBALDconsult30-Aug-07 5:51 
Questionmedia player Pin
Tarun.Suneja30-Aug-07 0:51
Tarun.Suneja30-Aug-07 0:51 
AnswerRe: media player Pin
Dave Kreskowiak30-Aug-07 6:31
mveDave Kreskowiak30-Aug-07 6:31 
QuestionContent Alignment Pin
Stevo Z30-Aug-07 0:42
Stevo Z30-Aug-07 0:42 
AnswerRe: Content Alignment Pin
Martin#30-Aug-07 1:18
Martin#30-Aug-07 1:18 
GeneralRe: Content Alignment Pin
Stevo Z30-Aug-07 1:25
Stevo Z30-Aug-07 1:25 
QuestionInstant Messenger Pin
fyzkhan30-Aug-07 0:25
fyzkhan30-Aug-07 0:25 
AnswerRe: Instant Messenger Pin
jith - iii30-Aug-07 1:32
jith - iii30-Aug-07 1:32 

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.