Esempio n. 1
0
        public AboutVoodoo()
        {
            InitializeComponent();

            try
            {
                Assembly     assembly         = Assembly.GetExecutingAssembly();
                Stream       textStream       = assembly.GetManifestResourceStream("VoodooUI.Resources.about.md");
                StreamReader textStreamReader = new StreamReader(textStream);

                String text = new StreamReader(textStream).ReadToEnd();

                MarkdownSharp.MarkdownOptions mdopt = new MarkdownSharp.MarkdownOptions();
                mdopt.AutoHyperlink = true; mdopt.LinkEmails = true;
                MarkdownSharp.Markdown parser = new MarkdownSharp.Markdown(mdopt);

                text = parser.Transform(text);
                webBrowser1.DocumentText = text;

                textStreamReader.Close();
            }
            catch (Exception exc)
            {
                webBrowser1.DocumentText = "Voodoo Shader Framework<br>\nCopyright (c) 2010-2013 by Sean Sube, All Rights Reserved.<br>\n<br>\nError loading info:<br>\n\t" + exc.Message;
            }

            m_NoNav = true;
        }
Esempio n. 2
0
        public AboutVoodoo()
        {
            InitializeComponent();

            try
            {
                Assembly assembly = Assembly.GetExecutingAssembly();
                Stream textStream = assembly.GetManifestResourceStream("VoodooUI.Resources.about.md");
                StreamReader textStreamReader = new StreamReader(textStream);

                String text = new StreamReader(textStream).ReadToEnd();

                MarkdownSharp.MarkdownOptions mdopt = new MarkdownSharp.MarkdownOptions();
                mdopt.AutoHyperlink = true; mdopt.LinkEmails = true;
                MarkdownSharp.Markdown parser = new MarkdownSharp.Markdown(mdopt);

                text = parser.Transform(text);
                webBrowser1.DocumentText = text;

                textStreamReader.Close();
            }
            catch (Exception exc)
            {
                webBrowser1.DocumentText = "Voodoo Shader Framework<br>\nCopyright (c) 2010-2013 by Sean Sube, All Rights Reserved.<br>\n<br>\nError loading info:<br>\n\t" + exc.Message;
            }

            m_NoNav = true;
        }
