Ok hello sharpcorner
i been having a issue now for ages and cant seem to find out why its causing me issues but here is a lines of the code
Ok main form1
- elfenlied_program_settings elf;
- addingweapons elf_weap;
- Parser elfenliedl;
- gscadding elfy1;
-
-
-
-
-
-
- public Form1()
- {
-
- InitializeComponent();
-
- updater1.CheckForUpdates();
- listBoxAdv1.Visible = false;
- elf = new elfenlied_program_settings(listBoxAdv1,elfenliedl);
- elf_weap = new addingweapons(richTextBoxEx1);
- elfenliedl = new Parser("model1887_sp");
- elfy1 = new gscadding(this, elf_weap);
- elfy1.elfygsc = this;
- timer1.Start();
- elf.buttonX2 = buttonX2;
- elf.elfenform = this;
-
- buttonX2.Visible = false;
- buttonX3.Enabled = true;
- textBoxX6.Enabled = false;
- elfenliedl.buttonX1 = buttonX1;
-
-
-
- if (Properties.Settings.Default.root.Equals("First"))
- {
- if (Directory.Exists(wawpath))
- {
- Properties.Settings.Default.root.Equals(wawpath);
- string rootsave = wawpath;
- Properties.Settings.Default.root = rootsave;
- Properties.Settings.Default.Save();
- listBoxAdv1.Visible = true;
- root = Properties.Settings.Default.root;
- buttonX2.Visible = true;
- elf.newlistbox();
- elf.listboxfunction();
- updatesettings();
-
- }
- }
- else
- {
- MessageBox.Show("we did not hit it");
- }
-
-
- }
the methord i want to reach in form1
- public void updatesettings()
- {
- mods = Properties.Settings.Default.mods + "//maps//_zombiemode_weapons.gsc";
- dlc3code = Properties.Settings.Default.mods + "//maps//dlc3_code.gsc";
- zombiemodeweapons = Properties.Settings.Default.mods + "//maps//_zombiemode_weapons.gsc";
- }
and what im trying to do is get gscadder to revrence form 1 to update string paths as follows here
gscadding
and i want here to revrence updatesettings in form1
- public SoundAlis sounds;
- public addingweapons dlc3gsc;
- public Form1 elfygsc;
- public gscadding(addingweapons dlc3)
- {
- dlc3gsc = dlc3;
- }
-
- public gscadding(Form1 elfygsc,addingweapons dlc3)
- {
- this.elfygsc = elfygsc;
- }
-
-
-
- public void dlcexists()
- {
-
- elfygsc.updatesettings();
- if (dlc3gsc.Model1887 == true)
- {
- if (File.Exists(dlc3code))
- {
- MessageBox.Show("exists");
- }
- else
- {
- DialogResult dialogResult = MessageBox.Show("Dlc3code.gsc is not found in mods do you wish to copy.", "Dlc3_code.gsc not found in mods", MessageBoxButtons.YesNo);
- if (dialogResult == DialogResult.Yes)
- {
- File.Copy(Properties.Settings.Default.root + "\\raw\\maps\\dlc3_code.gsc", Properties.Settings.Default.mods + "//maps//dlc3_code.gsc", true);
- {
- string s = "include_weapon( \"model1887_sp\");";
-
- string file = modspath1 + "//maps//dlc3_code.gsc";
- List<string> lines = new List<string>(System.IO.File.ReadAllLines(file));
- int index = lines.FindLastIndex(item => item.Contains(("include_weapon(")));
- if (index != -1)
- {
- lines.Insert(index + 1, s);
- }
- System.IO.File.WriteAllLines(file, lines);
- MessageBox.Show("done");
- }
- }
-
- else if (dialogResult == DialogResult.No)
- {
- MessageBox.Show("No Files Copied To Add files to the mystery box you will need to add lines later");
- }
- }
- }
and i do have a call in another class im not sure if this is what is causing it or not but i dont think so as that one revrences the form1 as well
addingweapons.cs
- SoundAlis sounds;
- gscadding elfgscadd;
- public bool M27 { get; set; }
- public bool Model1887 { get; set; }
-
-
-
-
-
- private void DirectoryCopy(
- string sourceDirName, string destDirName, bool copySubDirs)
- {
- DirectoryInfo dir = new DirectoryInfo(sourceDirName);
- DirectoryInfo[] dirs = dir.GetDirectories();
-
-
- if (!dir.Exists)
- {
- throw new DirectoryNotFoundException(
- "Source directory does not exist or could not be found: "
- + sourceDirName);
- }
-
-
- if (!Directory.Exists(destDirName))
- {
- Directory.CreateDirectory(destDirName);
- }
-
-
-
- FileInfo[] files = dir.GetFiles();
-
- foreach (FileInfo file in files)
- {
-
- string temppath = Path.Combine(destDirName, file.Name);
-
-
- file.CopyTo(temppath, true);
- }
-
-
- if (copySubDirs)
- {
-
- foreach (DirectoryInfo subdir in dirs)
- {
-
- string temppath = Path.Combine(destDirName, subdir.Name);
-
-
- DirectoryCopy(subdir.FullName, temppath, copySubDirs);
- }
- }
- }
-
- public addingweapons(DevComponents.DotNetBar.Controls.RichTextBoxEx richtextboxelf)
- {
-
- richTextBoxEx1 = richtextboxelf;
-
- elfgscadd = new gscadding(this);
- sounds = new SoundAlis(this, elfgscadd);
- elfgscadd.sounds = sounds;
-
-
-
-
-
-
-
-
-
- }
And this is the error i get once i push copy weapons
Thank you in advance Saito