public FrmViewSpreadsheet( string markup ) { this.InitializeComponent(); UiControls.SetIcon( this ); FileLoadInfo fli = UiControls.GetFileLoadInfo(); this.tableLayoutPanel1.ColumnStyles.Clear(); Type t = fli.GetType(); string[] lines = markup.Split( "\r\n".ToCharArray() ); string data = null; StringBuilder description = new StringBuilder(); foreach (string line in lines.Skip( 1 )) { if (line.StartsWith( "{" ) && line.EndsWith( "}" )) { this.AddDescription( data, description.ToString() ); string name = line.Substring( 1, line.Length - 2 ); if (name.StartsWith( "=" )) { data = name.Substring( 1 ); } else if (name == "") { data = "This is the first cell of the spreadsheet and must be left empty."; } else if (name == "META") { data = "All further columns -->"; } else { FieldInfo field = t.GetField( name ); string[] value = (string[])field.GetValue( fli ); data = "\"" + string.Join( "\" or \"", value ) + "\""; } description.Clear(); } else { description.AppendLine( line ); } } this.AddDescription( data, description.ToString() ); }
public static FileLoadInfo OpenFile(string filename) { FileLoadInfo ret = null; #if UNITY_ANDROID && !UNITY_EDITOR WWW file = StreamAssetHelper.LoadAsset(StreamAssetRoot.LUA_ROOT, filename); while (!file.isDone && (file.progress < 0.9f)) { Thread.Sleep(100); } if (file.bytes != null) { MemoryStream stream = new MemoryStream(file.bytes); ret = new FileLoadInfo(stream); } #else Stream stream = StreamAssetHelper.LoadFile(StreamAssetRoot.LUA_ROOT, filename); ret = new FileLoadInfo(stream); #endif return(ret); }