Example #1
0
        public static bool ShowEula()
        {
            string sAcceptedEulaToken = Path.Combine(EditorManager.GetDirectory(EditorManager.DirectoryType.UserDataPath), "UserAcceptedEula.token");

            using (EULA EulaDlg = new EULA())
            {
                string sEulaHash = EulaDlg.GenerateEulaTextHash();

                // already confirmed an Eula
                if (System.IO.File.Exists(sAcceptedEulaToken) && EulaDlg.ContainsValidEulaText())
                {
                    // check hash to confirm if it was exactly this eula
                    try
                    {
                        if (System.IO.File.ReadLines(sAcceptedEulaToken).First().Equals(sEulaHash))
                        {
                            return(true);
                        }
                    }
                    catch
                    {
                        // proceed normally
                    }
                }


                EulaDlg.ShowDialog();

                if (!EulaDlg.HasAcceptedEula())
                {
                    MessageBox.Show("You rejected the Project Anarchy EULA.\nvForge will now close.", "vForge", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
                else
                {
                    try
                    {
                        System.IO.File.WriteAllText(sAcceptedEulaToken, sEulaHash + "\nThe Project Anarchy EULA has been accepted by this user.");
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Failed to write this file: \n'" + sAcceptedEulaToken + "'\nPlease make sure vForge has the necessary access rights to create this file.", "vForge", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            return(true);
        }
Example #2
0
        public static bool ShowEula()
        {
            string sAcceptedEulaToken = Path.Combine(EditorManager.GetDirectory(EditorManager.DirectoryType.UserDataPath), "UserAcceptedEula.token");

             using (EULA EulaDlg = new EULA())
             {
            string sEulaHash = EulaDlg.GenerateEulaTextHash();

            // already confirmed an Eula
            if (System.IO.File.Exists(sAcceptedEulaToken) && EulaDlg.ContainsValidEulaText())
            {
               // check hash to confirm if it was exactly this eula
               try
               {
                  if (System.IO.File.ReadLines(sAcceptedEulaToken).First().Equals(sEulaHash))
                     return true;
               }
               catch
               {
                  // proceed normally
               }
            }

            EulaDlg.ShowDialog();

            if (!EulaDlg.HasAcceptedEula())
            {
               MessageBox.Show("You rejected the Project Anarchy EULA.\nvForge will now close.", "vForge", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
               return false;
            }
            else
            {
               try
               {
                  System.IO.File.WriteAllText(sAcceptedEulaToken, sEulaHash + "\nThe Project Anarchy EULA has been accepted by this user.");
               }
               catch (Exception)
               {
                  MessageBox.Show("Failed to write this file: \n'" + sAcceptedEulaToken + "'\nPlease make sure vForge has the necessary access rights to create this file.", "vForge", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
               }
            }
             }
             return true;
        }
Example #3
0
        private void ShowEula()
        {
            string sAcceptedEulaToken = Path.Combine(EditorManager.GetDirectory(EditorManager.DirectoryType.UserDataPath), "UserAcceptedEula.token");

              if (System.IO.File.Exists(sAcceptedEulaToken))
            return;

              using (EULA EulaDlg = new EULA())
              {
            EulaDlg.ShowDialog();

            if (!EulaDlg.HasAcceptedEula())
            {
              MessageBox.Show("You rejected the Project Anarchy EULA.\nvForge will now close.", "vForge", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
              Close();
            }
            else
            {
              try
              {
            System.IO.File.WriteAllText(sAcceptedEulaToken, "The Project Anarchy EULA has been accepted by this user.");
              }
              catch(Exception e)
              {
            MessageBox.Show("Failed to write this file: \n'" + sAcceptedEulaToken + "'\nPlease make sure vForge has the necessary access rights to create this file.", "vForge", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
              }
            }
              }
        }