Esempio n. 3
0
        public string ConvertToMarkdown(string str)
        {
            var options = new MarkdownSharp.MarkdownOptions();

            options.AutoHyperlink = true;
            var md = new MarkdownSharp.Markdown(options);

            return(md.Transform(str));
        }
    }//END getclientDataObject_Commands Method

    // ==============================================================================
    /// <summary>
    /// This method creates the demonstration user registration instructions.
    /// </summary>
    /// <param name="Page">Evado.UniForm.Model.Page object.</param>
    //  ------------------------------------------------------------------------------
    private void getDataObject_InstructionsGroup (
      Evado.UniForm.Model.Page Page )
    {
      this.LogMethod ( "getDataObject_InstructionsGroup" );
      // 
      // Initialise the methods variables and objects.
      // 
      Evado.UniForm.Model.Group pageGroup = new Evado.UniForm.Model.Group ( );

      // 
      // create the page pageMenuGroup
      // 
      pageGroup = Page.AddGroup (
         String.Empty,
         Evado.UniForm.Model.EditAccess.Disabled );
      pageGroup.Layout = Evado.UniForm.Model.GroupLayouts.Full_Width;

      //
      // Define the markdown options.
      //
      MarkdownSharp.MarkdownOptions markDownOptions = new MarkdownSharp.MarkdownOptions ( );
      markDownOptions.AutoHyperlink = true;
      markDownOptions.AutoNewlines = true;
      markDownOptions.EmptyElementSuffix = "/>";
      markDownOptions.EncodeProblemUrlCharacters = true;
      markDownOptions.LinkEmails = true;
      markDownOptions.StrictBoldItalic = true;

      //
      // Initialise the markdown class
      //
      MarkdownSharp.Markdown markDown = new MarkdownSharp.Markdown ( markDownOptions );

      //
      // perform the html body transformation.
      //
      string description = markDown.Transform ( this.AdapterObjects.ContentTemplates.DemoRegistrationInstuctions );

      pageGroup.Description = description;

      //
      // Add a streamed video if exists.
      //
      this.getStreamedVideoField ( pageGroup );

      this.LogMethodEnd ( "getDataObject_InstructionsGroup" );

    }
    }//END RegisterUserDetails method

    // ==================================================================================
    /// <summary>
    /// THis method validates that the user id is not duplicated in the ADS
    /// </summary>
    /// <returns>Application Data object</returns>
    //  ----------------------------------------------------------------------------------
    private Evado.UniForm.Model.AppData GetUserRegistrationExitPage (
      EvEventCodes UpdateResult )
    {
      this.LogMethod ( "GetUserRegistrationExitPage method" );
      //
      // Initialise the methods variables and objects.
      //
      Evado.UniForm.Model.AppData clientDataObject = new Evado.UniForm.Model.AppData ( );
      String groupDescription = this.AdapterObjects.ContentTemplates.DemoRegistrationConfirmation;

      if ( UpdateResult != EvEventCodes.Ok )
      {
        this.LogDebug ( "ERROR: Update Result Error: {0}", UpdateResult );

        groupDescription = this.AdapterObjects.ContentTemplates.DemoRegistrationError;
      }

      //
      // set the client ResultData object properties
      //
      clientDataObject.Id = this.Session.AdminUserProfile.Guid;
      clientDataObject.Page.Id = this.Session.AdminUserProfile.Guid;
      clientDataObject.Title = EdLabels.User_Profile_Page_Title
        + this.Session.AdminUserProfile.CommonName;

      clientDataObject.Page.Title = clientDataObject.Title;
      clientDataObject.Page.PageId = Evado.Digital.Model.EdStaticPageIds.User_Profile_Page.ToString ( );
      clientDataObject.Page.EditAccess = Evado.UniForm.Model.EditAccess.Enabled;

      var pageGroup = clientDataObject.Page.AddGroup (
        String.Empty,
        Evado.UniForm.Model.EditAccess.Disabled );
      pageGroup.Layout = Evado.UniForm.Model.GroupLayouts.Full_Width;

      //
      // Define the markdown options.
      //
      MarkdownSharp.MarkdownOptions markDownOptions = new MarkdownSharp.MarkdownOptions ( );
      markDownOptions.AutoHyperlink = true;
      markDownOptions.AutoNewlines = true;
      markDownOptions.EmptyElementSuffix = "/>";
      markDownOptions.EncodeProblemUrlCharacters = true;
      markDownOptions.LinkEmails = true;
      markDownOptions.StrictBoldItalic = true;

      //
      // Initialise the markdown class
      //
      MarkdownSharp.Markdown markDown = new MarkdownSharp.Markdown ( markDownOptions );

      //
      // perform the html body transformation.
      //
      string description = markDown.Transform ( groupDescription );

      pageGroup.Description = description;


      this.LogMethodEnd ( "GetUserRegistrationExitPage" );
      return clientDataObject;
    }
