Click here to Skip to main content
15,901,035 members
Home / Discussions / C#
   

C#

 
AnswerRe: C#In Canon Camera Development, find error Device Busy Pin
OriginalGriff19-Mar-19 20:59
mveOriginalGriff19-Mar-19 20:59 
AnswerRe: C#In Canon Camera Development, find error Device Busy Pin
Gerry Schmitz20-Mar-19 5:15
mveGerry Schmitz20-Mar-19 5:15 
QuestionI found this strange in C# Pin
Brian_TheLion19-Mar-19 13:06
Brian_TheLion19-Mar-19 13:06 
AnswerRe: I found this strange in C# Pin
Eddy Vluggen19-Mar-19 13:33
professionalEddy Vluggen19-Mar-19 13:33 
GeneralRe: I found this strange in C# Pin
Brian_TheLion19-Mar-19 14:23
Brian_TheLion19-Mar-19 14:23 
GeneralRe: I found this strange in C# Pin
Eddy Vluggen20-Mar-19 1:26
professionalEddy Vluggen20-Mar-19 1:26 
AnswerRe: I found this strange in C# Pin
Dave Kreskowiak19-Mar-19 14:24
mveDave Kreskowiak19-Mar-19 14:24 
GeneralRe: I found this strange in C# Pin
Brian_TheLion19-Mar-19 14:51
Brian_TheLion19-Mar-19 14:51 
Hi Dave.

Sorry but my code is a bit messy as I'm experimenting while learning C#.
At the bottom of the code you'll find num=i; then near the top I have numberOfVerbs = num;
I could not use numberOfVerbs = i;

I have found out since that I could have used the .long command to find out how many CollectText's created.

I use to be able to run the code without errors but something has changed to cause some errors.



C#
namespace Lads_in_CSharp
{
    public class Program
    {
        int i = 0;
        int num;
        int numberOfVerbs;
        int y=0;
        int a = 0;
        //String sr;
        String Text1="";
        String[] CollectText = new String[1000];
        String [] TT = new String[3] ;
        public static void Main(string[] args)
         {
            Program prog = new Program();
            StreamReader sr = new StreamReader("demo.adv");


           Console.WriteLine("Start of Program");
           prog.y = 4;
           prog.ReadHeader(sr);
           Console.WriteLine(prog.i);
           prog.ReadVerbs(sr);
           prog.ReadNouns(sr);
           prog.ReadObjects(sr);
           prog.ReadStartRoom(sr);
           prog.ReadRooms(sr);
           prog.ReadMessages(sr);
           prog.ReadAutoActions(sr);
           prog.ReadActions(sr);
           sr.Close(); 
           Console.Read();

        }
        public void ReadHeader(StreamReader sr)
        {
            
            Console.WriteLine("Read Header");
          
                ReadLineOfText(sr);
                Console.WriteLine("Text1 is: " + sr);
                      
         //   Console.WriteLine(y);
          //  i = 6;
        }

        public void ReadVerbs(StreamReader sr) //                                      VERBS
        {
            Console.WriteLine("Read Verbs++++++++++");
            // Verb1 = "Paint";
            int i=0;
            ReadLineOfText(sr);
            numberOfVerbs = num;
            Console.WriteLine("Text1 is:: " + Text1);
            Console.WriteLine("Collect Text 2 = "+CollectText[2]);   // TEST
            Console.WriteLine("Number of Verbs is "+num);

            // string[] authorsList = Text1.Split(",");


            Console.WriteLine("Comma separated strings");
            // String of authors  
            //  string authors = "Mahesh Chand, Henry He, Chris Love, Raj Beniwal, Praveen Kumar";
            // Split authors separated by a comma followed by space  
            //string[] authorsList = authors.Split(", ");
            // foreach (string author in authorsList)
            //    Console.WriteLine(author);



           // int i = 0;
          //  foreach (string line in File.ReadAllLines("TextFile1.txt"))
            {
                i = 0;

                while (a < 10)
                {
                    string[] parts = CollectText[1].Split(',');
                    foreach (string part in parts)
                    {
                        Console.WriteLine("part = {0}  ", part);
                        i++;
                        if (i == 1)
                        {
                            TT[i] = part;
                        }
                        else
                        {
                            TT[i] = part;
                        }
                        a++;
                    }
                }

                   
                }
                Console.WriteLine("TT[1] = " + TT[1]);
                Console.WriteLine("TT[2] = " + TT[2]);
                i++; // For demonstration.
            }
        }
                 //   Console.WriteLine("Text1 split:"+authorsList);
          


