Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.NET 4.0 Conan Patcher using rsync
  • Should be compiled with .NET 4.0 Client Profile
  • Change path if you are rsyncing to another server
  • You need to run an rsync server to make this work. It should have all your mod files in a common place labeled "files" by the rsync daemon.
  • You can keep your server-side mod files up to date using steamcmd.
  • conan_steamcmd.txt is the list of commands sent to steamcmd
  • 440900 is currently? (or permanently I hope) the Conan Exiles steam app ID
  • The other numbers are the Steam workshop IDs of each mod
  • conan-rsync.sh is the daemon script. Set this to launch on system startup.
  • Run update.sh whenever a mod updates
  • These scripts assume steamcmd.sh exists and runs steamcmd in the current working directory and ~/conan is where you have all this stuff
  • For example usage see here
#!/bin/bash
rsync --daemon --ipv4 --config=rsync.conf
@NoPromptForPassword 1
@ShutdownOnFailedCommand 1
@sSteamCmdForcePlatformType windows
login anonymous
force_install_dir ./steam
app_update 440900 validate
workshop_download_item 440900 1113901982
workshop_download_item 440900 1367454214
workshop_download_item 440900 1210390760
workshop_download_item 440900 862889805
workshop_download_item 440900 1159180273
workshop_download_item 440900 1206493209
workshop_download_item 440900 1386982683
workshop_download_item 440900 1369743238
workshop_download_item 440900 1234733286
workshop_download_item 440900 1371191181
workshop_download_item 440900 1394962491
workshop_download_item 440900 1374736088
workshop_download_item 440900 1121057177
workshop_download_item 440900 880454836
quit
using System;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Microsoft.VisualBasic;
using System.Windows.Forms;
namespace conanpatcher
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
String baseDir = @"C:\Program Files (x86)\Steam\steamapps";
String wsDir = @"/workshop/content/440900";
String gameDir = @"\common\Conan Exiles";
bool failed = false;
while (!Directory.Exists(baseDir + gameDir)) {
if(!failed)
Interaction.MsgBox(@"In the next window, please select your Steam 'steamapps' folder where Conan Exiles is installed.", MsgBoxStyle.OkOnly | MsgBoxStyle.SystemModal, "Conan Exiles Workshop Patcher");
var fd = new FolderBrowserDialog();
fd.ShowNewFolderButton = false;
fd.Description = "Select STEAMAPPS folder not just STEAM";
var rslt = fd.ShowDialog();
if (rslt == DialogResult.OK)
{
baseDir = fd.SelectedPath;
if(!Directory.Exists(baseDir + gameDir))
{
Interaction.MsgBox(@"Error: Can't find Conan Exiles at this path: '" + baseDir + gameDir + "'. Try again, or click Cancel on the next prompt.", MsgBoxStyle.OkOnly | MsgBoxStyle.SystemModal, "Conan Exiles Workshop Patcher");
failed = true;
}
}
else
{
Interaction.MsgBox(@"Failed to run Conan Workshop Patcher due to user aborting.", MsgBoxStyle.OkOnly | MsgBoxStyle.SystemModal, "Conan Exiles Workshop Patcher");
return;
}
}
var result = Interaction.MsgBox(@"Conan Exiles Workshop Patcher running on the following Steam installation: '" + baseDir + "'. Click OK to proceed or Cancel to abort.", MsgBoxStyle.OkCancel | MsgBoxStyle.SystemModal, "Conan Exiles Workshop Patcher");
if (result != MsgBoxResult.Ok) Interaction.MsgBox(@"Aborting due to user request.", MsgBoxStyle.OkOnly | MsgBoxStyle.SystemModal, "Conan Exiles Workshop Patcher");
Regex reg = new Regex("^([A-Za-z]):(.*)");
String cygPath = (baseDir + wsDir).Replace(@"\", "/");
cygPath = reg.Replace(cygPath, "/cygdrive/$1/$2");
cygPath = cygPath.Replace(@"//", @"/");
var cwd = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
var psi = new ProcessStartInfo();
string args = "-z --progress --verbose --checksum --delete --recursive --force --log-file=rsync.log rsync://smcnam.me:21857/files \"" + cygPath + "\"";
psi.FileName = @"rsync.exe";
psi.WorkingDirectory = cwd;
Interaction.MsgBox("(DEBUG INFO; click OK or take a screenshot in case this doesn't work!) \n\trsync command: " + psi.FileName + "\n\trsync arguments: " + args, MsgBoxStyle.OkOnly | MsgBoxStyle.SystemModal, "Conan Exiles Workshop Patcher");
psi.Arguments = args;
psi.CreateNoWindow = false;
psi.UseShellExecute = false;
psi.ErrorDialog = true;
psi.WindowStyle = ProcessWindowStyle.Normal;
var proc = Process.Start(psi);
proc.WaitForExit();
Interaction.MsgBox(@"Conan Exiles Workshop Patcher is done! The log file is at rsync.log in the directory where this EXE resides.", MsgBoxStyle.OkOnly | MsgBoxStyle.SystemModal, "Conan Exiles Workshop Patcher");
}
}
}
#!/bin/bash
pushd "${HOME}/conan"
rm -rf ./steam/steamapps/workshop/content
./steamcmd.sh +runscript conan_steamcmd.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment