コード例 #1
0
ファイル: ModuleSchemaTest.cs プロジェクト: xiulolz/DemoCode
        private static Module TryLoadModule(string name)
        {
            var    ns           = typeof(ModuleSchemaTest).Namespace;
            string filename     = name.ToLowerInvariant().Replace("-", "") + ".vdrum";
            string resourceName = $"{ns}.{filename}";

            using (var stream = typeof(ModuleSchemaTest).Assembly.GetManifestResourceStream(resourceName))
            {
                if (stream == null)
                {
                    return(null);
                }
                return((Module)ProtoIo.ReadStream(stream));
            }
        }
コード例 #2
0
 // It's unpleasant having this here, but I'm not sure of the alternative...
 /// <summary>
 /// Reads the given stream as drum data, returning a Kit or a Module depending
 /// on the data within the stream.
 /// </summary>
 public static object ReadStream(Stream stream) => ProtoIo.ReadStream(stream);