コード例 #1
0
 //- ~Serialize -//
 internal static String Serialize(ScriptCatalog scriptCatalog)
 {
     MemoryStream stream = new MemoryStream();
     DataContractSerializer serializer = new DataContractSerializer(_type);
     serializer.WriteObject(stream, scriptCatalog);
     //+
     return UTF8Encoding.UTF8.GetString(stream.ToArray());
 }
コード例 #2
0
 //- ~GetVolatileData -//
 internal static String GetVolatileData(ScriptCatalog scriptCatalog)
 {
     Func<Script, Boolean> frameworkIsCompatible = p => IsFrameworkCompatible(scriptCatalog.Framework, p.Framework());
     String domLoadDataVolatile;
     String loadDataVolatile;
     String adHocVolatile;
     //+ domLoadDataVolatile
     StringBuilder builder = new StringBuilder();
     scriptCatalog.DomLoadDataListVolatile.Where(frameworkIsCompatible).ToList().ForEach(p => builder.AppendLine(p.Content()));
     domLoadDataVolatile = builder.ToString();
     //+ loadDataVolatile
     builder = new StringBuilder();
     scriptCatalog.LoadDataListVolatile.Where(frameworkIsCompatible).ToList().ForEach(p => builder.AppendLine(p.Content()));
     loadDataVolatile = builder.ToString();
     //+ adHocVolatile
     builder = new StringBuilder();
     scriptCatalog.AdHocDataListVolatile.Where(frameworkIsCompatible).ToList().ForEach(p => builder.AppendLine(p.Content()));
     adHocVolatile = builder.ToString(); ;
     //+
     builder = new StringBuilder();
     builder.AppendLine(Template.Interpolate(scriptCatalog.DomLoadTemplate, MapEntry.Create("Code", domLoadDataVolatile)));
     builder.AppendLine(Template.Interpolate(scriptCatalog.PageLoadTemplate, MapEntry.Create("Code", loadDataVolatile)));
     builder.AppendLine(adHocVolatile);
     //+
     return builder.ToString();
 }