예제 #1
0
		/// <summary>
		/// return the folder where publication data should be saved
		/// </summary>
		/// <param name="template">Template with $(xxx)s for each element</param>
		/// <param name="database">name of Database to use as element of path</param>
		/// <param name="layout">name of style sheet to use as an element of the path</param>
		/// <returns>dereferenced path name</returns>
		public static string GetSaveInFolder(string template, string database, string layout)
		{
			Dictionary<string, string> map = new Dictionary<string, string>();
			map["Documents"] = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
			map["Base"] = SaveInFolderBase;
			map["CurrentProject"] = database;
			map["StyleSheet"] = layout;
			map["DateTime"] = DateTime.Now.ToString("yyyy-MM-dd_HHmmss");
			Substitution substitution = new Substitution();
			var del = new Substitution.MyDelegate(map);
			var result = substitution.DoSubstitute(template, @"\$\(([^)]*)\)s", RegexOptions.None, del.myValue);
			return DirectoryPathReplace(result);
		}
예제 #2
0
파일: Param.cs 프로젝트: neilmayhew/pathway
 private static void ApplyVariables()
 {
     var map = new Dictionary<string, string>();
     map["AppData"] = Common.GetAllUserAppPath();
     var deleg = new Substitution.MyDelegate(map);
     var mySub = new Substitution();
     var startValue = new Dictionary<string, string>(Value);
     foreach (var key in startValue.Keys)
         Value[key] = mySub.DoSubstitute(startValue[key], @"%\(([^)]*)\)s", RegexOptions.None, deleg.myValue);
 }