        public void ReadNouns(StreamReader sr)
        { 
            Console.WriteLine("Read Nouns ++++++++++++++++++"); //               NOUNS
            //Console.WriteLine("Verb : "+Verb1);
            ReadLineOfText(sr);
            Console.WriteLine("Text1 is: " + Text1);
        }

        public void ReadObjects(StreamReader sr)
        {
            Console.WriteLine("Read Objects+++++++++++++");
            ReadLineOfText(sr);
            Console.WriteLine("Text1 is: " + Text1);
        }

        public void ReadStartRoom(StreamReader sr)
        {
            Console.WriteLine("Read Start Room+++++++++++");
            ReadLineOfText(sr);
            Console.WriteLine("Text1 is: " + Text1);
        }

        public void ReadRooms(StreamReader sr)
        {
            Console.WriteLine("Read Rooms+++++++++++++");
            ReadLineOfText(sr);
            Console.WriteLine("Text1 is: " + Text1);
        }

        public void ReadMessages(StreamReader sr)
        {
            Console.WriteLine("Read Messages+++++++++++");
            ReadLineOfText(sr);
            Console.WriteLine("Text1 is: " + Text1);
        }

        public void ReadAutoActions(StreamReader sr)
        {
            Console.WriteLine("Read Auto Actions+++++++++");
            ReadLineOfText(sr);
            Console.WriteLine("Text1 is: " + Text1);
        }

        public void ReadActions(StreamReader sr)
        {
            Console.WriteLine("Read Actions");
            ReadLineOfText(sr);
            Console.WriteLine("Text1 is: "+Text1);
        }
        public void ReadLineOfText(StreamReader sr)
        {
            Text1 = "null";
            i = 0;
            while (Text1 != "")
            {
                Text1 = sr.ReadLine();

                Console.WriteLine("ReadLine is: [read from ReadOfText producer]" + Text1);
               
                i++;
                CollectText[i] = Text1;
            }
            i = i-1;
            num = i;
            
            Console.WriteLine(i);

        }

    }
<pre>

GeneralRe: I found this strange in C# Pin
Dave Kreskowiak19-Mar-19 15:34
mveDave Kreskowiak19-Mar-19 15:34 
GeneralRe: I found this strange in C# Pin
Brian_TheLion20-Mar-19 0:11
Brian_TheLion20-Mar-19 0:11 
AnswerRe: I found this strange in C# Pin
Richard MacCutchan19-Mar-19 22:59
mveRichard MacCutchan19-Mar-19 22:59 
GeneralRe: I found this strange in C# Pin
Brian_TheLion19-Mar-19 23:28
Brian_TheLion19-Mar-19 23:28 
AnswerRe: I found this strange in C# Pin
Gerry Schmitz20-Mar-19 5:10
mveGerry Schmitz20-Mar-19 5:10 
QuestionLooking for a good book to learn C# Pin
Brian_TheLion18-Mar-19 20:07
Brian_TheLion18-Mar-19 20:07 
AnswerRe: Looking for a good book to learn C# Pin
OriginalGriff18-Mar-19 21:01
mveOriginalGriff18-Mar-19 21:01 
GeneralRe: Looking for a good book to learn C# Pin
Brian_TheLion19-Mar-19 20:44
Brian_TheLion19-Mar-19 20:44 
GeneralRe: Looking for a good book to learn C# Pin
OriginalGriff19-Mar-19 21:17
mveOriginalGriff19-Mar-19 21:17 
AnswerRe: Looking for a good book to learn C# Pin
Ralf Meier18-Mar-19 22:28
mveRalf Meier18-Mar-19 22:28 
GeneralRe: Looking for a good book to learn C# Pin
OriginalGriff18-Mar-19 22:35
mveOriginalGriff18-Mar-19 22:35 
GeneralRe: Looking for a good book to learn C# Pin
Ralf Meier19-Mar-19 1:07
mveRalf Meier19-Mar-19 1:07 
GeneralRe: Looking for a good book to learn C# Pin
Brian_TheLion19-Mar-19 20:44
Brian_TheLion19-Mar-19 20:44 
GeneralRe: Looking for a good book to learn C# Pin
OriginalGriff19-Mar-19 21:12
mveOriginalGriff19-Mar-19 21:12 
AnswerRe: Looking for a good book to learn C# Pin
Richard MacCutchan18-Mar-19 22:45
mveRichard MacCutchan18-Mar-19 22:45 
GeneralRe: Looking for a good book to learn C# Pin
Brian_TheLion19-Mar-19 11:36
Brian_TheLion19-Mar-19 11:36 
GeneralRe: Looking for a good book to learn C# Pin
Richard MacCutchan19-Mar-19 22:54
mveRichard MacCutchan19-Mar-19 22:54 

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.