none
c# how can i get steamreader to read i think is binary file with text. RRS feed

  • Question

  • i dont know if this is binary with text or what format it is the its just called a file but it is mostly junk in there but i trying to extact stuff form the file the program loads it but where it has null values of cause it comes out of the loop before it gets to the text part that im trying to find so is there a way to read in this kind of file

    r   ƒ    +                @    (e‰     l   @   X   ”     ƒ        §   º     €?  €?  €?  €?tools lightgrid_volume lightgrid_volume colorMap normalMap $identitynormalmap colorTint 

    nulls are blank spaces ( some reason its replaced the null revrences here) 

    as you can see it just has random stuff then has at the end stuff im looking for i creatd what i think is a working code 

    public void findmaterialname()
            {
                Regex regex = new Regex(@"([a-z_0-9]+_c\s)(colorMap)", RegexOptions.Singleline);
                using (StreamReader reader = new StreamReader(@"F:\world_at_war_with_nuketown\Call of Duty - World at War\raw\materials\" + mattofind))
                {
                    string line;
                    while ((line = reader.ReadToEnd())!= "")
                    {
                        
                        Match match = regex.Match(line);
                        if (match.Success)
                        {
                            
                            string v = match.Groups[1].Value;
                            MessageBox.Show(v);
                        }
                    }
                }
            }

    but as you can see it fails due to the fact it hits a null part of the file witch shows as just blank space in here.

    file in notpate++

    Friday, May 24, 2019 8:13 PM

All replies

  • Hello,

    Step number 1 is to know the structure of this file, from there is plenty of post to assist but first the structure is needed.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Friday, May 24, 2019 9:04 PM
  • Hello,

    Step number 1 is to know the structure of this file, from there is plenty of post to assist but first the structure is needed.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    how would you find what file structure it is though i have looked it comes form a program but not 100% sure how you get what the jumble stuff is or how to find stucture from that 

    Friday, May 24, 2019 10:22 PM
  • Hello,

    Step number 1 is to know the structure of this file, from there is plenty of post to assist but first the structure is needed.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    how would you find what file structure it is though i have looked it comes form a program but not 100% sure how you get what the jumble stuff is or how to find stucture from that 

    i think the file structure is binary 8bit
    https://i.imgur.com/xOnrhoz.png
    Friday, May 24, 2019 10:37 PM
  • Not knowing what the file contains it could possibly be one or more types that have been serialized or not, no way to know from the screenshot or other information. In short you need inside information to how information is stored, otherwise you are simply hacking and we don't support hacking here.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Saturday, May 25, 2019 12:25 AM
  • Not knowing what the file contains it could possibly be one or more types that have been serialized or not, no way to know from the screenshot or other information. In short you need inside information to how information is stored, otherwise you are simply hacking and we don't support hacking here.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    its not hacking its a .file and its form a game called call of duty they given us mod tools so we all can create custom zombie maps for there games i trying to make a program that takes the old textures form there old game with mod tools support to there new bo3 game that has mod tools support its not hacking 

    Saturday, May 25, 2019 12:34 AM
  • In that case you need to contact their dev team for the layout of the file.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Saturday, May 25, 2019 12:56 AM
  • reason i ask in here is because the dev team at treyarch stopped supporting waw ages ago.... the games form 2008 
    Saturday, May 25, 2019 1:21 AM
  • Hi

    Thank you for posting here.

    For your last reply, it seems that your question is not related to c#, I suggest that you don't post in the c# forum. Because the Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 27, 2019 5:23 AM
  • This is a binary file, the fact that you can see text in the middle changes nothing. Any time strings are stored in a binary file they show up as raw text but they aren't. You'll need to get the file format from the developer (or figure out the constant offset that your data is at) in order to read the file. Once you have that you'll need to use BinaryReader to read the file as StreamReader will attempt to treat it as a text file and it isn't.

    Often times it is useful to first load the file into a binary editor and take a look at the first couple of bytes. On many occasions the file is just a zip file that has been renamed so try opening it in 7Zip or something. Since you're looking a CoD materials you might google for what format that is in. Many folks tend to have already figured this out. For example here it says the texture files are in TGA format. Using what you know about the format can help you identify the actual format being used. It is possible it is completely custom but unlikely.


    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, May 29, 2019 1:54 PM