Exemplo n.º 1
0
        static void Main(string[] args)
        {
            int?seed = null;

            Log.writeLine = write;

            try
            {
                title();//タイトル表示

                //オプションチェック
                int fnIndex = AnalyzeOption(args, ref seed);

                //ファイル名が指定されていない場合はusageを表示して終了
                if (args.Length < fnIndex + 1)
                {
                    DEF.PF("usage: m98.exe [-SEED=n] file1 [file2]");
                    throw new M98Exception();
                }

                string srcFile = args[fnIndex + 0];                              //変換対象ファイル
                string orgfile = Path.ChangeExtension(args[fnIndex + 0], "ORG"); //初版ファイル
                string bupfile = Path.ChangeExtension(args[fnIndex + 0], "BUP"); //処理前のファイル
                string saveFn  = args[fnIndex + 0];                              //処理後のファイル。(ソースと同名で上書き保存)
                //引数で別名が指定されていたらそれを使用して保存
                if (args.Length != fnIndex + 1)
                {
                    saveFn = args[fnIndex + 1];
                }

                if (!File.Exists(orgfile))
                {
                    DEF.PF("新規テキストなので、.orgファイルを作成します");
                    File.Copy(srcFile, orgfile);//.orgファイルの作成
                }

                File.Copy(srcFile, bupfile, true);//.bupファイルの作成


                //M98で処理実施
                M98 m98 = new M98(null);
                m98.seed = seed;

                using (FileStream sourceMML = new FileStream(srcFile, FileMode.Open, FileAccess.Read, FileShare.Read))
                    using (FileStream destMML = new FileStream(saveFn, FileMode.Create, FileAccess.Write))
                    {
                        m98.Preprocess(sourceMML, destMML, null);
                    }
            }
            catch (M98Exception)
            {
                Environment.Exit(-1);
            }

            DEF.PF("Complete.");
            Environment.Exit(0);
        }
Exemplo n.º 2
0
        public command(flag f, M98 m98)
        {
            this.m98 = m98;

            allflgis(f);
            name = "";            //, '\0', DEF.MAXCOMNAME);
            for (int i = 0; i < DEF.MAXCOMP; i++)
            {
                prm[0][i] = 0;
                prm[1][i] = 0;
            }
            spnum = pnum = 0;
        }
Exemplo n.º 3
0
 public TONE(flag a, M98 m98)
 {
     this.m98 = m98;
 }
Exemplo n.º 4
0
 public static void setup(M98 m98)
 {
     gWork.m98 = m98;
     com       = new command(flag.ON, m98);
 }