示例#1
0
        private static bool WriteBack(IPatchDestinationWritable destination, PatchFile patch, string patched, string verbing,
                                      out StatusReportItem status)
        {
            if (destination.TryWritePatched(patch.TargetPath, patched))
            {
                status = new StatusReportItem
                {
                    Status = $"{destination.LongDescription} successfully wrote {patch.TargetPath} after {verbing} patch"
                };
                return(true);
            }

            status = new StatusReportItem
            {
                Status =
                    $"{destination.LongDescription} could not write {patch.TargetPath} after {verbing} patch",
                Severity       = StatusReportItem.SeverityCode.Error,
                Recommendation = "please ensure you have write permission to all the files in the target location"
            };
            return(false);
        }
示例#2
0
        public static PatchList Load(string fromFolder)
        {
            PatchList patches = new PatchList();

            if (!Directory.Exists(fromFolder))
            {
                return(patches);
            }
            foreach (string patchPath in Directory.EnumerateFiles(fromFolder, "*.gpatch",
                                                                  SearchOption.AllDirectories))
            {
                PatchFile patch = new PatchFile
                {
                    TargetPath = patchPath.Substring(fromFolder.Length + 1,
                                                     patchPath.Length - (fromFolder.Length + 8))
                };
                patch.Load(patchPath);
                patches.Add(patch);
            }
            return(patches);
        }
示例#3
0
 public void Add(PatchFile patch)
 {
     _patches.Add(patch);
 }