Пример #1
0
        private ImportResult ComputeNameAndKey_Generic(string[] vars, string currentPath)
        {
            ImportResult ret = new ImportResult();

            string filePath = "";

            if (!Utils.TryResolvePathIncludeParameter(vars))
            {
                return(ret);
            }

            string[] genParams = vars.Length > 1 ? vars.SubArray(1, vars.Length - 1).ToArray() : new string[0];

            string rel = Path.Combine(currentPath, vars[0]);
            string key = Path.GetFullPath(rel);

            filePath = rel;
            key     += genParams.Length > 0 ? "." + genParams.Unpack(Separator) : "";

            if (genParams.Length != 0)
            {
                ret.SetValue("genParams", genParams);
            }

            ret.SetValue("definedname", vars[0]);
            ret.SetValue("filename", filePath);
            ret.SetValue("key", key);
            ret.SetResult(true);

            return(ret);
        }
Пример #2
0
        /// <summary>
        ///     The default implementation of the key matching calculation
        /// </summary>
        /// <param name="vars">The import string in a source script</param>
        /// <param name="currentPath">the current path of the preprocessor</param>
        /// <returns>A result object.</returns>
        private ImportResult ComputeFileNameAndKey_Default(string[] vars, string currentPath)
        {
            ImportResult ret = new ImportResult();

            if (!Utils.TryResolvePathIncludeParameter(vars))
            {
                return(ret);
            }

            string rel = Path.Combine(currentPath, vars[0]);
            string key = Path.GetFullPath(rel);

            ret.SetValue("definedname", vars[0]);
            ret.SetValue("filename", key);

            ret.SetValue("key", key);
            ret.SetResult(true);

            return(ret);
        }