Example #1
0
        public static List <string> MakeHostHtml(DataInfo info,
                                                 Options options)
        {
            List <string> stringResult = new List <string>();
            string        htmlFile     = GetHostFile(options, info);

            if (CommonIO.Exists(htmlFile, options) == true)
            {
                if (options.IsTraceOn(Trace_Options.TraceInfo))
                {
                    Trace.TraceInformation("Host file = [" + htmlFile + "]");
                }

                stringResult = LoadStrings(htmlFile, options);
            }
            else
            {
                if (options.IsTraceOn(Trace_Options.TraceWarning))
                {
                    Trace.TraceWarning("No Host file, likely webassembly or Razor");
                }
            }

            return(stringResult);
        }
Example #2
0
        // support methods


        public static List <string> LoadStrings(string fileName,
                                                Options options)
        {
            List <string> strings = new List <string>();

            if (CommonIO.Exists(fileName, options) == true)
            {
                string[] strs = CommonIO.ReadAllLines(fileName, options);
                foreach (string s in strs)
                {
                    strings.Add(s);
                }
            }

            return(strings);
        }
Example #3
0
        public static Type_Options GetProjectType(Options options)
        {
            Type_Options result = Type_Options.Unknown;

            try
            {
                string strFile = options.BlazorProjectPath + options.HostHtml;
                if (CommonIO.Exists(strFile, options) == true)
                {
                    result = Type_Options.BlazorServer;
                }
                else
                {
                    strFile = options.BlazorProjectPath + options.WasmHostHtml;
                    if (CommonIO.Exists(strFile, options) == true)
                    {
                        strFile = options.BlazorProjectPath + options.PWAFile;
                        if (CommonIO.Exists(strFile, options) == true)
                        {
                            result = Type_Options.BlazorWebassemblyPWA;
                        }
                        else
                        {
                            result = Type_Options.BlazorWebassembly;
                        }
                    }
                    else
                    {
                        strFile = options.BlazorProjectPath + options.RazorHostHtml;
                        if (CommonIO.Exists(strFile, options) == true)
                        {
                            result = Type_Options.ASPNetRazor;
                        }
                    }
                }
            }
            catch (IOException e)
            {
                if (options.IsTraceOn(Trace_Options.TraceExceptions))
                {
                    Trace.TraceError("Exception get Project Type", e);
                }
            }

            return(result);
        }