public EditorUIContentFile(EditorContentFile file) { EdFile = file; CreateSpecialProperties(); /* Processor properties */ RefreshProcessorProperties(false); }
/// <summary> /// Enumerate the content of the directory excluding elements matching the specified regexes /// </summary> /// <param name="ignoreRegexes"></param> /// <returns></returns> private IEnumerable<EditorBaseBoundObject> EnumerateDirectoryContent(Regex[] ignoreRegexes) { DirectoryInfo directory; try { directory = new DirectoryInfo(CurrentPath); } catch (Exception ex) { directory = null; ErrorString = ex.ToString(); IsValid = false; } if (directory != null) { DirectoryInfo[] dirs = null; try { dirs = directory.GetDirectories(); } catch { IsValid = false; } if (dirs != null) { foreach (var sub_dir in dirs) { string relativeDirPath = Path.Combine(RelativePath, sub_dir.Name); bool ignoreDirectory = false; if (ignoreRegexes != null) { /* test to see if the directory should be ignored */ foreach (var regex in ignoreRegexes) { if (regex.IsMatch(relativeDirPath)) { ignoreDirectory = true; break; } } } if (!ignoreDirectory) { EditorContentDirectory contentDir = null; try { contentDir = new EditorContentDirectory(Editor, relativeDirPath, BasePath, sub_dir.FullName); } catch { } if (contentDir != null) yield return contentDir; } } } FileInfo[] files = null; try { files = directory.GetFiles(); } catch { IsValid = false; } if (files != null) { foreach (var sub_file in files) { if (!CirrusDesignHelper.CirrusPackageExtention.Equals(sub_file.Extension, StringComparison.OrdinalIgnoreCase)) { string relativeFilePath = Path.Combine(RelativePath, sub_file.Name); bool ignoreFile = false; if (ignoreRegexes != null) { /* test to see if the directory should be ignored */ foreach (var regex in ignoreRegexes) { if (regex.IsMatch(relativeFilePath)) { ignoreFile = true; break; } } } if (!ignoreFile) { EditorContentFile contentFile = null; try { contentFile = new EditorContentFile(Editor, relativeFilePath, BasePath, sub_file.FullName); } catch { } if (contentFile != null) yield return contentFile; } } } } } }
private string GetOutputPathForFile(EditorApplication packageCopy, EditorContentFile file) { var rootDirectory = Path.GetDirectoryName(packageCopy.CurrentPackagePath); var outputBaseDirectory = Path.IsPathRooted(packageCopy.CurrentPackage.OutputDirectory) ? packageCopy.CurrentPackage.OutputDirectory : Path.Combine(rootDirectory, packageCopy.CurrentPackage.OutputDirectory); outputBaseDirectory += "\\" + GetSafeContentDirectorySuffix(packageCopy); var outputCompletePath = Path.Combine(outputBaseDirectory, file.RelativePath); var normalizedOutputCompletePath = Path.ChangeExtension(new FileInfo(outputCompletePath).FullName, CirrusContentManager.ContentFileExtention); return normalizedOutputCompletePath; }
private void Build_ProcessFile(List<XNACirrusAsset> decodedAssets, EditorApplication packageCopy, EditorContentFile file) { var src = GetSourcePathForFile(packageCopy, file); var dst = GetOutputPathForFile(packageCopy, file); switch (file.BuildAction) { default: case Sora.GameEngine.Cirrus.Design.Packages.XmlBuildAction.None: { Build_Message("Ignored", "ProcessFile"); break; } case Sora.GameEngine.Cirrus.Design.Packages.XmlBuildAction.Compile: { var importer = file.Importer; var processor = file.Processor; if (String.IsNullOrEmpty(importer) && String.IsNullOrEmpty(processor)) { Build_Message("No importer or processor specified, copying to output"); goto case Sora.GameEngine.Cirrus.Design.Packages.XmlBuildAction.CopyToOutput; } else { //Build_Message(String.Format("Compiling {0} to {1}", src, dst), "ProcessFile"); //XNAFileCompile(packageCopy, file, src, dst); decodedAssets.Add(new XNACirrusAsset(packageCopy, file)); } break; } case Sora.GameEngine.Cirrus.Design.Packages.XmlBuildAction.CopyToOutput: { Build_Message(String.Format("Copying {0} to {1}", src, dst), "ProcessFile"); var outDirectory = Path.GetDirectoryName(dst); if (!Directory.Exists(outDirectory)) Directory.CreateDirectory(outDirectory); File.Copy(src, dst, true); break; } } }
private string GetSourcePathForFile(EditorApplication packageCopy, EditorContentFile file) { var contentBaseDirectory = GetContentBaseDirectory(packageCopy); var inputCompletePath = Path.Combine(contentBaseDirectory, file.RelativePath); var normalizedInputCompletePath = new FileInfo(inputCompletePath).FullName; return normalizedInputCompletePath; }