Exemple #1
0
        public Form1()
        {
            InitializeComponent();
            AvailableMapsBox.SelectedValueChanged += AvailableMapsBoxOnSelectedValueChanged;
            InstalledMapsBox.SelectedValueChanged += AvailableMapsBoxOnSelectedValueChanged;
            MapDescriptionLabel.LinkClicked       += MapDescriptionLabelOnLinkClicked;
            selectAllToolStripMenuItem.Click      += SelectAllToolStripMenuItemOnClick;
            selectNoneToolStripMenuItem.Click     += SelectNoneToolStripMenuItemOnClick;
            selectAllToolStripMenuItem1.Click     += SelectAllToolStripMenuItem1OnClick;
            selectNoneToolStripMenuItem1.Click    += SelectNoneToolStripMenuItem1OnClick;
            m_DefaultThumbnail = thumbnailBox.Image;

            string version = ApplicationDeployment.IsNetworkDeployed ? ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(4) : VERSION;

            Directory.CreateDirectory($@"{s_ApplicationDataPath}\MordhauMapInstaller\Info\");

            Log($"Version {version}");
            versionlabel.Text = $@"Version {version}";

            Directory.CreateDirectory(s_AppData);

            // Remove old log file so we can make a new one
            string logPath = $@"{s_AppData}\log.txt";

            if (File.Exists(logPath))
            {
                File.Delete(logPath);
            }

            checkForUpdates = !File.Exists(s_DisableUpdatesFile);

            // Check for updates on startup
            if (checkForUpdates)
            {
                CheckForUpdates();
            }

            // Next check if we have an ini file with mordhau location
            string configPath = $@"{s_AppData}\config.txt";

            if (File.Exists(configPath))
            {
                using (var reader = new StreamReader(configPath))
                    m_MordhauPath = reader.ReadLine();
                Log("Mordhau Path read from configuration file");
            }
            else
            {
                // If no file, show help form
                var help = new HelpForm();
                help.Show(this);
            }
            // Even if we loaded one, make sure it's right, if not loaded this will also be true
            if (!m_MordhauPath.ToLower().Contains(MAPS_PATH) || !Directory.Exists(m_MordhauPath))
            {
                Log("Trying to find Mordhau Directory...");
                string steamPath = GetSteamPath();
                Log($"Steam Path: {steamPath}"); // If steampath contains mordhau, it's the straightup mordhau path
                if (steamPath.Equals(string.Empty) || !Directory.Exists($@"{steamPath}\steamapps\common\mordhau") && !steamPath.ToLower().Contains("mordhau") || !Directory.Exists(steamPath))
                {
                    Log("Mordhau not found");
                    // Open configuration menu to have them browse to it
                    ShowMordhauPathDialog();
                    if (!m_MordhauPath.ToLower().Contains(MAPS_PATH) || !Directory.Exists(m_MordhauPath))
                    {
                        Log($"Invalid Mordhau Path, please re-enter through Settings: {m_MordhauPath}");
                    }
                    Log($"Mordhau Path: {m_MordhauPath}");
                }
                else // If we're here, the directory exists and we have one
                {
                    m_MordhauPath = steamPath.ToLower().Contains("mordhau")
                        ? $@"{steamPath}\mordhau\content\mordhau\maps\"
                        : $@"{steamPath}\steamapps\common\mordhau\mordhau\content\mordhau\maps\";
                    Log($"Mordhau Path: {m_MordhauPath}");
                }
                // Regardless let's save now
                using (var writer = new StreamWriter(configPath))
                {
                    writer.WriteLine(m_MordhauPath);
                }
            }

            // First check for any installed info files and show them
            UpdateInstalledMaps();
            Log("Checking for maps...");
            // Then download the info files from github for available maps and update them
            CheckContents();
        }
Exemple #2
0
        private void basicHelpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var help = new HelpForm();

            help.Show();
        }
