public ImageSetDocument()
 {
     ImageSetName = "";
     FilePath     = "";
     Source       = null;
     Images       = new List <ImageSetImage>();
 }
        private void LoadInData(string inPath, VD2FileSource inSource)
        {
            string fullpath = EditorUserSettings.UserSettings.VD2Path + inSource.Path + "Data\\" + inPath;

            if (Directory.Exists(fullpath))
            {
                List <string> datafiles = Directory.EnumerateFiles(fullpath).ToList();
                for (int i = 0; i < datafiles.Count; i++)
                {
                    if (datafiles[i].EndsWith(".xml"))
                    {
                        //string dataname = inSource.ShortName + "\\" + datafiles[i].Substring(fullpath.Length + 1, (datafiles[i].Length - fullpath.Length) - 5);
                        string dataname = inSource.ShortName + ":" + datafiles[i];
                        if (Data.ContainsKey(dataname))
                        {
                            UI.ErrorMessageDialog dialog = new UI.ErrorMessageDialog();
                            dialog.ErrorTitleText    = "Duplicate File Name";
                            dialog.ErrorMessageText  = "The file " + datafiles[i] + "would result in a duplicate key error\r\n";
                            dialog.ErrorMessageText += "The resulting key would be:\r\n" + dataname + "\r\nThe file will be skipped.";
                            dialog.ShowDialog();
                        }
                        else
                        {
                            T currentdata = System.Activator.CreateInstance(typeof(T), datafiles[i], inSource) as T;
                            Data.Add(dataname, currentdata);
                        }
                    }
                }
            }
        }
        public void LoadData()
        {
            VD2FileSource basesource = EditorUserSettings.UserSettings.GetSourceByShortName("Base");
            VD2FileSource modsource  = EditorUserSettings.UserSettings.GetSourceByShortName("Mod");

            if (Directory.Exists(EditorUserSettings.UserSettings.VD2Path + "Mod\\Media\\gui\\imagesets"))
            {
                List <string> files = Directory.EnumerateFiles(EditorUserSettings.UserSettings.VD2Path + "Mod\\Media\\gui\\imagesets").ToList();
                foreach (string file in files)
                {
                    if (Path.GetExtension(file) == ".imageset")
                    {
                        ImageSetDocument imagesetdoc = new ImageSetDocument(Path.GetFileNameWithoutExtension(file), file, modsource);
                        Data.Add("Mod:" + imagesetdoc.ImageSetName, imagesetdoc);
                    }
                }
            }
            if (Directory.Exists(EditorUserSettings.UserSettings.VD2Path + "Media\\gui\\imagesets"))
            {
                List <string> files = Directory.EnumerateFiles(EditorUserSettings.UserSettings.VD2Path + "Media\\gui\\imagesets").ToList();
                foreach (string file in files)
                {
                    if (Path.GetExtension(file) == ".imageset")
                    {
                        ImageSetDocument imagesetdoc = new ImageSetDocument(Path.GetFileNameWithoutExtension(file), file, basesource);
                        Data.Add("Base:" + imagesetdoc.ImageSetName, imagesetdoc);
                    }
                }
            }
            return;
        }
 public ImageSetDocument(string inImageSetName, string inFilePath, VD2FileSource inSource)
 {
     ImageSetName = inImageSetName;
     FilePath     = inFilePath;
     Source       = inSource;
     Images       = new List <ImageSetImage>();
     LoadData();
 }
        public void LoadData()
        {
            VD2FileSource basesource = EditorUserSettings.UserSettings.GetSourceByShortName("Base");
            VD2FileSource modsource  = EditorUserSettings.UserSettings.GetSourceByShortName("Mod");

            if (modsource != null)
            {
                if (Directory.Exists(EditorUserSettings.UserSettings.VD2Path + "Mod\\Media\\models"))
                {
                    List <string> folders = Directory.EnumerateDirectories(EditorUserSettings.UserSettings.VD2Path + "Mod\\Media\\models").ToList();
                    foreach (string folder in folders)
                    {
                        List <string> files = Directory.EnumerateFiles(folder).ToList();
                        foreach (string file in files)
                        {
                            if (Path.GetExtension(file) == ".mesh")
                            {
                                MeshDocument meshdoc = new MeshDocument();
                                meshdoc.MeshName = Path.GetFileName(file);
                                meshdoc.FilePath = file;
                                meshdoc.Source   = modsource;
                                if (!Data.ContainsKey("Mod:" + Path.GetFileNameWithoutExtension(file)))
                                {
                                    Data.Add("Mod:" + Path.GetFileNameWithoutExtension(file), meshdoc);
                                }
                            }
                        }
                    }
                }
            }
            if (basesource != null)
            {
                if (Directory.Exists(EditorUserSettings.UserSettings.VD2Path + "Media\\models"))
                {
                    List <string> folders = Directory.EnumerateDirectories(EditorUserSettings.UserSettings.VD2Path + "Media\\models").ToList();
                    foreach (string folder in folders)
                    {
                        List <string> files = Directory.EnumerateFiles(folder).ToList();
                        foreach (string file in files)
                        {
                            if (Path.GetExtension(file) == ".mesh")
                            {
                                MeshDocument meshdoc = new MeshDocument();
                                meshdoc.MeshName = Path.GetFileName(file);
                                meshdoc.FilePath = file;
                                meshdoc.Source   = basesource;
                                if (!Data.ContainsKey("Base:" + Path.GetFileNameWithoutExtension(file)))
                                {
                                    Data.Add("Base:" + Path.GetFileNameWithoutExtension(file), meshdoc);
                                }
                            }
                        }
                    }
                }
            }
        }
 public T LoadSingleFileFromAbsolutePath(string inPath, VD2FileSource inSource)
 {
     if (inPath.EndsWith(".xml"))
     {
         string dataname    = inSource.ShortName + "\\" + Path.GetFileNameWithoutExtension(inPath);
         T      currentdata = System.Activator.CreateInstance(typeof(T), inPath, inSource) as T;
         Data.Add(dataname, currentdata);
         return(currentdata);
     }
     return(null);
 }
 public HangarData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
