The class here is also for convenience; The LoadCSharp macro calls Init().
Пример #1
0
        /// <inheritdoc />
        public void CreateAnalog(SmartEntity sourceEntity, bool copyLayer)
        {
#if !DEBUG
            ModPlusAPI.Statistic.SendCommandStarting(
                GroundLine.GetDescriptor().Name, ModPlusConnector.Instance.AvailProductExternalVersion);
#endif

            try
            {
                Overrule.Overruling = false;

                /* Регистрация ЕСКД приложения должна запускаться при запуске
                 * функции, т.к. регистрация происходит в текущем документе
                 * При инициализации плагина регистрации нет!
                 */
                ExtendedDataUtils.AddRegAppTableRecord(GroundLine.GetDescriptor());

                var groundLine     = new GroundLine();
                var blockReference = MainFunction.CreateBlock(groundLine);

                groundLine.SetPropertiesFromSmartEntity(sourceEntity, copyLayer);

                LinearEntityUtils.InsertWithJig(groundLine, blockReference);
            }
            catch (System.Exception exception)
            {
                ExceptionBox.Show(exception);
            }
            finally
            {
                Overrule.Overruling = true;
            }
        }
Пример #2
0
        private void CreateGroundLine()
        {
            try
            {
                Overrule.Overruling = false;

                /* Регистрация ЕСКД приложения должна запускаться при запуске
                 * функции, т.к. регистрация происходит в текущем документе
                 * При инициализации плагина регистрации нет!
                 */
                ExtendedDataUtils.AddRegAppTableRecord(GroundLine.GetDescriptor());

                var style      = StyleManager.GetCurrentStyle(typeof(GroundLine));
                var groundLine = new GroundLine();

                var blockReference = MainFunction.CreateBlock(groundLine);
                groundLine.ApplyStyle(style, true);

                LinearEntityUtils.InsertWithJig(groundLine, blockReference);
            }
            catch (System.Exception exception)
            {
                ExceptionBox.Show(exception);
            }
            finally
            {
                Overrule.Overruling = true;
            }
        }
Пример #3
0
 /// <summary>
 /// Prevent console window from disappearing before the user sees it.
 /// </summary>
 /// <param name="main"></param>
 public static void InvokeMain(MainFunction main)
 {
     if (String.IsNullOrEmpty(Process.GetCurrentProcess().
                              MainWindowTitle))
     {
         // Process is running in its parent's console window.  The
         // user will see output and any exceptions raised.
         main();
         return;
     }
     // Prevent console window from disappearing before user
     // sees it.
     try
     {
         main();
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
         throw;
     }
     finally
     {
         {
             Console.WriteLine("\nPress any key...");
             Console.ReadKey();
         }
     }
 }
Пример #4
0
        private static void CreateBreakLine(BreakLineType breakLineType)
        {
            // send statistic
            Statistic.SendCommandStarting(BreakLineDescriptor.Instance.Name, ModPlusConnector.Instance.AvailProductExternalVersion);
            try
            {
                Overrule.Overruling = false;

                /* Регистрация ЕСКД приложения должна запускаться при запуске
                 * функции, т.к. регистрация происходит в текущем документе
                 * При инициализации плагина регистрации нет!
                 */
                ExtendedDataUtils.AddRegAppTableRecord(BreakLineDescriptor.Instance.Name);
                var style     = StyleManager.GetCurrentStyle(typeof(BreakLine));
                var breakLine = new BreakLine();

                var blockReference = MainFunction.CreateBlock(breakLine);
                breakLine.ApplyStyle(style, true);
                breakLine.BreakLineType = breakLineType;

                InsertBreakLineWithJig(breakLine, blockReference);
            }
            catch (System.Exception exception)
            {
                ExceptionBox.Show(exception);
            }
            finally
            {
                Overrule.Overruling = true;
            }
        }
Пример #5
0
        /// <inheritdoc/>
        public void CreateAnalog(IntellectualEntity sourceEntity, bool copyLayer)
        {
#if !DEBUG
            Statistic.SendCommandStarting(LevelMarkDescriptor.Instance.Name, ModPlusConnector.Instance.AvailProductExternalVersion);
#endif
            try
            {
                Overrule.Overruling = false;

                /* Регистрация ЕСКД приложения должна запускаться при запуске
                 * функции, т.к. регистрация происходит в текущем документе
                 * При инициализации плагина регистрации нет!
                 */
                ExtendedDataUtils.AddRegAppTableRecord(LevelMarkDescriptor.Instance.Name);
                var levelMark = new LevelMark();

                var blockReference = MainFunction.CreateBlock(levelMark);

                levelMark.SetPropertiesFromIntellectualEntity(sourceEntity, copyLayer);

                InsertLevelMarkWithJig(levelMark, blockReference);
            }
            catch (System.Exception exception)
            {
                ExceptionBox.Show(exception);
            }
            finally
            {
                Overrule.Overruling = true;
            }
        }
Пример #6
0
        /// <inheritdoc />
        public void CreateAnalog(SmartEntity sourceEntity, bool copyLayer)
        {
#if !DEBUG
            Statistic.SendCommandStarting(Section.GetDescriptor().Name, ModPlusConnector.Instance.AvailProductExternalVersion);
#endif
            try
            {
                Overrule.Overruling = false;

                /* Регистрация ЕСКД приложения должна запускаться при запуске
                 * функции, т.к. регистрация происходит в текущем документе
                 * При инициализации плагина регистрации нет!
                 */
                ExtendedDataUtils.AddRegAppTableRecord(Section.GetDescriptor());

                var sectionLastLetterValue  = string.Empty;
                var sectionLastIntegerValue = string.Empty;
                FindLastSectionValues(ref sectionLastLetterValue, ref sectionLastIntegerValue);
                var section = new Section(sectionLastIntegerValue, sectionLastLetterValue);

                var blockReference = MainFunction.CreateBlock(section);

                section.SetPropertiesFromSmartEntity(sourceEntity, copyLayer);

                InsertSectionWithJig(true, section, blockReference);
            }
            catch (System.Exception exception)
            {
                ExceptionBox.Show(exception);
            }
            finally
            {
                Overrule.Overruling = true;
            }
        }
Пример #7
0
    public static void ConsoleBoard()
    {
        string            move;
        int               counterMove = 0;
        BeginnerBoardGame boardGame   = new BeginnerBoardGame();

        boardGame.PopulateBoardGame();

        if (boardGame.ValidadeBeginnerBoardSolution())
        {
        }
        else
        {
            do
            {
                boardGame.WriteBeginnerBoardGame();
                move = Console.ReadLine();
                if (MainFunction.ValidateMove(move.ToUpper(), boardGame.beginnerBoardGameShuffle) == "SAIR")
                {
                    break;
                }
                else
                {
                    counterMove++;
                }
            }while(boardGame.ValidadeBeginnerBoardSolution() == false);
            boardGame.WriteBeginnerBoardGame();
            Console.WriteLine($"Quantidade de movimento: {counterMove}");
        }
    }
Пример #8
0
 /// <summary>
 /// Prevent console window from disappearing before the user sees it.
 /// </summary>
 /// <param name="main"></param>
 public static void InvokeMain(MainFunction main)
 {
     if (String.IsNullOrEmpty(Process.GetCurrentProcess().
         MainWindowTitle))
     {
         // Process is running in its parent's console window.  The
         // user will see output and any exceptions raised.
         main();
         return;
     }
     // Prevent console window from disappearing before user
     // sees it.
     try
     {
         main();
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
         throw;
     }
     finally
     {
         {
             Console.WriteLine("\nPress any key...");
             Console.ReadKey();
         }
     }
 }
