Beispiel #1
0
        private static void LoadGenerators(RegistryKey generatorsKey, IDictionary <string, IORMGenerator> generators
#if VISUALSTUDIO_15_0
                                           // Allow resolution of reg: prefixed transform URI's
                                           , RegistryKey rootKey
#endif
                                           )
        {
            if (generatorsKey == null)
            {
                return;
            }
            string[] generatorNames = generatorsKey.GetSubKeyNames();
            for (int i = 0; i < generatorNames.Length; i++)
            {
                string      generatorName = generatorNames[i];
                RegistryKey generatorKey  = null;
                try
                {
                    generatorKey = generatorsKey.OpenSubKey(generatorName, RegistryKeyPermissionCheck.ReadSubTree);
                    string        type         = generatorKey.GetValue("Type", null) as string;
                    IORMGenerator ormGenerator = null;
                    if (String.Equals(type, "XSLT", StringComparison.OrdinalIgnoreCase))
                    {
                        ormGenerator = new XslORMGenerator(generatorKey
#if VISUALSTUDIO_15_0
                                                           , rootKey
#endif
                                                           );
                    }
                    else if (String.Equals(type, "Class", StringComparison.OrdinalIgnoreCase))
                    {
                        ormGenerator = LoadGeneratorClass(generatorKey);
                    }

                    if (ormGenerator != null)
                    {
                        System.Diagnostics.Debug.Assert(String.Equals(generatorName, ormGenerator.OfficialName, StringComparison.OrdinalIgnoreCase));
                        //ormGenerator.ORMCustomTool = this;
                        generators.Add(ormGenerator.OfficialName, ormGenerator);
                    }
                }
                catch (Exception ex)
                {
                    // TODO: Localize message.
                    ReportError("WARNING: Exception ocurred while trying to load generator \"" + generatorName + "\" in ORMCustomTool:", ex);
                }
                finally
                {
                    if (generatorKey != null)
                    {
                        generatorKey.Close();
                    }
                }
            }
        }
Beispiel #2
0
		private static void LoadGenerators(RegistryKey generatorsKey)
		{
			if (generatorsKey == null)
			{
				return;
			}
			string[] generatorNames = generatorsKey.GetSubKeyNames();
			for (int i = 0; i < generatorNames.Length; i++)
			{
				string generatorName = generatorNames[i];
				RegistryKey generatorKey = null;
				try
				{
					generatorKey = generatorsKey.OpenSubKey(generatorName, RegistryKeyPermissionCheck.ReadSubTree);
					string type = generatorKey.GetValue("Type", null) as string;
					IORMGenerator ormGenerator = null;
					if (String.Equals(type, "XSLT", StringComparison.OrdinalIgnoreCase))
					{
						ormGenerator = new XslORMGenerator(generatorKey);
					}
					else if (String.Equals(type, "Class", StringComparison.OrdinalIgnoreCase))
					{
						ormGenerator = LoadGeneratorClass(generatorKey);
					}

					if (ormGenerator != null)
					{
						System.Diagnostics.Debug.Assert(String.Equals(generatorName, ormGenerator.OfficialName, StringComparison.OrdinalIgnoreCase));
						//ormGenerator.ORMCustomTool = this;
						ORMGenerators.Add(ormGenerator.OfficialName, ormGenerator);
					}
				}
				catch (Exception ex)
				{
					// TODO: Localize message.
					ReportError("WARNING: Exception ocurred while trying to load generator \"" + generatorName + "\" in ORMCustomTool:", ex);
				}
				finally
				{
					if (generatorKey != null)
					{
						generatorKey.Close();
					}
				}
			}
		}