示例#1
0
        private IFunctionData UpdateToVersion1(IFunctionData data)
        {
            bool isText = data.Properties[FileOpenShared.IsTextPropertyName].GetValue <bool>();
            var  updatedExecutionPath = new ExecutionPath
            {
                Key    = FileOpenShared.ExecutionPathName,
                Name   = FileOpenShared.ExecutionPathName,
                Output = TypeReference.CreateGeneratedType(
                    new TypeProperty(FileOpenShared.OutputFilePathPropertyName, typeof(string), AccessType.Read),
                    new TypeProperty(FileOpenShared.OutputFileHandlePropertyName, TypeReference.CreateResource(isText ? typeof(TextFileHandle) : typeof(BinaryFileHandle)), AccessType.Read)),
                IterationHint = Plugin.Common.IterationHint.Once
            };

            IExecutionPathData existingExecutionPath;

            if (data.TryFindExecutionPathByKey(FileOpenShared.ExecutionPathName, out existingExecutionPath))
            {
                data = data.ReplaceExecutionPath(existingExecutionPath, updatedExecutionPath);
            }
            else
            {
                data = data.AddExecutionPath(updatedExecutionPath);
            }

            return(data.UpdateVersion("1"));
        }
示例#2
0
        private IFunctionData ChangeExecutionPathHint(IFunctionData data)
        {
            foreach (var executionPath in data.ExecutionPaths.Values.ToArray())
            {
                if (executionPath.IterationHint != IterationHint.ZeroOrMore)
                {
                    data = data.ReplaceExecutionPath(executionPath, new ExecutionPath
                    {
                        Key           = executionPath.Key,
                        Name          = executionPath.Name,
                        Output        = executionPath.Output,
                        IterationHint = IterationHint.ZeroOrMore
                    });
                }
            }

            return(data);
        }