Пример #9
0
        private static void CreateSection(bool isSimple)
        {
#if !DEBUG
            Statistic.SendCommandStarting(Section.GetDescriptor().Name, ModPlusConnector.Instance.AvailProductExternalVersion);
#endif
            try
            {
                Overrule.Overruling = false;

                /* Регистрация ЕСКД приложения должна запускаться при запуске
                 * функции, т.к. регистрация происходит в текущем документе
                 * При инициализации плагина регистрации нет!
                 */
                ExtendedDataUtils.AddRegAppTableRecord(Section.GetDescriptor());

                var style = StyleManager.GetCurrentStyle(typeof(Section));
                var sectionLastLetterValue  = string.Empty;
                var sectionLastIntegerValue = string.Empty;
                FindLastSectionValues(ref sectionLastLetterValue, ref sectionLastIntegerValue);
                var section = new Section(sectionLastIntegerValue, sectionLastLetterValue);

                var blockReference = MainFunction.CreateBlock(section);
                section.ApplyStyle(style, true);

                InsertSectionWithJig(isSimple, section, blockReference);
            }
            catch (System.Exception exception)
            {
                ExceptionBox.Show(exception);
            }
            finally
            {
                Overrule.Overruling = true;
            }
        }
Пример #10
0
 public static void Run(MainFunction main, ExceptionMsg ExCall = null, string[] args = null)
 {
     try
     {
         if (Excall != null)
         {
             Excall = ExCall;
         }
         Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
         Application.ThreadException += new ThreadExceptionEventHandler(RunningExceptionTool.CatchThreadException);
         AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(RunningExceptionTool.CatchUnhandledException);
         if (main != null)
         {
             if (args == null)
             {
                 main(null);
             }
             else
             {
                 main(args);
             }
         }
     }
     catch (Exception exception)
     {
         string exceptionMsg = GetExceptionMsg(exception, string.Empty);
         MessageBox.Show(exceptionMsg, ecodsra102(0), MessageBoxButtons.OK, MessageBoxIcon.Hand);
         if (Excall != null)
         {
             Excall(exceptionMsg);
         }
     }
 }
Пример #11
0
 private void frmFaction_FormClosed(object sender, FormClosedEventArgs e)
 {
     MainFunction.AddOrRemaveChildName(pMdiParent: (mdiMain)this.MdiParent,
                                       pChildName: this.Name,
                                       pChildText: this.Text,
                                       pIsAdd: false);
 }
Пример #12
0
 public void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     this.timer1     = new System.Windows.Forms.Timer(this.components);
     this.timer2     = new System.Windows.Forms.Timer(this.components);
     ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
     this.SuspendLayout();
     //
     // timer1
     //
     this.timer1.Enabled  = true;
     this.timer1.Interval = 60;
     this.timer1.Tick    += new System.EventHandler(this.timer1_Tick);
     //
     // timer2
     //
     this.timer2.Enabled  = true;
     this.timer2.Interval = 1000;
     this.timer2.Tick    += new System.EventHandler(this.timer2_Tick);
     ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
     this.ResumeLayout(false);
     mob      = new Monster();
     player   = new PictureBox();
     pf       = new MainFunction();
     form2obj = new GameMain();
 }
Пример #13
0
        private static void CreateLevelMark()
        {
#if !DEBUG
            Statistic.SendCommandStarting(
                LevelMark.GetDescriptor().Name, ModPlusConnector.Instance.AvailProductExternalVersion);
#endif
            try
            {
                Overrule.Overruling = false;

                /* Регистрация ЕСКД приложения должна запускаться при запуске
                 * функции, т.к. регистрация происходит в текущем документе
                 * При инициализации плагина регистрации нет!
                 */
                ExtendedDataUtils.AddRegAppTableRecord(LevelMark.GetDescriptor());
                var style     = StyleManager.GetCurrentStyle(typeof(LevelMark));
                var levelMark = new LevelMark();

                var blockReference = MainFunction.CreateBlock(levelMark);
                levelMark.ApplyStyle(style, true);

                InsertLevelMarkWithJig(levelMark, blockReference);
            }
            catch (Exception exception)
            {
                ExceptionBox.Show(exception);
            }
            finally
            {
                Overrule.Overruling = true;
            }
        }
Пример #14
0
        static void Main(string[] args)
        {
            string choice;

            do
            {
                choice = MainFunction.WriteMenu();
                switch (choice)
                {
                case "1":
                    BeginnerGame.ConsoleBoard();
                    break;

                case "2":
                    IntermediaryGame.ConsoleBoard();
                    break;

                case "3":
                    AdvancedGame.ConsoleBoard();
                    break;

                case "4":
                    MainFunction.WriteHowToPlay();
                    break;

                default:
                    choice = "Done";
                    Console.WriteLine("Até logo.");
                    break;
                }
            } while (choice != "Done");
        }
