public static DocTemplate Load(string fpath, int level = 0) { Util.WriteLine("Loading template file", level); try { Util.WriteLine($"Template file path: {fpath}", level); var template = XmlSerializationHelper.FromXmlFile <DocTemplate>(fpath); Util.WriteLine("Template file loaded", level); return(template); } catch (Exception e) { Util.WriteLine(e.ToString(), level + 1); throw; } }
static void Main(string[] args) { var tempPath = args?[0]; if (!File.Exists(tempPath)) { return; } Util.WriteLine($"Loading File {tempPath}"); var temp = XmlSerializationHelper.FromXmlFile <DocTemplate>(tempPath); temp.BuildFile(); WordHelper.SafeQuit(); //temp.Resources.Add( // new ParaResource {ParaName = "PN", ResourceName = "RN", ParaValue = "PV"}); temp.ToXmlFile(tempPath); Util.WriteLine("AllDone"); Console.Read(); }