Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Muteo42 authored Dec 9, 2023
1 parent 3015f78 commit 056efd8
Show file tree
Hide file tree
Showing 15 changed files with 1,193 additions and 22 deletions.
2 changes: 1 addition & 1 deletion LoslandLauncher/Classes/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace LoslandLauncher.Classes
class Globals
{
public static string WEBAPI = "http://fast.sec-nine.com/secac/losland/app/";
public static string Version = "0.7";
public static string Version = "0.8";
public static string GameIP = "51.77.74.142";
public static string _GamePath = Registry.CurrentUser.OpenSubKey(@"Software\\SAMP").GetValue("gta_sa_exe").ToString();
public static string GamePath = _GamePath = _GamePath.Substring(0, _GamePath.LastIndexOf(@"\") + 1);
Expand Down
31 changes: 18 additions & 13 deletions LoslandLauncher/Downloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ private void Downloader_Load(object sender, EventArgs e)
{
Directory.CreateDirectory(Globals.GamePath + "\\secac\\data");
}
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\loslauncher", true);
if (registryKey == null)
{
registryKey = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\loslauncher");
}
if (registryKey.GetValue("settings_1") == null) registryKey.SetValue("settings_1", 0);
if (registryKey.GetValue("settings_2") == null) registryKey.SetValue("settings_2", 0);
downloadArray = Functions.ReadTextFromUrl(Globals.WEBAPI + "patch.php", true).Split('|');
CheckUpdate();
}
Expand Down Expand Up @@ -130,7 +137,15 @@ private void CheckUpdate()
if (Directory.Exists(Globals.GamePath + "\\modloader"))
{
int needdownload = 0;
if (Directory.Exists(Globals.GamePath + "\\modloader\\mod_loslandlauncher"))
if (File.Exists(Globals.GamePath + "\\modloader\\mod_loslandlauncher.zip"))
{
label1.Text = "Mod dosyaları güncelleniyor...";
label2.Text = "mod_loslandlauncher.zip çıkartılıyor...";
label3.Text = "Bu işlem disk hızına göre biraz zaman alabilir.";
zipExtractor.RunWorkerAsync();
return;
}
else if (Directory.Exists(Globals.GamePath + "\\modloader\\mod_loslandlauncher"))
{
long filesize = Functions.GetDirectorySize(new DirectoryInfo(Globals.GamePath + "\\modloader\\mod_loslandlauncher"));
long neededfilesize = Convert.ToInt64(Functions.ReadTextFromUrl(Globals.WEBAPI + "modpatch.php", true));
Expand All @@ -141,18 +156,7 @@ private void CheckUpdate()
}
else
{
if (File.Exists(Globals.GamePath + "\\modloader\\mod_loslandlauncher.zip"))
{
label1.Text = "Mod dosyaları güncelleniyor...";
label2.Text = "mod_loslandlauncher.zip çıkartılıyor...";
label3.Text = "Bu işlem disk hızına göre biraz zaman alabilir.";
zipExtractor.RunWorkerAsync();
return;
}
else
{
needdownload = 1;
}
needdownload = 1;
}
if(needdownload == 1)
{
Expand Down Expand Up @@ -203,6 +207,7 @@ private void DownloadFinish(object sender, AsyncCompletedEventArgs e)
{
if(downloadingZip)
{
if (File.Exists(Globals.GamePath + "\\modloader\\mod_loslandlauncher.zip")) File.Delete(Globals.GamePath + "\\modloader\\mod_loslandlauncher.zip");
File.Move(Globals.GamePath + "\\modloader\\mod_loslandlauncher_crc.zip", Globals.GamePath + "\\modloader\\mod_loslandlauncher.zip");
File.Delete(Globals.GamePath + "\\modloader\\mod_loslandlauncher_crc.zip");
downloadingZip = false;
Expand Down
8 changes: 0 additions & 8 deletions LoslandLauncher/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ public Main()
try
{
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\loslauncher", true);
if (registryKey == null)
{
registryKey = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\loslauncher");
}
if (registryKey.GetValue("username") == null)
{
RegistryKey _reg = Registry.CurrentUser.OpenSubKey(@"Software\\SAMP", true);
Expand Down Expand Up @@ -151,10 +147,6 @@ private void pictureBox1_Click(object sender, EventArgs e)
}
Globals.Username = userNameBox.Text;
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\loslauncher", true);
if (registryKey == null)
{
registryKey = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\loslauncher");
}
registryKey.SetValue("username", userNameBox.Text);
this.Hide();
ACLauncher launcher = new ACLauncher();
Expand Down
6 changes: 6 additions & 0 deletions SECACUpdater/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
67 changes: 67 additions & 0 deletions SECACUpdater/Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 81 additions & 0 deletions SECACUpdater/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LoslandUpdater
{
public partial class Main : Form
{
public Main()
{
InitializeComponent();
foreach (Process process in Process.GetProcesses("."))
{
try
{
if (process.MainWindowTitle.Length > 0 && (process.MainWindowTitle.Contains("GTA: San Andreas") || process.MainWindowTitle.Contains("GTA:SA:MP")))
{
process.Kill();
break;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}

private void Main_Load(object sender, EventArgs e)
{
timer1.Start();
}

private void timer1_Tick(object sender, EventArgs e)
{
try
{
string _GamePath = Registry.CurrentUser.OpenSubKey(@"Software\\SAMP").GetValue("gta_sa_exe").ToString();
string GamePath = _GamePath = _GamePath.Substring(0, _GamePath.LastIndexOf(@"\") + 1);

string[] replaceFiles = Directory.GetFiles(GamePath, "*.acreplace", SearchOption.AllDirectories);
foreach (var file in replaceFiles)
{
FileInfo f = new FileInfo(file);
string fileName = f.FullName;
string originalFile = f.FullName;
originalFile = originalFile.Replace(".acreplace", "");
if (File.Exists(originalFile)) File.Delete(originalFile);
File.Move(fileName, originalFile);
if (File.Exists(fileName)) File.Delete(fileName);
}

RegistryKey _reg = Registry.CurrentUser.OpenSubKey(@"Software\\SAMP", true);
string username = (string)_reg.GetValue("PlayerName");

Process game = new Process();
game.StartInfo.FileName = GamePath + "\\samp.exe";
game.StartInfo.Arguments = "samp.losland-rp.com -n" + username;
game.StartInfo.UseShellExecute = true;
game.Start();

Application.Exit();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
}
Loading

0 comments on commit 056efd8

Please sign in to comment.