Пример #15
0
        /// <inheritdoc/>
        public void CreateAnalog(SmartEntity sourceEntity, bool copyLayer)
        {
#if !DEBUG
            Statistic.SendCommandStarting(NodalLeader.GetDescriptor().Name, ModPlusConnector.Instance.AvailProductExternalVersion);
#endif
            try
            {
                Overrule.Overruling = false;

                /* Регистрация ЕСКД приложения должна запускаться при запуске
                 * функции, т.к. регистрация происходит в текущем документе
                 * При инициализации плагина регистрации нет!
                 */
                ExtendedDataUtils.AddRegAppTableRecord(NodalLeader.GetDescriptor());
                var lastNodeNumber = FindLastNodeNumber();
                var nodalLeader    = new NodalLeader(lastNodeNumber);
                var blockReference = MainFunction.CreateBlock(nodalLeader);
                nodalLeader.SetPropertiesFromSmartEntity(sourceEntity, copyLayer);

                InsertNodalLeaderWithJig(nodalLeader, blockReference);
            }
            catch (Exception exception)
            {
                ExceptionBox.Show(exception);
            }
            finally
            {
                Overrule.Overruling = true;
            }
        }
Пример #16
0
 /* Selecciona el objeto que desea cargar a la escena. */
 private void seleccionarEscena()
 {
     if (scene == 1 && definidaEscena1 == false)
     {
         this.mainFunctionFirstInterface = GameObject.Find("MainObjectFirstInterface");
         this.escena1 = mainFunctionFirstInterface.GetComponent <MainFunctionFirstInterface>();
         this.escena1.playAudio(this.dictationRecognizer);
         this.definidaEscena1 = true;
     }
     else if (scene == 2 && definidaEscena2 == false)
     {
         this.mainFunctionJugadorInterface = GameObject.Find("MainObjectInt");
         this.escena2 = mainFunctionJugadorInterface.GetComponent <MainFunctionJugadorInterface>();
         this.escena2.playAudio(this.dictationRecognizer, null);
         this.definidaEscena2 = true;
     }
     else if (scene == 3 && definidaEscena3 == false)
     {
         this.mainFunctionTablero = GameObject.Find("MainFunctionTableroInterface");
         this.escena3             = mainFunctionTablero.GetComponent <MainFunctionTablero>();
         this.escena3.playAudio(this.dictationRecognizer, null);
         this.definidaEscena3 = true;
     }
     else if (scene == 4 && definidaEscena4 == false)
     {
         this.mainFunction = GameObject.Find("MainObject");
         this.escena4      = mainFunction.GetComponent <MainFunction>();
         this.escena4.defineDirector(this.dictationRecognizer);
         this.escena4.setFilas(this.filas, this.columnas, this.a);
         this.escena4.crearTablero();
         this.definidaEscena4 = true;
     }
 }
Пример #17
0
        public static int Start <TConfiguration>(string[] args, MainFunction <TConfiguration> main)
            where TConfiguration : new()
        {
            Console.WriteLine(CurrentUtility.Signature);
            Console.WriteLine(CurrentUtility.MoaiUtilsHint);
            Console.WriteLine();

            try {
                // Parse command line arguments
                TConfiguration configuration = Activator.CreateInstance <TConfiguration>();
                if (!Parser.Default.ParseArguments(args, configuration))
                {
                    Console.WriteLine(HelpText.AutoBuild(configuration,
                                                         current => HelpText.DefaultParsingErrorsHandler(configuration, current)));
                    return(1);
                }

                // Start application
                main(configuration);

                Console.WriteLine("\nDone.");
                return(0);
            } catch (Exception e) {
                string message = e is PlainTextException ? e.Message : e.ToString();
                Console.WriteLine("\nAn error occurred.");
                Console.WriteLine(message);
                Console.WriteLine("Terminating application.");
                return(1);
            }
        }
