Skip to content

Commit

Permalink
Fixed an issue with file version
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Jun 19, 2022
1 parent 0039de5 commit 04ddb52
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
25 changes: 20 additions & 5 deletions Datalya/Classes/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,27 @@ public static void CreateJumpLists()

public static bool IsVersionGreaterThanActual(string version)
{
string[] numbers = version.Split(new string[] { "." }, StringSplitOptions.None)[0..2];
int ver = int.Parse(numbers.UnSplit(""));
try
{
string[] numbers = version.Split(new string[] { "." }, StringSplitOptions.None)[0..2];
int ver = int.Parse(numbers.UnSplit(""));

string[] numCurrentVer = Version.Split(new string[] { "." }, StringSplitOptions.None)[0..2];
int currentVer = int.Parse(numCurrentVer.UnSplit(""));

return ver > currentVer;
}
catch
{
CurrentDataBase.DataBaseInfo.Version = Version;
return false;
}
}

string[] numCurrentVer = Version.Split(new string[] { "." }, StringSplitOptions.None)[0..2];
int currentVer = int.Parse(numCurrentVer.UnSplit(""));
public static long ConvertToUnixTime(DateTime datetime)
{
DateTime sTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

return ver > currentVer;
return (long)(datetime - sTime).TotalSeconds;
}
}
2 changes: 1 addition & 1 deletion Datalya/Windows/NewDataBaseWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void CreateBtn_Click(object sender, RoutedEventArgs e)
{
Global.DataBaseFilePath = ""; // Reset

DataBaseInfo dbi = new() { Authors = new(), CreationTime = Env.UnixTime, LastEditTime = Env.UnixTime, Size = 0 };
DataBaseInfo dbi = new() { Authors = new(), CreationTime = Env.UnixTime, LastEditTime = Env.UnixTime, Size = 0, Version = Global.Version };
dbi.Authors.Add(Environment.UserName); // Add
dbi.Name = NameTxt.Text; // Set text

Expand Down

0 comments on commit 04ddb52

Please sign in to comment.