Exemple #1
0
        internal Editor()
        {
            Instance = this;

            Log("Setting up C# Editor...");

            Internal_GetProjectInfo(out _projectInfo);

            // Create common editor modules
            RegisterModule(Windows           = new WindowsModule(this));
            RegisterModule(UI                = new UIModule(this));
            RegisterModule(Thumbnails        = new ThumbnailsModule(this));
            RegisterModule(Simulation        = new SimulationModule(this));
            RegisterModule(Scene             = new SceneModule(this));
            RegisterModule(SceneEditing      = new SceneEditingModule(this));
            RegisterModule(ContentEditing    = new ContentEditingModule(this));
            RegisterModule(ContentDatabase   = new ContentDatabaseModule(this));
            RegisterModule(ContentImporting  = new ContentImportingModule(this));
            RegisterModule(CodeEditing       = new CodeEditingModule(this));
            RegisterModule(ProgressReporting = new ProgressReportingModule(this));

            StateMachine = new EditorStateMachine(this);
            Undo         = new EditorUndo(this);

            ScriptsBuilder.ScriptsReloadBegin += ScriptsBuilder_ScriptsReloadBegin;
            ScriptsBuilder.ScriptsReloadEnd   += ScriptsBuilder_ScriptsReloadEnd;
        }
Exemple #2
0
        internal Editor()
        {
            Instance = this;

            Log("Setting up C# Editor...");

            Internal_GetProjectInfo(out _projectInfo);

            Icons = new EditorIcons();
            Icons.GetIcons();

            // Create common editor modules
            RegisterModule(Options           = new OptionsModule(this));
            RegisterModule(ProjectCache      = new ProjectCacheModule(this));
            RegisterModule(Scene             = new SceneModule(this));
            RegisterModule(Windows           = new WindowsModule(this));
            RegisterModule(UI                = new UIModule(this));
            RegisterModule(Thumbnails        = new ThumbnailsModule(this));
            RegisterModule(Simulation        = new SimulationModule(this));
            RegisterModule(Prefabs           = new PrefabsModule(this));
            RegisterModule(SceneEditing      = new SceneEditingModule(this));
            RegisterModule(ContentEditing    = new ContentEditingModule(this));
            RegisterModule(ContentDatabase   = new ContentDatabaseModule(this));
            RegisterModule(ContentImporting  = new ContentImportingModule(this));
            RegisterModule(CodeEditing       = new CodeEditingModule(this));
            RegisterModule(ProgressReporting = new ProgressReportingModule(this));
            RegisterModule(ContentFinding    = new ContentFindingModule(this));

            StateMachine = new EditorStateMachine(this);
            Undo         = new EditorUndo(this);

            ScriptsBuilder.ScriptsReloadBegin   += ScriptsBuilder_ScriptsReloadBegin;
            ScriptsBuilder.ScriptsReloadEnd     += ScriptsBuilder_ScriptsReloadEnd;
            UIControl.FallbackParentGetDelegate += OnUIControlFallbackParentGet;
        }
        public void TestHelpOutput()
        {
            iModule mod = new WindowsModule ();

              mod.run ("help", new string[0]);

              // The return code may indicate
              // the tests are not being run in an environment
              // with cmd (e.g. Anything but Windows).
              if (mod.resultCode() != 2) {
            // Light check just to ensure some related output came back.
            Assert.AreEqual (mod.standardOutput ().Contains ("HELP"), true);
              }
        }
        public void TestMkDirAndRMDir()
        {
            // Cleanup
              if (Directory.Exists (testDir))
            Directory.Delete (testDir);

              iModule mod = new WindowsModule ();

              string[] args = new string[1];
              args [0] = testDir;

              mod.run ("mkdir", args);

              // The return code may indicate
              // the tests are not being run in an environment
              // with bash (Windows, some distros).
              if (mod.resultCode() != 2) {
            // Check the directory exists indicating success
            // Double check the return code is the expected 0
            Assert.AreEqual (Directory.Exists (testDir), true);
            Assert.AreEqual (mod.resultCode (), 0);
              }

              args = new string[3];
              args [0] = "/s";
              args [1] = "/q";
              args [2] = testDir;

              mod.run ("rmdir", args);

              // The return code may indicate
              // the tests are not being run in an environment
              // with bash (Windows, some distros).
              if (mod.resultCode() != 2) {
            // Check the directory no longer exists indicating success
            // Double check the return code is the expected 0
            Assert.AreEqual (Directory.Exists (testDir), false);
            Assert.AreEqual (mod.resultCode (), 0);
              }
        }
        public void TestUnsupported()
        {
            iModule mod = new WindowsModule ();

              Assert.True(mod.unsupportedCommand("nslookup", new string[0]));
        }
        public void TestTracertOutput()
        {
            iModule mod = new WindowsModule ();

              string[] args = new string[1];
              args [0] = "127.0.0.1";

              mod.run ("tracert", args);

              // The return code may indicate
              // the tests are not being run in an environment
              // with cmd (e.g. Anything but Windows).
              if (mod.resultCode() != 2) {
            // Light check just to ensure some related output came back.
            Assert.AreEqual (mod.standardOutput ().Contains ("Tracing"), true);
              }
        }
