internal static bool CanBeProcessed(string Path) { var Manifest = FileService.ReadAsString(Path); // if is not valid - stop if (VisualElementsManifest.ManifestService.Validate(Manifest) == false) { return(false); } var VisualElements = VisualElementsManifest.ManifestService.Parse(Manifest); // if is basic version (without images) - ok if (VisualElements.IsSquare70x70LogoAndSquare150x150LogoSet() == false) { return(true); } var Square70x70LogoPath = PathService.CombinePath(PathService.GetDirectoryPath(Path), VisualElements.GetSetSquare70x70Logo()); var Square150x150LogoPath = PathService.CombinePath(PathService.GetDirectoryPath(Path), VisualElements.GetSetSquare150x150Logo()); // images exists for sure? return(FileService.Exists(Square70x70LogoPath) && FileService.Exists(Square150x150LogoPath)); }
internal static ManifestProcessingResult Process(string Path) { var Manifest = FileService.ReadAsString(Path); var VisualElements = VisualElementsManifest.ManifestService.Parse(Manifest); var ManifestData = StringFormatter.Serialize(Manifest); var ManifestFileName = PathService.GetFileName(Path); var Components = new Dictionary <ManifestComponentType, ManifestComponentData> { [ManifestComponentType.Manifest] = new ManifestComponentData(ManifestData, ManifestFileName) }; if (VisualElements.IsSquare70x70LogoAndSquare150x150LogoSet()) { var Square70x70LogoPath = PathService.CombinePath(PathService.GetDirectoryPath(Path), VisualElements.GetSetSquare70x70Logo()); var Square150x150LogoPath = PathService.CombinePath(PathService.GetDirectoryPath(Path), VisualElements.GetSetSquare150x150Logo()); var Square70x70LogoData = FileService.ReadAsBytes(Square70x70LogoPath); var Square150x150LogoData = FileService.ReadAsBytes(Square150x150LogoPath); var Square70x70LogoFileName = VisualElements.GetSetSquare70x70Logo(); var Square150x150LogoFileName = VisualElements.GetSetSquare150x150Logo(); Components[ManifestComponentType.Square70x70Logo] = new ManifestComponentData(Square70x70LogoData, Square70x70LogoFileName); Components[ManifestComponentType.Square150x150Logo] = new ManifestComponentData(Square150x150LogoData, Square150x150LogoFileName); } return(new ManifestProcessingResult(Components)); }
internal static ManifestCompilationResult Compile(string AppName, int BackgroundColor, bool LightForegroundText, bool ShowNameOnSquare150x150Logo, byte[] Square70x70LogoData, byte[] Square150x150LogoData, string Square70x70LogoName, string Square150x150LogoName, string OptionalSquare70x70LogoFormat = null, string OptionalSquare150x150LogoFormat = null, string OptionalSquare70x70LogoDirectoryPath = null, string OptionalSquare150x150LogoDirectoryPath = null) { var Square70x70LogoFormat = OptionalSquare70x70LogoFormat ?? ImageService.GetFormat(Square70x70LogoData); var Square150x150LogoFormat = OptionalSquare150x150LogoFormat ?? ImageService.GetFormat(Square150x150LogoData); var Square70x70LogoDirectoryPath = OptionalSquare70x70LogoDirectoryPath ?? string.Empty; var Square150x150LogoDirectoryPath = OptionalSquare150x150LogoDirectoryPath ?? string.Empty; var Square70x70LogoFullName = PathService.CombineName(Square70x70LogoName, Square70x70LogoFormat); var Square150x150LogoFullName = PathService.CombineName(Square150x150LogoName, Square150x150LogoFormat); var Square70x70LogoPath = PathService.CombinePath(Square70x70LogoDirectoryPath, Square70x70LogoFullName); var Square150x150LogoPath = PathService.CombinePath(Square150x150LogoDirectoryPath, Square150x150LogoFullName); var VisualElements = new VisualElements(); VisualElements.SetBackgroundColorOn(BackgroundColor); VisualElements.SetForegroundTextOn(LightForegroundText); VisualElements.SetShowNameOnSquare150x150LogoOn(ShowNameOnSquare150x150Logo); VisualElements.SetSquare70x70LogoOn(Square70x70LogoPath); VisualElements.SetSquare150x150LogoOn(Square150x150LogoPath); var Manifest = VisualElementsManifest.ManifestService.Create(VisualElements); var ManifestData = StringFormatter.Serialize(Manifest); var ManifestFileName = ManifestNameBuilder.Build(AppName); var Components = new Dictionary <ManifestComponentType, ManifestComponentData>() { { ManifestComponentType.Manifest, new ManifestComponentData(ManifestData, ManifestFileName) }, { ManifestComponentType.Square70x70Logo, new ManifestComponentData(Square70x70LogoData, Square70x70LogoPath) }, { ManifestComponentType.Square150x150Logo, new ManifestComponentData(Square150x150LogoData, Square150x150LogoPath) }, }; return(new ManifestCompilationResult(Components)); }
/// <include file=".Docs/.ManifestService.xml" path="docs/method[@name='CanBeProcessed(string, string)']/*"/> public static bool CanBeProcessed(string AppDirectory, string AppName) { return(Processer.CanBeProcessed(PathService.CombinePath(AppDirectory, ManifestNameBuilder.Build(AppName)))); }
/// <include file=".Docs/.ManifestService.xml" path="docs/method[@name='Process(string, string)']/*"/> public static ManifestProcessingResult Process(string AppDirectory, string AppName) { return(Processer.Process(PathService.CombinePath(AppDirectory, ManifestNameBuilder.Build(AppName)))); }