Ejemplo n.º 1
0
 private void mnuFileSave_Click(object sender, EventArgs e)
 {
     if (filepath == null)
     {
         mnuFileSaveAs_Click(sender, e);
     }
     else
     {
         file.Flush();
         RecentFiles.AddRecent(filepath);
     }
 }
Ejemplo n.º 2
0
        void OpenFile(string filename)
        {
            filepath = filename;

            IStorageGraph newgraph;
            bool          isnewfile = false;

            if (string.IsNullOrEmpty(filename))
            {
                newgraph  = new MemoryStorageGraph();
                isnewfile = true;
            }
            else
            {
                switch (Path.GetExtension(filename))
                {
                case ".musicwriter":
                    var stream =
                        File.Open(
                            path: filepath,
                            mode: FileMode.OpenOrCreate,
                            access: FileAccess.ReadWrite,
                            share: FileShare.Read
                            );

                    var archive =
                        new ZipArchive(
                            stream: stream,
                            mode: ZipArchiveMode.Update | ZipArchiveMode.Read
                            );

                    newgraph = new ZipStorageGraph(archive);

                    break;

                case ".musicwriter-dir":
                    throw new NotImplementedException();

                default:
                    throw new NotSupportedException();
                }
            }

            tabScreens.Controls.Clear();

            file = new EditorFile(newgraph, containerfactoryset, isnewfile);
            Setup();

            RecentFiles.AddRecent(filepath);
        }