예제 #1
0
        public static OutputViewController Create(string name, ScriptStore store, ScriptRunner runner)
        {
            UIStoryboard         mainStoryboard       = UIStoryboard.FromName("Main", null);
            OutputViewController outputViewController = (OutputViewController)mainStoryboard.InstantiateViewController("OutputViewController");

            outputViewController.scriptName = name;
            outputViewController.store      = store;
            outputViewController.runner     = runner;
            return(outputViewController);
        }
예제 #2
0
        void OnAddNewFile(EditScriptViewController editScriptViewController, string name)
        {
            name = ScriptStore.FixName(name);

            if (!dataSource.Exists(name))
            {
                WriteNewFileAndReloadList(name);
                editScriptViewController.Dismiss();
                PerformSegue("showDetail", this);
                return;
            }

            ConfirmFileReplace(editScriptViewController, name, Replace_AddNew_Dismissed);
        }
예제 #3
0
        void OnRenameScript(EditScriptViewController editViewController, string oldName, string newName)
        {
            newName = ScriptStore.FixName(newName);
            // No-op
            if (oldName == newName)
            {
                editViewController.Dismiss();
                return;
            }

            string existingFile = scripts.FirstOrDefault(s => s.Equals(newName, StringComparison.OrdinalIgnoreCase));

            existingFile = existingFile ?? newName;

            if (oldName.Equals(newName, StringComparison.OrdinalIgnoreCase) || !Exists(newName))
            {
                Store.RenameFile(oldName, newName, existingFile);
                editViewController.Dismiss();
                Reload();
                controller.TableView.ReloadData();
                if (controller.ScriptViewController?.ScriptName == oldName)
                {
                    controller.ScriptViewController.SetScript(newName);
                }
                return;
            }


            controller.ConfirmFileReplace(editViewController, newName, (edit, n) =>
            {
                Store.RenameFile(oldName, newName, existingFile);
                edit.Dismiss();
                Reload();
                controller.TableView.ReloadData();
                if (controller.ScriptViewController?.ScriptName == oldName)
                {
                    controller.ScriptViewController.SetScript(newName);
                }
            });
        }
예제 #4
0
 public ScriptsDataSource(ScriptListViewController controller)
 {
     this.controller = controller;
     Store           = new ScriptStore(LocalPathPrepare.ScriptsPath);
 }