Esempio n. 6
0
    }//END addCustomerGroup method

    // ==================================================================================
    /// <summary>
    /// THis method genrates and send a user notification email. Send to new users and 
    /// when a user's password is updated by the administrator.
    /// </summary>
    //  ----------------------------------------------------------------------------------
    public EvEmail.EmailStatus sendUserNotificationEmail (
      EvStaticContentTemplates.NotiificationTypes Notification )
    {
      this.LogMethod ( "sendUserNotificationEmail" );
      this.LogDebug ( "Notification: " + Notification );
      this.LogDebug ( "ApplicationParameters.ApplicationUrl: " + this.AdapterObjects.ApplicationUrl );
      this.LogDebug ( "SupportEmailAddress: " + this.AdapterObjects.SupportEmailAddress );
      this.LogDebug ( "AdminUserProfile.UserId: " + this.Session.AdminUserProfile.UserId );
      this.LogDebug ( "AdminUserProfile.Password: "******"AdminUserProfile.EmailAddress: " + this.Session.AdminUserProfile.EmailAddress );
      // 
      // Initialise the update variables.
      // 
      string EmailTitle = String.Empty;
      string EmailBody = String.Empty;
      EvEmail email = new EvEmail ( );
      EvEmail.EmailStatus emailStatus = EvEmail.EmailStatus.Null;

      //
      // Validate that the necessary parametes exist.
      //
      if ( this.AdapterObjects.ApplicationUrl == String.Empty
        || this.Session.AdminUserProfile.EmailAddress == String.Empty
        || this.AdapterObjects.SupportEmailAddress == String.Empty )
      {
        this.LogValue ( "Parameters Missing" );
        this.LogMethodEnd ( "sendUserNotificationEmail" );
        return EvEmail.EmailStatus.Parameters_Missing_Error;
      }

      switch ( Notification )
      {
        case EvStaticContentTemplates.NotiificationTypes.Update_Password_Email:
          {
            EmailTitle = this.AdapterObjects.ContentTemplates.UpdatePasswordEmail_Title;
            EmailBody = this.AdapterObjects.ContentTemplates.UpdatePasswordEmail_Body;
            break;
          }
        case EvStaticContentTemplates.NotiificationTypes.Reset_Password_Email:
          {
            EmailTitle = this.AdapterObjects.ContentTemplates.ResetPasswordEmail_Title;
            EmailBody = this.AdapterObjects.ContentTemplates.ResetPasswordEmail_Body;
            break;
          }
        case EvStaticContentTemplates.NotiificationTypes.Password_Change_Email:
          {
            EmailTitle = this.AdapterObjects.ContentTemplates.PasswordConfirmationEmail_Title;
            EmailBody = this.AdapterObjects.ContentTemplates.PasswordConfirmationEmail_Body;
            break;
          }
        case EvStaticContentTemplates.NotiificationTypes.Introductory_Email:
        default:
          {
            EmailTitle = this.AdapterObjects.ContentTemplates.IntroductoryEmail_Title;
            EmailBody = this.AdapterObjects.ContentTemplates.IntroductoryEmail_Body;
            break;
          }
      }//End switch statementf

      EmailTitle = EmailTitle.Replace ( "\r\n\r\n", "\r\n \r\n" );
      EmailTitle = EmailTitle.Replace ( EvcStatics.TEXT_SUBSITUTION_FIRST_NAME,
        this.Session.AdminUserProfile.GivenName );

      EmailTitle = EmailTitle.Replace ( EvcStatics.TEXT_SUBSITUTION_FAMILY_NAME,
        this.Session.AdminUserProfile.FamilyName );

      EmailTitle = EmailTitle.Replace ( EvcStatics.TEXT_SUBSITUTION_ADAPTER_TITLE,
         this.AdapterObjects.Settings.Title );

      EmailBody = EmailBody.Replace ( "\r\n\r\n", "\r\n \r\n" );
      EmailBody = EmailBody.Replace ( EvcStatics.TEXT_SUBSITUTION_FIRST_NAME,
        this.Session.AdminUserProfile.GivenName );
      EmailBody = EmailBody.Replace ( EvcStatics.TEXT_SUBSITUTION_FAMILY_NAME,
        this.Session.AdminUserProfile.FamilyName );

      EmailBody = EmailBody.Replace ( EvcStatics.TEXT_SUBSITUTION_EMAIL_ADDRESS,
        this.Session.AdminUserProfile.EmailAddress );

      EmailBody = EmailBody.Replace ( EvcStatics.TEXT_SUBSITUTION_USER_ID,
        this.Session.AdminUserProfile.UserId );

      EmailBody = EmailBody.Replace ( EvcStatics.TEXT_SUBSITUTION_PASSWORD,
        this.Session.AdminUserProfile.Password );

      EmailBody = EmailBody.Replace ( EvcStatics.TEXT_SUBSITUTION_ORG_ID,
        this.Session.SelectedUserType.ToString() );

      EmailBody = EmailBody.Replace ( EvcStatics.TEXT_SUBSITUTION_ORG_NAME,
        this.Session.AdminUserProfile.OrganisationName );

      EmailBody = EmailBody.Replace ( EvcStatics.TEXT_SUBSITUTION_ADAPTER_TITLE,
        this.AdapterObjects.Settings.Title );


      EmailBody = EmailBody.Replace ( EvcStatics.TEXT_SUBSITUTION_PASSWORD_RESET_URL,
        this.AdapterObjects.PasswordResetUrl );

      EmailBody = EmailBody.Replace ( EvcStatics.TEXT_SUBSITUTION_DATE_STAMP,
        DateTime.Now.ToLongDateString ( ) + " at " + DateTime.Now.ToShortTimeString ( ) );


      this.LogValue ( "EmailTitle: " + EmailTitle );

      //
      // Define the markdown options.
      //
      MarkdownSharp.MarkdownOptions markDownOptions = new MarkdownSharp.MarkdownOptions ( );
      markDownOptions.AutoHyperlink = true;
      markDownOptions.AutoNewlines = true;
      markDownOptions.EmptyElementSuffix = "/>";
      markDownOptions.EncodeProblemUrlCharacters = true;
      markDownOptions.LinkEmails = true;
      markDownOptions.StrictBoldItalic = true;

      //
      // Initialise the markdown class
      //
      MarkdownSharp.Markdown markDown = new MarkdownSharp.Markdown ( markDownOptions );

      //
      // perform the html body transformation.
      //
      EmailBody = markDown.Transform ( EmailBody );

      //
      // Initialise the report alert class
      //
      email.SmtpServer = this.AdapterObjects.Settings.SmtpServer;
      email.SmtpServerPort = this.AdapterObjects.Settings.SmtpServerPort;
      email.SmtpUserId = this.AdapterObjects.Settings.SmtpUserId;
      email.SmtpPassword = this.AdapterObjects.Settings.SmtpPassword;

      //
      // Set the email alert to the recipents
      //
      emailStatus = email.sendEmail (
        EmailTitle,
        EmailBody,
        this.AdapterObjects.SupportEmailAddress,
        this.Session.AdminUserProfile.EmailAddress,
        String.Empty );

      this.LogValue ( "Email DebugLog: " + email.Log );

      //
      // Log email send error.
      //
      if ( emailStatus != EvEmail.EmailStatus.Email_Sent )
      {
        this.LogError ( EvEventCodes.Database_Record_Update_Error,
          "User Notificatin Email Event Status: " + emailStatus
          + "\r\n" + email.Log );

        this.LogClass ( email.Log );
      }

      this.LogMethodEnd ( "sendUserNotificationEmail" );
      return emailStatus;

    }//END sendUserNotificationEmail method
