예제 #1
0
        public String compile(Boolean explorerBit = false)
        {
            if (!(File.Exists(this.instructionsFile)))
            {
                Byte[] defaultInst = Encoding.UTF8.GetBytes("3,-fobj,bin" + Environment.NewLine);
                using (FileStream fs = File.Create(this.instructionsFile))
                    fs.Write(defaultInst, 0, defaultInst.Length);
            }

            OptData data = OptData.getOptData(File.ReadAllLines(this.instructionsFile));
            String  compiledFn = "\"" + compileDir + @"\" + header.pName + "." + data.fileExt + "\"", compileBatchFile = this.compileDir + @"\compile.bat", retVal = compiledFn.Substring(1).Remove(compiledFn.Length - 2);
            String  append = (explorerBit)?"\nexplorer \"" + this.compileDir + '"':"";

            append += (data.bonusInstructions.Count() > 0)?'\n' + data.bonusInstructions.Where(x => (!(String.IsNullOrEmpty(x)))).Select(x => x.Replace("%EXEPATH%", '"' + Application.ExecutablePath + '"').Replace("%BINDIR%", this.compileDir).Replace("%CMPFILE%", compiledFn)).merge("\n"):"";

            this.compileType = data.compileType;

            switch (this.compileType)
            {
            case CompileType.FASM:
                File.WriteAllText(compileBatchFile, "(\ncd \"" + Compiler.exeDir + "\\include\"\n" + "fasm " + '"' + this.entryFile + "\" " + compiledFn + append + "\n)1> \"" + this.compileDir + "\\output.txt\" 2>&1");
                this.compilerProcess = Process.Start(new ProcessStartInfo()
                {
                    FileName = compileBatchFile, CreateNoWindow = true, UseShellExecute = false, WindowStyle = ProcessWindowStyle.Hidden
                });
                return(retVal);

            case CompileType.NASM:
                //TODO:: Load in NASM includes @ compile time, this is probably easy, test if setting WorkingDirectory in the ProcessStartInfo to src folder will work.
                File.WriteAllText(compileBatchFile, "(\ncd \"" + Compiler.exeDir + "\\include\"\n" + "nasm " + data.nasmArgs + " \"" + this.entryFile + "\" -o " + compiledFn + append + "\n)1> \"" + this.compileDir + "\\output.txt\" 2>&1");
                this.compilerProcess = Process.Start(new ProcessStartInfo()
                {
                    FileName = compileBatchFile, CreateNoWindow = true, UseShellExecute = false, WindowStyle = ProcessWindowStyle.Hidden
                });
                return(retVal);

            case CompileType.MASM:
                MessageBox.Show("Sorry!! MASM Is not yet supported!");                         //TODO:: Support compiling with MASM
                return(retVal);

            default:
                this.compilerProcess = Process.Start(new ProcessStartInfo()
                {
                    FileName = @"C:\Windows\Cmd.exe", Arguments = " /c echo whatever"
                });
                return(Compiler.exeDir + @"\invalidCompileType.vbs");
            }
        }
예제 #2
0
        private void CompilerOptionsLoad(Object sender, EventArgs e)
        {
            this.ShowIcon        = false;
            this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            this.MinimizeBox     = true;

            if (!(this.nasmRadioBtn.Checked))
            {
                this.nasmCompileInstruction.Hide();
            }


            if (!(File.Exists(this.fn)))
            {
                Byte[] defaultInst = Encoding.UTF8.GetBytes("3,-fobj,bin" + Environment.NewLine);
                using (FileStream fs = File.Create(this.fn))
                    fs.Write(defaultInst, 0, defaultInst.Length);
            }

            OptData data = OptData.getOptData(File.ReadAllLines(this.fn));

            switch (data.compileType)
            {
            case CompileType.NASM:
                this.selRbtnTR            = "1";
                this.nasmRadioBtn.Checked = true;
                break;

            case CompileType.MASM:
                this.selRbtnTR            = "2";
                this.masmRadioBtn.Checked = true;
                break;

            default:
                this.selRbtnTR            = "3";
                this.fasmRadioBtn.Checked = true;
                break;
            }

            this.nasmCompileInstruction.Text = data.nasmArgs;
            this.compileAsTextBox.Text       = data.fileExt;
        }