Пример #18
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            progressRing.IsActive = true;
            //
            var picker = new Windows.Storage.Pickers.FileOpenPicker();

            picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
            picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary;
            picker.FileTypeFilter.Add(".jpg");
            picker.FileTypeFilter.Add(".jpeg");
            picker.FileTypeFilter.Add(".png");
            picker.FileTypeFilter.Add(".bmp");
            Windows.Storage.StorageFile file = await picker.PickSingleFileAsync();

            if (file != null)
            {
                using (var stream = await file.OpenReadAsync())
                {
                    _bitmap = new BitmapImage();
                    await _bitmap.SetSourceAsync(stream);

                    Image1.Source = _bitmap;
                    //
                    BitmapDecoder bitmapDecoder = await BitmapDecoder.CreateAsync(stream);

                    //
                    var pixels = await bitmapDecoder.GetPixelDataAsync();

                    //----------------------------------------------------------


                    MainFunction main = new MainFunction();

                    main.MsgReporter = this;// optional

                    var resultPixels = await main.Run(pixels.DetachPixelData(), (int)bitmapDecoder.PixelWidth, (int)bitmapDecoder.PixelHeight);

                    //
                    using (var ms = new InMemoryRandomAccessStream())
                    {
                        float devicedpi = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().LogicalDpi;
                        var   encoder   = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, ms);

                        encoder.SetPixelData(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Ignore, bitmapDecoder.PixelWidth, bitmapDecoder.PixelHeight, devicedpi, devicedpi, resultPixels);
                        await encoder.FlushAsync();

                        var _bitmap2 = new BitmapImage();
                        await _bitmap2.SetSourceAsync(ms);

                        Image2.Source = _bitmap2;
                    }


                    //--
                }
            }
            //
            progressRing.IsActive = false;
        }
Пример #19
0
 public static unsafe void RunApp(int numArgs, byte **args, MainFunction callback)
 {
     BeginRun();
     CurrentMain = callback;
     CoreRunApp(numArgs, args, GetCallMainPtr());
     CurrentMain = null;
     EndRun();
 }
Пример #20
0
 static void Main(string[] args)
 {
     if (args.Length == 2)
     {
         MainFunction obj = new MainFunction(args[0], args[1]);
         obj.StartTimer();
     }
 }
Пример #21
0
 // Token: 0x06000054 RID: 84 RVA: 0x00006E88 File Offset: 0x00005088
 private static void Main(string[] args)
 {
     Var.color         = Color.SkyBlue;
     Var.authUrl       = "https://CRACKEDBYCRANKCRACK.SX";
     Var.encryptionKey = "CRANKISGAI";
     Var.firingMethod  = Program.SelectMenu();
     MainFunction.SetDesign("dotTwitch", "1.0.0", "Crank [Crack.sx]", Var.color, Program.useProxy, "accounts");
 }
Пример #22
0
        public static unsafe void RunApp(IReadOnlyList <string> args, MainFunction callback)
        {
            BeginRun();
            var argsPtr = SilkMarshal.StringArrayToPtr(args);

            CurrentMain = callback;
            CoreRunApp(args.Count, (byte **)argsPtr, GetCallMainPtr());
            CurrentMain = null;
            SilkMarshal.Free(argsPtr);
            EndRun();
        }
Пример #23
0
        public static void Start()
        {
            try
            {
                if (!MainSettings.Instance.AddToMpPalette)
                {
                    MainFunction.RemoveFromMpPalette(false);
                    if (PaletteSet != null)
                    {
                        PaletteSet.Visible = true;
                    }
                    else
                    {
                        PaletteSet = new PaletteSet(
                            Language.GetItem("h11"), // Свойства ЕСКД
                            "mpPropertiesPalette",
                            new Guid("1c0dc0f7-0d06-49df-a2d3-bcea4241e036"));
                        PaletteSet.Load   += PaletteSet_Load;
                        PaletteSet.Save   += PaletteSet_Save;
                        _propertiesPalette = new PropertiesPalette();
                        var elementHost = new ElementHost
                        {
                            AutoSize = true,
                            Dock     = DockStyle.Fill,
                            Child    = _propertiesPalette
                        };
                        PaletteSet.Add(
                            Language.GetItem("h11"), // Свойства ЕСКД
                            elementHost);
                        PaletteSet.Style = PaletteSetStyles.ShowCloseButton |
                                           PaletteSetStyles.ShowPropertiesMenu |
                                           PaletteSetStyles.ShowAutoHideButton;
                        PaletteSet.MinimumSize = new System.Drawing.Size(100, 300);
                        PaletteSet.DockEnabled = DockSides.Right | DockSides.Left;
                        PaletteSet.Visible     = true;
                    }
                }
                else
                {
                    if (PaletteSet != null)
                    {
                        PaletteSet.Visible = false;
                    }

                    MainFunction.AddToMpPalette();
                }
            }
            catch (System.Exception exception)
            {
                ExceptionBox.Show(exception);
            }
        }
