Beispiel #1
0
        /// <summary>
        /// Aces the operation configuration set global.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="value">The value.</param>
        public void aceOperation_configSetGlobal(string path, string value)
        {
            DateTime start = DateTime.Now; output.getLastLine();

            PropertyExpression pe = imbWEMManager.settings.GetExpressionResolved(path);

            if (pe.state == PropertyExpressionStateEnum.resolvedAll)
            {
                pe.setValue(value);
                //log("Path [" + path + "] [" + pe.state.ToString() + "] [" + value + "] set");
            }
            else
            {
                log("Path [" + path + "] [" + pe.state.ToString() + "] failed to be resolved in part: [" + pe.undesolvedPart + "]");
            }
        }
        /// <summary>
        /// Gets the filepath. Optionally sets instance property if <see cref="path"/> contains filename. In the most cases you want to use this without parameters
        /// </summary>
        /// <param name="path">Optional target path information, may provide property value if <see cref="fileDataFilenameMode.propertyValue"/> mode is set</param>
        /// <param name="instance">Optionally, instance to set property value if <see cref="fileDataFilenameMode.propertyValue"/> mode is used</param>
        /// <param name="appendPathInOutput">if set to true it will use <paramref name="path"/> as prefix to output.</param>
        /// <returns>filename with extension, optionally full path with prefix <paramref name="path"/></returns>
        public override String GetFilepath(String path = "", IFileDataStructure instance = null, Boolean appendPathInOutput = false)
        {
            String filepath = "";

            switch (filenameMode)
            {
            case fileDataFilenameMode.memberInfoName:
            case fileDataFilenameMode.customName:
                filepath = filename;
                break;

            case fileDataFilenameMode.propertyValue:

                filepath = Path.GetFileNameWithoutExtension(path);
                path     = path.getPathVersion(1, "\\");
                if (instance != null)
                {
                    PropertyExpression pexp = new PropertyExpression(instance, nameOrPropertyPath);
                    pexp.setValue(filename);
                }
                break;

            default:

                //
                //throw new NotImplementedException("File Data Structure can't have filename by property value");
                break;
            }

            if (options.HasFlag(fileDataPropertyOptions.itemAsFile))
            {
                filepath = filepath + WILLCARD_SUFIX;
            }

            filepath = filepath.ensureEndsWith(formatMode.GetExtension());

            if (appendPathInOutput)
            {
                path = path.add(filepath, "\\");
            }
            else
            {
                path = filepath;
            }

            return(path);
        }
        public override string GetFilepath(string path = "", IFileDataStructure instance = null, bool appendPathInOutput = false)
        {
            String filepath = "";

            switch (filenameMode)
            {
            case fileDataFilenameMode.memberInfoName:
            case fileDataFilenameMode.customName:
                filepath = filename;
                break;

            case fileDataFilenameMode.propertyValue:

                filepath = Path.GetFileNameWithoutExtension(path);
                path     = imbStringPathTools.getPathVersion(path, 1, Path.DirectorySeparatorChar);
                if (instance != null)
                {
                    PropertyExpression pexp = new PropertyExpression(instance, nameOrPropertyPath);
                    pexp.setValue(filename);
                }
                break;

            default:

                fileDataStructureExtensions.FileDataStructureError("File Data Structure can't have filename by property value. " + path, instance?.folder, null, null, instance);
                break;
            }

            if (options.HasFlag(fileDataPropertyOptions.itemAsFile))
            {
                filepath = filepath + "_*";
            }

            //path = path.ensureEndsWith(filepath);

            if (appendPathInOutput)
            {
                path = path.add(filepath, Path.DirectorySeparatorChar);
            }

            return(path);
        }