using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace StringsResourceGeneratorTask { internal abstract class CodeTypeController { #region Constructors protected CodeTypeController() { } #endregion #region Properties public abstract string StringsCodeTemplate { get; } public static string CodeFileName { get; private set; } #endregion #region Public Functions public static CodeType GetCodeTypeFromXamlFile(string xamlFileName) { string xamlFileNameWithoutExtension = Path.GetFileNameWithoutExtension(xamlFileName); CodeTypeController.CodeFileName = Path.Combine(Path.GetDirectoryName(xamlFileName), xamlFileNameWithoutExtension + ".xaml.cs"); if (File.Exists(CodeTypeController.CodeFileName)) return CodeType.CS; CodeTypeController.CodeFileName = Path.Combine(Path.GetDirectoryName(xamlFileName), xamlFileNameWithoutExtension + ".xaml.vb"); if (File.Exists(CodeTypeController.CodeFileName)) return CodeType.VB; return CodeType.None; } public static CodeTypeController GetController(CodeType codeType) { switch (codeType) { case CodeType.CS: return new CSController(); case CodeType.VB: throw new NotImplementedException(); case CodeType.None: default: throw new NotSupportedException(); } } abstract public string GeneratePropertyCode(ResourceProperty resourceProperty); #endregion } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)