Click here to Skip to main content
15,895,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: creating a folder on console application with c# by clicking on it's .exe file ! Pin
Richard MacCutchan19-Jun-16 21:25
mveRichard MacCutchan19-Jun-16 21:25 
AnswerRe: creating a folder on console application with c# by clicking on it's .exe file ! Pin
BillWoodruff17-Jun-16 23:45
professionalBillWoodruff17-Jun-16 23:45 
QuestionHow to export a result table and charts from RDotNet to Excel Pin
Member 1085025317-Jun-16 15:45
Member 1085025317-Jun-16 15:45 
AnswerRe: How to export a result table and charts from RDotNet to Excel Pin
Garth J Lancaster17-Jun-16 16:40
professionalGarth J Lancaster17-Jun-16 16:40 
GeneralRe: How to export a result table and charts from RDotNet to Excel Pin
Member 1085025323-Jun-16 11:41
Member 1085025323-Jun-16 11:41 
GeneralRe: How to export a result table and charts from RDotNet to Excel Pin
Garth J Lancaster23-Jun-16 16:12
professionalGarth J Lancaster23-Jun-16 16:12 
GeneralRe: How to export a result table and charts from RDotNet to Excel Pin
Member 1085025323-Jun-16 16:22
Member 1085025323-Jun-16 16:22 
QuestionCan't get the replace to work, and double check my work. Pin
jkirkerx17-Jun-16 11:11
professionaljkirkerx17-Jun-16 11:11 
I wrote this new version of a function to replace an older version, which reads a HTML file, replaces some values, and sends it back out for emailing.

I wrote an earlier post in which I said the HTML didn't persist, but that was an easy fix. I currently just don't understand why the replace is not working. It worked before when html_Template was a string builder.

I really don't want to use regex to replace the values, I'm not good at writing regex.
And I'm sure not if what I wrote is kosher and efficient. Maybe I can move the replace outside the using filestream.
private static string read_HTML_Template(
            model_crm_contact_request cm)
        {
            string html_Template = string.Empty;
            using (var htmlStream = new FileStream(cm.smtp_templatePath_customer, FileMode.Open, FileAccess.Read))
            {
                long htmlLen = htmlStream.Length;
                byte[] bytes = new byte[htmlLen];
                htmlStream.Read(bytes, 0, (int)htmlLen);

                if (!(htmlStream == null))
                    htmlStream.Close();

                var enc = new UTF8Encoding(true);
                var preamble = enc.GetPreamble();
                if (preamble.Where((p, i) => p != bytes[i]).Any())
                    html_Template = enc.GetString(bytes.ToArray());
                else
                    html_Template = enc.GetString(bytes.Skip(preamble.Length).ToArray());

                html_Template.Replace("<% smtp.WebsiteUrl %>", cm.smtp_websiteUrl);
                html_Template.Replace("<% smtp.HeaderImage %>", cm.smtp_headerImage);
                html_Template.Replace("<% smtp.CustomerName %>", cm.Name);
                html_Template.Replace("<% smtp.WebsiteName %>", cm.smtp_websiteName);
                html_Template.Replace("<% smtp.CustomerComment %>", cm.Query);

                html_Template.Replace("<% smtp.TimeStamp_GMT %>", DateTime.UtcNow + " GMT");
                html_Template.Replace("<% smtp.TimeStamp_UTC %>", DateTime.UtcNow + " UTC");
            }                

            return html_Template;

        }

AnswerMy Bad, perhaps I can just get that double check Pin
jkirkerx17-Jun-16 11:19
professionaljkirkerx17-Jun-16 11:19 
QuestionError while trying to use R.Net in VS 2012 Pin
Member 1085025317-Jun-16 5:39
Member 1085025317-Jun-16 5:39 
AnswerRe: Error while trying to use R.Net in VS 2012 Pin
OriginalGriff17-Jun-16 5:47
mveOriginalGriff17-Jun-16 5:47 
QuestionHelp me gather info about multiple monitors Pin
Tomaž Štih17-Jun-16 3:41
Tomaž Štih17-Jun-16 3:41 
AnswerRe: Help me gather info about multiple monitors Pin
BillWoodruff17-Jun-16 23:52
professionalBillWoodruff17-Jun-16 23:52 
GeneralRe: Help me gather info about multiple monitors Pin
Tomaž Štih18-Jun-16 3:52
Tomaž Štih18-Jun-16 3:52 
GeneralRe: Help me gather info about multiple monitors Pin
BillWoodruff18-Jun-16 19:06
professionalBillWoodruff18-Jun-16 19:06 
QuestionI want to show my GPS cursor in Mapwingis, how to do it? Pin
Member 1241411416-Jun-16 3:55
Member 1241411416-Jun-16 3:55 
AnswerRe: I want to show my GPS cursor in Mapwingis, how to do it? Pin
Pete O'Hanlon16-Jun-16 21:40
mvePete O'Hanlon16-Jun-16 21:40 
GeneralRe: I want to show my GPS cursor in Mapwingis, how to do it? Pin
Member 1241411416-Jun-16 22:32
Member 1241411416-Jun-16 22:32 
GeneralRe: I want to show my GPS cursor in Mapwingis, how to do it? Pin
Pete O'Hanlon16-Jun-16 22:37
mvePete O'Hanlon16-Jun-16 22:37 
GeneralRe: I want to show my GPS cursor in Mapwingis, how to do it? Pin
Member 1241411416-Jun-16 22:40
Member 1241411416-Jun-16 22:40 
GeneralRe: I want to show my GPS cursor in Mapwingis, how to do it? Pin
Pete O'Hanlon16-Jun-16 22:45
mvePete O'Hanlon16-Jun-16 22:45 
QuestionHow to find out, if the toolbar icon or the notifyicon is clicked Pin
Member 1191673515-Jun-16 19:26
Member 1191673515-Jun-16 19:26 
AnswerRe: How to find out, if the toolbar icon or the notifyicon is clicked Pin
OriginalGriff15-Jun-16 20:22
mveOriginalGriff15-Jun-16 20:22 
GeneralRe: How to find out, if the toolbar icon or the notifyicon is clicked Pin
Member 1191673515-Jun-16 22:50
Member 1191673515-Jun-16 22:50 
GeneralRe: How to find out, if the toolbar icon or the notifyicon is clicked Pin
OriginalGriff15-Jun-16 22:53
mveOriginalGriff15-Jun-16 22:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.