Exemple #7
0
        /// <summary>
        ///     The main form load
        /// </summary>
        /// <param name="sender">
        ///     The sender.
        /// </param>
        /// <param name="e">
        ///     The e.
        /// </param>
        private void FrmMainLoad(object sender, EventArgs e)
        {
            if (Settings.Default.FirstRun)
            {
                if (Settings.Default.UpdateSettings)
                {
                    Settings.Default.Upgrade();
                }

                Settings.Default.FirstRun = false;
                Settings.Default.Save();
            }

            WindowsModule platform = new WindowsModule();

            platform.RegisterPlatform();
            this.ReloadSettings();

            this.updaterWorker         = new BackgroundWorker();
            this.skipUpdate            = !Settings.Default.AutoUpdate;
            this.updaterWorker.DoWork += (s, args) =>
            {
                this.latestVersion = null;
                try
                {
                    if (!this.skipUpdate)
                    {
                        Updater updaterObject = new Updater(
                            "ZARA",
                            Assembly.GetExecutingAssembly().GetName().Version,
                            this.listener != null &&
                            this.listener.Status.HasFlag(ProxyController.ControllerStatus.Proxy)
                                    ? new WebProxy(this.listener.Ip + ":" + this.listener.Port, true)
                                    : null);
                        if (updaterObject.IsNewVersionAvailable())
                        {
                            this.latestVersion = updaterObject.GetLatestVersion();
                        }
                    }
                }
                catch (Exception)
                {
                }
            };
            this.updaterWorker.RunWorkerCompleted += (s, args) =>
            {
                try
                {
                    if (this.latestVersion != null)
                    {
                        VDialog updaterDialog = new VDialog
                        {
                            Content =
                                "New version of this application is available for download, do you want us to open the release page so you can download it?",
                            WindowTitle = "Auto Update Check",
                            MainIcon    = VDialogIcon.Question,
                            Buttons     =
                                new[]
                            {
                                new VDialogButton(VDialogResult.No, "No"),
                                new VDialogButton(
                                    VDialogResult.Yes,
                                    "Yes",
                                    true)
                            }
                        };

                        this.skipUpdate = updaterDialog.Show() != VDialogResult.Yes;
                        if (!this.skipUpdate)
                        {
                            Process.Start(this.latestVersion.PageLink);
                        }
                    }
                }
                catch
                {
                }
            };

            this.updaterWorker.RunWorkerAsync();

            try
            {
                Program.Notify.ContextMenu =
                    new ContextMenu(
                        new[]
                {
                    new MenuItem(
                        "Show Window",
                        delegate
                    {
                        Program.Notify.GetType()
                        .GetMethod(
                            "OnDoubleClick",
                            BindingFlags.Instance | BindingFlags.NonPublic)
                        .Invoke(Program.Notify, new object[] { null });
                    })
                    {
                        DefaultItem = true
                    },
                    new MenuItem("-", (EventHandler)null), new MenuItem(
                        "Exit",
                        delegate
                    {
                        this.StopServer();
                        Application.Exit();
                    })
                });
                Program.Notify.Icon         = Resources.Icon;
                Program.Notify.Text         = @"Z A Я A - Stopped";
                Program.Notify.DoubleClick += this.BtnMinimizeClick;
            }
            catch (Exception)
            {
            }
        }