private void buttonLoad_Click(object sender, EventArgs e) { if (CategoryTheory.BinaryLoader.Object == null || Diagram.UI.BinaryChooser.Object == null) { return; } Diagram.UI.BinaryChooser.Object.Show(this, "dll"); if (Diagram.UI.BinaryChooser.Object.Name == null) { return; } textBoxDB.Text = Diagram.UI.BinaryChooser.Object.Name + ""; id = Diagram.UI.BinaryChooser.Object.Id; string[] names = LibraryObjectWrapper.GetNames(id); if (names == null) { return; } comboBoxName.Items.Clear(); foreach (string it in names) { comboBoxName.Items.Add(it); } buttonBrowse.Enabled = false; }
void Load() { byte[] bytesOut; Assembly ass = LibraryObjectWrapper.Load(bytes, out bytesOut); IArrowFactory f = GetFactory(ass); theArrow = f[name]; ICategoryArrow arr = this; theArrow.SetAssociatedObject(arr.Object); }
/// <summary> /// Constructor /// </summary> /// <param name="label">Associated label</param> /// <param name="wrapper">Library object</param> public FormLibraryObject(IObjectLabel label, LibraryObjectWrapper wrapper) { this.label = label; this.wrapper = wrapper; InitializeComponent(); this.LoadControlResources(ControlUtilites.Resources); if (CategoryTheory.BinaryLoader.Object == null || Diagram.UI.BinaryChooser.Object == null) { buttonLoad.Enabled = false; } UpdateFormUI(); }
/// <summary> /// Adds dynamic link library /// </summary> /// <param name="filename">Library file</param> public void Add(string filename) { Stream stream = File.OpenRead(filename); byte[] b = new byte[stream.Length]; stream.Read(b, 0, b.Length); stream.Close(); byte[] bytesOut; assembly = LibraryObjectWrapper.Load(b, out bytesOut); bytes.Add(b); names.Add(filename); }
private void buttonBrowse_Click(object sender, EventArgs e) { if (openFileDialogDLL.ShowDialog(this) != DialogResult.OK) { return; } string fn = openFileDialogDLL.FileName + ""; string[] names = LibraryObjectWrapper.GetNames(fn); if (names == null) { return; } textBoxFileName.Text = fn; comboBoxName.Items.Clear(); foreach (string it in names) { comboBoxName.Items.Add(it); } buttonLoad.Enabled = false; }
void fill() { if (wrapper.FileName == null) { return; } textBoxFileName.Text = wrapper.FileName; string[] items = LibraryObjectWrapper.GetNames(wrapper.FileName); int n = 0; int sel = 0; foreach (string it in items) { comboBoxName.Items.Add(it); if (it.Equals(wrapper.Name)) { sel = n; } ++n; } comboBoxName.SelectedIndex = sel; }
/// <summary> /// Initialization /// </summary> protected void init() { byte[] bytesOut = null; int i = 0; List <byte[]> lb = new List <byte[]>(bytes); foreach (byte[] b in lb) { assembly = LibraryObjectWrapper.Load(b, out bytesOut); if (bytesOut != null) { bytes[i] = bytesOut; } ++i; } IObjectFactory factory = Factory; theObject = factory[name]; childern[0] = theObject; IPropertiesEditor pe = theObject.GetObject <IPropertiesEditor>(); if ((properties != null) & (pe != null)) { pe.Properties = properties; } if (bytesOut != null) { Interfaces.ISeparatedAssemblyEditedObject ine = theObject.GetObject <Interfaces.ISeparatedAssemblyEditedObject>(); if (ine != null) { ine.FirstLoad(); } } if (Object != null) { theObject.SetAssociatedObject(Object); } }