Inheritance: UserDataHandler
 internal UserDataHandler GetHandler(String userDataFile)
 {
     /*
      *  <script> </script>   (from ec2config)
         <powershell> </powershell>    (from ec2config)
         <eucalyptus> </eucalyptus>    : for euca-specific parameter passing
         <include> </include> : (optional) a list of URLs (that's to be processed with the same rule)
         zipped directory
      *
      */
     try
     {
         String unzippedDir = String.Format("{0}\\unzipped", CloudInit.CloudInitDirectory);
         if(Directory.Exists(unzippedDir))
             Directory.Delete(unzippedDir, true);
         Directory.CreateDirectory(unzippedDir);
         tryDecompress(userDataFile, unzippedDir);
         return new ZipHandler(unzippedDir);
     }
     catch (Exception ex)
     {
         // the user-data is not a zipped file
         UserDataHandler dataHandler = null;
         using (StreamReader sr = new StreamReader(File.OpenRead(userDataFile)))
         {
             String line = null;
             while ((line = sr.ReadLine()) != null)
             {
                 line = line.Trim();
                 if (line.Length > 0)
                 {
                     line = line.ToLower();
                     if (line.StartsWith("<script>") || line.StartsWith("<powershell>"))
                         dataHandler = new ScriptHandler();
                     else if (line.StartsWith("<eucalyptus>"))
                         dataHandler = new EucalyptusParameterHandler();
                     else if (line.StartsWith("<include>"))
                         dataHandler = new IncludeHandler();
                     else
                         dataHandler = new BogusHandler();
                     break;
                 }
             }
         }
         if (dataHandler == null)
             throw new EucaException("User-data is in unknown format");
         return dataHandler;
     }
 }
 internal UserDataHandler GetHandler(String userDataFile)
 {
     /*
      *  <script> </script>   (from ec2config)
      *  <powershell> </powershell>    (from ec2config)
      *  <eucalyptus> </eucalyptus>    : for euca-specific parameter passing
      *  <include> </include> : (optional) a list of URLs (that's to be processed with the same rule)
      *  zipped directory
      *
      */
     try
     {
         String unzippedDir = String.Format("{0}\\unzipped", CloudInit.CloudInitDirectory);
         if (Directory.Exists(unzippedDir))
         {
             Directory.Delete(unzippedDir, true);
         }
         Directory.CreateDirectory(unzippedDir);
         tryDecompress(userDataFile, unzippedDir);
         return(new ZipHandler(unzippedDir));
     }
     catch (Exception ex)
     {
         // the user-data is not a zipped file
         UserDataHandler dataHandler = null;
         using (StreamReader sr = new StreamReader(File.OpenRead(userDataFile)))
         {
             String line = null;
             while ((line = sr.ReadLine()) != null)
             {
                 line = line.Trim();
                 if (line.Length > 0)
                 {
                     line = line.ToLower();
                     if (line.StartsWith("<script>") || line.StartsWith("<powershell>"))
                     {
                         dataHandler = new ScriptHandler();
                     }
                     else if (line.StartsWith("<eucalyptus>"))
                     {
                         dataHandler = new EucalyptusParameterHandler();
                     }
                     else if (line.StartsWith("<include>"))
                     {
                         dataHandler = new IncludeHandler();
                     }
                     else
                     {
                         dataHandler = new BogusHandler();
                     }
                     break;
                 }
             }
         }
         if (dataHandler == null)
         {
             throw new EucaException("User-data is in unknown format");
         }
         return(dataHandler);
     }
 }