1
Answer

beginner needs help

Photo of katheleous

katheleous

21y
1.5k
1
Hi , I've been asked to create a controller class that will control what forms will be displayed on the screen. Basically the project will start and a new controller will be created and the initial from to be loaded will be passed, the class will create the form and show it and also handle the disposing of the form......... Has anyone developed anything like this or has any ideas on where to staet coding Cheers.

Answers (1)

0
Photo of Vulpes
NA 98.3k 1.5m 12y
Assuming there's only one GUID in each file or it's just the first one you need to match, then this is easily done using a regular expression.

Here's some sample code:

using System;
using System.IO;
using System.Text.RegularExpressions;

class Test
{
   static void Main()
   {
      string regExp = 
      @"(?i)\b" +
      @"[0-9A-F]{8}-" +
      @"[0-9A-F]{4}-" +
      @"[0-9A-F]{4}-" +
      @"[0-9A-F]{4}-" +
      @"[0-9A-F]{12}" +
      @"\b";

      string text = File.ReadAllText("darma.xml");
      string guid = Regex.Match(text, regExp).Value;
      Console.WriteLine(guid);

      string text2 = File.ReadAllText("darma.ini");
      string guid2 = Regex.Match(text2, regExp).Value;
      Console.WriteLine(guid2);

      if (guid == guid2)
         Console.WriteLine("Files are the same");
      else
         Console.WriteLine("Files are not the same");
      Console.ReadKey();
   }
 
 


Accepted
0
Photo of darma teja
NA 493 194.3k 12y
Wonderful!!!

Thanks allot!!!