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);
                }
            }
        }
 public static string ToInternalShortName(this DeltaEngineFramework framework)
 {
     if (framework == DeltaEngineFramework.Default)
     {
         throw new ArgumentException(framework.ToString());
     }
     return(FrameworkShortNames[framework]);
 }
 private void CreateSamplesFromInstallerDirectories(DeltaEngineFramework framework)
 {
     if (!Directory.Exists(installPath))
     {
         return;
     }
     UsingPrecompiledSamplesFromInstaller = true;
     GetExecutablesFromInstallPath(framework, SampleCategory.Game);
     GetExecutablesFromInstallPath(framework, SampleCategory.Tutorial);
     //GetVisualTestsFromInstallPath(framework);
 }
Exemple #4
0
 public void CreateSamples(DeltaEngineFramework framework)
 {
     if (framework == DeltaEngineFramework.Default)
         CreateSamplesFromSourceCodeDirectories();
     else
     {
         CreateSamplesFromInstallerDirectories(framework);
         if (Samples.Count == 0)
             CreateSamplesFromSourceCodeDirectories();
     }
     if (Samples.Count == 0)
         Logger.Warning("No Samples found. Please setup the " +
             PathExtensions.EnginePathEnvironmentVariableName +
             " or compile the DeltaEngine solutions.");
 }
Exemple #5
0
 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();
 }
        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());
        }
        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);
                }
            }
        }
 public void CreateSamples(DeltaEngineFramework framework)
 {
     if (framework == DeltaEngineFramework.Default)
     {
         CreateSamplesFromSourceCodeDirectories();
     }
     else
     {
         CreateSamplesFromInstallerDirectories(framework);
         if (Samples.Count == 0)
         {
             CreateSamplesFromSourceCodeDirectories();
         }
     }
     if (Samples.Count == 0)
     {
         Logger.Warning("No Samples found. Please setup the " +
                        PathExtensions.EnginePathEnvironmentVariableName +
                        " or compile the DeltaEngine solutions.");
     }
 }
Exemple #9
0
 private void CreateSamplesFromInstallerDirectories(DeltaEngineFramework framework)
 {
     if (!fileSystem.Directory.Exists(installPath))
         return;
     UsingPrecompiledSamplesFromInstaller = true;
     GetExecutablesFromInstallPath(framework, SampleCategory.Game);
     GetExecutablesFromInstallPath(framework, SampleCategory.Tutorial);
     //GetVisualTestsFromInstallPath(framework);
 }
 private void SetFrameworkToDefault()
 {
     FrameworksAvailable = new[] { DeltaEngineFramework.Default };
     SelectedFramework = DeltaEngineFramework.Default;
     RaisePropertyChanged("FrameworksAvailable");
     RaisePropertyChanged("SelectedFramework");
 }
		public void CreateFromString(DeltaEngineFramework framework, string fromString)
		{
			Assert.AreEqual(framework, DeltaEngineFrameworkExtensions.FromString(fromString));
		}
		public void MapPublicToInternalShortName(DeltaEngineFramework publicName, string internalName)
		{
			Assert.AreEqual(internalName, publicName.ToInternalShortName());
		}
 public void ChangeSelection(DeltaEngineFramework expectedFramework)
 {
     viewModel.OnFrameworkSelectionChanged.Execute(expectedFramework);
     Assert.AreEqual(expectedFramework, viewModel.SelectedFramework);
 }
Exemple #14
0
 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);
         }
     }
 }
 private void AddSelectionFilters()
 {
     AssembliesAvailable = new List<String>
     {
         "All",
         "Sample Games",
         "Tutorials",
         //"Visual Tests"
     };
     SelectedAssembly = AssembliesAvailable[1];
     FrameworksAvailable = frameworks.All;
     SelectedFramework = frameworks.Default;
 }
Exemple #16
0
 public void CreateFromString(DeltaEngineFramework framework, string fromString)
 {
     Assert.AreEqual(framework, DeltaEngineFrameworkExtensions.FromString(fromString));
 }
Exemple #17
0
 public void MapPublicToInternalShortName(DeltaEngineFramework publicName, string internalName)
 {
     Assert.AreEqual(internalName, publicName.ToInternalShortName());
 }
 public void ChangeSelection(int id, DeltaEngineFramework expectedFramework)
 {
     viewModel.OnFrameworkSelectionChanged.Execute(id);
     Assert.AreEqual(expectedFramework, viewModel.SelectedFramework);
 }
Exemple #19
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 =
         fileSystem.Directory.GetDirectories(Path.Combine(frameworkPath,
             category == SampleCategory.Game ? "Samples" : "Tutorials"));
     foreach (string projectDirectory in directories)
         if (!projectDirectory.Contains("EmptyLibrary"))
             AddSample(category, projectDirectory, frameworkPath);
 }
Exemple #20
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);
				}
			}
		}