Skip to content

Commit

Permalink
🔧 Moved log to tmp folder
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherFoxGuy committed Jun 21, 2021
1 parent 91f3df2 commit 40dd6b3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
14 changes: 8 additions & 6 deletions Client/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ public void InitApp(object sender, StartupEventArgs e)
// Render the form
_sForm.Update();

var currdir = Directory.GetCurrentDirectory();
File.WriteAllText($"{currdir}/Updater_log.txt", "");
File.WriteAllText(Utils.LogPath, "Updater Started");

SentrySdk.ConfigureScope(scope => { scope.AddAttachment($"{currdir}/Updater_log.txt"); });
SentrySdk.ConfigureScope(scope => { scope.AddAttachment(Utils.LogPath); });

var assembly = Assembly.GetExecutingAssembly();
var fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
Expand All @@ -74,19 +73,22 @@ public void InitApp(object sender, StartupEventArgs e)
if (File.Exists("RoR.exe") && Utils.FileIsInUse("RoR.exe"))
{
Utils.LOG($"Error| game in use");
MessageBox.Show("Please close the game before starting the updater", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show("Please close the game before starting the updater", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
Quit();
}

Utils.LOG("Info| Creating Web Handler");
_webClient = new WebClient();
Utils.LOG("Info| Done.");

if (File.Exists($"{currdir}/ror-updater-settings.json"))
var currentDirectory = Directory.GetCurrentDirectory();

if (File.Exists($"{currentDirectory}/ror-updater-settings.json"))
{
try
{
var set = File.ReadAllText($"{currdir}/ror-updater-settings.json");
var set = File.ReadAllText($"{currentDirectory}/ror-updater-settings.json");
Settings = JsonConvert.DeserializeObject<Settings>(set);
}
catch (Exception ex)
Expand Down
4 changes: 2 additions & 2 deletions Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyVersion("1.1.2.0")]
[assembly: AssemblyFileVersion("1.1.2.0")]
4 changes: 2 additions & 2 deletions Client/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<package id="ControlzEx" version="5.0.0" targetFramework="net472" />
<package id="ILMerge" version="3.0.41" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net472" />
<package id="Sentry" version="3.3.1" targetFramework="net472" />
<package id="Sentry" version="3.5.0" targetFramework="net472" />
<package id="System.Reflection.Metadata" version="5.0.0" targetFramework="net472" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="5.0.1" targetFramework="net472" />
<package id="System.Text.Json" version="5.0.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
<package id="MahApps.Metro" version="2.4.4" targetFramework="net472" />
<package id="MahApps.Metro" version="2.4.6" targetFramework="net472" />
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net461" />
<package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.31" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
Expand Down
7 changes: 3 additions & 4 deletions Client/ror-updater.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<Private>True</Private>
</Reference>
<Reference Include="MahApps.Metro, Version=2.0.0.0, Culture=neutral, PublicKeyToken=51482d6f650b2b3f">
<HintPath>..\packages\MahApps.Metro.2.4.4\lib\net47\MahApps.Metro.dll</HintPath>
<HintPath>..\packages\MahApps.Metro.2.4.6\lib\net47\MahApps.Metro.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
Expand All @@ -119,8 +119,8 @@
<Reference Include="Semver, Version=2.0.6.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Semver.2.0.6\lib\net452\Semver.dll</HintPath>
</Reference>
<Reference Include="Sentry, Version=3.3.1.0, Culture=neutral, PublicKeyToken=fba2ec45388e2af0">
<HintPath>..\packages\Sentry.3.3.1\lib\net461\Sentry.dll</HintPath>
<Reference Include="Sentry, Version=3.5.0.0, Culture=neutral, PublicKeyToken=fba2ec45388e2af0">
<HintPath>..\packages\Sentry.3.5.0\lib\net461\Sentry.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down Expand Up @@ -292,7 +292,6 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
<None Include="ror-updater_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Expand Down
7 changes: 4 additions & 3 deletions Shared/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ namespace ror_updater
{
internal class Utils
{
internal static readonly string LogPath = $"{Path.GetTempPath()}/RoR_Updater_Log.txt";

public static void LOG(string str)
{
var file = new StreamWriter("./Updater_log.txt", true);
var file = new StreamWriter(LogPath, true);
file.WriteLine(str);

file.Close();
}

Expand All @@ -45,7 +46,7 @@ public static string GetFileHash(string filename)
}
}
}

public static bool FileIsInUse(string sFilename)
{
try
Expand Down

0 comments on commit 40dd6b3

Please sign in to comment.