Exemple #8
0
 public MeshDocument()
 {
     MeshName = "";
     _Source  = null;
 }
Exemple #9
0
 public DialogData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
Exemple #10
0
 public OtherObjectData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
 public ParticleData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
Exemple #12
0
 public ActiveUpgradeData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
Exemple #13
0
        public bool InitUserSettings()
        {
            Sources.Clear();
            VD2FileSource currentsource = new VD2FileSource("Base Game", "Base", "", false, true);

            Sources.Add(currentsource);
            currentsource = new VD2FileSource("Mod Game", "Mod", "Mod\\", true, true);
            Sources.Add(currentsource);
            DataEditorTheme theme = new DataEditorTheme();

            theme.ThemeName           = "DefaultDark";
            theme.ContentColor        = Color.FromArgb(15, 15, 15);
            theme.FrameColor          = Color.FromArgb(90, 90, 90);
            theme.TextColor           = Color.White;
            theme.SecondaryFrameColor = Color.FromArgb(45, 45, 45);
            theme.ButtonColor         = Color.FromArgb(120, 120, 120);
            theme.ButtonHoverColor    = Color.FromArgb(64, 64, 64);
            theme.ButtonDownColor     = Color.Silver;
            Themes.Add(theme);
            CurrentTheme = theme;
            bool configfoundandvalid = false;

            if (File.Exists("EditorUserSettings.cfg"))
            {
                List <string> configlines = File.ReadAllLines("EditorUserSettings.cfg").ToList();
                if (configlines.Count > 0)
                {
                    for (int i = 0; i < configlines.Count; i++)
                    {
                        List <string> currentlinesplit = configlines[i].Split('|').ToList();
                        if (currentlinesplit.Count == 2)
                        {
                            if (currentlinesplit[0] == "VD2Path")
                            {
                                if (File.Exists(currentlinesplit[1] + "/Void Destroyer 2.exe"))
                                {
                                    VD2Path             = currentlinesplit[1];
                                    configfoundandvalid = true;
                                }
                            }
                            else if (currentlinesplit[0] == "TreeIconSize")
                            {
                                int treeiconsizeresult;

                                if (int.TryParse(currentlinesplit[1], out treeiconsizeresult))
                                {
                                    if (treeiconsizeresult == 16)
                                    {
                                        TreeIconSize = 16;
                                    }
                                    else if (treeiconsizeresult == 32)
                                    {
                                        TreeIconSize = 32;
                                    }
                                    else
                                    {
                                        TreeIconSize = 16;
                                    }
                                    //unlike vd2path, we gracefully default to 16 here if the value isn't in the file.
                                    //next time it saves the proper value will be set in the right format, no biggie.
                                }
                            }
                        }
                    }
                }
            }
            if (!configfoundandvalid)
            {
                /*string SteamPath = (string)Registry.GetValue("HKEY_CURRENT_USER\\Software\\Valve\\Steam", "SteamPath", "C:\\Program Files (x86)\\Steam");
                 * if (Directory.Exists(SteamPath + "\\steamapps\\common\\Void Destroyer 2"))
                 * {
                 *  VD2Path = SteamPath + "\\steamapps\\common\\Void Destroyer 2";
                 * }
                 * else
                 * {
                 *  DialogResult folderdialogresult = EditorUI.UI.EditorForm.folderBrowserDialog1.ShowDialog();
                 *  if (folderdialogresult == DialogResult.OK)
                 *  {
                 *      VD2Path = EditorUI.UI.EditorForm.folderBrowserDialog1.SelectedPath;
                 *  }
                 * }
                 *
                 * List<string> configlines = new List<string>();
                 * configlines.Add("VD2Path|" + VD2Path);
                 * File.WriteAllLines("EditorUserSettings.cfg", configlines);*/
                FirstTimeSetupWizard wizard = new FirstTimeSetupWizard();
                if (wizard.ShowDialog() == DialogResult.Abort)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #14
0
 public CockpitData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
 public MissileData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
Exemple #16
0
 public ShieldData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
 public DockedMovingElementData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
Exemple #18
0
 public AsteroidData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
Exemple #19
0
 public VD2SourceDropdownItem()
 {
     InitializeComponent();
     AssociatedSource = null;
 }
 public AmmoData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
Exemple #21
0
 public MusicData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
Exemple #22
0
 public CharacterData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
 public DebrisData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
 public AreaOfEffectData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
 public ExplosionData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
Exemple #26
0
 public SkyboxData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
 public LauncherData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }
Exemple #28
0
 public TurretData(string inPath, VD2FileSource inSource) : base(inPath, inSource)
 {
 }