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 8212939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:56:32+00:00 2026-06-07T10:56:32+00:00

Is there any way to simplify this code? Or any way to create another

  • 0

Is there any way to simplify this code? Or any way to create another page of class page to keep the main page clean as possible. I’m planning to have hundreds of text file and since I’m a newbie I don’t the best way to approach this. I’m trying to make an app with Xbox 360 achievement guides, but each game averaged around 40 achievements. (That’s allot of text files).

if (selectedIndex == "0")
{
    var Tutorial = Application.GetResourceStream(new Uri("Resources/Games/MaxPayne3/StoryRelated.txt", UriKind.Relative));

    using (Stream Text = Tutorial.Stream)
    {
        StreamReader sr = new StreamReader(Text);
        Guide.Text = "Story Complete [MEDIUM]\n" + Environment.NewLine + sr.ReadToEnd();
        Title.Text = "Feel The Payne";
        AppBarMenuDisable.IsEnabled = false;
    }
}
else if (selectedIndex == "1")
{
    var Tutorial = Application.GetResourceStream(new Uri("Resources/Games/MaxPayne3/StoryRelated.txt", UriKind.Relative));

    using (Stream Text = Tutorial.Stream)
    {
        StreamReader sr = new StreamReader(Text);
        Guide.Text = "Story Complete [HARD]\n" + Environment.NewLine + sr.ReadToEnd();
        Title.Text = "Serious Payne";
        AppBarMenuDisable.IsEnabled = false;
    }
}
else if (selectedIndex == "2")
{
    var Tutorial = Application.GetResourceStream(new Uri("Resources/Games/MaxPayne3/StoryRelated.txt", UriKind.Relative));

    using (Stream Text = Tutorial.Stream)
    {
        StreamReader sr = new StreamReader(Text);
        Guide.Text = "Story Complete [OLD SCHOOL]\n" + Environment.NewLine + sr.ReadToEnd();
        Title.Text = "Maximum Payne";
        AppBarMenuDisable.IsEnabled = false;
    }
}
else if (selectedIndex == "3")
{
    var Tutorial = Application.GetResourceStream(new Uri("Resources/Games/MaxPayne3/TextFile1.txt", UriKind.Relative));

    using (Stream Text = Tutorial.Stream)
    {
        StreamReader sr = new StreamReader(Text);
        Guide.Text = sr.ReadToEnd();
        Title.Text = "Payne In The Ass";
        AppBarMenuDisable.IsEnabled = false;
    }
}
else if (selectedIndex == "4")
{
    var Tutorial = Application.GetResourceStream(new Uri("Resources/Games/MaxPayne3/StoryRelated.txt", UriKind.Relative));

    using (Stream Text = Tutorial.Stream)
    {
        StreamReader sr = new StreamReader(Text);
        Guide.Text = sr.ReadToEnd();
        Title.Text = "Part I Complete";
        AppBarMenuDisable.IsEnabled = false;
    }
}
else if (selectedIndex == "5")
{
    var Tutorial = Application.GetResourceStream(new Uri("Resources/Games/MaxPayne3/StoryRelated.txt", UriKind.Relative));

    using (Stream Text = Tutorial.Stream)
    {
        StreamReader sr = new StreamReader(Text);
        Guide.Text = sr.ReadToEnd();
        Title.Text = "Part II Complete";
        AppBarMenuDisable.IsEnabled = false;
    }
}
else if (selectedIndex == "6")
{
    var Tutorial = Application.GetResourceStream(new Uri("Resources/Games/MaxPayne3/StoryRelated.txt", UriKind.Relative));

    using (Stream Text = Tutorial.Stream)
    {
        StreamReader sr = new StreamReader(Text);
        Guide.Text = sr.ReadToEnd();
        Title.Text = "Part III Complete";
        AppBarMenuDisable.IsEnabled = false;
    }
}
else if (selectedIndex == "7")
{
    var Tutorial = Application.GetResourceStream(new Uri("Resources/Games/MaxPayne3/TextFile2.txt", UriKind.Relative));

    using (Stream Text = Tutorial.Stream)
    {
        StreamReader sr = new StreamReader(Text);
        Guide.Text = sr.ReadToEnd();
        Title.Text = "A New York Minute";
        AppBarMenuDisable.IsEnabled = false;
    }
}
else if (selectedIndex == "8")
{
    var Tutorial = Application.GetResourceStream(new Uri("Resources/Games/MaxPayne3/TextFile3.txt", UriKind.Relative));

    using (Stream Text = Tutorial.Stream)
    {
        StreamReader sr = new StreamReader(Text);
        Guide.Text = sr.ReadToEnd();
        Title.Text = "The Shadows Rushed Me";
        AppBarMenuDisable.IsEnabled = false;
    }
}
else if (selectedIndex == "9")
{
    var Tutorial = Application.GetResourceStream(new Uri("Resources/Games/MaxPayne3/TextFile4.txt", UriKind.Relative));

    using (Stream Text = Tutorial.Stream)
    {
        StreamReader sr = new StreamReader(Text);
        Guide.Text = sr.ReadToEnd();
        Title.Text = "Out The Window";
        YouTubeLink.URL = "http://www.youtube.com/watch?v=lRg6ygA-M_Y";
    }
}

I would love to have this text files somewhere in the internet as the user can retrieve them as needed.

  • 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-07T10:56:35+00:00Added an answer on June 7, 2026 at 10:56 am

    You are overcomplicating things. If you really want to bundle all your data with the application, you could serialize it to XML or JSON and then deserialize it internally.

    This also adds flexibility to your code, since working directly with hardcoded values like you do might cause some headaches in the long run, when you decide to add changes.

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

Sidebar

Related Questions

Is there any way to simplify this method? Perhaps a way to && both
I'm trying to simplify a Card class, and am wondering if there's any way
Is there any way in Notepad++ (or even with another tool) to change the
Is there any way in which I can automatically convert a Custom Class Object
I am new to Rails and I wonder if there's any way to simplify
Is there any way I can set a formatter on models that will convert
Is there any way to use Google's API to retrieve a user's current zipcode
Is there any way to overload the > (greater than) operator, to be able
Is there any way we can fetch X509 Public Cetrificates using c# from AD
Is there any way to stop animation in iOS 3 ? I know about:

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.