/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="document">The script document</param>
 /// <param name="className">The class name</param>
 public ScriptNetworkLayerFactory(ScriptDocument document, string className)
 {
     Script = document;
     ClassName = className;
     Description = Properties.Resources.ScriptNetworkLayerFactory_Name;
     _config = new Dictionary<string, object>();
     _desc = new ScriptDynamicTypeDescriptor(this);
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="document">The script document</param>
 /// <param name="className">The class name</param>
 public ScriptDataEndpointFactory(ScriptDocument document, string className)
     : base(className, new ServerConfig())
 {
     ServerConfig config = Config as ServerConfig;
     config.SetFactory(this);
     Script = document;
     ClassName = className;
 }
示例#3
0
        public ScriptOptionsForm(ScriptDocument document)
        {
            InitializeComponent();
            _document = document;

            checkBoxEnableDebug.Checked = _document.Container.EnableDebug;
            dynamicConfigEditorControl.Properties = _document.Configuration.ToArray();

            LoadReferenceList(_document.Container.ReferencedNames);
        }
示例#4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="document">The script document to test</param>
 public ScriptTestDocument(ScriptDocument document)
 {
     #pragma warning disable 612
     _document = null;
     _path = null;
     #pragma warning restore 612
     _config = new DynamicNodeConfig();
     _config.Label = "node";
     _config.Script = document;
     _config.DirtyChanged += new EventHandler(_config_DirtyChanged);
 }
示例#5
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="document">The script document to test</param>
        public ScriptTestDocument(ScriptDocument document)
        {
#pragma warning disable 612
            _document = null;
            _path     = null;
#pragma warning restore 612
            _config               = new DynamicNodeConfig();
            _config.Label         = "node";
            _config.Script        = document;
            _config.DirtyChanged += new EventHandler(_config_DirtyChanged);
        }
示例#6
0
        // TODO: Fix this :)
        public ScriptDocumentControl(IDocumentObject document, bool forParserDocument)
        {
            _document = (ScriptDocument)document;
            _currText = _document.Script;

            InitializeComponent();

            Text = _document.Name;

            ScriptDocumentControlConfig config = _document.GetProperty<ScriptDocumentControlConfig>(DOCUMENT_CONFIG_NAME, false);

            UpdateConfig(config ?? DocumentControl.GetConfigItem<ScriptDocumentControlConfig>(GetConfigForEngine(_document.Container.Engine), true));

            LoadFile(_document.Script);

            _forParserDocument = forParserDocument;

            if (!forParserDocument)
            {
                if (this.ParentForm != null)
                {
                    this.ParentForm.FormClosing += new FormClosingEventHandler(ParentForm_FormClosing);
                }
            }

            textEditorControl.ActiveTextAreaControl.Document.UndoStack.OperationPushed +=
                new OperationEventHandler(UndoStack_OperationPushed);
            textEditorControl.ActiveTextAreaControl.Document.UndoStack.ActionUndone += new EventHandler(UndoStack_ActionUndone);
            textEditorControl.ActiveTextAreaControl.Document.UndoStack.ActionRedone += new EventHandler(UndoStack_ActionUndone);

            if (GlobalControlConfig.ScriptEditorFont != null)
            {
                textEditorControl.Font = GlobalControlConfig.ScriptEditorFont;
            }

            if (forParserDocument)
            {
                toolStripButtonSave.Visible = false;
                toolStripButtonOptions.Visible = false;
                toolStripButtonOpenTest.Visible = false;
            }
        }
示例#7
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (scriptSelectionControl.Document == null)
     {
         MessageBox.Show(this, CANAPE.Properties.Resources.ScriptSelectForm_NoDocument, CANAPE.Properties.Resources.ScriptSelectForm_Caption,
             MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (String.IsNullOrWhiteSpace(scriptSelectionControl.ClassName))
     {
         MessageBox.Show(this, CANAPE.Properties.Resources.ScriptSelectForm_NoClass, CANAPE.Properties.Resources.ScriptSelectForm_Caption,
                 MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Document = scriptSelectionControl.Document;
         ClassName = scriptSelectionControl.ClassName;
         DialogResult = DialogResult.OK;
         Close();
     }
 }
示例#8
0
        private static ScriptDocument FindScriptDocument(string name)
        {
            ScriptDocument doc = CANAPEProject.CurrentProject.GetDocumentByName(name) as ScriptDocument;

            if (doc == null)
            {
                Guid g;

                if (Guid.TryParse(name, out g))
                {
                    doc = CANAPEProject.CurrentProject.GetDocumentByUuid(g) as ScriptDocument;
                }

                if (doc == null)
                {
                    throw new ArgumentException(String.Format(CANAPE.Documents.Properties.Resources.ScriptDocument_CannotFindDocument, name));
                }
            }

            return(doc);
        }
示例#9
0
 public ScriptStringConverter(ScriptDocument document)
 {
     _document = document;
 }
示例#10
0
 private void ApplyScript_Click(ScriptDocument script)
 {
     try
     {
         ApplyStringConverter(ScriptUtils.GetInstance<IStringConverter>(script.Container) ?? new ScriptStringConverter(script));
     }
     catch (Exception ex)
     {
         MessageBox.Show(this,
             ex.Message, CANAPE.Properties.Resources.MessageBox_ErrorString,
             MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#11
0
        protected override bool SelectScript(ScriptDocument document, string className)
        {
            Server = new ScriptDataEndpointFactory(document, className);

            return true;
        }
示例#12
0
        protected override bool SelectScript(ScriptDocument document, string className)
        {
            Factory = new ScriptNetworkLayerFactory(document, className);

            return true;
        }
示例#13
0
 protected virtual bool SelectScript(ScriptDocument document, string className)
 {
     // Do nothing
     return true;
 }
示例#14
0
 private void ReloadScript()
 {
     if ((_script == null) && (_uuid != Guid.Empty))
     {
         _script = (ScriptDocument)CANAPEProject.CurrentProject.GetDocumentByUuid(_uuid);
         if (_script == null)
         {
             _uuid = Guid.Empty;
             ClassName = String.Empty;
         }
     }
 }
示例#15
0
 public ScriptPacketLogExtension(ScriptDocument document)
 {
     _document = document;
 }
示例#16
0
 void RunScript_Click(ScriptDocument script)
 {
     try
     {
         RunPacketLogExtension(ScriptUtils.GetInstance<IPacketLogExtension>(script.Container)
             ?? new ScriptPacketLogExtension(script));
     }
     catch (Exception ex)
     {
         MessageBox.Show(this,
             ex.Message, CANAPE.Properties.Resources.MessageBox_ErrorString,
             MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }