Source

main-vinayFork / Source / WebService / Web.Admin / Common / Constants.cs

Full commit
using System;
using System.Configuration;
using System.IO;

namespace DataUp.Web.Admin
{
    internal class Constants
    {
        internal const string XLSX = ".xlsx";
        internal const string XLS = ".xls";
        internal const string ZIP = ".zip";
        internal const string TAR = ".tar";
        internal const string GZIP = ".gz";
        internal const string Boundary = "dhfYTTEWYfbn38d";

        internal static string PathDelimter = "\\";
        internal static string TempFolder = @"DCXL\";
        internal static string TempFileName = @"DcxlObject.{0}";
        internal static string MrtEmlFile = "mrt-eml.xml";
        internal static string MrtErcFile = "mrt-erc.txt";
        internal static string MrtManifestFile = "mrt-dataone-manifest.txt";
        internal static string Mapping = "/metadatalist/metadatagroup/metadata";
        internal static string EmlNamespace = "eml://ecoinformatics.org/eml2.1.0";
        internal static string AttributListNodeXPath = "./dataset/dataTable/attributeList";
        internal static string SheetTableXPath = "./dataset/dataTable";

        internal const string MerrittRepositoryName = "merritt";
        internal const string MerrittIdentifierLink = "https://merritt-stage.cdlib.org/object/mint";
        internal const string MerrittPostFileLink = "https://merritt-stage.cdlib.org/object/ingest";
        internal const string MerrittRepositoryType = "DataONE";

        /// <summary>
        /// The application registry path.
        /// </summary>
        public const string AppRegistryPath = "Software\\Microsoft\\Office\\Excel\\Addins\\Excel.Addin";

        /// <summary>
        /// The application registry key.
        /// </summary>
        public const string AppRegistryKey = "Manifest";
        internal static string TempDownloadPath
        {
            get
            {
                return string.Format(
                    "{0}{1}{2}",
                    Path.GetTempPath(),
                    Constants.TempFolder,
                    Guid.NewGuid().ToString());
            }
        }

        public static string AdminEmail
        {
            get
            {
                return ConfigurationManager.AppSettings["AdminEmail"];
            }
        }

        public static string NewscientificMetadata
        {
            get
            {
                return ConfigurationManager.AppSettings["NewscientificMetadata"];
            }
        }

        public static string DataUpMetadata
        {
            get
            {
                return ConfigurationManager.AppSettings["EMLMetadata"];
            }
        }

        public static string StandardUnitsPath
        {
            get
            {
                return ConfigurationManager.AppSettings["StandardUnitsPath"];
            }
        }

        public static string GetAppInstallationLocation()
        {
            string installationLocation = string.Empty;
            try
            {

                installationLocation = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
            }
            catch (Exception)
            {

            }

            return installationLocation;
        }
    }
}