private string RetrieveDeployedBuildConfigFromDevice() { var CommandResult = GetCommand().Execute(string.Format("ls {0}", DeploymentPath)); string CleanedCommandRes = Regex.Replace(CommandResult, @"\r\n?|\n", ""); string[] Folders = CleanedCommandRes.Split(' '); // Kill all processes with the current name running on the Linux machine. foreach (var FolderName in Folders) { if (string.IsNullOrEmpty(FolderName)) { continue; } if (FolderName.Contains(ProjectConfig.Name)) { Match ConfigMatch = Regex.Match(FolderName, @"ShooterGame-[^-]+-(.+)(?=Server)", RegexOptions.IgnoreCase); if (ConfigMatch.Success) { string RetrievedValue = ConfigMatch.Groups[1].Captures[0].Value; Logger.Info(string.Format("Config {0} was deduced from device build folder {1}", RetrievedValue, FolderName)); return(RetrievedValue); } else { Logger.Info(string.Format("Unable to retrieve Config from device build folder {0} !", FolderName)); return(string.Empty); } } } Logger.Info(string.Format("Unable to find build folder from the device, searching folder {0} !", DeploymentPath)); return(string.Empty); }
private string RetrieveDeploymentPathFromDevice() { var CommandResult = GetCommand().Execute(string.Format("ls {0}", DeploymentPath)); string CleanedCommandRes = Regex.Replace(CommandResult, @"\r\n?|\n", ""); string[] Folders = CleanedCommandRes.Split(' '); // Kill all processes with the current name running on the Linux machine. foreach (var FolderName in Folders) { if (string.IsNullOrEmpty(FolderName)) { continue; } if (FolderName.Contains(ProjectConfig.Name)) { string DeducedPath = string.Format("{0}/{1}", DeploymentPath, FolderName); Logger.Info(string.Format("Following deployment path was found on the device : {0}", DeducedPath)); return(DeducedPath); } } Logger.Info(string.Format("Unable to retrieve deployment path from the device, searching folder {0} !", DeploymentPath)); return(string.Empty); }
/// <summary> /// Load all sub-folders into the Folders collection. /// </summary> public void LoadFolders() { try { ClearFolders(); string fullPath = Path.Combine(FolderPath, FolderName); if (FolderName.Contains(':')) // This is a drive { fullPath = string.Concat(FolderName, "\\"); } else { fullPath = FolderPath; } foreach (string dir in Directory.GetDirectories(fullPath)) { AddFolder(dir); } } catch (UnauthorizedAccessException ae) { this.ShowNotification(FileSystemModels.Local.Strings.STR_MSG_UnknownError, ae.Message); } catch (IOException ie) { this.ShowNotification(FileSystemModels.Local.Strings.STR_MSG_UnknownError, ie.Message); } }
/// <summary> /// 上传文件之后 /// </summary> protected virtual void AfterUploadToFtp() { if (FolderName.Contains("栅格图")) { var ftpFilePPath = Path.Combine(FtpConfig.DirectoryPath, Files[0].FileData); var thumbFilePath = ftpFilePPath.Insert(ftpFilePPath.LastIndexOf("."), "_thumb"); MakeThumbnail(SaveFilePath, thumbFilePath, 220, 200); } }
private void LoadFolders() { try { if (Folders.Count > 0) { return; } string[] dirs = null; string fullPath = Path.Combine(FolderPath, FolderName); if (FolderName.Contains(':')) //This is a drive { fullPath = string.Concat(FolderName, "\\"); } else { fullPath = FolderPath; } dirs = Directory.GetDirectories(fullPath); Folders.Clear(); foreach (string dir in dirs) { Folders.Add(new FolderViewModel { Root = this.Root, FolderName = Path.GetFileName(dir), FolderPath = Path.GetFullPath(dir), FolderIcon = "Images\\FolderClosed.png" }); } if (FolderName.Contains(":")) { FolderIcon = "Images\\HardDisk.ico"; } Root.SelectedFolder = FolderPath; } catch (UnauthorizedAccessException ae) { Console.WriteLine(ae.Message); } catch (IOException ie) { Console.WriteLine(ie.Message); } }
private void LoadFolders() { try { if (Folders.Count > 0) { return; } string[] dirs = null; string fullPath = Path.Combine(FolderPath, FolderName); if (FolderName.Contains(':'))//This is a drive { fullPath = string.Concat(FolderName, "\\"); } else { fullPath = FolderPath; } dirs = Directory.GetDirectories(fullPath); Folders.Clear(); foreach (string dir in dirs) { try { DirectoryInfo di = new DirectoryInfo(dir); // create the sub-structure only if this is not a hidden directory if ((di.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden) { Folders.Add(new FolderViewModel { Root = this.Root, FolderName = Path.GetFileName(dir), FolderPath = Path.GetFullPath(dir), FolderIcon = "Resources\\FolderClosed.png" }); } } catch (UnauthorizedAccessException ae) { Console.WriteLine(ae.Message); } catch (Exception e) { Console.WriteLine(e.Message); } } if (FolderName.Contains(":")) { FolderIcon = "Resources\\HardDisk.ico"; } // Root.SelectedFolder = FolderPath; My addition? } catch (UnauthorizedAccessException ae) { Console.WriteLine(ae.Message); // TODO Make an error dialog. } catch (IOException ie) { Console.WriteLine(ie.Message); // TODO Make an error dialog. } }