void Save(string file) { TLYFile t = GetSaveFile(); LasterHelper.SetEnvironmentPath(file); t.Save(file); LastFile = file; }
/// <summary> /// Compila el archivo /// </summary> /// <param name="inputs">Colección de entradas</param> /// <param name="pathForEnvironmentVariable">Ruta para variable de entorno</param> public void Compile(DataInputCollection inputs, string pathForEnvironmentVariable) { // Cargar topología if (Items != null) { foreach (TopologyItem item in Items.Values) { if (item.Item is IDataInput) { inputs.Add((IDataInput)item.Item); } } if (Relations != null) { foreach (Relation rel in Relations) { if (rel.From == rel.To) { continue; } TopologyItem from, to; if (Items.TryGetValue(rel.From, out from) && Items.TryGetValue(rel.To, out to) && from != null && to != null) { if (to.Item is IDataProcess) { from.Item.Process.Add((IDataProcess)to.Item); } } } } // Si los remplazo en diseño, ahora mismo se cambiarian en real, tendria que runearse una copia, y no el de edición RemplaceVariables(inputs, Variables, null); } LasterHelper.SetEnvironmentPath(pathForEnvironmentVariable); }
void NewTopology() { if (_InPlay) { // Stop-it playToolStripMenuItem_Click(null, null); } LastFile = ""; _Lines.Clear(); _Current = new ConnectedLine(); Select(null); _Vars.Clear(); _VariableCache.Clear(); generateExeToolStripMenuItem.Enabled = false; LasterHelper.SetEnvironmentPath(null); foreach (UCTopologyItem u in _List.ToArray()) { Delete(u); } }
void LoadFile(string fileName) { TLYFile t = null; bool isFile = false; try { if (File.Exists(fileName)) { t = TLYFile.LoadFromFile(fileName); isFile = true; } else { t = TLYFile.Load(fileName); } } catch (Exception e) { ITopologyItem_OnException(null, e); return; } if (t != null) { NewTopology(); if (isFile) { LasterHelper.SetEnvironmentPath(fileName); LastFile = fileName; } else { LasterHelper.SetEnvironmentPath(""); LastFile = ""; } if (t.Variables != null) { foreach (Variable v in t.Variables) { _Vars.Add(v.Clone()); } } if (t.Items.Values != null) { foreach (TLYFile.TopologyItem i in t.Items.Values) { CreateItem(i.Item, i.Position); } if (t.Relations != null) { foreach (TLYFile.Relation rel in t.Relations) { TLYFile.TopologyItem from, to; if (t.Items.TryGetValue(rel.From, out from) && t.Items.TryGetValue(rel.To, out to) && from != null && to != null) { UCTopologyItem searchFrom = SearchControl(from.Item); UCTopologyItem searchTo = SearchControl(to.Item); if (searchFrom != null && searchTo != null) { _Lines.Add(new ConnectedLine() { From = searchFrom, To = searchTo }); if (to.Item is IDataProcess) { from.Item.Process.Add((IDataProcess)to.Item); } } } } } } pItems.Invalidate(); } }