コード例 #1
0
        void SaveChart()
        {
            string folderPath = NodeEditorSettings.PathToChartFolder;
            string chartPath  = IOHelpers.GetAvailableAssetPath(folderPath, string.Format("{0}.asset", chart.name));

            AssetDatabase.CreateAsset(chart, chartPath);
        }
コード例 #2
0
ファイル: PythonDetectorTest.cs プロジェクト: microsoft/Oryx
        public void Detect_ReturnsResult_WhenCustomRequirementsFileExists()
        {
            // Arrange
            var options = new DetectorOptions
            {
                CustomRequirementsTxtPath = "foo/requirements.txt",
            };
            var detector  = CreatePythonPlatformDetector(options);
            var sourceDir = Directory.CreateDirectory(Path.Combine(_tempDirRoot, Guid.NewGuid().ToString("N")))
                            .FullName;
            var subDirStr = "foo";
            var subDir    = Directory.CreateDirectory(Path.Combine(sourceDir, subDirStr)).FullName;

            IOHelpers.CreateFile(subDir, "foo==1.1", "requirements.txt");
            var repo    = new LocalSourceRepo(sourceDir, NullLoggerFactory.Instance);
            var context = CreateContext(repo);

            // Act
            var result = detector.Detect(context);

            // Assert
            var pythonPlatformResult = Assert.IsType <PythonPlatformDetectorResult>(result);

            Assert.NotNull(pythonPlatformResult);
            Assert.Equal(PythonConstants.PlatformName, pythonPlatformResult.Platform);
            Assert.Equal(string.Empty, pythonPlatformResult.AppDirectory);
            Assert.True(pythonPlatformResult.HasRequirementsTxtFile);
            Assert.Null(pythonPlatformResult.PlatformVersion);
        }
コード例 #3
0
        public void AccountData()
        {
            var dataFixture = new DataFixture();

            dataFixture.Fixture().ConfigureAwait(false).GetAwaiter().GetResult();

            // Initialize the list of objects and save them into database table.
            var filePath    = "\\Data\\accounts.json";
            var accountsDTO = IOHelpers.ReadFromFile <Account, AccountDTO>(filePath, true);

            var repositoryAccount = new RepositoryAccount();
            var accounts          = IOHelpers.EntitiesList <Account, AccountDTO>(accountsDTO, repositoryAccount.BusinessToDomainObjectPropertyMap());

            var accountsNew = new List <Account>();

            using (var dbContext = new BankAccountContext())
            {
                var repository = new RepositoryBaseEF <Account>(dbContext);

                accountsNew = repository.Get();
            }

            dataFixture.Dispose().ConfigureAwait(false).GetAwaiter().GetResult();

            Assert.NotNull(accountsNew);

            var count = accounts.Count;

            Assert.Equal(accounts[count - 1].AccountNo, accountsNew[count - 1].AccountNo);
        }
コード例 #4
0
        private void LoadDefinitions()
        {
            var defsFileName = game.abbreviation + ".json";

            session.logger.Info($"Loading definitions from {defsFileName}");
            definitions = IOHelpers.LoadResource(defsFileName);
        }
