public bool TryGetFigure(out TSOFigure fig) { fig = null; if (figureIndex < TSOFigureList.Count) { fig = TSOFigureList[figureIndex]; } return(fig != null); }
public void LoadTSOFile(Stream source) { TSOFigure fig = GetSelectedOrCreateFigure(); List <TSOFile> tso_list = fig.LoadTSOFile(source); foreach (TSOFile tso in tso_list) { tso.Open(device, effect); fig.AddTSO(tso); } }
public void AddFigureFromTSODirectory(string source_file) { TSOFigure fig = new TSOFigure(); List <TSOFile> tso_list = fig.LoadTSOFile(source_file); foreach (TSOFile tso in tso_list) { tso.Open(device, effect); fig.AddTSO(tso); } figureIndex = TSOFigureList.Count; TSOFigureList.Add(fig); }
public List <TSOFigure> LoadPNGFile(string source_file) { List <TSOFigure> fig_list = new List <TSOFigure>(); if (File.Exists(source_file)) { try { PNGFile png = new PNGFile(); TSOFigure fig = null; TMOFile tmo = null; png.Hsav += delegate(string type) { fig = new TSOFigure(); fig_list.Add(fig); }; png.Lgta += delegate(Stream dest, int extract_length) { fig = new TSOFigure(); fig_list.Add(fig); }; png.Ftmo += delegate(Stream dest, int extract_length) { tmo = new TMOFile(); tmo.Load(dest); fig.Tmo = tmo; }; png.Figu += delegate(Stream dest, int extract_length) { }; png.Ftso += delegate(Stream dest, int extract_length, byte[] opt1) { TSOFile tso = new TSOFile(); tso.Load(dest); fig.TSOList.Add(tso); }; png.Load(source_file); } catch (Exception ex) { Console.WriteLine("Error: " + ex); } } return(fig_list); }
public TSOFigure GetSelectedOrCreateFigure() { TSOFigure fig; if (TSOFigureList.Count == 0) { fig = new TSOFigure(); } else { fig = TSOFigureList[figureIndex]; } if (TSOFigureList.Count == 0) { figureIndex = TSOFigureList.Count; TSOFigureList.Add(fig); } return(fig); }