locked
System.IO.File.ReadAllText HELP ME RRS feed

  • Question

  • User282826316 posted

    I am reading a directory containing two video files, the two files are the same just change the name.
    The first time this is done ReadText = System.IO.File.ReadAllText (FullName); The program takes about 10 seconds,
    when it goes to the next video, I get stuck and do everything in practice crash in visual studio.
    I do not understand why can you help me?

    Ps the video files are about 500mb

    PPS sorry for my bad english

    Thursday, September 4, 2014 4:15 AM

All replies

  • User197322208 posted

    1. You read the video as text, when there are bytes

    2. 

    the video files are about 500mb
    - maybe you do not have this amount of RAM 

    3. Look into event viewer - some errors there?

    4. Why you are reading the video as text?

    Thursday, September 4, 2014 5:32 AM
  • User282826316 posted

    Hi,

    i think the probelm was file, For safety, I also included this 

    GC.Collect();
    readText = System.IO.File.ReadAllText(FullNomeFile);

    I would now like to replace an older text within the file and save it. 

    I have tried so

             File.WriteAllText(Path.Combine(txtDestinazione.Text, NomeFile), System.IO.File.ReadAllText(FullNomeFile).Replace(DataAcquizisioneAfter,DataAcquizisioneBefore));

    the saved file has 772,718 rows, the original file 27718, because I have all these extra lines.
    If I do I edit the file from notepad and save it, there is no problem, I would do the same thing with c #

    Thursday, September 4, 2014 9:16 AM
  • User-1360095595 posted

    My question is this: if they are video files, should you be using ReadAllText?

    "Opens a text file, reads all lines of the file into a string, and then closes the file": http://msdn.microsoft.com/en-us/library/system.io.file.readalltext(v=vs.110).aspx

    Thursday, September 4, 2014 9:36 AM
  • User282826316 posted

    ok, so it seems to work  

       readText = System.IO.File.ReadAllText(FullNomeFile, System.Text.Encoding.Default);

    Thursday, September 4, 2014 9:48 AM
  • User282826316 posted

    I need to change the date "media item creation" tab ORIGIN properties.
    The only way I found was this.

    Thursday, September 4, 2014 9:50 AM