Пример #24
0
 public void iteration()
 {
     for (param.r2 = param.r2Start; param.r2 <= param.r2End; param.r2 += param.r2Step)
     {
         for (param.r3 = param.r3Start; param.r3 <= param.r3End; param.r3 += param.r3Step)
         {
             for (param.a = param.aStart; param.a <= param.aEnd; param.a += param.aStep)
             {
                 var func = new MainFunction(param, file, folder, rout, cmd);
                 func.runFunction();
             }
         }
     }
 }
        private void LmSettings_OnClick(object sender, RoutedEventArgs e)
        {
            var lmSetting = new View.PaletteSettings();

            lmSetting.ShowDialog();

            if (MainSettings.Instance.AddToMpPalette)
            {
                MainFunction.AddToMpPalette();
            }
            else
            {
                MainFunction.RemoveFromMpPalette(true);
            }
        }
Пример #26
0
        /// <summary>
        /// 开始运行主应用程序
        /// </summary>
        static public void StartThisApp()
        {
            GlobalParameter.SetGlobalParameter();
            Logger.LogRootDirectory = GlobalParameter.logRootDirectory;

            if (GlobalParameter.httpServerRun)
            {
                mainFunction = new MainFunction();
                mainFunction.RunMainFunctionThread();
            }
            if (GlobalParameter.httpServerRun)
            {
                httpHandle = new HttpHandle();
                httpHandle.RunHttpServerThread();
            }
        }
Пример #27
0
        /// <inheritdoc />
        public void CreateAnalog(SmartEntity sourceEntity, bool copyLayer)
        {
#if !DEBUG
            ModPlusAPI.Statistic.SendCommandStarting(
                Axis.GetDescriptor().Name, ModPlusConnector.Instance.AvailProductExternalVersion);
#endif

            try
            {
                Overrule.Overruling = false;

                /* Регистрация ЕСКД приложения должна запускаться при запуске
                 * функции, т.к. регистрация происходит в текущем документе
                 * При инициализации плагина регистрации нет!
                 */
                ExtendedDataUtils.AddRegAppTableRecord(Axis.GetDescriptor());

                var axisLastHorizontalValue = string.Empty;
                var axisLastVerticalValue   = string.Empty;
                FindLastAxisValues(ref axisLastHorizontalValue, ref axisLastVerticalValue);
                var axis = new Axis(axisLastHorizontalValue, axisLastVerticalValue);

                var blockReference = MainFunction.CreateBlock(axis);

                axis.SetPropertiesFromSmartEntity(sourceEntity, copyLayer);

                // Отключаю видимость кружков направления
                axis.TopOrientMarkerVisible    = false;
                axis.BottomOrientMarkerVisible = false;

                InsertAxisWithJig(axis, blockReference);
            }
            catch (Exception exception)
            {
                ExceptionBox.Show(exception);
            }
            finally
            {
                Overrule.Overruling = true;
            }
        }
Пример #28
0
        public static void Run(MainFunction main, ExceptionMsg ExCall = null, string[] args = null)
        {
            try
            {
                if (Excall != null)
                {
                    RunningExceptionTool.Excall = ExCall;
                }

                // 捕获
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(CatchThreadException);
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CatchUnhandledException);

                if (main != null)
                {
                    if (args == null)
                    {
                        main();
                    }
                    else
                    {
                        main(args);
                    }
                }
            }
            catch (Exception ex)
            {
                string str = GetExceptionMsg(ex, string.Empty);
                MessageBox.Show(str, "运行异常", MessageBoxButtons.OK, MessageBoxIcon.Error);

                //bool ok = (MessageBox.Show(str, "运行异常,提交bug信息?", MessageBoxButtons.OKCancel, MessageBoxIcon.Error) == DialogResult.OK);
                //if (ok) sendBugToAuthor(str);

                if (Excall != null)
                {
                    Excall(str);
                }
            }
        }
