/// <summary>Creates another instance of <see cref="VBRazorHardCodedString"/> string with the provided arguments</summary> public override BaseHardCodedString CreateInstance(ProjectItem parent, int start, int end) { VBRazorHardCodedString newInstance = new VBRazorHardCodedString(parent, start, end); newInstance.InitializeValue(); return(newInstance); }
/// <summary> /// Returns an instance of BaseHardCodedString, based the type of the current document. /// </summary> /// <param name="currentDocument">The document that contains an hard-coded string.</param> /// <returns>A hard coded string that is file type aware.</returns> public static BaseHardCodedString GetHardCodedString(Document currentDocument) { BaseHardCodedString stringInstance = null; // Create the hard coded string instance switch (currentDocument.Language) { case "CSharp": stringInstance = new CSharpHardCodedString(); break; case "Basic": stringInstance = new VBHardCodedString(); break; case "XAML": stringInstance = new XamlHardCodedString(); break; case "HTMLX": if (currentDocument.Name.EndsWith(".cshtml", StringComparison.CurrentCultureIgnoreCase)) { stringInstance = new CSharpRazorHardCodedString(); } else if (currentDocument.Name.EndsWith(".vbhtml", StringComparison.CurrentCultureIgnoreCase)) { stringInstance = new VBRazorHardCodedString(); } break; case "HTML": if (currentDocument.Name.EndsWith(".aspx", StringComparison.CurrentCultureIgnoreCase) || currentDocument.Name.EndsWith(".ascx", StringComparison.CurrentCultureIgnoreCase) || currentDocument.Name.EndsWith(".master", StringComparison.CurrentCultureIgnoreCase)) { stringInstance = new AspxHardCodedString(); } break; } return(stringInstance); }