Skip to content

Commit

Permalink
Add Install step in case of prolog not present
Browse files Browse the repository at this point in the history
  • Loading branch information
Favry Erwan committed May 11, 2015
1 parent 5ce42ff commit 7ecf6b8
Show file tree
Hide file tree
Showing 25 changed files with 57 additions and 57 deletions.
74 changes: 54 additions & 20 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public partial class Form1 : Form
private String stringPrologFolder;
private Boolean boolIpseityFoundOnStart;
private Boolean boolPrologFoundOnStart;
private String stringCurrentDirectory;

public Form1()
{
Expand All @@ -36,30 +37,23 @@ private void Form1_Load(object sender, EventArgs e)
{
try
{
// Get the current directory in the case of the launcher present in the ipseity folder and
//test the validity of the asumption.
String stringCurrentDirectory = Directory.GetCurrentDirectory();
if (File.Exists(stringCurrentDirectory + @"\app\IpseityProject\binary\1.2.2\win\Ipseity.exe"))
{
//Hiding all that is unnecessary and put the correct path
textBox_RootFolder.Text = stringCurrentDirectory;
label_IpseityRootFolder.Visible = false;
textBox_RootFolder.Visible = false;
textBox_Status.Text = "Ipseity found. ";
boolIpseityFoundOnStart=true;
}
stringCurrentDirectory = Directory.GetCurrentDirectory();
//detect if ipseity is in the correct folder (root folder is the same than the launcher)
boolIpseityFoundOnStart = this.findIpseity();

//Same here but for prolog in the program files folder
String string32BitProgramFilesFolder = this.Get32bitProgramFiles();
if(File.Exists(string32BitProgramFilesFolder + @"\pl\bin\plcon.exe"))
boolPrologFoundOnStart = this.findProlog();

if (!boolPrologFoundOnStart && File.Exists(stringCurrentDirectory + @"\software\SWIProlog5_6_49.exe"))
{
//Hiding all that is unnecessary and put the correct path
textBox_PrologFolder.Text = string32BitProgramFilesFolder + @"\pl";
label_PrologFolder.Visible = false;
textBox_PrologFolder.Visible = false;
textBox_Status.Text = textBox_Status.Text + "Prolog found. ";
boolPrologFoundOnStart =true;
Process process = Process.Start(stringCurrentDirectory + @"\software\SWIProlog5_6_49.exe");
process.WaitForExit();
process.Close();
textBox_Status.Text = textBox_Status.Text + "Prolog not found, try to install. ";
boolPrologFoundOnStart = this.findProlog();
}

//if all is detected start ipseity
if (boolPrologFoundOnStart && boolIpseityFoundOnStart)
{
textBox_Status.Text = textBox_Status.Text + "Automatic Launch. ";
Expand All @@ -71,6 +65,46 @@ private void Form1_Load(object sender, EventArgs e)
MessageBox.Show("The launcher does not have enough right to access the current directory" + ex.ToString());
}
}
/// <summary>
/// try to find ipseity
/// </summary>
/// <returns>A bollean, true if ipseity is found</returns>
Boolean findIpseity()
{
// Get the current directory in the case of the launcher present in the ipseity folder and
//test the validity of the asumption.
String stringCurrentDirectory = Directory.GetCurrentDirectory();
if (File.Exists(stringCurrentDirectory + @"\app\IpseityProject\binary\1.2.2\win\Ipseity.exe"))
{
//Hiding all that is unnecessary and put the correct path
textBox_RootFolder.Text = stringCurrentDirectory;
label_IpseityRootFolder.Visible = false;
textBox_RootFolder.Visible = false;
textBox_Status.Text = textBox_Status.Text + "Ipseity found. ";
return true;
}
return false;
}

/// <summary>
/// Try to find prolog in the standart instalation folder.
/// </summary>
/// <returns>A boolean, true if prolog is found</returns>
Boolean findProlog()
{
//Same here but for prolog in the program files folder
String string32BitProgramFilesFolder = this.Get32bitProgramFiles();
if (File.Exists(string32BitProgramFilesFolder + @"\pl\bin\plcon.exe"))
{
//Hiding all that is unnecessary and put the correct path
textBox_PrologFolder.Text = string32BitProgramFilesFolder + @"\pl";
label_PrologFolder.Visible = false;
textBox_PrologFolder.Visible = false;
textBox_Status.Text = textBox_Status.Text + "Prolog found. ";
return true;
}
return false;
}

/// <summary>
/// This method will get the path given by the user
Expand Down
4 changes: 2 additions & 2 deletions IpseityLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
Expand All @@ -27,7 +28,6 @@
<PublisherName>Favry Erwan</PublisherName>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand All @@ -45,7 +45,7 @@
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>..\..\..\..\Tr\UTBM\GI01\IA41\Projet\ipseity_1-2-2_kernel_bin_win\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down
2 changes: 1 addition & 1 deletion IpseityLauncher.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<StartWorkingDirectory>C:\Users\Qsm-Cqfd\Desktop\Tr\UTBM\GI01\IA41\Projet\ipseity_1-2-2_kernel_bin_win\</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<PublishUrlHistory>publish\|C:\Users\Qsm-Cqfd\Desktop\Tr\UTBM\GI01\IA41\Projet\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
Expand Down
Binary file modified bin/Debug/IpseityLauncher.exe
Binary file not shown.
Binary file modified bin/Debug/IpseityLauncher.pdb
Binary file not shown.
11 changes: 0 additions & 11 deletions bin/Debug/IpseityLauncher.vshost.exe.manifest

This file was deleted.

Binary file removed bin/Release/IpseityLauncher1.exe
Binary file not shown.
Binary file removed bin/Release/IpseityLauncher1.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed obj/x86/Debug/IpseityLauncher.Form1.resources
Binary file not shown.
Binary file not shown.
9 changes: 0 additions & 9 deletions obj/x86/Debug/IpseityLauncher.csproj.FileListAbsolute.txt

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file removed obj/x86/Debug/IpseityLauncher.exe
Binary file not shown.
Binary file removed obj/x86/Debug/IpseityLauncher.pdb
Binary file not shown.
7 changes: 0 additions & 7 deletions obj/x86/Debug/IpseityLauncher1.csproj.FileListAbsolute.txt

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file modified obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
7 changes: 0 additions & 7 deletions obj/x86/Release/IpseityLauncher1.csproj.FileListAbsolute.txt

This file was deleted.

Binary file not shown.
Binary file removed obj/x86/Release/IpseityLauncher1.exe
Binary file not shown.
Binary file removed obj/x86/Release/IpseityLauncher1.pdb
Binary file not shown.

0 comments on commit 7ecf6b8

Please sign in to comment.