Пример #1
0
        /* L O A D  D A T A S O U R C E */

        /*----------------------------------------------------------------------------
        *       %%Function: LoadDatasource
        *       %%Qualified: AzLog.AzLogDatasourceSupport.LoadDatasource
        *       %%Contact: rlittle
        *
        *   Load the named datasource. This handles figuring out the datasource
        *   type and loading the correct type. Regurns an interface to the datasource
        *  ----------------------------------------------------------------------------*/
        public static IAzLogDatasource LoadDatasource(AzLogModel azlm, string sRegRoot, string sName)
        {
            // first, figure out what type of datasource this is
            Settings.SettingsElt[] _rgsteeDatasource =
            {
                new Settings.SettingsElt("Type", Settings.Type.Str, "", ""),
            };

            string sKey = String.Format("{0}\\Datasources\\{1}", sRegRoot, sName);

            // save everything we need to be able to recreate ourselves
            Settings ste = new Settings(_rgsteeDatasource, sKey, "ds");

            ste.Load();
            string         sType = ste.SValue("Type");
            DatasourceType dt;

            dt = TypeFromString(sType);
            switch (dt)
            {
            case DatasourceType.TextFile:
                return(AzLogFile.LoadFileDatasource(null, sRegRoot, sName));

            case DatasourceType.AzureTable:
                return(AzLogAzureTable.LoadAzureDatasource(null, sRegRoot, sName));

            case DatasourceType.AzureBlob:
                return(AzLogAzureBlob.LoadAzureDatasource(null, sRegRoot, sName));

            default:
                throw new Exception("unknown datasourcetype");
            }
        }
Пример #2
0
        /* L O A D  A Z U R E  D A T A S O U R C E */

        /*----------------------------------------------------------------------------
        *       %%Function: LoadAzureDatasource
        *       %%Qualified: AzLog.AzLogAzureTable.LoadAzureDatasource
        *       %%Contact: rlittle
        *
        *   Loads this azure datasource
        *  ----------------------------------------------------------------------------*/
        public static AzLogFile LoadFileDatasource(AzLogModel azlm, string sRegRoot, string sName)
        {
            AzLogFile azlf = new AzLogFile();

            if (azlf.FLoad(azlm, sRegRoot, sName))
            {
                return(azlf);
            }

            return(null);
        }