private void buttonInstance_Click(object sender, EventArgs e) { string mapsrcPath = launcher.GetCurrentMod().installPath + "\\mapsrc\\"; Directory.CreateDirectory(mapsrcPath); instanceDialog.SelectedPath = (textGamedata.EditValue.ToString() == string.Empty ? mapsrcPath : textGamedata.EditValue.ToString()); if (instanceDialog.ShowDialog() == DialogResult.OK) { textInstance.EditValue = instanceDialog.SelectedPath; } }
public GameInfo(Launcher launcher) { this.launcher = launcher; switch (launcher.GetCurrentGame().engine) { case Engine.SOURCE: root = KeyValue.readChunkfile(launcher.GetCurrentMod().installPath + "\\gameinfo.txt"); break; case Engine.SOURCE2: root = KeyValue.readChunkfile(launcher.GetCurrentMod().installPath + "\\gameinfo.gi"); break; } }
private void compileButton_Click(object sender, EventArgs e) { foreach (String fileName in vmfListBox.Items) { String propperPath = launcher.GetCurrentGame().installPath + "\\bin\\propper.exe"; if (!File.Exists(propperPath)) { if (File.Exists(Application.StartupPath + "\\Tools\\Propper\\propper.exe")) { File.Copy(Application.StartupPath + "\\Tools\\Propper\\propper.exe", propperPath, true); File.Copy(Application.StartupPath + "\\Tools\\Propper\\propper.fgd", propperPath, true); } else { MessageBox.Show("Could not find propper.exe"); return; } } String modPath = launcher.GetCurrentMod().installPath; ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = propperPath; startInfo.Arguments = "-game \"" + modPath + "\" \"" + fileName + "\""; Process.Start(startInfo); } }
public string getExtractedPath(string filePath) { foreach (string searchPath in launcher.GetCurrentMod().GetSearchPaths()) { if (File.Exists(searchPath + "\\" + filePath)) { return(searchPath + "\\" + filePath); } if (filePath.EndsWith(".vpk") && File.Exists(searchPath + "\\" + filePath.Replace(".vpk", "_dir.vpk"))) { return(searchPath + "\\" + filePath.Replace(".vpk", "_dir.vpk")); } } return(string.Empty); }
private void LoadTexture(PictureEdit pictureEdit) { string tag = pictureEdit.Tag.ToString(); int width = textureWidth; int height = textureHeight; if (openBitmapFileDialog.ShowDialog() == DialogResult.OK) { string type = new FileInfo(openBitmapFileDialog.FileName).Extension; string modPath = launcher.GetCurrentMod().installPath; Uri path1 = new Uri(modPath + "\\"); Uri path2 = new Uri(openBitmapFileDialog.FileName); Uri diff = path1.MakeRelativeUri(path2); if (type == ".vtf") { textures[tag].relativePath = diff.OriginalString; textures[tag].bytes = File.ReadAllBytes(openBitmapFileDialog.FileName); textures[tag].bitmap = VTF.ToBitmap(textures[tag].bytes, launcher); } else { textures[tag].relativePath = string.Empty; textures[tag].bitmap = new Bitmap(Bitmap.FromFile(openBitmapFileDialog.FileName), width, height); textures[tag].bytes = VTF.FromBitmap(textures[tag].bitmap, launcher); } if (textures[tag].bitmap != null) { pictureEdit.Image = textures[tag].bitmap; } } CreateToolTexture(); }
private void startPreview() { string sourcePath = AppDomain.CurrentDomain.BaseDirectory + "\\Tools\\IngamePreviews"; string modPath = launcher.GetCurrentMod().installPath; // Now Create all of the directories foreach (string dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories)) { Directory.CreateDirectory(dirPath.Replace(sourcePath, modPath)); } // Copy all the files & Replaces any files with the same name foreach (string newPath in Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories)) { File.Copy(newPath, newPath.Replace(sourcePath, modPath), true); } string fog_override = "1"; string fog_enabled = fogEnableCheck.Checked ? "1" : "0"; string fog_color = fogColor.Color.R + " " + fogColor.Color.G + " " + fogColor.Color.B; string fog_colorskybox = fogSkyboxColor.Color.R + " " + fogSkyboxColor.Color.G + " " + fogSkyboxColor.Color.B; string fog_enable_water_fog = "1"; string fog_enableskybox = fogEnableCheck.Checked ? "1" : "0"; string fog_end = getTrackValue(fogTrack.Value.Maximum).ToString(); string fog_endskybox = getTrackValue(fogSkyboxTrack.Value.Maximum).ToString(); string fog_start = getTrackValue(fogTrack.Value.Minimum).ToString(); string fog_startskybox = getTrackValue(fogSkyboxTrack.Value.Minimum).ToString(); string fog_maxdensity = ((float)densityTrack.Value / densityTrack.Properties.Maximum).ToString(); string fog_maxdensityskybox = ((float)skyboxDensityTrack.Value / skyboxDensityTrack.Properties.Maximum).ToString(); instance = new Instance(launcher, panelControl1); instance.Start(new RunPreset(RunMode.WINDOWED), "-nomouse +map fog_preview +crosshair 0" + " +fog_override " + fog_override + " +fog_enable " + fog_enabled + " +fog_start " + fog_start + " +fog_end " + fog_end + " +fog_startskybox " + fog_startskybox + " +fog_endskybox " + fog_endskybox + " +fog_enableskybox " + fog_enableskybox + " +fog_color \"" + fog_color + "\"" + " +fog_colorskybox \"" + fog_colorskybox + "\"" + " +fog_maxdensity " + fog_maxdensity + " +fog_maxdensityskybox " + fog_maxdensityskybox + " +fog_enable_water_fog " + fog_enable_water_fog ); this.ActiveControl = null; updatePreview(); }
private void SearchPathsForm_Load(object sender, EventArgs e) { string modPath = launcher.GetCurrentMod().installPath; string gameinfoPath = modPath + "\\gameinfo.txt"; gameinfo = SourceSDK.KeyValue.readChunkfile(gameinfoPath); comboGames.Properties.Items.Clear(); string appID = gameinfo.getChildByKey("filesystem").getValue("steamappid"); foreach (KeyValuePair <string, Game> item in launcher.GetGamesList()) { comboGames.Properties.Items.Add(item.Key); Game game = launcher.GetGamesList()[item.Key]; string gameAppID = game.GetAppId().ToString(); if (appID == gameAppID.ToString()) { comboGames.EditValue = item.Key; } } searchPaths = new List <string[]>(); foreach (SourceSDK.KeyValue searchPath in gameinfo.getChildByKey("filesystem") .getChildByKey("searchpaths") .getChildren()) { string key = searchPath.getKey(); if (key == "platform") { continue; } searchPaths.Add(new string[] { key, searchPath.getValue() }); } UpdateList(); }
private void ClientSchemeForm_Load(object sender, EventArgs e) { gamePath = launcher.GetCurrentGame().installPath; modPath = launcher.GetCurrentMod().installPath; string path = modPath + "\\scripts\\hudlayout.res"; Directory.CreateDirectory(Path.GetDirectoryName(path)); if (!File.Exists(path)) { MessageBox.Show("File does not exist."); Close(); } loadFile(path); Application.DoEvents(); startPreview(); }
private void menuLevelDesign_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // Run Map if (e.Item == menuLevelDesignRunMap) { Game game = launcher.GetCurrentGame(); FileExplorer form = new FileExplorer(launcher); form.RootDirectory = "maps/"; form.Filter = "BSP Files (*.bsp)|*.bsp|VPK Files (*.vpk)|*.vpk"; if (form.ShowDialog() == DialogResult.OK) { VPK.File file = form.selectedFiles[0]; if ((file.type == ".bsp" && game.engine == Engine.GOLDSRC) || (file.type == ".bsp" && game.engine == Engine.SOURCE) || (file.type == ".vpk" && file.path.StartsWith("maps/") && game.engine == Engine.SOURCE2)) { // It's a map string mapName = Path.GetFileNameWithoutExtension(file.path); if (instance != null) { instance.Command("+map " + mapName); } else { RunDialog runDialog = new RunDialog(launcher); if (runDialog.ShowDialog() == DialogResult.OK) { Run(runDialog.runPreset, string.Join(" ", new string[] { runDialog.commands, "+map " + mapName })); } } } } } // Hammer if (e.Item == menuLevelDesignHammer) { Hammer.RunHammer(launcher.GetCurrentMod()); } // Fog Previewer else if (e.Item == menuLevelDesignFogPreviewer) { FogForm form = new FogForm(launcher); form.ShowDialog(); } // Prefabs else if (e.Item == menuLevelDesignPrefabs) { switch (launcher.GetCurrentGame().engine) { case Engine.SOURCE: string gamePath = launcher.GetCurrentGame().installPath; Process.Start(gamePath + "\\bin\\Prefabs"); break; case Engine.GOLDSRC: Process.Start(AppDomain.CurrentDomain.BaseDirectory + "\\Tools\\HammerEditor\\prefabs"); break; } } // Mapsrc else if (e.Item == menuLevelDesignMapsrc) { // TODO implement this } // Crafty else if (e.Item == menuLevelDesignCrafty) { Process.Start("Tools\\Crafty\\Crafty.exe"); } // Terrain generator else if (e.Item == menuLevelDesignTerrainGenerator) { Process.Start("Tools\\TerrainGenerator\\TerrainGenerator.exe"); } // Batch compiler else if (e.Item == menuLevelDesignBatchCompiler) { Process.Start("Tools\\BatchCompiler\\Batch Compiler.exe"); } }
private void RunMapForm_Load(object sender, EventArgs e) { modPath = launcher.GetCurrentMod().installPath; LoadMaps(); }