slagtool.Filelist convert_inc(string f) { var fl = new slagtool.Filelist(); string[] readlist = null; try { readlist = File.ReadAllLines(f, Encoding.UTF8); } catch { return(null); } if (readlist == null || readlist.Length == 0) { return(null); } fl.root = Path.GetDirectoryName(f); foreach (var l in readlist) { var nl = l.Trim(); if (string.IsNullOrEmpty(nl) || nl.StartsWith("//")) { continue; } fl.filesAdd(nl); } return(fl); }
/// <summary> /// バイナリロード /// </summary> public void LoadBin(byte[] bin) { //m_curslag = this; var d = deserialize(bin); //m_idlist = d.ids; m_filelist = d.filelist; m_exelist = d.list; }
/// <summary> /// テキストソースロード /// id はデバッグ時の認識に利用 /// </summary> public void LoadSrc(string src, string id = null) { if (id == null) { id = TMPFILENAME; } m_filelist = new Filelist(id); m_exelist = util_sub.Compile(src); }
/// <summary> /// 拡張子JSのファイル(複数)をロード /// </summary> public void LoadJSFiles(Filelist filenames) { var sources = new List <string>(); for (var i = 0; i < filenames.Count; i++) { sources.Add(File.ReadAllText(filenames.GetFullPath(i))); } m_filelist = filenames; m_exelist = util_sub.Compile(sources); }
private byte[] serialize(List <YVALUE> list, Filelist filelist) { var d = new SaveFormat(); d.filelist = filelist; d.list = list; var bf = new BinaryFormatter(); using (var ms = new MemoryStream()) { bf.Serialize(ms, d); return(ms.ToArray()); } }
public static slagtool.slag Load(string path, string[] files) { var file_list = new slagtool.Filelist();//new List<string>(); file_list.root = path; for (var i = 0; i < files.Length; i++) { var file = files[i]; if (!file.ToUpper().EndsWith(".JS")) { SendWriteLine("ERROR:File is not JS :" + file); return(null); } file_list.filesAdd(file); } if (slagtool.sys.USETRY) { try { m_slagunity.LoadJSFiles(file_list); } catch (SystemException e) { SendWriteLine("-- EXCEPTION --"); SendWriteLine(e.Message); SendWriteLine("---------------"); return(null); } } else { m_slagunity.LoadJSFiles(file_list); } SendWriteLine("Loaded."); SendWriteLine("Checksum:" + m_slagunity.GetMD5()); return(m_slagunity.m_slag); }
/// <summary> /// 拡張子JSファイル(複数)をロード /// </summary> public void LoadJSFiles(slagtool.Filelist files) { m_slag.LoadJSFiles(files); }