コード例 #1
0
        public void InvalidFrameworkStructureDoesNotShowUp()
        {
            DeleteEnvironmentVariable();
            Directory.CreateDirectory(DefaultFramework.ToString());
            var invalidFrameworks = new FrameworkFinder();

            Assert.AreEqual(0, invalidFrameworks.All.Length);
            Directory.Delete(DefaultFramework.ToString());
            DeleteFrameworkFolders();
        }
コード例 #2
0
        private void GetVisualTestsFromInstallPath(DeltaEngineFramework framework)
        {
            string frameworkPath = Path.Combine(installPath, framework.ToString());

            foreach (var file in Directory.GetFiles(frameworkPath))
            {
                if (file.Contains(".Editor.") ||
                    (!file.EndsWith(".Tests.exe") && !file.EndsWith(".Tests.dll")))
                {
                    continue;
                }
                try
                {
                    TryGetVisualTestsFromInstallPath(frameworkPath, file);
                }
                catch (ReflectionTypeLoadException ex)
                {
                    ShowLoaderExceptionWarning(file, ex);
                }
                catch (FileLoadException ex)
                {
                    Logger.Warning("Failed to load dependency for " + file + ": " + ex.Message);
                }
            }
        }
コード例 #3
0
 public static string ToInternalShortName(this DeltaEngineFramework framework)
 {
     if (framework == DeltaEngineFramework.Default)
     {
         throw new ArgumentException(framework.ToString());
     }
     return(FrameworkShortNames[framework]);
 }
コード例 #4
0
ファイル: VsTemplate.cs プロジェクト: remy22/DeltaEngine
 public static string[] GetAllTemplateNames(DeltaEngineFramework framework)
 {
     if (!PathExtensions.IsDeltaEnginePathEnvironmentVariableAvailable())
     {
         Logger.Warning("No Visual Studio Templates found, please use the Installer to set them up");
         return new string[0];
     }
     var templatePath = Path.Combine(PathExtensions.GetDeltaEngineInstalledDirectory(),
         framework.ToString(), "VisualStudioTemplates", "Delta Engine");
     var templateNames = new List<string>();
     foreach (var file in Directory.GetFiles(templatePath))
         templateNames.Add(Path.GetFileNameWithoutExtension(file));
     templateNames.Remove("EmptyLibrary");
     return templateNames.ToArray();
 }
コード例 #5
0
        public static string[] GetAllTemplateNames(DeltaEngineFramework framework)
        {
            if (!PathExtensions.IsDeltaEnginePathEnvironmentVariableAvailable())
            {             //ncrunch: no coverage start
                Logger.Warning("No Visual Studio Templates found, please use the Installer to set them up");
                return(new string[0]);
            }             //ncrunch: no coverage end
            var templatePath = Path.Combine(PathExtensions.GetDeltaEngineInstalledDirectory(),
                                            framework.ToString(), "VisualStudioTemplates", "Delta Engine");
            var templateNames = new List <string>();

            foreach (var file in Directory.GetFiles(templatePath))
            {
                templateNames.Add(Path.GetFileNameWithoutExtension(file));
            }
            templateNames.Remove("EmptyLibrary");
            return(templateNames.ToArray());
        }
コード例 #6
0
        private void GetExecutablesFromInstallPath(DeltaEngineFramework framework,
                                                   SampleCategory category)
        {
            if (category != SampleCategory.Game && category != SampleCategory.Tutorial)
            {
                return;
            }
            string frameworkPath = Path.Combine(installPath, framework.ToString());

            string[] directories =
                Directory.GetDirectories(Path.Combine(frameworkPath,
                                                      category == SampleCategory.Game ? "Samples" : "Tutorials"));
            foreach (string projectDirectory in directories)
            {
                if (!projectDirectory.Contains("EmptyLibrary"))
                {
                    AddSample(category, projectDirectory, frameworkPath);
                }
            }
        }
コード例 #7
0
ファイル: SampleCreator.cs プロジェクト: remy22/DeltaEngine
 private void GetVisualTestsFromInstallPath(DeltaEngineFramework framework)
 {
     string frameworkPath = Path.Combine(installPath, framework.ToString());
     foreach (var file in fileSystem.Directory.GetFiles(frameworkPath))
     {
         if (file.Contains(".Editor.") ||
             (!file.EndsWith(".Tests.exe") && !file.EndsWith(".Tests.dll")))
             continue;
         try
         {
             Assembly assembly = Assembly.LoadFrom(file);
             foreach (var type in assembly.GetTypes())
             {
                 if (type.IsDefined(typeof(CompilerGeneratedAttribute), false) || !IsVisualTestClass(type))
                     continue;
                 foreach (var method in type.GetMethods().Where(IsVisualTestMethod))
                 {
                     string solutionFilePath = "";
                     string projectFilePath = "";
                     if (!type.Namespace.Contains("DeltaEngine"))
                     {
                         solutionFilePath = Path.Combine(frameworkPath, "DeltaEngine.Samples.sln");
                         projectFilePath = GetSampleTestsProjectFilePaths(frameworkPath, assembly.GetName().Name);
                     }
                     Samples.Add(new Sample(assembly.GetName().Name + ": " + method.Name, SampleCategory.Test,
                         solutionFilePath, projectFilePath, file)
                     {
                         EntryClass = type.Name,
                         EntryMethod = method.Name
                     });
                 }
             }
         }
         catch (ReflectionTypeLoadException ex)
         {
             Logger.Warning("Failed to load " + file + ". LoaderExceptions: " +
                 ex.LoaderExceptions.ToText());
         }
         catch (FileLoadException ex)
         {
             Logger.Warning("Failed to load dependency for " + file + ": " + ex.Message);
         }
     }
 }
コード例 #8
0
ファイル: SampleCreator.cs プロジェクト: remy22/DeltaEngine
 private void GetExecutablesFromInstallPath(DeltaEngineFramework framework,
     SampleCategory category)
 {
     if (category != SampleCategory.Game && category != SampleCategory.Tutorial)
         return;
     string frameworkPath = Path.Combine(installPath, framework.ToString());
     string[] directories =
         fileSystem.Directory.GetDirectories(Path.Combine(frameworkPath,
             category == SampleCategory.Game ? "Samples" : "Tutorials"));
     foreach (string projectDirectory in directories)
         if (!projectDirectory.Contains("EmptyLibrary"))
             AddSample(category, projectDirectory, frameworkPath);
 }
コード例 #9
0
ファイル: SampleCreator.cs プロジェクト: whztt07/DeltaEngine
		private void GetVisualTestsFromInstallPath(DeltaEngineFramework framework)
		{
			string frameworkPath = Path.Combine(installPath, framework.ToString());
			foreach (var file in Directory.GetFiles(frameworkPath))
			{
				if (file.Contains(".Editor.") ||
					(!file.EndsWith(".Tests.exe") && !file.EndsWith(".Tests.dll")))
					continue;
				try
				{
					TryGetVisualTestsFromInstallPath(frameworkPath, file);
				}
				catch (ReflectionTypeLoadException ex)
				{
					ShowLoaderExceptionWarning(file, ex);
				}
				catch (FileLoadException ex)
				{
					Logger.Warning("Failed to load dependency for " + file + ": " + ex.Message);
				}
			}
		}