Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8835763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:20:01+00:00 2026-06-14T09:20:01+00:00

so i am loading a file that has some encrypted text in it, it

  • 0

so i am loading a file that has some encrypted text in it, it uses a custom character table, how can i load it from an external file or put the character table in the code ?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:20:03+00:00Added an answer on June 14, 2026 at 9:20 am

    Start by going over the file and counting the lines so you can allocate an array. You could just use a list here but arrays have much better performance and you have a significant amount of items which you’ll have to loop over a lot (once for each encoded char in the file) so I think you should use an array instead.

        int lines = 0;
        try 
        {
             using (StreamReader sr = new StreamReader("Encoding.txt")) 
            {
                string line;
                while ((line = sr.ReadLine()) != null) 
                {
                    lines++;   
                }
            }
        }
        catch (Exception e) 
        {
            // Let the user know what went wrong.
            Console.WriteLine("The file could not be read:");
            Console.WriteLine(e.Message);
        }
    

    Now we’re going to allocate and array of tuples;

     Tuple<string, string> tuples = new Tuple<string, string>[lines];
    

    After that we’ll loop over the file again adding each key-value pair as a tuple.

         try 
        {
             using (StreamReader sr = new StreamReader("Encoding.txt")) 
            {
                string line;
                for (int i =0; i < lines; i++) 
                {
                    line = sr.Readline();
                    if (!line.startsWith('#')) //ignore comments
                    {
                         string[] tokens = line.Split('='); //split for key and value
                         foreach(string token in tokens)
                               token.Trim(' '); // remove whitespaces
    
                        tuples[i].Item1 = tokens[0];
                        tuples[i].Item2 = tokens[1];
                    }   
                }
            }
        }
        catch (Exception e) 
        {
            // Let the user know what went wrong.
            Console.WriteLine("The file could not be read:");
            Console.WriteLine(e.Message);
        }
    

    I’ve given you a lot of code although this may take a little tinkering to make work. I didn’t both to write the second loop in a compiler and I’m too lazy to look up things like System.String.Trim and make sure I’m using it correctly. I’ll leave those things to you. This has the core logic to do it. If you want to instead use a list move the logic inside of the for loop into the while loop where I count the lines.

    Do decode the file you’re reading you’ll have to loop over this array and compare the keys or values until you have a match.

    One other thing – your array of tuples is going to have some empty indexes (the array is of length lines while there are actually lines - comments + blankLines in the file). You’ll need some check to make sure you’re not accessing these indexes when you try to match characters. Alternatively, you could enhance the file reading so it doesn’t count blank lines or comments or remove those lines from the file you read from. The best solution would be to enhance the file reading but that’s also the most work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a flash file that is loading data from XML file. After I
I'm loading an Excel file that has cells with time data, e.g. 08:00:00. But
I am loading contents into a same domain iframe. Does the html file that
internet-explorer aborts the EOT file loading progress sometimes, so the font does not load
In one of my HTML page dynamically loading some file field while clicking a
Whats the advantage that the BDM ELF file has over the normal ELF file
I have several classes that need to load some properties files, and I was
I have a requirejs project that has been optimized into a single file, which
I have been fighting a losing battle against loading fonts from an embedded file
I've got an application that has to be compiled to x86 because of some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.