コード例 #1
0
        private void autoCompile(string file = "")
        {
            if (file != String.Empty)
            {
                if (readFile(file))
                {
                    return;
                }
            }

            if (!m_bFileLoaded)
            {
                Console.Clear();
                Console.WriteLine("-> CKT-PLC-Compile <-");
                Console.WriteLine("-- ERROR ------------");
                Console.WriteLine("No file loaded! Press any key!");
                Console.ReadKey();
            }

            bool     result   = false;
            int      errLine  = -1;
            string   msg      = "";
            ICompile Compiler = null;

            switch (m_iExtensionIndex)
            {
            case eValidExtensions.ED:
                Compiler = new CompilerCED();
                result   = Compiler.loadData(@"..\..\..\RES\COMPILER\CMD_VERSIONS.CRD", out msg);
                break;

            case eValidExtensions.DB:
                Compiler = new CompilerCDB();
                break;

            case eValidExtensions.FB:
                Compiler = new CompilerCFB();
                break;

            case eValidExtensions.PR:
                Compiler = new CompilerCPR();
                break;

            case eValidExtensions.PV:
                Compiler = new CompilerCPV();
                break;

            case eValidExtensions.EV:
                Compiler = new CompilerCEV();
                break;
            }


            result = Compiler.compile(m_FileData, out errLine, out msg);

            if (result)
            {
                Console.Clear();
                Console.WriteLine("-> CKT-PLC-Compile <-");
                Console.WriteLine("-- ERROR ------------");
                Console.WriteLine(msg);
                Console.WriteLine("LINE: " + errLine);
                Console.WriteLine("Press any key!");
                Console.ReadKey();
                return;
            }

            result = Compiler.write(out msg);

            Console.Clear();
            Console.WriteLine("-> CKT-PLC-Compile <-");
            Console.WriteLine("-- COMPLETE----------");
            Console.WriteLine(msg);
            Console.WriteLine("Press any key!");
            Console.ReadKey();
        }
コード例 #2
0
ファイル: App.cs プロジェクト: Chefkoch85/CKT_PLC
		private void autoCompile(string file = "")
		{
			if(file != String.Empty)
			{
				if(readFile(file))
				{
					return;
				}
			}

			if(!m_bFileLoaded)
			{
				Console.Clear();
				Console.WriteLine("-> CKT-PLC-Compile <-");
				Console.WriteLine("-- ERROR ------------");
				Console.WriteLine("No file loaded! Press any key!");
				Console.ReadKey();
			}
			
			bool result = false;
			int errLine = -1;
			string msg = "";
			ICompile Compiler = null;
			switch(m_iExtensionIndex)
			{
				case eValidExtensions.ED:
					Compiler = new CompilerCED();
					result = Compiler.loadData(@"..\..\..\RES\COMPILER\CMD_VERSIONS.CRD", out msg);
					break;
					
				case eValidExtensions.DB:
					Compiler = new CompilerCDB();
					break;
					
				case eValidExtensions.FB:
					Compiler = new CompilerCFB();
					break;

				case eValidExtensions.PR:
					Compiler = new CompilerCPR();
					break;

				case eValidExtensions.PV:
					Compiler = new CompilerCPV();
					break;

				case eValidExtensions.EV:
					Compiler = new CompilerCEV();
					break;
			}


			result = Compiler.compile(m_FileData, out errLine, out msg);

			if (result)
			{
				Console.Clear();
				Console.WriteLine("-> CKT-PLC-Compile <-");
				Console.WriteLine("-- ERROR ------------");
				Console.WriteLine(msg);
				Console.WriteLine("LINE: " + errLine);
				Console.WriteLine("Press any key!");
				Console.ReadKey();
				return;
			}

			result = Compiler.write(out msg);

			Console.Clear();
			Console.WriteLine("-> CKT-PLC-Compile <-");
			Console.WriteLine("-- COMPLETE----------");
			Console.WriteLine(msg);
			Console.WriteLine("Press any key!");
			Console.ReadKey();

		}