Ejemplo n.º 1
0
        /* ----------------------------------------------------------------- */
        ///
        /// 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);
        }
Ejemplo n.º 2
0
        /* ----------------------------------------------------------------- */
        ///
        /// 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); }
        }
Ejemplo n.º 3
0
 /* ----------------------------------------------------------------- */
 ///
 /// GetCreator
 ///
 /// <summary>
 /// Gets the normalized creator.
 /// </summary>
 ///
 /* ----------------------------------------------------------------- */
 private static string GetCreator(SettingValue src) =>
 src.Metadata.Creator.HasValue() ?
 src.Metadata.Creator :
 Assembly.GetExecutingAssembly().GetProduct();
Ejemplo n.º 4
0
 /* ----------------------------------------------------------------- */
 ///
 /// GetResolution
 ///
 /// <summary>
 /// Gets the normalized resolution.
 /// </summary>
 ///
 /* ----------------------------------------------------------------- */
 private static int GetResolution(SettingValue src) =>
 src.Resolution >= 72 ? src.Resolution : 600;
Ejemplo n.º 5
0
 /* ----------------------------------------------------------------- */
 ///
 /// 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;
Ejemplo n.º 6
0
 /* ----------------------------------------------------------------- */
 ///
 /// 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;