Exemple #3
0
        //private int progressWidth = 696;
        //private int progressHeight = 40;

        public Form1()
        {
            //System.Globalization.CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo("zh-CN");
            InitializeComponent();
            AvailableMapsBox.SelectedValueChanged += AvailableMapsBoxOnSelectedValueChanged;
            InstalledMapsBox.SelectedValueChanged += AvailableMapsBoxOnSelectedValueChanged;
            MapDescriptionLabel.LinkClicked       += MapDescriptionLabelOnLinkClicked;
            selectAllToolStripMenuItem.Click      += SelectAllToolStripMenuItemOnClick;
            selectNoneToolStripMenuItem.Click     += SelectNoneToolStripMenuItemOnClick;
            selectAllToolStripMenuItem1.Click     += SelectAllToolStripMenuItem1OnClick;
            selectNoneToolStripMenuItem1.Click    += SelectNoneToolStripMenuItem1OnClick;
            m_DefaultThumbnail = thumbnailBox.Image;
            //696, 40
            //progressWidth = progressBar1.Size.Width;
            //progressHeight = progressBar1.Size.Height;
            //progressBar1.Size = new Size(0,0);

            string version = ApplicationDeployment.IsNetworkDeployed ? ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(4) : VERSION;

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;



            Directory.CreateDirectory($@"{s_ApplicationDataPath}\MordhauMapInstaller\Info\");

            Log($"Version {version}");
            versionlabel.Text = $@"Version {version}";

            Directory.CreateDirectory(s_AppData);

            // Remove old log file so we can make a new one
            string logPath = $@"{s_AppData}\log.txt";

            if (File.Exists(logPath))
            {
                File.Delete(logPath);
            }

            checkForUpdates = !File.Exists(s_DisableUpdatesFile);

            // Check for updates on startup
            CheckForUpdates();

            // Next check if we have an ini file with mordhau location

            if (File.Exists(configPath))
            {
                using (var reader = new StreamReader(configPath))
                    m_MordhauPath = reader.ReadLine();
                Log("Mordhau Path read from configuration file");
            }
            else
            {
                // If no file, show help form
                var help = new HelpForm();
                help.Show(this);
            }
            // Even if we loaded one, make sure it's right, if not loaded this will also be true
            if (!m_MordhauPath.ToLower().Contains(MAPS_PATH) || !Directory.Exists(m_MordhauPath))
            {
                Log("Trying to find Mordhau Directory...");
                string steamPath = GetSteamPath();
                Log($"Steam Path: {steamPath}"); // If steampath contains mordhau, it's the straightup mordhau path
                // If steamPath doesn't contain "Mordhau", it is the actual steam path
                // So then also if that path + \steamapps\common\mordhau\mordhau.exe doesn't exist, its invalid
                // If its empty, its invalid
                // If the directory does not exist, its invalid
                // We should never get a directory containing 'Mordhau' that hasn't already been checked for validity
                if (steamPath.Equals(string.Empty) || (!File.Exists($@"{steamPath}\steamapps\common\mordhau\Mordhau.exe") && !steamPath.ToLower().Contains("mordhau")) || !Directory.Exists(steamPath))
                {
                    Log("Mordhau not found");
                    // Open configuration menu to have them browse to it
                    ShowMordhauPathDialog();
                    if (!m_MordhauPath.ToLower().Contains(MAPS_PATH) || !Directory.Exists(m_MordhauPath))
                    {
                        Log($"Mordhau Path: {m_MordhauPath}");
                        Log(Properties.Resources.str_Invalid_Mordhau_Path_please_re_enter);
                    }
                }
                else // If we're here, the directory exists and we have one
                {
                    m_MordhauPath = steamPath.ToLower().Contains("mordhau")
                        ? $@"{steamPath}\mordhau\content\mordhau\maps\"
                        : $@"{steamPath}\steamapps\common\mordhau\mordhau\content\mordhau\maps\";
                    Log($"Mordhau Path: {m_MordhauPath}");
                    UpdateEverything();
                }
            }
            else
            {
                UpdateEverything();
            }
        }