Esempio n. 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"));
        }