Пример #29
0
        public void TestFuction()
        {
            MainFunction mainf = new MainFunction();

            String[] s1      = { "C:\\test\\abc2.c", "C:\\test\\abc3.c", "C:\\test\\we2.png" };
            String[] s2      = { "C:\\test\\1.c", "C:\\test\\2c3.c", "C:\\test\\true2.c" };
            Folder   folder1 = new Folder(s1);
            Folder   folder2 = new Folder(s2);

            mainf.reName(folder1, folder2);
            //   Assert.AreEqual();
            Assert.AreEqual(folder2.myfile[0].getFileName(), "C:\\test\\1.c");
            Assert.AreEqual(folder2.myfile[1].getFileName(), "C:\\test\\2c3.c");
            Assert.AreEqual(folder2.myfile[2].getFileName(), "C:\\test\\true2.c");

            //Assert.AreEqual(folder2.myfile[0].getExpandName(), "C:\\test\\abc2.c");
            //Assert.AreEqual(folder2.myfile[1].getExpandName(), "C:\\test\\abc3.c");
            //Assert.AreEqual(folder2.myfile[2].getExpandName(), "C:\\test\\we2.png");

            //Assert.AreEqual(folder2.myfile[0].getPreName()., "C:\\test\\abc2.c");
            //Assert.AreEqual(folder2.myfile[1].getPreName(), "C:\\test\\abc3.c");
            //Assert.AreEqual(folder2.myfile[2].getPreName(), "C:\\test\\we2.png");
        }
Пример #30
0
        private static void CreateAxis()
        {
#if !DEBUG
            ModPlusAPI.Statistic.SendCommandStarting(
                Axis.GetDescriptor().Name, ModPlusConnector.Instance.AvailProductExternalVersion);
#endif
            try
            {
                Overrule.Overruling = false;

                /* Регистрация ЕСКД приложения должна запускаться при запуске
                 * функции, т.к. регистрация происходит в текущем документе
                 * При инициализации плагина регистрации нет!
                 */
                ExtendedDataUtils.AddRegAppTableRecord(Axis.GetDescriptor());

                var style = StyleManager.GetCurrentStyle(typeof(Axis));

                var axisLastHorizontalValue = string.Empty;
                var axisLastVerticalValue   = string.Empty;
                FindLastAxisValues(ref axisLastHorizontalValue, ref axisLastVerticalValue);
                var axis = new Axis(axisLastHorizontalValue, axisLastVerticalValue);

                var blockReference = MainFunction.CreateBlock(axis);
                axis.ApplyStyle(style, true);

                InsertAxisWithJig(axis, blockReference);
            }
            catch (Exception exception)
            {
                ExceptionBox.Show(exception);
            }
            finally
            {
                Overrule.Overruling = true;
            }
        }
