public static ESystemTarget ParseSystemTarget(string input) { ESystemTarget Target = ESystemTarget.Unknown; try { Target = (ESystemTarget)Enum.Parse(typeof(ESystemTarget), input); } catch (ArgumentNullException anex) { Log.Warn("Failed to parse the system target from the input string (ArgumentNullException): " + anex.Message + "\n\tInput: null"); } catch (ArgumentException aex) { Log.Warn("Failed to parse the system target from the input string (ArgumentException): " + aex.Message + "\n\tInput: " + input); } catch (OverflowException oex) { Log.Warn("Failed to parse the system target from the input string (OverflowException): " + oex.Message + "\n\tInput: " + input); } return(Target); }
/// <summary> /// Raises the button ok clicked event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> protected void OnButtonOkClicked(object sender, EventArgs e) { Application.Invoke(delegate { progressbar3.Text = Mono.Unix.Catalog.GetString("Verifying..."); }); bool bAreAllSettingsOK = true; Config.SetGameName(GameName_entry.Text); ESystemTarget SystemTarget = Utilities.ParseSystemTarget(combobox_SystemTarget.ActiveText); if (SystemTarget != ESystemTarget.Invalid) { Config.SetSystemTarget(SystemTarget); } else { bAreAllSettingsOK = false; } if (FTPURL_entry.Text.StartsWith("ftp://")) { Config.SetBaseFTPUrl(FTPURL_entry.Text); } else { bAreAllSettingsOK = false; Gdk.Color col = new Gdk.Color(255, 128, 128); FTPURL_entry.ModifyBase(StateType.Normal, col); FTPURL_entry.TooltipText = Mono.Unix.Catalog.GetString("The URL needs to begin with \"ftp://\". Please correct the URL."); } Config.SetFTPPassword(FTPPassword_entry.Text); Config.SetFTPUsername(FTPUsername_entry.Text); if (bAreAllSettingsOK) { if (Checks.CanConnectToFTP()) { Destroy(); } else { MessageDialog dialog = new MessageDialog( null, DialogFlags.Modal, MessageType.Warning, ButtonsType.Ok, Mono.Unix.Catalog.GetString("Failed to connect to the FTP server. Please check your FTP settings.")); dialog.Run(); dialog.Destroy(); } } progressbar3.Text = Mono.Unix.Catalog.GetString("Idle"); }
public override bool IsPlatformAvailable(ESystemTarget Platform) { string remote = String.Format("{0}/game/{1}/.provides", Config.GetBaseFTPUrl(), Platform); return(DoesRemoteFileExist(remote)); }
/// <inheritdoc /> public override bool IsPlatformAvailable(ESystemTarget platform) { var remote = $"{this.Configuration.RemoteAddress}/game/{platform}/.provides"; remote = DirectoryHelpers.FixURL(remote); return(DoesRemoteFileExist(remote)); }
/// <summary> /// Initializes a new instance of the <see cref="ManifestHandler"/> class. /// This constructor also serves to updated outdated file paths for the manifests. /// <param name="localBaseDirectory">The local base directory of the launcher installation.</param> /// <param name="remoteURL">The remote <see cref="Url"/> where the manifest files are expected to be..</param> /// <param name="systemTarget">The target system for which the handler should retrieve files.</param> /// </summary> public ManifestHandler(string localBaseDirectory, Url remoteURL, ESystemTarget systemTarget) { this.LocalBaseDirectory = localBaseDirectory; this.RemoteURL = remoteURL; this.SystemTarget = systemTarget; ReplaceDeprecatedManifest(); }
public bool DoesServerProvidePlatform(ESystemTarget Platform) { FTPHandler FTP = new FTPHandler(); string remote = String.Format("{0}/game/{1}/.provides", Config.GetFTPUrl(), Platform.ToString()); return(FTP.DoesFileExist(remote)); }
public static ESystemTarget ParseSystemTarget(string input) { ESystemTarget Target = ESystemTarget.Unknown; try { Target = (ESystemTarget)Enum.Parse(typeof(ESystemTarget), input); } catch (ArgumentNullException anex) { Console.WriteLine("ArgumentNullException in ParseSystemTarget(): " + anex.Message); } catch (ArgumentException aex) { Console.WriteLine("ArgumentException in ParseSystemTarget(): " + aex.Message); } catch (OverflowException oex) { Console.WriteLine("OverflowException in ParseSystemTarget(): " + oex.Message); } return(Target); }
/// <summary> /// Sets the system target. /// </summary> /// <param name="SystemTarget">System target.</param> public void SetSystemTarget(ESystemTarget SystemTarget) { //possible values are: //Win64 //Win32 //Linux //Mac lock (ReadLock) { try { FileIniDataParser Parser = new FileIniDataParser(); IniData data = Parser.ReadFile(GetConfigPath()); data["Local"]["SystemTarget"] = SystemTarget.ToString(); WriteConfig(Parser, data); } catch (IOException ioex) { Console.WriteLine("IOException in SetSystemTarget(): " + ioex.Message); } } }
/// <summary> /// Initializes a new instance of the <see cref="ManifestHandler"/> class. /// This constructor also serves to updated outdated file paths for the manifests. /// </summary> /// <param name="localBaseDirectory">The local base directory of the launcher installation.</param> /// <param name="remoteURL">The remote <see cref="Uri"/> where the manifest files are expected to be.</param> /// <param name="systemTarget">The target system for which the handler should retrieve files.</param> public ManifestHandler(string localBaseDirectory, Uri remoteURL, ESystemTarget systemTarget) { this.LocalBaseDirectory = localBaseDirectory; this.RemoteURL = remoteURL; this.SystemTarget = systemTarget; }
/// <summary> /// Checks whether or not the server provides binaries and patches for the specified platform. /// </summary> /// <returns><c>true</c>, if the server does provide files for the platform, <c>false</c> otherwise.</returns> /// <param name="platform">platform.</param> public bool IsPlatformAvailable(ESystemTarget platform) { PatchProtocolHandler patchService = Configuration.GetPatchProtocol(); return(patchService.IsPlatformAvailable(platform)); }
/// <summary> /// Determines whether the protocol can provide patches and updates for the provided platform. /// </summary> /// <param name="platform">The platform to check.</param> /// <returns><c>true</c> if the platform is available; otherwise, <c>false</c>.</returns> public abstract bool IsPlatformAvailable(ESystemTarget platform);
/// <summary> /// Sets the system target. /// </summary> /// <param name="SystemTarget">System target.</param> public void SetSystemTarget(ESystemTarget SystemTarget) { //possible values are: //Win64 //Win32 //Linux //Mac lock (ReadLock) { try { FileIniDataParser Parser = new FileIniDataParser(); IniData data = Parser.ReadFile(GetConfigPath()); data["Local"]["SystemTarget"] = SystemTarget.ToString(); WriteConfig(Parser, data); } catch (IOException ioex) { Console.WriteLine("IOException in SetSystemTarget(): " + ioex.Message); } } }
/// <summary> /// Determines whether the protocol can provide patches and updates for the provided platform. /// </summary> /// <returns><c>true</c> if the platform is available; otherwise, <c>false</c>.</returns> public override bool IsPlatformAvailable(ESystemTarget platform) { string remote = $"{this.Config.GetBaseFTPUrl()}/game/{platform}/.provides"; return(DoesRemoteFileExist(remote)); }
/// <summary> /// Checks whether or not the server provides binaries and patches for the specified platform. /// </summary> /// <returns><c>true</c>, if the server does provide files for the platform, <c>false</c> otherwise.</returns> /// <param name="Platform">Platform.</param> public bool IsPlatformAvailable(ESystemTarget Platform) { PatchProtocolHandler Patch = Config.GetPatchProtocol(); return(Patch.IsPlatformAvailable(Platform)); }
public override bool IsPlatformAvailable(ESystemTarget platform) { return(false); }
public override bool IsPlatformAvailable(ESystemTarget Platform) { string remote = $"{Config.GetBaseHTTPUrl()}/game/{Platform}/.provides"; return(DoesRemoteDirectoryOrFileExist(remote)); }
public bool DoesServerProvidePlatform(ESystemTarget Platform, string GameName) { FTPHandler FTP = new FTPHandler (); string remote = String.Format ("{0}/game/{1}/{2}/.provides", Config.GetFTPUrl(), GameName, Platform.ToString()); return FTP.DoesFileExist (remote); }
/// <summary> /// Checks whether or not the server provides binaries and patches for the specified platform. /// </summary> /// <returns><c>true</c>, if the server does provide files for the platform, <c>false</c> otherwise.</returns> /// <param name="platform">platform.</param> public bool IsPlatformAvailable(ESystemTarget platform) { return(this.Patch.IsPlatformAvailable(platform)); }