/// <summary> /// Initialize/Load the progressfile and de-serialize the object /// </summary> public ResumeSupport() { string directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); XML_FILE_NAME = Path.Combine(directory, Resources.AppName, XML_FILE_NAME); flagResume = true; progressObject = LoadFile(); }
/// <summary> /// Starting a new Copy command /// </summary> /// <param name="source">Source Paths</param> /// <param name="target">Destination Path</param> /// <param name="force">Force Replace</param> /// <param name="details">Upload Specification Request Details</param> public void Start(String[] source, String target, bool force, String details) { progressObject = new ProgressFile(); progressObject.ArgumentSource = source; progressObject.ArgumentTarget = target; progressObject.ArgumentForce = force; progressObject.ArgumentDetails = details; SaveFile(progressObject); }
/// <summary> /// Save/serialize progress to ".progressfile" file /// It will be called after each operation i.e. file completion, command completion & new command /// </summary> /// <param name="progressObject">Process file object</param> private void SaveFile(ProgressFile progressObject) { SupportHandler<ProgressFile>.Save(progressObject, XML_FILE_NAME); }
/// <summary> /// Load/de-serialize progress of command from ".progressfile" to and object /// </summary> /// <returns>ProgressFile object</returns> private ProgressFile LoadFile() { ProgressFile progressObject = new ProgressFile(); if (File.Exists(XML_FILE_NAME) == true) { progressObject = SupportHandler<ProgressFile>.Load(XML_FILE_NAME); progressObject.IsExist = true; } return progressObject; }
/// <summary> /// Save/serialize progress to ".progressfile" file /// It will be called after each operation i.e. file completion, command completion & new command /// </summary> /// <param name="progressObject">Process file object</param> private void SaveFile(ProgressFile progressObject) { SupportHandler <ProgressFile> .Save(progressObject, XML_FILE_NAME); }