Example #1
0
        private void ExportManifest_Click(object sender, RoutedEventArgs e)
        {
            string id = InputModname.Text;

            if (string.IsNullOrWhiteSpace(InputModname.Text))
            {
                LabelStatus.Content = "Export failed! Please fill out the Modname.";
                StatusTimer();
                return;
            }
            if (string.IsNullOrWhiteSpace(InputVersion.Text))
            {
                LabelStatus.Content = "Export failed! Please fill out the Version.";
                StatusTimer();
                return;
            }
            if (string.IsNullOrWhiteSpace(InputAuthors.Text))
            {
                LabelStatus.Content = "Export failed! Please fill out the Author.";
                StatusTimer();
                return;
            }
            string path;

            if (string.IsNullOrWhiteSpace(parentWindow.modFolderPath))
            {
                path = System.AppDomain.CurrentDomain.BaseDirectory + "Exported\\";
            }
            else
            {
                path = parentWindow.modFolderPath + "\\";
            }
            path += InputModname.Text + "\\";

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            Mod m = new Mod();

            m.id           = InputModname.Text;
            m.Name         = InputModname.Text;
            m.Version      = InputVersion.Text;
            m.Description  = InputDescription.Text;
            m.Authors      = InputAuthors.Text.Split(';').ToList();
            m.Requirements = InputRequirements.Text.Split(';').ToList();

            parentWindow.CopyFile(InputIconPath.Text, path);
            m.Icon = parentWindow.TrimPath(InputIconPath.Text);

            XMLManager.CreateManifest(path, m);
            LabelStatus.Content = "Export successful.";
            StatusTimer();
        }