Exemplo n.º 1
0
        public void InitConfigKeys()
        {
            buildInfo = new BuildInfo(BasePath + "/.build.info");

            var buildConfigKey = buildInfo["Build Key"];

            if (buildConfigKey != null)
            {
                if (buildConfigKey.Length / 2 > 16)
                {
                    throw new InvalidOperationException("Build config key too long");
                }
                else if (buildConfigKey.Length / 2 < 16)
                {
                    throw new InvalidOperationException("Build config key too short");
                }

                buildConfig = new BuildConfig(BasePath, buildConfigKey);

                if (buildConfig == null)
                {
                    throw new InvalidOperationException("Can't create build config.");
                }
            }

            var cdnConfigKey = buildInfo["CDN Key"];

            if (cdnConfigKey != null)
            {
                if (cdnConfigKey.Length / 2 > 16)
                {
                    throw new InvalidOperationException("CDN config key too long");
                }
                else if (cdnConfigKey.Length / 2 < 16)
                {
                    throw new InvalidOperationException("CDN config key too short");
                }

                cdnConfig = new CDNConfig(BasePath, cdnConfigKey);

                cdnConfig.Path = buildInfo["CDN Path"];
                cdnConfig.Host = buildInfo["CDN Hosts"].Split(new[] { ' ' })[0];

                if (cdnConfig == null)
                {
                    throw new InvalidOperationException("Can't create cdn config.");
                }
            }
        }
Exemplo n.º 2
0
        public void InitConfigKeys()
        {
            buildInfo = new BuildInfo(BasePath + "/.build.info");

            var buildConfigKey = buildInfo["Build Key"];

            if (buildConfigKey != null)
            {
                if (buildConfigKey.Length / 2 > 16)
                    throw new InvalidOperationException("Build config key too long");
                else if (buildConfigKey.Length / 2 < 16)
                    throw new InvalidOperationException("Build config key too short");

                buildConfig = new BuildConfig(BasePath, buildConfigKey);

                if (buildConfig == null)
                    throw new InvalidOperationException("Can't create build config.");
            }

            var cdnConfigKey = buildInfo["CDN Key"];

            if (cdnConfigKey != null)
            {
                if (cdnConfigKey.Length / 2 > 16)
                    throw new InvalidOperationException("CDN config key too long");
                else if (cdnConfigKey.Length / 2 < 16)
                    throw new InvalidOperationException("CDN config key too short");

                cdnConfig = new CDNConfig(BasePath, cdnConfigKey);

                cdnConfig.Path = buildInfo["CDN Path"];
                cdnConfig.Host = buildInfo["CDN Hosts"].Split(new[] { ' ' })[0];

                if (cdnConfig == null)
                    throw new InvalidOperationException("Can't create cdn config.");
            }
        }