Пример #31
0
        private void openChildren(PageNo pPageNo)
        {
            Type targetFormType = typeof(frmCowPart);

            if (pPageNo == PageNo.ManageStaff)
            {
                targetFormType = typeof(frmStaff);
            }
            else if (pPageNo == PageNo.ManageMember)
            {
                targetFormType = typeof(frmMember);
            }
            else if (pPageNo == PageNo.CowPart)
            {
                targetFormType = typeof(frmCowPart);
            }
            else if (pPageNo == PageNo.StaffTimeStamp)
            {
                targetFormType = typeof(frmStaffTimeStamp);
            }
            else if (pPageNo == PageNo.CowList)
            {
                targetFormType = typeof(frmCowList);
            }
            else if (pPageNo == PageNo.Department)
            {
                targetFormType = typeof(frmDepartment);
            }
            else if (pPageNo == PageNo.Faction)
            {
                targetFormType = typeof(frmFaction);
            }

            // tsmMainData
            else if (pPageNo == PageNo.CowBreed)
            {
                targetFormType = typeof(frmCowBreed);
            }
            else if (pPageNo == PageNo.CowHorn)
            {
                targetFormType = typeof(frmCowHorn);
            }
            else if (pPageNo == PageNo.CowPurpose)
            {
                targetFormType = typeof(frmCowPurpose);
            }
            else if (pPageNo == PageNo.CowStatus)
            {
                targetFormType = typeof(frmCowStatus);
            }
            else if (pPageNo == PageNo.CowGrowUpLevel)
            {
                targetFormType = typeof(frmCowGrowLevel);
            }
            else if (pPageNo == PageNo.CowColor)
            {
                targetFormType = typeof(frmCowColor);
            }
            else if (pPageNo == PageNo.CowStall)
            {
                targetFormType = typeof(frmCowStall);
            }
            else if (pPageNo == PageNo.CowLocation)
            {
                targetFormType = typeof(frmCowLocation);
            }

            bool isExist = false;

            foreach (Form f in this.MdiChildren)
            {
                if (f.GetType() == targetFormType)
                {
                    f.Activate();
                    if (f.WindowState != FormWindowState.Maximized)
                    {
                        f.WindowState = FormWindowState.Maximized;
                    }
                    isExist = true;
                    break;
                }
            }

            if (!isExist)
            {
                Form targetForm = null;

                if (pPageNo == PageNo.ManageStaff)
                {
                    targetForm = new frmStaff();
                }
                else if (pPageNo == PageNo.ManageMember)
                {
                    targetForm = new frmMember();
                }
                else if (pPageNo == PageNo.CowPart)
                {
                    targetForm = new frmCowPart();
                }
                else if (pPageNo == PageNo.StaffTimeStamp)
                {
                    targetForm = new frmStaffTimeStamp();;
                }
                else if (pPageNo == PageNo.CowList)
                {
                    targetForm = new frmCowList();
                }
                else if (pPageNo == PageNo.Department)
                {
                    targetForm = new frmDepartment();
                }
                else if (pPageNo == PageNo.Faction)
                {
                    targetForm = new frmFaction();
                }

                // tsmMainData
                else if (pPageNo == PageNo.CowBreed)
                {
                    targetForm = new frmCowBreed();
                }
                else if (pPageNo == PageNo.CowHorn)
                {
                    targetForm = new frmCowHorn();
                }
                else if (pPageNo == PageNo.CowPurpose)
                {
                    targetForm = new frmCowPurpose();
                }
                else if (pPageNo == PageNo.CowStatus)
                {
                    targetForm = new frmCowStatus();
                }
                else if (pPageNo == PageNo.CowGrowUpLevel)
                {
                    targetForm = new frmCowGrowLevel();
                }
                else if (pPageNo == PageNo.CowColor)
                {
                    targetForm = new frmCowColor();
                }
                else if (pPageNo == PageNo.CowStall)
                {
                    targetForm = new frmCowStall();
                }
                else if (pPageNo == PageNo.CowLocation)
                {
                    targetForm = new frmCowLocation();
                }

                targetForm.MdiParent = this;
                targetForm.Show();
                targetForm.WindowState = FormWindowState.Maximized;

                MainFunction.AddOrRemaveChildName(pMdiParent: this,
                                                  pChildName: targetForm.Name,
                                                  pChildText: targetForm.Text,
                                                  pIsAdd: true);
            }
        }
		private static void GenerateEntryPoint(string compileDirPath, MainFunction mainFunction)
		{
			using(var file = File.CreateText(Path.Combine(compileDirPath, "src/אEntryPoint.cs")))
			{
				var returns = mainFunction.ReturnType != "void";
				var returnType = returns ? "int" : "void";
				var returnStatement = returns ? "return " : "";

				file.WriteLine("public class אEntryPoint");
				file.WriteLine("{");
				file.WriteLine($"	public static {returnType} Main(string[] args)");
				file.WriteLine("	{");
				file.WriteLine($"		{returnStatement}{mainFunction.Name}(new א.System.Console.Console(), args);");
				file.WriteLine("	}");
				file.WriteLine("}");
			}
		}