Exemple #1
0
        static void Main(string[] args)
        {
            if (args[0] == "help")
            {
                Console.WriteLine("runner.exe [pdf|doc|excel|ppt] options \n");
                Console.WriteLine("runner.exe pdf htmlFile pdfFile \n");
                Console.WriteLine("runner.exe docx wordFile str url");
            }
            //string pdffile_path = args[0];
            //pdfChecker pdf = new pdfChecker();
            //pdf.ReadPdfFile(pdffile_path);
            //if (pdf.SameAsExpected("a.txt"))
            //{
            //    Console.WriteLine("Same");
            //}
            //else {
            //    Console.WriteLine("not same");
            //}

            //runner.exe htmlTemp pdfFIle

            if (args[0] == "pdf")
            {
                string       html    = args[1];
                string       pdfPath = args[2];
                PdfOperation pdf     = new PdfOperation();

                pdf.CreatePdf(html, pdfPath);
            }

            if (args[0] == "docx")
            {
                string wordFile  = args[1];
                string url       = args[3];
                string targetStr = args[2];

                OfficeOperation officeDoc = new OfficeOperation();
                officeDoc.Word2007SearchAndReplace(wordFile, targetStr, url);
            }

            if (args[0] == "xlsx")
            {
                string excelFile = args[1];
                string url       = args[3];
                string targetStr = args[2];

                OfficeOperation officeDoc = new OfficeOperation();
                officeDoc.Excel2007SearchAndReplace(excelFile, targetStr, url);
            }

            if (args[0] == "pptx")
            {
                string          pptFile   = args[1];
                string          url       = args[3];
                string          targetStr = args[2];
                OfficeOperation pptDoc    = new OfficeOperation();
                pptDoc.PPT2007SearchAndReplace(pptFile, targetStr, url);
            }
        }
Exemple #2
0
        public async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var msg = await result;

            string[] options = new string[] { "Image", "Paragraph" };
            string   prompt  = $"I see you are running the Clippy Bot in Word. Which of the following would you like me to insert into Word:";

            PromptDialog.Choice(context, async(IDialogContext choiceContext, IAwaitable <string> choiceResult) =>
            {
                var selection      = await choiceResult;
                OfficeOperation op = (OfficeOperation)Enum.Parse(typeof(OfficeOperation), selection);

                // Send the operation through the backchannel using Event activity
                var reply   = choiceContext.MakeMessage() as IEventActivity;
                reply.Type  = "event";
                reply.Name  = "officeOperation";
                reply.Value = op.ToString();
                await choiceContext.PostAsync((IMessageActivity)reply);
            }, options, prompt);
        }
        public async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var msg = await result;

            string[] options = new string[] { "Chart", "Range" };
            string   prompt  = $"I see you are running the Clippy Bot in Excel. Select something and I'll insert it into a *NEW* worksheet:";

            PromptDialog.Choice(context, async(IDialogContext choiceContext, IAwaitable <string> choiceResult) =>
            {
                var selection      = await choiceResult;
                OfficeOperation op = (OfficeOperation)Enum.Parse(typeof(OfficeOperation), selection);

                // Send the operation through the backchannel using Event activity
                var reply   = choiceContext.MakeMessage() as IEventActivity;
                reply.Type  = "event";
                reply.Name  = "officeOperation";
                reply.Value = op.ToString();
                await choiceContext.PostAsync((IMessageActivity)reply);
            }, options, prompt);
        }
Exemple #4
0
        public async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var msg = await result;

            string[] options = new string[] { "Reply", "Reply All" };
            var      user    = context.UserData.Get <string>("user");
            string   prompt  = $"Hey {user}, I see you are running the Clippy Bot in Outlook. For this mail, I can help you with the following:";

            PromptDialog.Choice(context, async(IDialogContext choiceContext, IAwaitable <string> choiceResult) =>
            {
                var selection      = await choiceResult;
                OfficeOperation op = (OfficeOperation)Enum.Parse(typeof(OfficeOperation), selection.Replace(" ", ""));

                // Send the operation through the backchannel using Event activity
                var reply   = choiceContext.MakeMessage() as IEventActivity;
                reply.Type  = "event";
                reply.Name  = "officeOperation";
                reply.Value = op.ToString();
                await choiceContext.PostAsync((IMessageActivity)reply);
            }, options, prompt);
        }