예제 #3
0
파일: Util.cs 프로젝트: yuonceruyi/LKEQ
 /// <summary>
 /// 保存员工持款信息
 /// </summary>
 /// <param name="dao"></param>
 /// <param name="data"></param>
 /// <param name="cklx">持款类型 1 挂号 2 门诊 3 住院 4 其他</param>
 /// <param name="je">收款金额</param>
 /// <param name="lsh">流水号 或就诊好</param>
 /// <param name="lx">类型</param>
 public static void SaveYgCk(Dao dao, OptData data, int cklx, decimal je, string lsh, string lx)
 {
     SaveYgCk(dao, data, cklx, je, lsh, lx, true);
 }
예제 #4
0
파일: Util.cs 프로젝트: yuonceruyi/LKEQ
        /// <summary>
        /// 保存员工持款信息
        /// </summary>
        /// <param name="dao"></param>
        /// <param name="data"></param>
        /// <param name="cklx">持款类型 1 挂号 2 门诊 3 住院 4 其他</param>
        /// <param name="je">收款金额</param>
        /// <param name="lsh">流水号 或就诊好</param>
        /// <param name="lx">类型</param>
        /// <param name="allowNull">是否允许持款为空</param>
        public static void SaveYgCk(Dao dao, OptData data, int cklx, decimal je, string lsh, string lx, bool allowNull)
        {
            Dictionary <string, object> param = DaoTool.Get(dao, OptContent.get("MZ_HaveCKList"), data);

            if (param == null)
            {
                if (!allowNull)
                {
                    throw new Exception("员工持款信息无效!");
                }
                data.Param["收款日期"]  = DateTime.Now;
                data.Param["累计持款额"] = je;
                data.Param["累计交款额"] = 0;
                if (cklx == 1)
                {
                    data.Param["挂号人数"] = 1;
                }
                if (cklx == 2)
                {
                    data.Param["门诊人数"] = 1;
                }
                if (DaoTool.Save(dao, OptContent.get("MZ_SaveYGCK"), data) < 0)
                {
                    throw new Exception("保存员工持款信息失败!");
                }
            }
            else
            {
                param["收款日期"]  = DateTime.Now;
                param["累计持款额"] = (new ObjItem(param["累计持款额"]).ToDecimal() + je);
                if (je > 0)
                {
                    if (cklx == 1)
                    {
                        param["挂号人数"] = (new ObjItem(param["挂号人数"]).ToInt() + 1);
                    }
                    if (cklx == 2)
                    {
                        param["门诊人数"] = (new ObjItem(param["门诊人数"]).ToInt() + 1);
                    }
                }
                else
                {
                    if (cklx == 1)
                    {
                        param["挂号人数"] = (new ObjItem(param["挂号人数"]).ToInt() - 1);
                    }
                    if (cklx == 2)
                    {
                        param["门诊人数"] = (new ObjItem(param["门诊人数"]).ToInt() - 1);
                    }
                    decimal ck = new ObjItem(param["累计持款额"]).ToDecimal() + je;
                    // if (ck < 0)
                    //throw new Exception("员工持款额不足于支付退款");
                }
                param["cHosCode"] = data.Param["cHosCode"];
                if (DaoTool.ExecuteNonQuery(dao, OptContent.get("MZ_UpdateYGCKINFO"), param) < 0)
                {
                    throw new Exception("更新员工持款信息失败!");
                }
            }
            data.Param["发生金额"] = je;
            data.Param["发生时间"] = DateTime.Now;
            data.Param["类型"]   = lx;
            data.Param["就诊号"]  = lsh;
            if (DaoTool.Save(dao, OptContent.get("MZ_SaveYGZJL"), data) < 0)
            {
                throw new Exception("保存员工资金流信息失败!");
            }
        }