/* ----------------------------------------------------------------- */ /// /// GetTempOrEmpty /// /// <summary> /// Gets a temporary directory if necessary. /// </summary> /// /* ----------------------------------------------------------------- */ private static string GetTempOrEmpty(SettingValue src) { var e0 = Environment.GetEnvironmentVariable("Tmp"); var e1 = Environment.GetEnvironmentVariable("Temp"); return(e0.Length != System.Text.Encoding.UTF8.GetByteCount(e0) || e1.Length != System.Text.Encoding.UTF8.GetByteCount(e1) ? src.Temp : string.Empty); }
/* ----------------------------------------------------------------- */ /// /// GetDestination /// /// <summary> /// Gets the normalized destination. /// </summary> /// /* ----------------------------------------------------------------- */ private static string GetDestination(SettingValue src, IO io) { var desktop = Environment.SpecialFolder.Desktop.GetName(); try { if (!src.Destination.HasValue()) { return(desktop); } var dest = io.Get(src.Destination); return(dest.IsDirectory ? dest.FullName : dest.DirectoryName); } catch { return(desktop); } }
/* ----------------------------------------------------------------- */ /// /// GetCreator /// /// <summary> /// Gets the normalized creator. /// </summary> /// /* ----------------------------------------------------------------- */ private static string GetCreator(SettingValue src) => src.Metadata.Creator.HasValue() ? src.Metadata.Creator : Assembly.GetExecutingAssembly().GetProduct();
/* ----------------------------------------------------------------- */ /// /// GetResolution /// /// <summary> /// Gets the normalized resolution. /// </summary> /// /* ----------------------------------------------------------------- */ private static int GetResolution(SettingValue src) => src.Resolution >= 72 ? src.Resolution : 600;
/* ----------------------------------------------------------------- */ /// /// GetOrientation /// /// <summary> /// Gets the normalized orientation. /// </summary> /// /* ----------------------------------------------------------------- */ private static Orientation GetOrientation(SettingValue src) => ViewResources.Orientations.Any(e => e.Value == src.Orientation) ? src.Orientation : Orientation.Auto;
/* ----------------------------------------------------------------- */ /// /// GetFormat /// /// <summary> /// Gets the normalized format. /// </summary> /// /* ----------------------------------------------------------------- */ private static Format GetFormat(SettingValue src) => ViewResources.Formats.Any(e => e.Value == src.Format) ? src.Format : Format.Pdf;