Click here to Skip to main content
15,914,943 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: How to prevent user click to the checkbox on a listview control Pin
Mark Salsbery17-Oct-09 8:37
Mark Salsbery17-Oct-09 8:37 
AnswerRe: How to prevent user click to the checkbox on a listview control Pin
Richard MacCutchan17-Oct-09 9:25
mveRichard MacCutchan17-Oct-09 9:25 
GeneralRe: How to prevent user click to the checkbox on a listview control Pin
[N][Q][H]17-Oct-09 16:40
[N][Q][H]17-Oct-09 16:40 
GeneralRe: How to prevent user click to the checkbox on a listview control Pin
Richard MacCutchan17-Oct-09 21:27
mveRichard MacCutchan17-Oct-09 21:27 
AnswerRe: How to prevent user click to the checkbox on a listview control Pin
vsaratkar19-Oct-09 7:29
vsaratkar19-Oct-09 7:29 
QuestionHow do I create an unstopable thread? Pin
Paulo Zemek15-Oct-09 13:19
Paulo Zemek15-Oct-09 13:19 
AnswerRe: How do I create an unstopable thread? Pin
Dave Kreskowiak16-Oct-09 5:23
mveDave Kreskowiak16-Oct-09 5:23 
QuestionAny chance of reversing the encoding Pin
cristi82gt15-Oct-09 6:03
cristi82gt15-Oct-09 6:03 
I made a big mistake. The code bellow tells everything:

private void SearchFolders(FileSystemInfo[] fsInfos)
{
foreach (FileSystemInfo fsi in fsInfos)
if (fsi is FileInfo)
try
{
ReplaceInFile((FileInfo)fsi, "textToSearch", String.Empty);
}
catch {}
else if (fsi is DirectoryInfo)
SearchFolders(((DirectoryInfo)fsi).GetFileSystemInfos());
}

private void ReplaceInFile(FileInfo fi, string searchText, string replaceText)
{
StreamReader reader = new StreamReader(fi.FullName);
string content = reader.ReadToEnd();
reader.Close();

content = Regex.Replace(content, searchText, replaceText);

StreamWriter writer = new StreamWriter(fi.FullName);
writer.Write(content);
writer.Close();
}

So i have a recursive function SearchFolders witch searches an expression in all files from a folder. The problem: well i forgot to put the condition that the search should be done only on text file. So the function just executed on every kind of file (jpeg, gif, pdf, doc, etc.). The result: the files are unreadable. Tryng to reverse the proces with someting like this had no result


private void Reverse()
{
FileInfo fi = new FileInfo(@"D:\test\test.jpg");

FileStream fs = fi.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None);
StreamReader sr = new StreamReader(fs);

string content = sr.ReadToEnd();
System.Text.UTF8Encoding utf8 = new UTF8Encoding();

byte[] bytes = utf8.GetBytes(content);

FileStream fstarget = File.Create(@"D:\test\reverse.jpg");


fstarget.Write(bytes, 0, bytes.Count);
fstarget.Close();

}

I think the files are lost but i just want to hear and another opinion.
AnswerRe: Any chance of reversing the encoding Pin
Dave Kreskowiak15-Oct-09 7:55
mveDave Kreskowiak15-Oct-09 7:55 
GeneralRe: Any chance of reversing the encoding Pin
cristi82gt15-Oct-09 8:35
cristi82gt15-Oct-09 8:35 
GeneralRe: Any chance of reversing the encoding Pin
Dave Kreskowiak15-Oct-09 8:46
mveDave Kreskowiak15-Oct-09 8:46 
GeneralRe: Any chance of reversing the encoding Pin
cristi82gt15-Oct-09 8:52
cristi82gt15-Oct-09 8:52 
Question???Some function exists: Pin
GuilleB0914-Oct-09 9:46
GuilleB0914-Oct-09 9:46 
AnswerRe: ???Some function exists: Pin
Abhijit Jana14-Oct-09 17:10
professionalAbhijit Jana14-Oct-09 17:10 
QuestionHow to refresh the child window dropdown Pin
sandhya1413-Oct-09 19:53
sandhya1413-Oct-09 19:53 
AnswerRe: How to refresh the child window dropdown Pin
Shameel19-Oct-09 0:02
professionalShameel19-Oct-09 0:02 
QuestionCloning winforms Pin
Starkie7013-Oct-09 9:01
Starkie7013-Oct-09 9:01 
AnswerRe: Cloning winforms Pin
Henry Minute13-Oct-09 10:11
Henry Minute13-Oct-09 10:11 
Questionhow do my Windows forms buttons change their border appearance at runtime? Pin
mnemonic6913-Oct-09 0:41
mnemonic6913-Oct-09 0:41 
AnswerRe: how do my Windows forms buttons change their border appearance at runtime? Pin
Richard MacCutchan13-Oct-09 1:14
mveRichard MacCutchan13-Oct-09 1:14 
GeneralRe: how do my Windows forms buttons change their border appearance at runtime? Pin
mnemonic6913-Oct-09 2:12
mnemonic6913-Oct-09 2:12 
GeneralRe: how do my Windows forms buttons change their border appearance at runtime? Pin
Richard MacCutchan13-Oct-09 2:54
mveRichard MacCutchan13-Oct-09 2:54 
AnswerRe: how do my Windows forms buttons change their border appearance at runtime? Pin
Shameel19-Oct-09 0:05
professionalShameel19-Oct-09 0:05 
QuestionSQL Command Wrapper class and configuration instance in web.config Pin
NICE TO MEET13-Oct-09 0:29
NICE TO MEET13-Oct-09 0:29 
QuestionStored procedure Pin
krishnaveer12-Oct-09 21:36
krishnaveer12-Oct-09 21:36 

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.