Пример #1
0
        public frmFunctionWizard(FunctionInfo function, bool isNewFunction)
        {
            InitializeComponent();
            Instance = this;
            ucHeading1.Text = "";
            BackColor = Slyce.Common.Colors.BackgroundColor;

            IsDeleted = false;
            MustRefreshFunctionList = false;
            IsNewFunction = isNewFunction;
            CurrentFunction = function;
            // Clone the function.
            TempFunction =  new FunctionInfo(CurrentFunction);
            Controller.ShadeMainForm();
            bool dirtyStatus = Project.Instance.IsDirty;
            CurrentFunction = function;
            ContentItems.Add(new FunctionWizardScreens.Screen1());
            ContentItems.Add(new FunctionWizardScreens.Screen2());
            ContentItems.Add(new FunctionWizardScreens.Screen3());
            LoadScreen(ContentItems[0]);
            Project.Instance.IsDirty = dirtyStatus;
        }
        public frmFunctionWizard(FunctionInfo function, bool isNewFunction)
        {
            InitializeComponent();
            Instance        = this;
            ucHeading1.Text = "";
            BackColor       = Slyce.Common.Colors.BackgroundColor;

            IsDeleted = false;
            MustRefreshFunctionList = false;
            IsNewFunction           = isNewFunction;
            CurrentFunction         = function;
            // Clone the function.
            TempFunction = new FunctionInfo(CurrentFunction);
            Controller.ShadeMainForm();
            bool dirtyStatus = Project.Instance.IsDirty;

            CurrentFunction = function;
            ContentItems.Add(new FunctionWizardScreens.Screen1());
            ContentItems.Add(new FunctionWizardScreens.Screen2());
            ContentItems.Add(new FunctionWizardScreens.Screen3());
            LoadScreen(ContentItems[0]);
            Project.Instance.IsDirty = dirtyStatus;
        }
