public bool InitOpen(string fullPath, string[] buf, EnmMmlFileFormat srcFileFormat) { fullPath = fullPath.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar); if (buf == null || buf.Length < 1) { return(false); } gwiFullPath = fullPath; errBox = null; wrnBox = null; InitFolderTree(); editor.Text = Path.GetFileName(fullPath); this.srcFileFormat = srcFileFormat; editor.azukiControl.Text = string.Join("\r\n", buf); editor.azukiControl.ClearHistory(); editor.Tag = this; editor.azukiControl.Tag = this; isNew = false; edit = false; compileStatus = EnmCompileStatus.NeedCompile; dstFileFormat = EnmFileFormat.unknown; compiledData = null; return(true); }
public bool InitOpen(string fullPath) { fullPath = fullPath.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar); if (!File.Exists(fullPath)) { return(false); } gwiFullPath = fullPath; errBox = null; wrnBox = null; InitFolderTree(); editor.Text = Path.GetFileName(fullPath); switch (Path.GetExtension(fullPath).ToLower()) { case ".muc": srcFileFormat = EnmMmlFileFormat.MUC; editor.azukiControl.Text = File.ReadAllText(fullPath, Encoding.GetEncoding(932)); break; case ".mml": srcFileFormat = EnmMmlFileFormat.MML; editor.azukiControl.Text = File.ReadAllText(fullPath, Encoding.GetEncoding(932)); break; case ".mdl": srcFileFormat = EnmMmlFileFormat.MDL; editor.azukiControl.Text = File.ReadAllText(fullPath, Encoding.GetEncoding(932)); break; case ".gwi": default: srcFileFormat = EnmMmlFileFormat.GWI; editor.azukiControl.Text = File.ReadAllText(fullPath); break; } editor.azukiControl.ClearHistory(); editor.Tag = this; editor.azukiControl.Tag = this; isNew = false; edit = false; compileStatus = EnmCompileStatus.NeedCompile; dstFileFormat = EnmFileFormat.unknown; compiledData = null; return(true); }
public Document(Setting setting, bool isMUC) { gwiFullPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "(新規mmlファイル).gwi"); errBox = null; wrnBox = null; InitFolderTree(); editor = new FrmEditor(setting, isMUC); editor.Text = Path.GetFileName(gwiFullPath + "*"); string filename = Path.Combine(System.Windows.Forms.Application.StartupPath, "Template.gwi"); editor.azukiControl.Text = ""; try { editor.azukiControl.Text = File.ReadAllText(filename); } catch {; } editor.azukiControl.ClearHistory(); editor.Tag = this; editor.azukiControl.Tag = this; isNew = true; edit = false; compileStatus = EnmCompileStatus.None; srcFileFormat = EnmMmlFileFormat.GWI; dstFileFormat = EnmFileFormat.unknown; compiledData = null; }