Esempio n. 7
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                string input = args[0];
                string title = "タイトル";
                if (args.Length > 1)
                {
                    title = args[1];
                }
                string regptn = Regex.Escape(input);
                regptn = regptn.Replace(@"\*", ".*?");
                regptn = regptn.Replace(@"\?", ".");

                ScriptNode root  = new ScriptNode();
                Regex      regex = new Regex(regptn);
                foreach (string s in Directory.GetFiles(".\\"))
                {
                    if (regex.IsMatch(s))
                    {
                        Stream stream = null;
                        try {
                            stream = new FileStream(s, FileMode.Open);
                            var        serializer = new DataContractJsonSerializer(typeof(ScriptNode));
                            ScriptNode node       = (ScriptNode)serializer.ReadObject(stream);
                            root.margeNode(node);
                        } catch (Exception) {
                            if (stream != null)
                            {
                                stream.Close();
                            }
                        }
                    }
                }
                string about = title;
                if (System.IO.File.Exists("about.md"))
                {
                    System.IO.StreamReader sr = new System.IO.StreamReader("about.md", System.Text.Encoding.GetEncoding("UTF-8"));
                    about = sr.ReadToEnd();
                    sr.Close();
                }
                if (root.Members != null && root.Members.Count > 0)
                {
                    var option = new MarkdownSharp.MarkdownOptions();
                    option.AutoHyperlink              = true;
                    option.AutoNewLines               = true;
                    option.EmptyElementSuffix         = " />";
                    option.EncodeProblemUrlCharacters = true;
                    option.LinkEmails       = true;
                    option.StrictBoldItalic = false;
                    ScriptNode.Markdown     = new MarkdownSharp.Markdown(option);
                    ScriptNode.Root         = root;
                    root.WriteMain(title, about);
                }

                /*
                 * Stream stream = new FileStream( args[0], FileMode.Open );
                 * var serializer = new DataContractJsonSerializer( typeof( ScriptNode ) );
                 * try {
                 *      ScriptNode node = (ScriptNode)serializer.ReadObject( stream );
                 *      node.WriteHtml( "" );
                 * } catch( System.Runtime.Serialization.SerializationException e ) {
                 *      System.Console.WriteLine( e.Message );
                 *      System.Console.WriteLine( e.Source );
                 * }
                 * stream.Close();
                 */
            }
            else
            {
                System.Console.WriteLine("apijsontohtml [json file name]");
            }
        }