Пример #3
0
        public void AddNewFile()
        {
            if (treeFiles.SelectedNodes.Count == 0)
            {
                MessageBox.Show(this, "Select a folder to add this file to first.", "No Folder Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (treeFiles.SelectedNodes.Count > 1)
            {
                throw new Exception("Only one node can be selected.");
            }

            Node selectedNode = treeFiles.SelectedNodes[0];
            TagInfo ti = (TagInfo)selectedNode.Tag;

            if (ti.FileType != TagInfo.FileTypes.Folder)
            {
                MessageBox.Show(this, "A file cannot be added as a child of a file. Select a parent folder", "No Folder Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            Cursor = Cursors.WaitCursor;

            try
            {
                Refresh();
                Wizards.frmOutputFileWizard.IterationType = null;
                Wizards.frmOutputFileWizard.FileType = Wizards.frmOutputFileWizard.FileTypes.Script;
                Wizards.frmOutputFileWizard.FileName = "";
                Wizards.frmOutputFileWizard.StaticFileName = "";
                Wizards.frmOutputFileWizard.FunctionName = "";
                Wizards.frmOutputFileWizard form = new Wizards.frmOutputFileWizard();
                bool showFunctions = false;

                if (form.ShowDialog() == DialogResult.OK)
                {
                    var createNewFunction = Wizards.frmOutputFileWizard.ShowNewFunctionWizardOnClose &&
                            (Wizards.frmOutputFileWizard.StaticSkipFunction == Wizards.frmOutputFileWizard.SkipFunctionChoice.DontUse
                            || Wizards.frmOutputFileWizard.FileType == Wizards.frmOutputFileWizard.FileTypes.Script);
                    if (createNewFunction)
                    {
                        Controller.Instance.MainForm.Refresh();
                        FunctionInfo newFunc = Controller.Instance.MainForm.UcFunctions.NewFunction(Wizards.frmOutputFileWizard.IterationType);

                        if (newFunc != null)
                        {
                            Wizards.frmOutputFileWizard.FunctionName = newFunc.Name;
                            showFunctions = true;
                        }
                    }
                    else if (Wizards.frmOutputFileWizard.StaticSkipFunction == Wizards.frmOutputFileWizard.SkipFunctionChoice.CreateNew)
                    {
                        FunctionInfo newFunction = new FunctionInfo(
                                                        NamingHelper.CleanNameCSharp(Wizards.frmOutputFileWizard.StaticFileName) + "_SkipFile",
                                                            typeof(bool), "return false;", false, SyntaxEditorHelper.ScriptLanguageTypes.CSharp,
                                                            "Returns true if the static file should be skipped and not generated", "plain text", "Skip Static Files");

                        Project.Instance.AddFunction(newFunction);
                        Wizards.frmFunctionWizard functionForm = new Wizards.frmFunctionWizard(newFunction, true);

                        if (functionForm.ShowDialog(ParentForm) == DialogResult.Cancel)
                        {
                            Project.Instance.DeleteFunction(newFunction);
                            //OwnerTabStripPage.TabStrip.Pages.Remove(OwnerTabStripPage);
                        }
                    }

                    string id = ((TagInfo)selectedNode.Tag).Id;

                    OutputFolder folder = Project.Instance.FindFolder(id);

                    if (folder != null)
                    {
                        OutputFile file;

                        if (Wizards.frmOutputFileWizard.FileType == Wizards.frmOutputFileWizard.FileTypes.Static)
                        {
                            file = new OutputFile(Wizards.frmOutputFileWizard.FileName, OutputFileTypes.File, "", Guid.NewGuid().ToString());
                            file.StaticFileName = Wizards.frmOutputFileWizard.StaticFileName;
                            file.StaticFileIterator = Wizards.frmOutputFileWizard.IterationType;
                            file.StaticFileSkipFunctionName = Wizards.frmOutputFileWizard.StaticSkipFunctionName;
                        }
                        else if (Wizards.frmOutputFileWizard.FileType == Wizards.frmOutputFileWizard.FileTypes.Script)
                        {
                            file = new OutputFile(Wizards.frmOutputFileWizard.FileName, OutputFileTypes.Script, Wizards.frmOutputFileWizard.FunctionName, Guid.NewGuid().ToString());
                            file.IteratorFunction = Project.Instance.FindFunctionSingle(Wizards.frmOutputFileWizard.FunctionName);
                        }
                        else
                        {
                            throw new NotImplementedException("Not catered for yet.");
                        }
                        folder.AddFile(file);
                        Node newFileNode = AddFileNode(selectedNode, file);
                        selectedNode.Expanded = true;
                        treeFiles.SelectedNode = newFileNode;
                    }
                    else
                    {
                        MessageBox.Show(this, "No matching folder found.", "No matching folder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    Project.Instance.IsDirty = true;
                }
                if (showFunctions)
                {
                    Controller.Instance.MainForm.HidePanelControls(Controller.Instance.MainForm.UcFunctions);
                }
            }
            finally
            {
                Controller.Instance.MainForm.Activate();
                Cursor = Cursors.Default;
            }
        }
Пример #4
0
        private void mnuItemEdit_Click(object sender, EventArgs e)
        {
            if (treeFiles.SelectedNodes.Count == 0)
            {
                MessageBox.Show(this, "Select a folder first.", "No Folder Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (treeFiles.SelectedNodes.Count > 1)
            {
                throw new Exception("Only one node can be selected.");
            }
            try
            {
                Node selectedNode = treeFiles.SelectedNodes[0];
                TagInfo ti = (TagInfo)selectedNode.Tag;

                if (ti.FileType == TagInfo.FileTypes.Folder)
                {
                    string id = ((TagInfo)selectedNode.Tag).Id;
                    OutputFolder folder = Project.Instance.FindFolder(id);
                    Wizards.frmOutputFileWizard.FileType = Wizards.frmOutputFileWizard.FileTypes.Folder;
                    Wizards.frmOutputFileWizard form = new Wizards.frmOutputFileWizard();
                    Wizards.frmOutputFileWizard.FileName = selectedNode.Text;
                    Wizards.frmOutputFileWizard.IterationType = folder.IteratorType;

                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        if (folder != null)
                        {
                            folder.Name = Wizards.frmOutputFileWizard.FileName;
                            folder.IteratorType = Wizards.frmOutputFileWizard.IterationType;
                        }
                        Project.Instance.IsDirty = true;
                        selectedNode.Text = folder.Name;
                        selectedNode.Cells[(int)CellTypes.Iterator].Text = folder.IteratorType == null ? "" : folder.IteratorType.FullName;
                    }
                }
                else //if (ti.FileType == TagInfo.FileTypes.ScriptFile)
                {
                    string id = ((TagInfo)selectedNode.Tag).Id;
                    OutputFile file = Project.Instance.FindFile(id);

                    Wizards.frmOutputFileWizard.StaticSkipFunction = Wizards.frmOutputFileWizard.SkipFunctionChoice.DontUse;

                    if (ti.FileType == TagInfo.FileTypes.ScriptFile)
                    {
                        Wizards.frmOutputFileWizard.FileType = Wizards.frmOutputFileWizard.FileTypes.Script;
                        Wizards.frmOutputFileWizard.FunctionName = selectedNode.Cells[(int)CellTypes.Function].Text;
                        Wizards.frmOutputFileWizard.StaticFileName = "";

                        if (!string.IsNullOrEmpty(file.IteratorTypes))
                        {
                            Wizards.frmOutputFileWizard.IterationType = Project.Instance.GetTypeFromReferencedAssemblies(file.IteratorTypes, false);
                        }
                        else
                        {
                            Wizards.frmOutputFileWizard.IterationType = null;
                        }
                    }
                    else
                    {
                        Wizards.frmOutputFileWizard.FileType = Wizards.frmOutputFileWizard.FileTypes.Static;
                        Wizards.frmOutputFileWizard.StaticFileName = file.StaticFileName;
                        Wizards.frmOutputFileWizard.FunctionName = file.StaticFileSkipFunctionName;
                        Wizards.frmOutputFileWizard.IterationType = file.StaticFileIterator;
                    }
                    Wizards.frmOutputFileWizard form = new Wizards.frmOutputFileWizard();
                    Wizards.frmOutputFileWizard.FileName = selectedNode.Text;
                    FunctionInfo func = Project.Instance.FindFunctionSingle(Wizards.frmOutputFileWizard.FunctionName);

                    if (func != null && func.Parameters.Count > 0)
                    {
                        Wizards.frmOutputFileWizard.IterationType = func.Parameters[0].DataType;
                    }
                    bool showFunctions = false;

                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        if (Wizards.frmOutputFileWizard.ShowNewFunctionWizardOnClose &&
                            Wizards.frmOutputFileWizard.StaticSkipFunction == Wizards.frmOutputFileWizard.SkipFunctionChoice.DontUse)
                        {
                            Controller.Instance.MainForm.Refresh();
                            FunctionInfo newFunc = Controller.Instance.MainForm.UcFunctions.NewFunction(Wizards.frmOutputFileWizard.IterationType);

                            if (newFunc != null)
                            {
                                Wizards.frmOutputFileWizard.FunctionName = newFunc.Name;
                                showFunctions = true;
                            }
                        }
                        else if (Wizards.frmOutputFileWizard.StaticSkipFunction == Wizards.frmOutputFileWizard.SkipFunctionChoice.CreateNew)
                        {
                            FunctionInfo newFunction = new FunctionInfo(
                                                            NamingHelper.CleanNameCSharp(Wizards.frmOutputFileWizard.StaticFileName) + "_SkipFile",
                                                                typeof(bool), "return false;", false, SyntaxEditorHelper.ScriptLanguageTypes.CSharp,
                                                                "Returns true if the static file should be skipped and not generated", "plain text", "Skip Static Files");

                            Project.Instance.AddFunction(newFunction);
                            Wizards.frmFunctionWizard functionForm = new Wizards.frmFunctionWizard(newFunction, true);

                            if (functionForm.ShowDialog(ParentForm) == DialogResult.Cancel)
                            {
                                Project.Instance.DeleteFunction(newFunction);
                                //OwnerTabStripPage.TabStrip.Pages.Remove(OwnerTabStripPage);
                            }
                            file.StaticFileSkipFunctionName = newFunction.Name;
                        }
                        else if (Wizards.frmOutputFileWizard.StaticSkipFunction == Wizards.frmOutputFileWizard.SkipFunctionChoice.UseExisting)
                        {
                            file.StaticFileSkipFunctionName = Wizards.frmOutputFileWizard.FunctionName;
                        }

                        file.Name = Wizards.frmOutputFileWizard.FileName;
                        file.ScriptName = Wizards.frmOutputFileWizard.FunctionName;
                        Project.Instance.IsDirty = true;
                        selectedNode.Text = file.Name;

                        switch (Wizards.frmOutputFileWizard.FileType)
                        {
                            case Wizards.frmOutputFileWizard.FileTypes.Script:
                                file.FileType = OutputFileTypes.Script;
                                ti.FileType = TagInfo.FileTypes.ScriptFile;
                                selectedNode.Cells[(int)CellTypes.Function].Text = file.ScriptName;
                                selectedNode.Cells[(int)CellTypes.Iterator].Text = file.IteratorTypes;
                                break;
                            case Wizards.frmOutputFileWizard.FileTypes.Static:
                                file.FileType = OutputFileTypes.File;
                                file.StaticFileIterator = Wizards.frmOutputFileWizard.IterationType;
                                ti.FileType = TagInfo.FileTypes.NormalFile;
                                selectedNode.Cells[(int)CellTypes.Function].Text = "[File] " + Wizards.frmOutputFileWizard.StaticFileName;

                                if (file.StaticFileIterator != null)
                                {
                                    selectedNode.Cells[(int)CellTypes.Iterator].Text = file.StaticFileIterator.FullName;
                                    selectedNode.Cells[(int)CellTypes.Iterator].StyleNormal = treeFiles.Styles["functionLinkStyle"];
                                    selectedNode.Cells[(int)CellTypes.Iterator].StyleMouseOver = treeFiles.Styles["functionLinkHoverStyle"];
                                    selectedNode.Cells[(int)CellTypes.Iterator].Cursor = Cursors.Hand;
                                }
                                if (string.IsNullOrEmpty(file.StaticFileSkipFunctionName) == false)
                                {
                                    selectedNode.Cells[(int)CellTypes.SkipFunction].Text = file.StaticFileSkipFunctionName;
                                    selectedNode.Cells[(int)CellTypes.SkipFunction].StyleNormal = treeFiles.Styles["functionLinkStyle"];
                                    selectedNode.Cells[(int)CellTypes.SkipFunction].StyleMouseOver = treeFiles.Styles["functionLinkHoverStyle"];
                                    selectedNode.Cells[(int)CellTypes.SkipFunction].Cursor = Cursors.Hand;
                                }
                                break;
                            default:
                                throw new NotImplementedException("Filetype not handled yet: " + Wizards.frmOutputFileWizard.FileType.ToString());
                        }
                        selectedNode.Tag = ti;

                    }
                    if (showFunctions)
                    {
                        Controller.Instance.MainForm.HidePanelControls(Controller.Instance.MainForm.UcFunctions);
                    }
                }
            }
            finally
            {
                Controller.Instance.MainForm.Activate();
            }
        }
Пример #5
0
        /*
                private void btnDeleteFunction_Click(object sender, EventArgs e)
                {
                    if (
                        MessageBox.Show(this, "Delete this function?", "Delete", MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Project.Instance.DeleteFunction(_CurrentFunction);
                    }
                }
        */
        private void btnEdit_Click(object sender, EventArgs e)
        {
            frmFunctionWizard form = new frmFunctionWizard(CurrentFunction, false);
            form.ShowDialog(ParentForm);

            if (frmFunctionWizard.IsDeleted)
            {
                if (OwnerIsTabStrip && Controller.Instance.MainForm.UcFunctions != null)
                {
                    Controller.Instance.MainForm.UcFunctions.RemoveTab(OwnerTabStripPage);
                }
                return;
            }
            //FunctionName = frmFunctionWizard.CurrentFunction.Name;
            // Switch UseSplitLanguage because it gets re-switched inside SwitchFormatting, so we need to make sure we don't switch the formatting the user currently sees.
            UseSplitLanguage = !UseSplitLanguage;
            PopulateFunctionHeader();
        }
Пример #6
0
        public FunctionInfo NewFunction(Type parameterTypeForNewScriptFunction)
        {
            FunctionInfo newFunction =
                new FunctionInfo("NewFunction", typeof(string), "", true,
                                         SyntaxEditorHelper.ScriptLanguageTypes.CSharp, "", "plain text", "");

            if (parameterTypeForNewScriptFunction != null)
            {
                string paramName = parameterTypeForNewScriptFunction.Name.Replace("[]", "s");
                paramName = paramName.Substring(0, 1).ToLower() + paramName.Substring(1);

                if (paramName.IndexOf("List<") == 0)
                {
                    paramName = paramName.Replace("List<", "").Replace(">", "") + "s";
                }
                string cleanParamName = "";

                for (int i = 0; i < paramName.Length; i++)
                {
                    if (char.IsLetterOrDigit(paramName[i]))
                    {
                        cleanParamName += paramName[i];
                    }
                }

                newFunction.Parameters.Add(new ParamInfo(cleanParamName, parameterTypeForNewScriptFunction));
            }
            Project.Instance.AddFunction(newFunction);
            frmFunctionWizard form = new frmFunctionWizard(newFunction, true);

            if (form.ShowDialog(ParentForm) == DialogResult.Cancel)
            {
                Project.Instance.DeleteFunction(newFunction);
                //OwnerTabStripPage.TabStrip.Pages.Remove(OwnerTabStripPage);
                return null;
            }
            ShowFunction(frmFunctionWizard.CurrentFunction, true, null);
            return newFunction;
        }
Пример #7
0
        public void AddNewFile()
        {
            if (treeFiles.SelectedNodes.Count == 0)
            {
                MessageBox.Show(this, "Select a folder to add this file to first.", "No Folder Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (treeFiles.SelectedNodes.Count > 1)
            {
                throw new Exception("Only one node can be selected.");
            }

            Node    selectedNode = treeFiles.SelectedNodes[0];
            TagInfo ti           = (TagInfo)selectedNode.Tag;

            if (ti.FileType != TagInfo.FileTypes.Folder)
            {
                MessageBox.Show(this, "A file cannot be added as a child of a file. Select a parent folder", "No Folder Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            Cursor = Cursors.WaitCursor;

            try
            {
                Refresh();
                Wizards.frmOutputFileWizard.IterationType  = null;
                Wizards.frmOutputFileWizard.FileType       = Wizards.frmOutputFileWizard.FileTypes.Script;
                Wizards.frmOutputFileWizard.FileName       = "";
                Wizards.frmOutputFileWizard.StaticFileName = "";
                Wizards.frmOutputFileWizard.FunctionName   = "";
                Wizards.frmOutputFileWizard form = new Wizards.frmOutputFileWizard();
                bool showFunctions = false;

                if (form.ShowDialog() == DialogResult.OK)
                {
                    var createNewFunction = Wizards.frmOutputFileWizard.ShowNewFunctionWizardOnClose &&
                                            (Wizards.frmOutputFileWizard.StaticSkipFunction == Wizards.frmOutputFileWizard.SkipFunctionChoice.DontUse ||
                                             Wizards.frmOutputFileWizard.FileType == Wizards.frmOutputFileWizard.FileTypes.Script);
                    if (createNewFunction)
                    {
                        Controller.Instance.MainForm.Refresh();
                        FunctionInfo newFunc = Controller.Instance.MainForm.UcFunctions.NewFunction(Wizards.frmOutputFileWizard.IterationType);

                        if (newFunc != null)
                        {
                            Wizards.frmOutputFileWizard.FunctionName = newFunc.Name;
                            showFunctions = true;
                        }
                    }
                    else if (Wizards.frmOutputFileWizard.StaticSkipFunction == Wizards.frmOutputFileWizard.SkipFunctionChoice.CreateNew)
                    {
                        FunctionInfo newFunction = new FunctionInfo(
                            NamingHelper.CleanNameCSharp(Wizards.frmOutputFileWizard.StaticFileName) + "_SkipFile",
                            typeof(bool), "return false;", false, SyntaxEditorHelper.ScriptLanguageTypes.CSharp,
                            "Returns true if the static file should be skipped and not generated", "plain text", "Skip Static Files");

                        Project.Instance.AddFunction(newFunction);
                        Wizards.frmFunctionWizard functionForm = new Wizards.frmFunctionWizard(newFunction, true);

                        if (functionForm.ShowDialog(ParentForm) == DialogResult.Cancel)
                        {
                            Project.Instance.DeleteFunction(newFunction);
                            //OwnerTabStripPage.TabStrip.Pages.Remove(OwnerTabStripPage);
                        }
                    }

                    string id = ((TagInfo)selectedNode.Tag).Id;

                    OutputFolder folder = Project.Instance.FindFolder(id);

                    if (folder != null)
                    {
                        OutputFile file;

                        if (Wizards.frmOutputFileWizard.FileType == Wizards.frmOutputFileWizard.FileTypes.Static)
                        {
                            file = new OutputFile(Wizards.frmOutputFileWizard.FileName, OutputFileTypes.File, "", Guid.NewGuid().ToString());
                            file.StaticFileName             = Wizards.frmOutputFileWizard.StaticFileName;
                            file.StaticFileIterator         = Wizards.frmOutputFileWizard.IterationType;
                            file.StaticFileSkipFunctionName = Wizards.frmOutputFileWizard.StaticSkipFunctionName;
                        }
                        else if (Wizards.frmOutputFileWizard.FileType == Wizards.frmOutputFileWizard.FileTypes.Script)
                        {
                            file = new OutputFile(Wizards.frmOutputFileWizard.FileName, OutputFileTypes.Script, Wizards.frmOutputFileWizard.FunctionName, Guid.NewGuid().ToString());
                            file.IteratorFunction = Project.Instance.FindFunctionSingle(Wizards.frmOutputFileWizard.FunctionName);
                        }
                        else
                        {
                            throw new NotImplementedException("Not catered for yet.");
                        }
                        folder.AddFile(file);
                        Node newFileNode = AddFileNode(selectedNode, file);
                        selectedNode.Expanded  = true;
                        treeFiles.SelectedNode = newFileNode;
                    }
                    else
                    {
                        MessageBox.Show(this, "No matching folder found.", "No matching folder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    Project.Instance.IsDirty = true;
                }
                if (showFunctions)
                {
                    Controller.Instance.MainForm.HidePanelControls(Controller.Instance.MainForm.UcFunctions);
                }
            }
            finally
            {
                Controller.Instance.MainForm.Activate();
                Cursor = Cursors.Default;
            }
        }
Пример #8
0
        private void mnuItemEdit_Click(object sender, EventArgs e)
        {
            if (treeFiles.SelectedNodes.Count == 0)
            {
                MessageBox.Show(this, "Select a folder first.", "No Folder Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (treeFiles.SelectedNodes.Count > 1)
            {
                throw new Exception("Only one node can be selected.");
            }
            try
            {
                Node    selectedNode = treeFiles.SelectedNodes[0];
                TagInfo ti           = (TagInfo)selectedNode.Tag;

                if (ti.FileType == TagInfo.FileTypes.Folder)
                {
                    string       id     = ((TagInfo)selectedNode.Tag).Id;
                    OutputFolder folder = Project.Instance.FindFolder(id);
                    Wizards.frmOutputFileWizard.FileType = Wizards.frmOutputFileWizard.FileTypes.Folder;
                    Wizards.frmOutputFileWizard form = new Wizards.frmOutputFileWizard();
                    Wizards.frmOutputFileWizard.FileName      = selectedNode.Text;
                    Wizards.frmOutputFileWizard.IterationType = folder.IteratorType;

                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        if (folder != null)
                        {
                            folder.Name         = Wizards.frmOutputFileWizard.FileName;
                            folder.IteratorType = Wizards.frmOutputFileWizard.IterationType;
                        }
                        Project.Instance.IsDirty = true;
                        selectedNode.Text        = folder.Name;
                        selectedNode.Cells[(int)CellTypes.Iterator].Text = folder.IteratorType == null ? "" : folder.IteratorType.FullName;
                    }
                }
                else                 //if (ti.FileType == TagInfo.FileTypes.ScriptFile)
                {
                    string     id   = ((TagInfo)selectedNode.Tag).Id;
                    OutputFile file = Project.Instance.FindFile(id);

                    Wizards.frmOutputFileWizard.StaticSkipFunction = Wizards.frmOutputFileWizard.SkipFunctionChoice.DontUse;

                    if (ti.FileType == TagInfo.FileTypes.ScriptFile)
                    {
                        Wizards.frmOutputFileWizard.FileType       = Wizards.frmOutputFileWizard.FileTypes.Script;
                        Wizards.frmOutputFileWizard.FunctionName   = selectedNode.Cells[(int)CellTypes.Function].Text;
                        Wizards.frmOutputFileWizard.StaticFileName = "";

                        if (!string.IsNullOrEmpty(file.IteratorTypes))
                        {
                            Wizards.frmOutputFileWizard.IterationType = Project.Instance.GetTypeFromReferencedAssemblies(file.IteratorTypes, false);
                        }
                        else
                        {
                            Wizards.frmOutputFileWizard.IterationType = null;
                        }
                    }
                    else
                    {
                        Wizards.frmOutputFileWizard.FileType       = Wizards.frmOutputFileWizard.FileTypes.Static;
                        Wizards.frmOutputFileWizard.StaticFileName = file.StaticFileName;
                        Wizards.frmOutputFileWizard.FunctionName   = file.StaticFileSkipFunctionName;
                        Wizards.frmOutputFileWizard.IterationType  = file.StaticFileIterator;
                    }
                    Wizards.frmOutputFileWizard form = new Wizards.frmOutputFileWizard();
                    Wizards.frmOutputFileWizard.FileName = selectedNode.Text;
                    FunctionInfo func = Project.Instance.FindFunctionSingle(Wizards.frmOutputFileWizard.FunctionName);

                    if (func != null && func.Parameters.Count > 0)
                    {
                        Wizards.frmOutputFileWizard.IterationType = func.Parameters[0].DataType;
                    }
                    bool showFunctions = false;

                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        if (Wizards.frmOutputFileWizard.ShowNewFunctionWizardOnClose &&
                            Wizards.frmOutputFileWizard.StaticSkipFunction == Wizards.frmOutputFileWizard.SkipFunctionChoice.DontUse)
                        {
                            Controller.Instance.MainForm.Refresh();
                            FunctionInfo newFunc = Controller.Instance.MainForm.UcFunctions.NewFunction(Wizards.frmOutputFileWizard.IterationType);

                            if (newFunc != null)
                            {
                                Wizards.frmOutputFileWizard.FunctionName = newFunc.Name;
                                showFunctions = true;
                            }
                        }
                        else if (Wizards.frmOutputFileWizard.StaticSkipFunction == Wizards.frmOutputFileWizard.SkipFunctionChoice.CreateNew)
                        {
                            FunctionInfo newFunction = new FunctionInfo(
                                NamingHelper.CleanNameCSharp(Wizards.frmOutputFileWizard.StaticFileName) + "_SkipFile",
                                typeof(bool), "return false;", false, SyntaxEditorHelper.ScriptLanguageTypes.CSharp,
                                "Returns true if the static file should be skipped and not generated", "plain text", "Skip Static Files");

                            Project.Instance.AddFunction(newFunction);
                            Wizards.frmFunctionWizard functionForm = new Wizards.frmFunctionWizard(newFunction, true);

                            if (functionForm.ShowDialog(ParentForm) == DialogResult.Cancel)
                            {
                                Project.Instance.DeleteFunction(newFunction);
                                //OwnerTabStripPage.TabStrip.Pages.Remove(OwnerTabStripPage);
                            }
                            file.StaticFileSkipFunctionName = newFunction.Name;
                        }
                        else if (Wizards.frmOutputFileWizard.StaticSkipFunction == Wizards.frmOutputFileWizard.SkipFunctionChoice.UseExisting)
                        {
                            file.StaticFileSkipFunctionName = Wizards.frmOutputFileWizard.FunctionName;
                        }

                        file.Name                = Wizards.frmOutputFileWizard.FileName;
                        file.ScriptName          = Wizards.frmOutputFileWizard.FunctionName;
                        Project.Instance.IsDirty = true;
                        selectedNode.Text        = file.Name;

                        switch (Wizards.frmOutputFileWizard.FileType)
                        {
                        case Wizards.frmOutputFileWizard.FileTypes.Script:
                            file.FileType = OutputFileTypes.Script;
                            ti.FileType   = TagInfo.FileTypes.ScriptFile;
                            selectedNode.Cells[(int)CellTypes.Function].Text = file.ScriptName;
                            selectedNode.Cells[(int)CellTypes.Iterator].Text = file.IteratorTypes;
                            break;

                        case Wizards.frmOutputFileWizard.FileTypes.Static:
                            file.FileType           = OutputFileTypes.File;
                            file.StaticFileIterator = Wizards.frmOutputFileWizard.IterationType;
                            ti.FileType             = TagInfo.FileTypes.NormalFile;
                            selectedNode.Cells[(int)CellTypes.Function].Text = "[File] " + Wizards.frmOutputFileWizard.StaticFileName;

                            if (file.StaticFileIterator != null)
                            {
                                selectedNode.Cells[(int)CellTypes.Iterator].Text           = file.StaticFileIterator.FullName;
                                selectedNode.Cells[(int)CellTypes.Iterator].StyleNormal    = treeFiles.Styles["functionLinkStyle"];
                                selectedNode.Cells[(int)CellTypes.Iterator].StyleMouseOver = treeFiles.Styles["functionLinkHoverStyle"];
                                selectedNode.Cells[(int)CellTypes.Iterator].Cursor         = Cursors.Hand;
                            }
                            if (string.IsNullOrEmpty(file.StaticFileSkipFunctionName) == false)
                            {
                                selectedNode.Cells[(int)CellTypes.SkipFunction].Text           = file.StaticFileSkipFunctionName;
                                selectedNode.Cells[(int)CellTypes.SkipFunction].StyleNormal    = treeFiles.Styles["functionLinkStyle"];
                                selectedNode.Cells[(int)CellTypes.SkipFunction].StyleMouseOver = treeFiles.Styles["functionLinkHoverStyle"];
                                selectedNode.Cells[(int)CellTypes.SkipFunction].Cursor         = Cursors.Hand;
                            }
                            break;

                        default:
                            throw new NotImplementedException("Filetype not handled yet: " + Wizards.frmOutputFileWizard.FileType.ToString());
                        }
                        selectedNode.Tag = ti;
                    }
                    if (showFunctions)
                    {
                        Controller.Instance.MainForm.HidePanelControls(Controller.Instance.MainForm.UcFunctions);
                    }
                }
            }
            finally
            {
                Controller.Instance.MainForm.Activate();
            }
        }