コード例 #5
0
        /// <summary>
        /// Gets the main element.
        /// </summary>
        /// <param name="xnod">The XML node.</param>
        /// <param name="topicsNames">The topics names.</param>
        /// <param name="topic">The topic.</param>
        /// <returns>Main element of the XML</returns>
        private static XmlElement GetMainElement(XmlNode xnod, SortedDictionary <Guid, string> topicsNames, Topic topic)
        {
            XmlElement mainElementName = null;

            if (xnod.NodeType != XmlNodeType.Element)
            {
                return(null);
            }
            if (xnod.Name == "topic")
            {
                if (!IOHelpers.IsGuid(xnod.Attributes["id"].Value))
                {
                    MessageBox.Show("GUID of the topic is invalid", "Invalid GUID!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
                else
                {
                    topic.TopicsGuid = new Guid(xnod.Attributes["id"].Value);
                    if (!topicsNames.ContainsKey(topic.TopicsGuid))
                    {
                        return(null);
                    }
                    topic.TopicsTitle = topicsNames[topic.TopicsGuid];
                    xnod            = xnod.FirstChild;
                    mainElementName = xnod as XmlElement;
                    return(mainElementName);
                }
            }
            foreach (XmlNode xnodWorking in xnod.ChildNodes)
            {
                GetMainElement(xnodWorking, topicsNames, topic);
            }
            return(null);
        }
コード例 #6
0
        public void CustomerData()
        {
            var dataFixture = new DataFixture();

            dataFixture.Fixture().ConfigureAwait(false).GetAwaiter().GetResult();

            // Initialize the list of objects and save them into database table.
            string filePath     = "\\Data\\customers.json";
            var    customersDTO = IOHelpers.ReadFromFile <Customer, CustomerDTO>(filePath, true);

            var repositoryCustomer = new RepositoryCustomer();
            var customers          = IOHelpers.EntitiesList <Customer, CustomerDTO>(customersDTO, repositoryCustomer.BusinessToDomainObjectPropertyMap());

            var customersNew = new List <Customer>();

            using (var dbContext = new BankAccountContext())
            {
                var repository = new RepositoryBaseEF <Customer>(dbContext);

                customersNew = repository.Get();
            }

            dataFixture.Dispose().ConfigureAwait(false).GetAwaiter().GetResult();

            Assert.NotNull(customersNew);

            var count = customers.Count;

            Assert.Equal(customers[count - 1].BirthDate, customersNew[count - 1].BirthDate);
        }
コード例 #7
0
        /// <summary>
        ///   Raises <see cref="TheEyeTribeSettingsDialog" /> to change the settings
        ///   for this interface.
        /// </summary>
        public override void ChangeSettings()
        {
            var dlg = new TheEyeTribeSettingsDialog {
                TheEyeTribeSettings = this.theEyeTribeSettings
            };

            switch (dlg.ShowDialog())
            {
            case DialogResult.OK:
                var oldServerStartParams = this.theEyeTribeSettings.ServerStartParams;
                this.theEyeTribeSettings = dlg.TheEyeTribeSettings;
                this.SerializeSettings(this.theEyeTribeSettings, this.SettingsFile);

                if (this.theEyeTribeSettings.ServerStartParams != oldServerStartParams)
                {
                    // Need to restart the eye tribe server if it is running
                    if (IOHelpers.IsProcessOpen("EyeTribe"))
                    {
                        this.KillEyeTribeProcess();

                        // Now restart
                        this.StartEyeTribeProcess();
                    }
                }

                break;
            }
        }
コード例 #8
0
        public void Detect_ReutrnsResult_WhenNoPyFileExists_ButRuntimeTextFileExists_HavingPythonVersionInIt()
        {
            // Arrange
            var expectedVersion = "1000.1000.1000";
            var defaultVersion  = "1000.1000.1001";
            var detector        = CreatePythonPlatformDetector(
                supportedPythonVersions: new[] { defaultVersion, expectedVersion },
                defaultVersion: defaultVersion,
                new PythonScriptGeneratorOptions());
            var sourceDir = IOHelpers.CreateTempDir(_tempDirRoot);

            // No file with a '.py' extension
            IOHelpers.CreateFile(sourceDir, "", PythonConstants.RequirementsFileName);
            IOHelpers.CreateFile(sourceDir, $"python-{expectedVersion}", "runtime.txt");
            var repo    = new LocalSourceRepo(sourceDir, NullLoggerFactory.Instance);
            var context = CreateContext(repo);

            // Act
            var result = detector.Detect(context);

            // Assert
            Assert.NotNull(result);
            Assert.Equal("python", result.Platform);
            Assert.Equal(expectedVersion, result.PlatformVersion);
        }
コード例 #9
0
        /// <summary>
        /// Rename all trucks to include their mass in the name.
        /// </summary>
        public static void RenameTrucks(DirectoryInfo directory, GameLanguage language)
        {
            var directoryLocation = IOHelpers.NormalizeDirectory(directory.FullName);
            var strings           = GetStrings(directory, language, out var stringsMap, out var stringsLocation);

            Console.WriteLine("Processing trucks data.");
            var newTruckNames = new List <KeyValuePair <string, string> > ();
            var trucks        = Directory.EnumerateFiles(Path.Combine(directoryLocation, @"[media]\classes\trucks"), "*.xml");

            foreach (var truckXmlLocation in trucks)
            {
                var root       = XmlHelpers.ReadFragments(truckXmlLocation);
                var nameIdNode = root.Element("Truck")?.Element("GameData")?.Element("UiDesc")?.Attribute("UiName");
                var nameId     = nameIdNode?.Value;
                if (nameId == null)
                {
                    continue;
                }
                var originalId = GetOriginalId(nameId);
                var mass       = TruckHelpers.GetMass(root.Element("Truck"));
                if (mass < 100)
                {
                    continue;
                }

                var newId = GetNewId(originalId, truckXmlLocation[directoryLocation.Length..]);
コード例 #10
0
ファイル: PythonDetectorTest.cs プロジェクト: microsoft/Oryx
        public void Detect_ReturnsResult_WithAllPropertiesPopulatedWithExpectedInformation()
        {
            // Arrange
            var expectedPythonVersion = "3.5.6";
            var detector  = CreatePythonPlatformDetector();
            var sourceDir = IOHelpers.CreateTempDir(_tempDirRoot);

            IOHelpers.CreateFile(sourceDir, "channels:", PythonConstants.CondaEnvironmentYmlFileName);
            IOHelpers.CreateFile(sourceDir, "requirements.txt content", PythonConstants.RequirementsFileName);
            IOHelpers.CreateFile(
                sourceDir,
                "notebook content",
                $"notebook1.{PythonConstants.JupyterNotebookFileExtensionName}");
            IOHelpers.CreateFile(sourceDir, $"python-{expectedPythonVersion}", PythonConstants.RuntimeFileName);
            var repo    = new LocalSourceRepo(sourceDir, NullLoggerFactory.Instance);
            var context = CreateContext(repo);

            // Act
            var result = detector.Detect(context);

            // Assert
            var pythonPlatformResult = Assert.IsType <PythonPlatformDetectorResult>(result);

            Assert.Equal(PythonConstants.PlatformName, pythonPlatformResult.Platform);
            Assert.Equal(expectedPythonVersion, pythonPlatformResult.PlatformVersion);
            Assert.True(pythonPlatformResult.HasJupyterNotebookFiles);
            Assert.True(pythonPlatformResult.HasCondaEnvironmentYmlFile);
        }
コード例 #11
0
        /// <summary>
        /// Load the editor from the last session. Returns null if none found.
        /// </summary>
        public static ChartEditorSave Load()
        {
            string path = IOHelpers.CombinePath(assets, resources, assetNameWithExtension);
            var    save = EditorGUIUtility.Load(path) as ChartEditorSave;

            return(save);
        }
コード例 #12
0
        /// <summary>
        /// The async task for deleting all the notes in the application
        /// Also asks for validation from the user before deleting
        /// </summary>
        /// <returns>A task to delete all the notes</returns>
        private async Task DeleteAllNotes()
        {
            await DisplayPopupHelpers
            .ShowOKDialogAsync("Are you sure?",
                               "You are about to delete ALL your notes. This CANNOT be reversed!");

            string promptResult = await DisplayPopupHelpers
                                  .ShowPromptAsync("Are you sure?",
                                                   "Please enter 'DELETE ALL MY NOTES' into the box below to confirm");

            if (promptResult == null)
            {
                return;
            }

            if (promptResult != "DELETE ALL MY NOTES")
            {
                await DisplayPopupHelpers
                .ShowOKDialogAsync("Incorrect",
                                   "Your notes have NOT been deleted");

                return;
            }

            await Task.Run(() => IOHelpers.DeleteAllNotes());

            await DisplayPopupHelpers
            .ShowOKDialogAsync("Deleted",
                               "All your notes have now been deleted");
        }
コード例 #13
0
        static string RequireSubfolder(string name)
        {
            string rootPath   = PathToRootFolder;
            string folderPath = IOHelpers.RequireFolder(rootPath, name);

            return(folderPath);
        }
コード例 #14
0
        void CreateMap()
        {
            string rootPath      = IOHelpers.RequireFolder(ROOT_FOLDER);
            string mapFolderPath = IOHelpers.RequireFolder(rootPath, MAP_FOLDER);
            string mapPath       = IOHelpers.GetAvailableAssetPath(mapFolderPath, MAP_NAME);
            string configName;

            switch (caveGenType)
            {
            case CaveGeneratorUI.CaveGeneratorType.ThreeTiered:
                configName = THREE_TIER_CONFIG_NAME;
                break;

            case CaveGeneratorUI.CaveGeneratorType.RockOutline:
                configName = ROCK_CAVE_CONFIG_NAME;
                break;

            default:
                throw CaveGenTypeException;
            }
            string             property       = string.Format("{0}.{1}", configName, MAP_GEN_NAME);
            SerializedProperty mapGenProperty = serializedObject.FindProperty(property);
            var mapGen  = (MapGenModule)mapGenProperty.objectReferenceValue;
            var map     = mapGen.Generate();
            var texture = map.ToTexture();

            IOHelpers.SaveTextureAsPNG(texture, mapPath);
        }
コード例 #15
0
        public void Detect_ReturnsVersionFromRuntimeTextFile_IfEnvironmentVariableValueIsNotPresent()
        {
            // Arrange
            var expectedVersion = "2.5.0";
            var environment     = new TestEnvironment();
            var detector        = CreatePythonLanguageDetector(
                supportedPythonVersions: new[] { "100.100.100", expectedVersion, "1.2.3" },
                defaultVersion: expectedVersion,
                environment);
            var sourceDir = IOHelpers.CreateTempDir(_tempDirRoot);

            IOHelpers.CreateFile(sourceDir, "", PythonConstants.RequirementsFileName);
            IOHelpers.CreateFile(sourceDir, "", "app.py");
            IOHelpers.CreateFile(sourceDir, $"python-{expectedVersion}", PythonConstants.RuntimeFileName);
            var repo    = new LocalSourceRepo(sourceDir, NullLoggerFactory.Instance);
            var context = CreateContext(repo);

            // Act
            var result = detector.Detect(context);

            // Assert
            Assert.NotNull(result);
            Assert.Equal("python", result.Language);
            Assert.Equal(expectedVersion, result.LanguageVersion);
        }
コード例 #16
0
        private static void CreateProject(string targetDir, string targetName, List <string> additionalAssemblies, string code)
        {
            var targetFileName = targetName + ".dll";
            var targetPath     = Path.Combine(targetDir, targetFileName);

            var entityFrameworkPath = new Uri(typeof(DbContext).Assembly.CodeBase).LocalPath;

            IOHelpers.CopyToDir(entityFrameworkPath, targetDir);

            var entityFrameworkSqlServerPath = new Uri(typeof(SqlProviderServices).Assembly.CodeBase).LocalPath;

            IOHelpers.CopyToDir(entityFrameworkSqlServerPath, targetDir);

            using (var compiler = new CSharpCodeProvider())
            {
                additionalAssemblies.AddRange(
                    new List <string>
                {
                    "System.dll",
                    "System.Data.dll",
                    "System.Core.dll",
                    "System.Data.Entity.dll",
                    entityFrameworkPath
                });

                var results = compiler.CompileAssemblyFromSource(new CompilerParameters(additionalAssemblies.ToArray(), targetPath), code);

                if (results.Errors.HasErrors)
                {
                    throw new InvalidOperationException(results.Errors.Cast <CompilerError>().First(e => !e.IsWarning).ToString());
                }
            }
        }
コード例 #17
0
        void CreateMeshAssets(Transform cave, string path)
        {
            string floorFolder   = IOHelpers.CreateFolder(path, FLOOR_FOLDER);
            string ceilingFolder = IOHelpers.CreateFolder(path, CEILING_FOLDER);
            string wallFolder    = IOHelpers.CreateFolder(path, WALL_FOLDER);

            foreach (Transform sector in cave.transform)
            {
                foreach (Transform component in sector)
                {
                    if (Sector.IsFloor(component))
                    {
                        CreateMeshAsset(component, floorFolder);
                    }
                    else if (Sector.IsCeiling(component))
                    {
                        CreateMeshAsset(component, ceilingFolder);
                    }
                    else if (Sector.IsWall(component))
                    {
                        CreateMeshAsset(component, wallFolder);
                    }
                }
            }
            foreach (string folder in new[] { floorFolder, wallFolder, ceilingFolder })
            {
                if (IOHelpers.IsFolderEmpty(folder))
                {
                    AssetDatabase.DeleteAsset(folder);
                }
            }
        }
コード例 #18
0
        private static void CreateMigrationsProject(string targetDir, string contextDir)
        {
            var contextPath = Path.Combine(contextDir, "ContextLibrary1.dll");

            IOHelpers.CopyToDir(contextPath, targetDir);

            CreateProject(
                targetDir, "ClassLibrary1", new List <string> {
                contextPath
            },
                @"namespace ClassLibrary1
{
    using System.Data.Common;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Data.Entity.Migrations.History;

    public class Configuration : DbMigrationsConfiguration<ContextLibrary1.Context>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = true;
        }
    }

    public class CustomHistoryContext : HistoryContext
    {
        public CustomHistoryContext(DbConnection existingConnection, string defaultSchema)
            : base(existingConnection, defaultSchema)
        {
        }
    }
}");
        }
コード例 #19
0
        void CreateMeshAsset(Transform component, string path)
        {
            Mesh mesh = ExtractMesh(component.gameObject);

            path = IOHelpers.CombinePath(path, component.name);
            AssetDatabase.CreateAsset(mesh, path);
        }
コード例 #20
0
        public void Detect_Throws_WhenUnsupportedPythonVersion_IsSetInOptions()
        {
            // Arrange
            var unsupportedVersion           = "100.100.100";
            var supportedVersion             = "1.2.3";
            var pythonScriptGeneratorOptions = new PythonScriptGeneratorOptions()
            {
                PythonVersion = unsupportedVersion
            };
            var platform = CreatePlatform(
                supportedVersions: new[] { supportedVersion },
                defaultVersion: supportedVersion,
                pythonScriptGeneratorOptions: pythonScriptGeneratorOptions);
            var sourceDir = IOHelpers.CreateTempDir(_tempDirRoot);

            IOHelpers.CreateFile(sourceDir, "", PythonConstants.RequirementsFileName);
            IOHelpers.CreateFile(sourceDir, "python-" + supportedVersion, PythonConstants.RuntimeFileName);
            var repo    = new LocalSourceRepo(sourceDir, NullLoggerFactory.Instance);
            var context = CreateContext(repo);

            // Act & Assert
            var exception = Assert.Throws <UnsupportedVersionException>(() => platform.Detect(context));

            Assert.Equal(
                $"Platform 'python' version '{unsupportedVersion}' is unsupported. " +
                $"Supported versions: {supportedVersion}",
                exception.Message);
        }
コード例 #21
0
        /// <summary>
        /// This method parses the stimulus file names in the import for
        /// forbidden characters like white space, and shows a notification.
        /// </summary>
        /// <returns><strong>True</strong>, if filenames are valid,
        /// otherwise <strong>false</strong>.</returns>
        private bool CheckforValidFilenames()
        {
            int fileErrorCounter = 0;

            foreach (string filename in this.detectionSetting.TrialIDToImageAssignments.Values)
            {
                if (!IOHelpers.IsValidFilename(filename))
                {
                    fileErrorCounter++;
                }
            }

            if (fileErrorCounter > 0)
            {
                string message = "It seems that at least " + fileErrorCounter.ToString() + " stimulus filenames are not valid, "
                                 + Environment.NewLine + " because they contain white-space "
                                 + " or other unallowed characters." + Environment.NewLine
                                 + "Would you like to revise the names ?";
                if (InformationDialog.Show("Invalid filename", message, true, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #22
0
        public void Detect_ReturnsVersionFromOptions_EvenIfRuntimeTextFileHasVersion()
        {
            // Arrange
            var expectedVersion              = "1.2.3";
            var runtimeTextFileVersion       = "2.5.0";
            var pythonScriptGeneratorOptions = new PythonScriptGeneratorOptions()
            {
                PythonVersion = expectedVersion
            };
            var platform = CreatePlatform(
                supportedVersions: new[] { expectedVersion },
                defaultVersion: expectedVersion,
                pythonScriptGeneratorOptions: pythonScriptGeneratorOptions);
            var sourceDir = IOHelpers.CreateTempDir(_tempDirRoot);

            IOHelpers.CreateFile(sourceDir, "", "app.py");
            IOHelpers.CreateFile(sourceDir, "", PythonConstants.RequirementsFileName);
            IOHelpers.CreateFile(sourceDir, $"python-{runtimeTextFileVersion}", PythonConstants.RuntimeFileName);
            var repo    = new LocalSourceRepo(sourceDir, NullLoggerFactory.Instance);
            var context = CreateContext(repo);

            // Act
            var result = platform.Detect(context);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(PythonConstants.PlatformName, result.Platform);
            Assert.Equal(expectedVersion, result.PlatformVersion);
        }
コード例 #23
0
        protected override void SaveAdditionalAssets(GameObject cave, string path)
        {
            string ceilingFolder = IOHelpers.CreateFolder(path, CEILING_FOLDER);
            string floorFolder   = IOHelpers.CreateFolder(path, FLOOR_FOLDER);
            string wallFolder    = IOHelpers.CreateFolder(path, WALL_FOLDER);

            foreach (Transform sector in cave.transform)
            {
                foreach (Transform component in sector)
                {
                    if (Sector.IsFloor(component))
                    {
                        CreateMeshAsset(component, floorFolder);
                    }
                    else if (Sector.IsCeiling(component))
                    {
                        CreateMeshAsset(component, ceilingFolder);
                    }
                    else if (Sector.IsWall(component))
                    {
                        CreateMeshAsset(component, wallFolder);
                    }
                }
            }
        }
コード例 #24
0
 /// <summary>
 /// The <see cref="Control.Validating"/> event handler for
 /// the <see cref="TextBox"/> <see cref="txbYSizeEyeMon"/>.
 /// Checks y size of tracking monitor text field for correct numeric entry.
 /// </summary>
 /// <param name="sender">Source of the event.</param>
 /// <param name="e">A <see cref="CancelEventArgs"/> with the event data.</param>
 private void fldYSizeEyeMon_Validating(object sender, CancelEventArgs e)
 {
     if (!IOHelpers.IsNumeric(this.txbYSizeEyeMon.Text))
     {
         e.Cancel = true;
         ExceptionMethods.ProcessErrorMessage("The screen height has to be a numerical value");
     }
 }
コード例 #25
0
 /// <summary>
 /// The <see cref="Control.Validating"/> event handler for
 /// the <see cref="TextBox"/> <see cref="txbSamplingRateMouse"/>.
 /// Checks mouse sampling rate text field for correct numeric entry.
 /// </summary>
 /// <param name="sender">Source of the event.</param>
 /// <param name="e">A <see cref="CancelEventArgs"/> with the event data.</param>
 private void txbSamplingRateMouse_Validating(object sender, CancelEventArgs e)
 {
     if (!IOHelpers.IsNumeric(this.txbSamplingRateMouse.Text))
     {
         e.Cancel = true;
         ExceptionMethods.ProcessErrorMessage("The sampling rate has to be a numerical value");
     }
 }
コード例 #26
0
        void SaveModule()
        {
            var    compoundModule = BuildModule();
            string folderPath     = NodeEditorSettings.PathToModuleFolder;
            string modulePath     = IOHelpers.GetAvailableAssetPath(folderPath, SAVED_MODULE_NAME);

            AssetDatabase.CreateAsset(compoundModule, modulePath);
        }
コード例 #27
0
        static void Duplicate(MenuCommand command)
        {
            Module module      = (Module)command.context;
            string folderPath  = IOHelpers.GetFolderContainingAsset(module);
            string path        = IOHelpers.GetAvailableAssetPath(folderPath, module.name + ".asset");
            Module copiedAsset = module.CopyDeep();

            ScriptableObjectHelpers.SaveCompoundScriptableObject(copiedAsset, path);
        }
コード例 #28
0
        void SaveMap()
        {
            var       compoundModule = BuildModule();
            string    folderPath     = NodeEditorSettings.PathToMapFolder;
            Texture2D texture        = compoundModule.Generate().ToTexture();
            string    texturePath    = IOHelpers.GetAvailableAssetPath(folderPath, SAVED_TEXTURE_NAME);

            IOHelpers.SaveTextureAsPNG(texture, texturePath);
        }
コード例 #29
0
        static void SaveAsPNG(MenuCommand command)
        {
            var       module      = (MapGenModule)command.context;
            string    folderPath  = IOHelpers.GetFolderContainingAsset(module);
            Texture2D texture     = module.Generate().ToTexture();
            string    name        = string.Format("{0}{1}.png", module.name, MapImporter.MAP_SUBSTRING);
            string    texturePath = IOHelpers.GetAvailableAssetPath(folderPath, name);

            IOHelpers.SaveTextureAsPNG(texture, texturePath);
        }
コード例 #30
0
 /// <summary>
 /// Initializes a new instance of the LanguageStrategyBase class.
 /// </summary>
 /// <param name="languageName">Name of the language.</param>
 /// <param name="fileExtension">The file extension.</param>
 /// <param name="projectFileExtension">The project file extension.</param>
 protected LanguageStrategyBase(string languageName, string fileExtension, string projectFileExtension)
 {
     this.Logger                  = Logger.Null;
     this.LanguageName            = languageName;
     this.FileExtension           = fileExtension;
     this.ProjectFileExtension    = projectFileExtension;
     this.TempSourceFileDirectory = IOHelpers.CreateTempDirectory("SourcesToCompile");
     this.TempAssemblyDirectory   = IOHelpers.CreateTempDirectory("CompiledAsemblies");
     this.RemoteCompilerType      = "DotNet40";
     this.AssemblyPathResolver    = new AssemblyPathResolver();
 }