Пример #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="frmMain"/> form.
        /// </summary>
        public frmMain()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            settings = Settings.Instance();
            controller = new PluginController();
            pluginPaths = new ArrayList();
            controller.AttachLogger(rtblLog);
            controller.PluginStateChanged += new EventHandler(controller_PluginStateChanged);
            memUsage = 0;
            lblVersion.Text = "Version: " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
        }
Пример #2
0
        /// <summary>
        /// Returns the result of a child action of a SurfaceController
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="htmlHelper"></param>
        /// <param name="actionName"></param>
        /// <param name="surfaceType"></param>
        /// <returns></returns>
        public static IHtmlString Action(this HtmlHelper htmlHelper, string actionName, Type surfaceType)
        {
            Mandate.ParameterNotNull(surfaceType, "surfaceType");
            Mandate.ParameterNotNullOrEmpty(actionName, "actionName");

            var routeVals = new RouteValueDictionary(new { area = "" });

            var surfaceController = SurfaceControllerResolver.Current.RegisteredSurfaceControllers
                                    .SingleOrDefault(x => x == surfaceType);

            if (surfaceController == null)
            {
                throw new InvalidOperationException("Could not find the surface controller of type " + surfaceType.FullName);
            }
            var metaData = PluginController.GetMetadata(surfaceController);

            if (!metaData.AreaName.IsNullOrWhiteSpace())
            {
                //set the area to the plugin area
                routeVals.Add("area", metaData.AreaName);
            }

            return(htmlHelper.Action(actionName, metaData.ControllerName, routeVals));
        }
Пример #3
0
        /// <summary>
        /// Returns the result of a child action of a SurfaceController
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="htmlHelper"></param>
        /// <param name="actionName"></param>
        /// <param name="surfaceType"></param>
        /// <returns></returns>
        public static IHtmlString Action(this HtmlHelper htmlHelper, string actionName, Type surfaceType)
        {
            if (surfaceType == null)
            {
                throw new ArgumentNullException(nameof(surfaceType));
            }
            if (string.IsNullOrWhiteSpace(actionName))
            {
                throw new ArgumentNullOrEmptyException(nameof(actionName));
            }

            var routeVals = new RouteValueDictionary(new { area = "" });

            var surfaceController = Current.SurfaceControllerTypes.SingleOrDefault(x => x == surfaceType);

            if (surfaceController == null)
            {
                throw new InvalidOperationException("Could not find the surface controller of type " + surfaceType.FullName);
            }
            var metaData = PluginController.GetMetadata(surfaceController);

            if (!metaData.AreaName.IsNullOrWhiteSpace())
            {
                //set the area to the plugin area
                if (routeVals.ContainsKey("area"))
                {
                    routeVals["area"] = metaData.AreaName;
                }
                else
                {
                    routeVals.Add("area", metaData.AreaName);
                }
            }

            return(htmlHelper.Action(actionName, metaData.ControllerName, routeVals));
        }
Пример #4
0
 private void LoadPlugins()
 {
     PluginController.LoadPlugins();
     OnPluginsLoaded(new EventArgs());
 }
Пример #5
0
        /// <summary>
        /// 起動時に必要な設定を読み込みます。
        /// </summary>
        public static void LoadHandler()
        {
            // 保存元のファイル名
            string fileName      = "accounts.dat";
            string settingFile   = "settings.xml";
            string LinkFileName  = "links.txt";
            string MasterKeyFile = Environment.CurrentDirectory + @"\masterkey.cfg";

            //Program.loadAccountFromText(fileName);
            ProgramController.AController = new AccountController();

            Program.splash.statusUpdate("マスターキーを読み込んでいます...", 10);
            if (System.IO.File.Exists(MasterKeyFile))
            {
                SimpleLogger.WriteLine("MasterKey file exist.");
                System.IO.StreamReader sr = System.IO.File.OpenText(MasterKeyFile);
                AccountController.MasterKey = sr.ReadLine();
            }
            else
            {
                SimpleLogger.WriteLine("MasterKey file does not found.");
                AccountController.MasterKey = Microsoft.VisualBasic.Interaction.InputBox("暗号化解除キーワードを入力してください。", "TSLoginManager", "", (Screen.PrimaryScreen.Bounds.Width / 2) - (360 / 2), (Screen.PrimaryScreen.Bounds.Height / 2) - 120);
            }
            Program.splash.statusUpdate("基本設定を読み込み中...", 5);

            // load settings.xml
            SimpleLogger.WriteLine("load settings...");
            SettingController.loadSettings(settingFile);
            Program.splash.statusUpdate("設定を読み込み中...", 5);

            Program.splash.statusUpdate("アカウント情報を読み込み中...", 5);
            // load accounts.dat
            SimpleLogger.WriteLine("load account data...");
            ProgramController.AController.loadAccounts(fileName, AccountController.MasterKey);
            Program.splash.statusUpdate("アカウント情報を読み込み中...", 5);

            // load plugins
            Program.splash.statusUpdate("プラグインを読み込み中...", 5);
            SimpleLogger.WriteLine("load plugins...");
            Program.plugins = PluginController.loadPlugins(Program.frm);

            // load links.txt
            Program.splash.statusUpdate("リンクファイルを読み込み中...", 5);
            SimpleLogger.WriteLine("load link file...");
            SettingController.loadLinks(LinkFileName);


            SimpleLogger.WriteLine("all data load complete.");
            Program.splash.statusUpdate("設定の読み込み完了", 5);

            // auto update check

            /*
             * if (SettingController.Update.startupAutoCehck)
             * {
             *  Program.splash.statusUpdate("アップデートを確認中...", 5);
             *  Program.checkMyUpdate(false);
             * }
             */
            Program.splash.statusUpdate("", 5);
        }
Пример #6
0
 public ContentServiceWrapper(PluginController controller)
 {
     _contentService = controller.Services.ContentService;
 }
Пример #7
0
 public void Initialize(PluginController pluginController)
 {
     this.pluginController = pluginController;
     this.pluginController.LoadAboutForm(this);
 }
Пример #8
0
        /// <summary>
        /// Creates the routes
        /// </summary>
        protected internal void CreateRoutes()
        {
            var umbracoPath = GlobalSettings.UmbracoMvcArea;

            //Create the front-end route
            var defaultRoute = RouteTable.Routes.MapRoute(
                "Umbraco_default",
                umbracoPath + "/RenderMvc/{action}/{id}",
                new { controller = "RenderMvc", action = "Index", id = UrlParameter.Optional }
                );

            defaultRoute.RouteHandler = new RenderRouteHandler(ControllerBuilder.Current.GetControllerFactory());

            //Create the install routes
            var installPackageRoute = RouteTable.Routes.MapRoute(
                "Umbraco_install_packages",
                "Install/PackageInstaller/{action}/{id}",
                new { controller = "InstallPackage", action = "Index", id = UrlParameter.Optional }
                );

            installPackageRoute.DataTokens.Add("area", umbracoPath);

            //Create the REST/web/script service routes
            var webServiceRoutes = RouteTable.Routes.MapRoute(
                "Umbraco_web_services",
                umbracoPath + "/RestServices/{controller}/{action}/{id}",
                new { controller = "SaveFileController", action = "Index", id = UrlParameter.Optional },
                //VERY IMPORTANT! for this route, only match controllers in this namespace!
                new string[] { "Umbraco.Web.WebServices" }
                );

            webServiceRoutes.DataTokens.Add("area", umbracoPath);

            //we need to find the surface controllers and route them
            var surfaceControllers = SurfaceControllerResolver.Current.RegisteredSurfaceControllers.ToArray();

            //local surface controllers do not contain the attribute
            var localSurfaceControlleres = surfaceControllers.Where(x => PluginController.GetMetadata(x).AreaName.IsNullOrWhiteSpace());

            foreach (var s in localSurfaceControlleres)
            {
                var meta  = PluginController.GetMetadata(s);
                var route = RouteTable.Routes.MapRoute(
                    string.Format("umbraco-{0}-{1}", "surface", meta.ControllerName),
                    umbracoPath + "/Surface/" + meta.ControllerName + "/{action}/{id}", //url to match
                    new { controller = meta.ControllerName, action = "Index", id = UrlParameter.Optional },
                    new[] { meta.ControllerNamespace });                                //only match this namespace
                route.DataTokens.Add("umbraco", "surface");                             //ensure the umbraco token is set
            }

            //need to get the plugin controllers that are unique to each area (group by)
            //TODO: One day when we have more plugin controllers, we will need to do a group by on ALL of them to pass into the ctor of PluginControllerArea
            var pluginSurfaceControlleres = surfaceControllers.Where(x => !PluginController.GetMetadata(x).AreaName.IsNullOrWhiteSpace());
            var groupedAreas = pluginSurfaceControlleres.GroupBy(controller => PluginController.GetMetadata(controller).AreaName);

            //loop through each area defined amongst the controllers
            foreach (var g in groupedAreas)
            {
                //create an area for the controllers (this will throw an exception if all controllers are not in the same area)
                var pluginControllerArea = new PluginControllerArea(g.Select(PluginController.GetMetadata));
                //register it
                RouteTable.Routes.RegisterArea(pluginControllerArea);
            }
        }
Пример #9
0
        public void HandlePacket(Packets packet)
        {
            var packetType         = packet.PacketType;
            var errorController    = new ErrorController(Client, packet);
            var windowsController  = new WindowsController(Client, packet);
            var settingsController = new SettingsController(Client, packet);
            var serverController   = new ServerController(Client, packet);

            if (packetType == PacketType.InvalidOrEmptyPacket)
            {
                errorController.InvalidPacket();
                return;
            }
            if (packetType == PacketType.RequestWindowsInformation)
            {
                windowsController.GetWindowsInformation();
                return;
            }
            if (packetType == PacketType.AesHandshake)
            {
                serverController.AesHandshake();
                return;
            }
            if (!AuthClient.Authenticated && packetType == PacketType.Authenticate)
            {
                serverController.Login();
                return;
            }
            if (AuthClient.Authenticated)
            {
                #region

                //Build a controller workshop!
                var fileController            = new FileController(Client, packet);
                var processController         = new ProcessController(Client, packet);
                var cpuController             = new CpuController(Client, packet);
                var systemController          = new SystemController(Client, packet);
                var operatingSystemController = new OperatingSystemController(Client, packet);
                var networkController         = new NetworkController(Client, packet);

                var gpuController         = new GpuController(Client, packet);
                var screenShareController = new ScreenShareController(Client, packet);
                var pluginController      = new PluginController(Client, packet);
                var webcamController      = new WebCamController(Client, packet);

                #endregion
                //Running long processes in a new task prevents timeouts from firing
                switch (packetType)
                {
                case PacketType.RequestFile:
                    Task.Run(() => { fileController.RequestFile(); });
                    break;

                case PacketType.RequestGpuInformation:
                    gpuController.GetGpuInformation();
                    break;

                case PacketType.RemoveFile:
                    fileController.RemoveFile();
                    break;

                case PacketType.Plugin:
                    Task.Run(() => { pluginController.StartPlugin(); });
                    break;

                case PacketType.ApprovePlugin:
                    pluginController.ApprovePlugin();
                    break;

                case PacketType.GetPendingPlugins:
                    pluginController.GetPendingPlugins();
                    break;

                case PacketType.GetPlugins:
                    pluginController.ListPlugins();
                    break;

                case PacketType.GetBadPlugins:
                    pluginController.ListBadPlugins();
                    break;

                case PacketType.CreateFileTree:
                    fileController.CreateFileTree();
                    break;

                case PacketType.StartCamera:
                    webcamController.StartCamera();
                    break;

                case PacketType.StopCamera:
                    Task.Run(() => { webcamController.StopCamera(); });
                    break;

                case PacketType.PauseCamera:
                    webcamController.PauseCamera();
                    break;

                case PacketType.GetCameras:
                    webcamController.GetCameras();
                    break;

                case PacketType.StartCameraStream:
                    webcamController.StartStream();
                    break;

                case PacketType.StopCameraStream:
                    webcamController.StopStream();
                    break;

                case PacketType.RequestProcess:
                    processController.RequestProcessInformation();
                    break;

                case PacketType.RequestCpuInformation:
                    cpuController.GetCpuInformation();
                    break;

                case PacketType.RequestOsInformation:
                    operatingSystemController.GetOperatingSystemInformation();
                    break;

                case PacketType.RestartServer:
                    serverController.RestartServer();
                    break;

                case PacketType.RequestNetworkInformation:
                    Task.Run(() => { networkController.GetNetworkInformation(); });
                    break;

                case PacketType.SearchFiles:
                    Task.Run(() => { fileController.SearchFile(); });
                    break;

                case PacketType.UseWebServer:
                    settingsController.ChangeWebServerUse();
                    break;

                case PacketType.ChangeWebServerPort:
                    settingsController.ChangeWebServerPort();
                    break;

                case PacketType.ChangeWebFilePath:
                    settingsController.ChangeWebFilePath();
                    break;

                case PacketType.ChangeTaskServerPort:
                    settingsController.ChangeTaskServerPort();
                    break;

                case PacketType.ChangeVncPort:
                    settingsController.ChangeVncPort();
                    break;

                case PacketType.ChangeVncPass:
                    settingsController.ChangeVncPassword();
                    break;

                case PacketType.ChangeVncProxyPort:
                    settingsController.ChangeVncProxyPort();
                    break;

                case PacketType.ChangeNetworkResolve:
                    settingsController.ChangeNetworkResolve();
                    break;

                case PacketType.ChangeLoadPlugins:
                    settingsController.ChangeLoadPlugins();
                    break;

                case PacketType.ChangeUseTerminal:
                    settingsController.ChangeUseTerminal();
                    break;

                case PacketType.GetCurrentSettings:
                    settingsController.GetCurrentSettings();
                    break;

                case PacketType.RequestSystemInformation:
                    systemController.GetSystemInformation();
                    break;

                case PacketType.GetEventLogs:
                    //WHO REENABLED THIS
                    // Task.Factory.StartNew(() => operatingSystemController.GetEventLogs());
                    break;

                case PacketType.StartScreenShare:
                    screenShareController.StartScreenShare();
                    break;

                case PacketType.StopScreenShare:
                    screenShareController.StopScreenShare();
                    break;

                case PacketType.ApproveFile:
                    fileController.ApproveFile();
                    break;

                case PacketType.StartProcess:
                    processController.StartProcess();
                    break;

                case PacketType.KillProcess:
                    processController.KillProcess();
                    break;

                case PacketType.InvalidOrEmptyPacket:
                    errorController.InvalidPacket();
                    break;

                case PacketType.CheckUpdate:
                    serverController.CheckForUpdate();
                    break;

                case PacketType.RefreshCameras:
                    webcamController.RefreshCameras();
                    break;
                }
            }
            else
            {
                errorController.NoAuth();
            }
        }
Пример #10
0
        /// <summary>
        /// To display in GUI
        /// </summary>
        void OnGUI()
        {
            // Listening to play button
            EditorApplication.playModeStateChanged += CheckPlayModeState;


            GUILayout.Label("Network settings", EditorStyles.boldLabel);

            if (networkConfigs.Count >= 1)
            {
                DrawTable();
            }

            DrawAddButton();

            GUILayout.Label("Logs", EditorStyles.boldLabel);
            if (EditorGUILayout.Toggle("Display Unity logs", enableUnityLogs) != enableUnityLogs)
            {
                enableUnityLogs = !enableUnityLogs;
                if (enableUnityLogs)
                {
                    Messages.EnableUnityLogs();
                }

                else
                {
                    Messages.DisableUnityLogs();
                }
            }

            if (EditorGUILayout.Toggle("Store logs in file", enableFileLogs) != enableFileLogs)
            {
                enableFileLogs = !enableFileLogs;
                if (enableFileLogs)
                {
                    //Messages.EnableFileLogs();
                }
                else
                {
                    // Messages.DisableFileLogs();
                }
            }

            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (stopped)
            {
                EditorGUI.BeginDisabledGroup(CheckIfNothingIsChecked() || !EditorApplication.isPlaying);
                if (GUILayout.Button("Start", GUILayout.Width(70)))
                {
                    Messages.Log("Starting TheiaVR plugin");
                    try
                    {
                        PluginController.GetInstance().Start(networkConfigs);

                        DisplayStopUI();
                    }
                    catch (Exception vException)
                    {
                        Messages.LogError(vException.Message);
                    }

                    Messages.Log("TheiaVR correctly started");
                }

                EditorGUI.EndDisabledGroup();
            }

            if (started)
            {
                if (GUILayout.Button("Stop", GUILayout.Width(70)))
                {
                    Messages.Log("Stopping TheiaVR plugin");
                    try
                    {
                        PluginController.GetInstance().Stop();
                        DisplayStartUI();
                    }
                    catch (Exception vException)
                    {
                        Messages.LogError(vException.Message);
                    }
                }
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            minSize = new Vector2(601f, 248f);
        }
Пример #11
0
 protected void OnApplicationQuit()
 {
     PluginController.GetInstance().Stop();
 }
Пример #12
0
        /*
         * private void ToolStripMenuItem_Right_Edit_ID_Click(object sender, EventArgs e)
         * {
         *  string ID = this.ToolStripMenuItem_Right_Edit_ID.Text;
         *  EditForm edtFrm = new EditForm(ID);
         *  edtFrm.Show(); // フォームの表示
         * }
         */


        private void ToolStripMenuItem_Right_Tool_UpdateCheckGame_Click(object sender, EventArgs e)
        {
            string currentVer = Common.getClientVersion();
            string updateVer  = Common.getServerVersion();

            NotifyIcon notiftIconClone = Program.frm.notifyIcon;

            if (Common.isNeedUpdate(currentVer, updateVer))
            {
                /*
                 * string strMsg = "アップデートがあります。" + Environment.NewLine +
                 *      "     " + currentVer + " → " + updateVer + Environment.NewLine +
                 *      "ランチャーを起動しますか?" + Environment.NewLine +
                 *      "※ここからゲームの起動はできません。";
                 * DialogResult msg = MessageBox.Show(strMsg, "TSLoginManager", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 * if (msg == DialogResult.Yes)
                 * {
                 *  if (!Common.isInstalled())
                 *  {
                 *      MessageBox.Show("トリックスタークライアントがインストールされていません。", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 *      return;
                 *  }
                 *  System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
                 *  psi.FileName = Common.getInstallPath();
                 *  psi.RedirectStandardInput = false;
                 *  psi.RedirectStandardOutput = false;
                 *  psi.UseShellExecute = false;
                 *  psi.CreateNoWindow = false;
                 *  // 引数
                 *  //psi.Arguments = "";
                 *
                 *  SimpleLogger.WriteLine("start Launcher and launch Update.");
                 *
                 *  // 起動
                 *  System.Diagnostics.Process.Start(psi);
                 * }
                 */

                string strMsg = "アップデートがあります。" + Environment.NewLine +
                                "     " + currentVer + " → " + updateVer + Environment.NewLine +
                                "ランチャーを起動するにはここをクリックしてください。";
                Program.frm.notifyIcon.BalloonTipIcon  = ToolTipIcon.Info;
                Program.frm.notifyIcon.BalloonTipTitle = "トリックスターアップデート通知";
                Program.frm.notifyIcon.BalloonTipText  = strMsg;
                Program.frm.notifyIcon.ShowBalloonTip(30000);
                Program.frm.notifyIcon.BalloonTipClicked += delegate
                {
                    if (!Common.isInstalled())
                    {
                        MessageBox.Show("トリックスタークライアントがインストールされていません。", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Program.frm.notifyIcon = notiftIconClone;
                        return;
                    }
                    Common.updateGame();

                    /// プラグインによるフック起動ポイント
                    PluginController.PluginHook(Program.plugins, HookPoint.UpdatedGame);

                    Program.frm.notifyIcon = notiftIconClone;
                };
                Program.frm.notifyIcon.BalloonTipClicked -= delegate
                {
                    if (!Common.isInstalled())
                    {
                        MessageBox.Show("トリックスタークライアントがインストールされていません。", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Program.frm.notifyIcon = notiftIconClone;
                        return;
                    }
                    Common.updateGame();

                    /// プラグインによるフック起動ポイント
                    PluginController.PluginHook(Program.plugins, HookPoint.UpdatedGame);

                    Program.frm.notifyIcon = notiftIconClone;
                };
            }
            else
            {
                SimpleLogger.WriteLine("no update.");

                /*
                 * MessageBox.Show("現在アップデートはありません。"
                 *  //+ "ver. " + currentVer
                 *  , "TSLoginManager", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 */
                Program.frm.notifyIcon.BalloonTipIcon  = ToolTipIcon.Info;
                Program.frm.notifyIcon.BalloonTipTitle = "トリックスターアップデート通知";
                Program.frm.notifyIcon.BalloonTipText  = "現在アップデートはありません。";
                Program.frm.notifyIcon.ShowBalloonTip(10000);
                Program.frm.notifyIcon.BalloonTipClicked += delegate
                {
                    Program.frm.notifyIcon = notiftIconClone;
                    return;
                };
            }
        }
Пример #13
0
        public MainForm()
        {
            Program.splash.statusUpdate("初期化しています...", 10);
            InitializeComponent();
            // コントロールボックスの[閉じる]ボタンの無効化
            IntPtr hMenu = TricksterTools.Library.Win32API.GetSystemMenu(this.Handle, 0);

            TricksterTools.Library.Win32API.RemoveMenu(hMenu, TricksterTools.Library.Win32API.SC_CLOSE, TricksterTools.Library.Win32API.MF_BYCOMMAND);

            /*
             * // .NET 3.5以上、Windows Vista / Windows 7 以上で対応可能なコード
             * // 再起動用コードの登録
             * ApplicationRestartRecoveryManager.RegisterForApplicationRestart(
             *      new RestartSettings("/restart",
             *      RestartRestrictions.NotOnReboot | RestartRestrictions.NotOnPatch));
             *
             * // 修復用メソッドの登録
             * RecoveryData data = new RecoveryData(new RecoveryCallback(RecoveryProcedure), null);
             * RecoverySettings settings = new RecoverySettings(data, 0);
             * ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(settings);
             *
             * // 起動時の再起動かどうかの判断
             * // 再起動時にデータを修復するコードの作成
             * if (System.Environment.GetCommandLineArgs().Length > 1 &&
             *  System.Environment.GetCommandLineArgs()[1] == "/restart")
             * {
             *  if (File.Exists(RecoveryFile))
             *  {
             *      textBox1.Text = File.ReadAllText(RecoveryFile);
             *  }
             * }
             */


            Program.splash.statusUpdate("設定を読み込み中...", 15);

            // 起動時に必要な設定を読み込みます。
            Program.LoadHandler();

            // start detect hangup timer

            /*
             * if (!SettingController.HungUp.enable)
             * {
             *  this.WController = new WatchController();
             *  this.WController.timer = new System.Threading.Timer(this.WController.timerCallback, null, 0, 1000);
             *  this.WController.timerCallback = new System.Threading.TimerCallback(this.WController.detectHungUp);
             *  this.watchThread = new Thread(new ThreadStart(this.WController.Run));
             * }
             */

            // 設定からアイコンを取得する。
            Program.splash.statusUpdate("リソース読み込み中...", 5);
            notifyIcon.Icon = Program.loadIconResource(SettingController.Icons.resourceName);

            // アイコン表示
            notifyIcon.Visible = true;
            Program.splash.statusUpdate("", 100);
            Thread.Sleep(50);
            Program.splash.Close();


            /// プラグインフックの起動
            PluginController.PluginHook(Program.plugins, TricksterTools.Plugins.HookPoint.Startup);
        }
Пример #14
0
        private void notifyIcon_MouseClick(object sender, MouseEventArgs e)
        {
            TricksterTools.Library.Win32API.SetForegroundWindow(new System.Runtime.InteropServices.HandleRef(this, this.Handle));

            Point mp = Control.MousePosition;

            /** ハッシュテーブルからIDを読み込む **/
            // 保存元のファイル名
            //string fileName = "config.txt";
            //System.Collections.Hashtable accounts = Program.loadConfig(fileName);
            System.Collections.SortedList links = SettingController.Links;

            if (e.Button == MouseButtons.Left)
            {
                #region 左クリック時

                this.contextMenuStrip_Left.Items.Clear();

                if (AccountController.AccountData.Count == 0)
                {
                    this.contextMenuStrip_Left.Items.Add("No Registered ID");
                    this.contextMenuStrip_Left.Enabled = false;
                }
                else
                {
                    this.contextMenuStrip_Left.Enabled = true;
                    IEnumerator ienum = AccountController.AccountData.GetEnumerator();
                    while (ienum.MoveNext())
                    {
                        Accounts.AccountProperties acprop = (Accounts.AccountProperties)ienum.Current;
                        string ID       = acprop.ID;
                        string Password = acprop.Password;

                        ToolStripMenuItem items = new ToolStripMenuItem();
                        items.Text = ID;

                        if (acprop.Site == Accounts.AccountProperties.LoginSite.Official)
                        {
                            items.Image = (Image)Properties.Resources.official.ToBitmap();
                        }
                        else if (acprop.Site == Accounts.AccountProperties.LoginSite.HanGame)
                        {
                            items.Image = (Image)Properties.Resources.hangame.ToBitmap();
                        }
                        else if (acprop.Site == Accounts.AccountProperties.LoginSite.AtGames)
                        {
                            items.Image = (Image)Properties.Resources.atgames.ToBitmap();
                        }
                        else if (acprop.Site == Accounts.AccountProperties.LoginSite.Gamers1)
                        {
                            //items.Image = (Image)Properties.Resources.lievo.ToBitmap();
                            items.Image = (Image)Properties.Resources.gamers1.ToBitmap();
                        }
                        else
                        {
                            items.Image = (Image)Properties.Resources.official.ToBitmap();
                        }


                        items.Click += delegate
                        {
                            if (!Common.isInstalled()) // クライアントがインストールされているか
                            {
                                MessageBox.Show("トリックスター クライアントがインストールされていません。" + Environment.NewLine +
                                                "クライアントプログラムをインストールして再度実行してください。", "TSLoginManager", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                //MessageBox.Show("TRICKSTER client program is not installed in this computer." + Environment.NewLine +
                                //    "Please try to install and run.", "TSLoginManager");
                            }
                            else
                            {
                                SimpleLogger.Write("auto login start...");
                                //LoginController.startGame(ID, Password);
                                if (acprop.Site == Accounts.AccountProperties.LoginSite.Official)
                                {
                                    SimpleLogger.WriteLine("Official");
                                    OfficialLoginController.setPluginHost(this);
                                    OfficialLoginController.startGame(ID, Password);
                                }
                                else if (acprop.Site == Accounts.AccountProperties.LoginSite.HanGame)
                                {
                                    SimpleLogger.WriteLine("HanGame");
                                    HanGameLoginController.setPluginHost(this);
                                    HanGameLoginController.startGame(ID, Password);
                                }
                                else if (acprop.Site == Accounts.AccountProperties.LoginSite.AtGames)
                                {
                                    SimpleLogger.WriteLine("AtGames");
                                    AtGamesLoginController.setPluginHost(this);
                                    AtGamesLoginController.startGame(ID, Password);
                                }
                                else if (acprop.Site == Accounts.AccountProperties.LoginSite.Gamers1)
                                {
                                    SimpleLogger.WriteLine("Lievo");
                                    //LievoLoginController.setPluginHost(this);
                                    //LievoLoginController.startGame(ID, Password);
                                    GamersOneLoginController.setPluginHost(this);
                                    GamersOneLoginController.startGame(ID, Password);
                                }
                                else
                                {
                                    OfficialLoginController.setPluginHost(this);
                                    OfficialLoginController.startGame(ID, Password);
                                }
                            }
                        };
                        this.contextMenuStrip_Left.Items.Add(items);
                    }
                }

                //this.notifyIcon.ContextMenuStrip = this.contextMenuStrip_Left;
                //this.contextMenuStrip_Left.Show(mp.X - contextMenuStrip_Left.Width, mp.Y);
                this.contextMenuStrip_Left.Show(this, PointToClient(Cursor.Position));
                #endregion
            }
            else if (e.Button == MouseButtons.Right)
            {
                #region 右クリック時

                //this.ToolStripMenuItem_Right_Edit.DropDownItems.Clear();
                //this.ToolStripMenuItem_Right_Edit.DisplayStyle = ToolStripItemDisplayStyle.Text;
                this.ToolStripMenuItem_Right_Delete.DropDownItems.Clear();
                this.ToolStripMenuItem_Right_Delete.DisplayStyle = ToolStripItemDisplayStyle.Text;
                this.ToolStripMenuItem_Right_Plugins.DropDownItems.Clear();
                this.ToolStripMenuItem_Right_Plugins.DisplayStyle = ToolStripItemDisplayStyle.Text;
                this.ToolStripMenuItem_Right_Links.DropDownItems.Clear();
                this.ToolStripMenuItem_Right_Links.DisplayStyle = ToolStripItemDisplayStyle.Text;
                this.ToolStripMenuItem_Right_Tool_PluginInfo.DropDownItems.Clear();
                this.ToolStripMenuItem_Right_Tool_PluginInfo.DisplayStyle = ToolStripItemDisplayStyle.Text;

                #region アカウント削除用一覧
                if (AccountController.AccountData.Count == 0)
                {
                    //this.ToolStripMenuItem_Right_Edit.DropDownItems.Add("No Registered ID");
                    //this.ToolStripMenuItem_Right_Edit.Enabled = false;
                    //this.ToolStripMenuItem_Right_Delete.DropDownItems.Add("No Registered ID");
                    this.ToolStripMenuItem_Right_Delete.Enabled = false;
                }
                else
                {
                    //this.ToolStripMenuItem_Right_Edit.Enabled = true;
                    //this.ToolStripMenuItem_Right_Edit.DropDown.Enabled = true;
                    this.ToolStripMenuItem_Right_Delete.Enabled          = true;
                    this.ToolStripMenuItem_Right_Delete.DropDown.Enabled = true;

                    this.contextMenuStrip_Left.Enabled = true;
                    IEnumerator ienum = AccountController.AccountData.GetEnumerator();
                    while (ienum.MoveNext())
                    {
                        //ToolStripMenuItem edit_items = new ToolStripMenuItem();
                        ToolStripMenuItem          del_items = new ToolStripMenuItem();
                        Accounts.AccountProperties acprop    = (Accounts.AccountProperties)ienum.Current;
                        string ID = acprop.ID;
                        //string Password = accounts[ID].ToString();

                        //edit_items.Text = ID;
                        del_items.Text = ID;

                        /*
                         * edit_items.Click += delegate
                         * {
                         *  EditForm edtFrm = new EditForm(ID);
                         *  edtFrm.Show(); // フォームの表示
                         * };
                         * this.ToolStripMenuItem_Right_Edit.DropDownItems.Add(edit_items);
                         */
                        if (acprop.Site == Accounts.AccountProperties.LoginSite.Official)
                        {
                            del_items.Image = (Image)Properties.Resources.official.ToBitmap();
                        }
                        else if (acprop.Site == Accounts.AccountProperties.LoginSite.HanGame)
                        {
                            del_items.Image = (Image)Properties.Resources.hangame.ToBitmap();
                        }
                        else if (acprop.Site == Accounts.AccountProperties.LoginSite.AtGames)
                        {
                            del_items.Image = (Image)Properties.Resources.atgames.ToBitmap();
                        }
                        else if (acprop.Site == Accounts.AccountProperties.LoginSite.Gamers1)
                        {
                            del_items.Image = (Image)Properties.Resources.lievo.ToBitmap();
                        }
                        else
                        {
                            del_items.Image = (Image)Properties.Resources.official.ToBitmap();
                        }

                        del_items.Click += delegate
                        {
                            DialogResult diagres = MessageBox.Show("ID: \" " + ID + " \" を削除しようとしています。" + Environment.NewLine +
                                                                   "よろしいですか?", "TSLoginManager", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);
                            if (diagres == DialogResult.No)
                            {
                                return;
                            }
                            ProgramController.AController.delete(ID, acprop.Site);

                            /*
                             * この時点でもアカウント情報をファイルに保存する
                             */
                            string filename = Environment.CurrentDirectory + @"\accounts.dat";
                            if (AccountController.isLoadedAccount && (AccountController.AccountData.Count > 0))
                            {
                                ProgramController.AController.saveAccounts(filename, AccountController.MasterKey);
                            }
                        };
                        this.ToolStripMenuItem_Right_Delete.DropDownItems.Add(del_items);
                    }
                }
                #endregion
                #region プラグイン一覧
                if (Program.plugins.Length == 0)
                {
                    //this.ToolStripMenuItem_Right_Plugins.DropDownItems.Add("No Plugin");
                    this.ToolStripMenuItem_Right_Plugins.Enabled = false;
                }
                else
                {
                    this.ToolStripMenuItem_Right_Plugins.Enabled          = true;
                    this.ToolStripMenuItem_Right_Plugins.DropDown.Enabled = true;

                    foreach (TricksterTools.Plugins.IPlugin plugin in Program.plugins)
                    {
                        ToolStripMenuItem_Plugin PluginItems = new ToolStripMenuItem_Plugin();
                        PluginItems.setPluginName(plugin.GetType().Name, plugin.Name);
                        PluginItems.Click += delegate
                        {
                            PluginController.PluginRun(Program.plugins, PluginItems.ClassName);
                        };
                        this.ToolStripMenuItem_Right_Plugins.DropDownItems.Add(PluginItems);
                    }
                }
                #endregion
                #region プラグイン情報
                if (Program.plugins.Length == 0)
                {
                    //this.ToolStripMenuItem_Right_Tool_PluginInfo.DropDownItems.Add("No Plugin");
                    this.ToolStripMenuItem_Right_Tool_PluginInfo.Enabled = false;
                }
                else
                {
                    this.ToolStripMenuItem_Right_Tool_PluginInfo.Enabled          = true;
                    this.ToolStripMenuItem_Right_Tool_PluginInfo.DropDown.Enabled = true;

                    foreach (TricksterTools.Plugins.IPlugin plugin in Program.plugins)
                    {
                        ToolStripMenuItem_Plugin PluginInfoItems = new ToolStripMenuItem_Plugin();
                        PluginInfoItems.setPluginName(plugin.GetType().Name, plugin.Name);
                        PluginInfoItems.Click += delegate
                        {
                            //PluginInfoForm pluginInfoForm = new PluginInfoForm(plugin);
                            PluginInfoForm pluginInfoForm = new PluginInfoForm(PluginController.getPluginInfo(Program.plugins, PluginInfoItems.ClassName));
                            pluginInfoForm.Show();
                            pluginInfoForm.Owner = this;
                        };
                        this.ToolStripMenuItem_Right_Tool_PluginInfo.DropDownItems.Add(PluginInfoItems);
                    }
                }
                #endregion
                #region リンク一覧

                if (links.ContainsKey("__TSLM_NULL__"))
                {
                    this.ToolStripMenuItem_Right_Links.DropDownItems.Add("No Links");
                    this.ToolStripMenuItem_Right_Links.Enabled = false;
                }
                else
                {
                    this.ToolStripMenuItem_Right_Links.Enabled          = true;
                    this.ToolStripMenuItem_Right_Links.DropDown.Enabled = true;

                    foreach (string key in links.Keys)
                    {
                        ToolStripMenuItem link_items = new ToolStripMenuItem();
                        string            SiteName   = key;
                        link_items.Text   = SiteName;
                        link_items.Click += delegate
                        {
                            System.Diagnostics.Process.Start(links[SiteName].ToString());
                        };
                        this.ToolStripMenuItem_Right_Links.DropDownItems.Add(link_items);
                    }
                }
                #endregion
                #region プラグイン情報
                //this.notifyIcon.ContextMenuStrip = this.contextMenuStrip_Right;
                this.Activate();
                this.contextMenuStrip_Right.Show(mp.X, mp.Y + 275);
                //this.contextMenuStrip_Right.Show(this, Cursor.Position.X - this.Location.X, Cursor.Position.X - this.Location.X);
                //this.contextMenuStrip_Right.Show(PointToScreen(Cursor.Position));

                ToolStripDropDownMenu tsddm_r_del = (ToolStripDropDownMenu)this.ToolStripMenuItem_Right_Delete.DropDown;
                tsddm_r_del.ShowImageMargin = true;
                ToolStripDropDownMenu tsddm_r_link = (ToolStripDropDownMenu)this.ToolStripMenuItem_Right_Links.DropDown;
                tsddm_r_link.ShowImageMargin = false;
                ToolStripDropDownMenu tsddm_r_plugin = (ToolStripDropDownMenu)this.ToolStripMenuItem_Right_Plugins.DropDown;
                tsddm_r_plugin.ShowImageMargin = false;
                ToolStripDropDownMenu tsddm_r_tool = (ToolStripDropDownMenu)this.ToolStripMenuItem_Right_Tool.DropDown;
                tsddm_r_tool.ShowImageMargin = false;
                ToolStripDropDownMenu tsddm_r_tool_setting = (ToolStripDropDownMenu)this.ToolStripMenuItem_Right_Tool_Settings.DropDown;
                tsddm_r_tool_setting.ShowImageMargin = false;
                ToolStripDropDownMenu tsddm_r_tool_plguininfo = (ToolStripDropDownMenu)this.ToolStripMenuItem_Right_Tool_PluginInfo.DropDown;
                tsddm_r_tool_plguininfo.ShowImageMargin = false;
                #endregion
                #endregion
            }
        }
Пример #15
0
        /// <summary>
        /// MainForm以外から終了処理を行う際に、
        /// タイマの処理を行わない状態で終了します。
        /// 外部からのやむを得ない終了処理時以外の使用を推奨しません。
        /// </summary>
        public static void ExitHandler()
        {
            /// プラグインフックの起動
            PluginController.PluginHook(Program.plugins, TricksterTools.Plugins.HookPoint.Shutdown);



            // 設定保存
            string settingfile   = Environment.CurrentDirectory + @"\settings.xml";
            string MasterKeyFile = Environment.CurrentDirectory + @"\masterkey.cfg";

            SettingController.saveSettings(settingfile);
            // プラグインの設定保存
            //PluginSettings.saveConfig(plugins);

            // アカウント情報保存
            //Program.saveAccountToText(filename);
            string filename = Environment.CurrentDirectory + @"\accounts.dat";

            if (AccountController.isLoadedAccount && (AccountController.AccountData.Count > 0))
            {
                ProgramController.AController.saveAccounts(filename, AccountController.MasterKey);
                if (!File.Exists(MasterKeyFile))
                {
                    DialogResult mbtn = DialogResult.No;
                    mbtn = MessageBox.Show("暗号化キーワードを保存しますか?" + Environment.NewLine +
                                           "保存すると次回起動時に暗号化キーワードの入力をスキップできます。" + Environment.NewLine +
                                           "※複数人と共有コンピュータに保存する場合は推奨しません。", "TSLoginManager", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (mbtn == DialogResult.Yes)
                    {
                        if (!TricksterTools.API.Controller.AccountController.saveMasterKey(AccountController.MasterKey, MasterKeyFile))
                        {
                            MessageBox.Show("暗号化キーワードファイルの保存に失敗しました。");
                        }
                    }
                }
            }
            else if (AccountController.AccountData.Equals(null))
            {
                return;
            }
            else
            {
                if (AccountController.AccountData.Count > 0 && !AccountController.isLoadedAccount)
                {
                    AccountController.MasterKey = Microsoft.VisualBasic.Interaction.InputBox("暗号化に使用するキーワードを入力してください。", "Error", "", (Screen.PrimaryScreen.Bounds.Width / 2) - (360 / 2), (Screen.PrimaryScreen.Bounds.Height / 2) - 120);
                    Boolean abortFlg = false;
                    while (AccountController.MasterKey.Trim() == "" || abortFlg)
                    {
                        DialogResult mboxbutton = MessageBox.Show("暗号化キーワードは必ず入力してください。", "Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        if (mboxbutton == DialogResult.Abort)
                        {
                            DialogResult mbtn = MessageBox.Show("この操作を中断するとアカウント情報を保存できません。" + Environment.NewLine +
                                                                "よろしいですか?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                            if (mbtn == DialogResult.Yes)
                            {
                                abortFlg = true;
                                break;
                            }
                        }
                        AccountController.MasterKey = Microsoft.VisualBasic.Interaction.InputBox("暗号化に使用するキーワードを入力してください。", "Error", "", (Screen.PrimaryScreen.Bounds.Width / 2) - (360 / 2), (Screen.PrimaryScreen.Bounds.Height / 2) - 120);
                    }
                    if (!abortFlg)
                    {
                        bool NoSaveFlag = false;
                        if (System.IO.File.Exists(filename))
                        {
                            DialogResult mbtn = DialogResult.No;
                            while (mbtn == DialogResult.No)
                            {
                                mbtn = MessageBox.Show("この状態で保存すると、既に存在しているアカウント情報は上書きされ、復元できなくなります。" + Environment.NewLine +
                                                       "上書きしてよろしいですか?", "上書き確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                                if (mbtn == DialogResult.Yes)
                                {
                                    break;
                                }
                                mbtn = MessageBox.Show("保存せずに終了しますか?", "終了確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                                if (mbtn == DialogResult.Yes)
                                {
                                    NoSaveFlag = true;
                                }
                            }
                        }
                        if (!NoSaveFlag)
                        {
                            ProgramController.AController.saveAccounts(filename, AccountController.MasterKey);
                            if (!File.Exists(MasterKeyFile))
                            {
                                DialogResult mbtn2 = DialogResult.No;
                                mbtn2 = MessageBox.Show("暗号化キーワードを保存しますか?" + Environment.NewLine +
                                                        "保存すると次回起動時に暗号化キーワードの入力をスキップできます。" + Environment.NewLine +
                                                        "※複数人と共有コンピュータに保存する場合は推奨しません。", "TSLoginManager", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                                if (mbtn2 == DialogResult.Yes)
                                {
                                    if (!TricksterTools.API.Controller.AccountController.saveMasterKey(AccountController.MasterKey, MasterKeyFile))
                                    {
                                        MessageBox.Show("暗号化キーワードファイルの保存に失敗しました。");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #16
0
 public MembershipHelperWrapper(PluginController controller)
 {
     _membershipHelper = controller.Members;
 }
 public IContentService GetContentService(PluginController controller)
 {
     return(controller.Services.ContentService);
 }
 public MemberServiceWrapper(PluginController controller)
 {
     _memberService = controller.Services.MemberService;
 }
 public IMembershipHelperWrapper GetMembershipHelperWrapper(PluginController controller)
 {
     return(new MembershipHelperWrapper(controller));
 }
Пример #20
0
                /// <summary>
                /// ゲームを起動します
                /// </summary>
                protected internal void runGame(string startID, string startKey)
                {
                    // execute launcher
                    string splash_path = Common.getInstallPath();
                    string bin_path    = splash_path.Replace("Splash.exe", "Trickster.bin");

                    if (SettingController.GameStartUp.mode == SettingController.RUN_GAME_DIRECT)
                    {
                        SimpleLogger.WriteLine("GameStartUpMode: Direct");
                    }
                    else
                    {
                        SimpleLogger.WriteLine("GameStartUpMode: Launcher");
                        bin_path = splash_path;
                    }

                    string serverVersion = Common.getServerVersion();
                    string clientVersion = Common.getClientVersion();

                    if (Common.isNeedUpdate(clientVersion, serverVersion) && SettingController.GameStartUp.mode == SettingController.RUN_GAME_DIRECT)
                    {
                        SimpleLogger.WriteLine("need update version: " + clientVersion + " -> " + serverVersion);
                        MessageBox.Show("アップデートがあるためランチャーを起動します。", "Trickster Tools", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        if (File.Exists(splash_path))
                        {
                            Common.updateGame(splash_path);
                            /// プラグインフックの起動
                            TricksterTools.Plugins.IPlugin[] plugins = PluginController.loadPlugins(pluginHost);
                            PluginController.PluginHook(plugins, TricksterTools.Plugins.HookPoint.UpdatedGame);
                        }
                    }

                    if (File.Exists(bin_path))
                    {
                        System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
                        psi.FileName = bin_path;
                        psi.RedirectStandardInput  = false;
                        psi.RedirectStandardOutput = false;
                        psi.UseShellExecute        = false;
                        // ウィンドウを表示しないようにする
                        psi.CreateNoWindow = false;
                        // 引数
                        psi.Arguments = startID + "," + startKey;
                        SimpleLogger.WriteLine(bin_path + " " + psi.Arguments.ToString());

                        if (Common.isNeedUpdate(clientVersion, serverVersion) && SettingController.GameStartUp.mode == SettingController.RUN_GAME_LAUNCHER)
                        {
                            // 起動
                            WatchController.TrickProcess = System.Diagnostics.Process.Start(psi);

                            SimpleLogger.WriteLine("need update version: " + clientVersion + " -> " + serverVersion);
                            MessageBox.Show("アップデートがあります。\n"
                                            + "アップデート完了後、ゲームスタートをする前にOKボタンを押してください。", "Trickster Tools", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);

                            /// プラグインフックの起動
                            TricksterTools.Plugins.IPlugin[] plugins = PluginController.loadPlugins(pluginHost);
                            PluginController.PluginHook(plugins, TricksterTools.Plugins.HookPoint.UpdatedGame);
                            PluginController.PluginHook(plugins, TricksterTools.Plugins.HookPoint.RunGame);
                        }
                        else
                        {
                            /// プラグインフックの起動
                            TricksterTools.Plugins.IPlugin[] plugins = PluginController.loadPlugins(pluginHost);
                            PluginController.PluginHook(plugins, TricksterTools.Plugins.HookPoint.RunGame);


                            // 起動
                            WatchController.TrickProcess = System.Diagnostics.Process.Start(psi);
                        }
                    }
                    else
                    {
                        SimpleLogger.WriteLine("\"" + bin_path + "\" does not exsit.");
                        MessageBox.Show("ゲーム起動に必要なプログラムが存在しないため起動できません。", "Trickster Tools", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
Пример #21
0
 public MembersWrapper(PluginController controller)
 {
     _members = controller.Members;
 }
Пример #22
0
        static void Main(string[] args)
        {
            {
                string s = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Substring(7);
                Environment.CurrentDirectory = s.Substring(0, s.LastIndexOf("/") + 2);//sets the WorkingDirectory to the program path
            }
            ControllServer Serv = null;

            //Console.TreatControlCAsInput=true;

            Console.Clear();
            Console.WriteLine("Verifying Enviroment");
            Console.WriteLine("WD:" + Environment.CurrentDirectory);
            if (!Directory.Exists(PluginSettings.PluginPath))
            {
                Directory.CreateDirectory(PluginSettings.PluginPath);
                Console.WriteLine("Created Plugin Directory");
            }
            Console.WriteLine("Done! Starting Program Boot");

            Console.WriteLine("Loading Services . . .");
            try
            {
                BrickControll.Brick.LEDS.SetBothLedsTo(LEDColor.red);
            }
            catch
            {
                Console.WriteLine("Failed to set LEDS from Ev3DevLib");
                Environment.Exit(ErrorCodes.Failed_ToLoadService);
            }//BrickControll.Brick.LEDS.SetBothLedsTo(LEDColor.red);
            try
            {
                CommandsList.INIT();
            }
            catch
            {
                Console.WriteLine("Failed to Initulize CommandList from BlackOS");
                Environment.Exit(ErrorCodes.Failed_ToLoadService);
            }//CommandsList.INIT();
            try
            {
                Serv = new ControllServer();
            }
            catch
            {
                Console.WriteLine("Failed to Load ControllServer from BlackOS");
                Environment.Exit(ErrorCodes.Failed_ToLoadService);
            }//Serv = new ControllServer();
            try
            {
                BlackOSPluginSDK.CMD.INIT(CMD.CommandsList.CreateCMDHandlerForSDK());
            }
            catch
            {
                Console.WriteLine("Failed to Initulize SDK CMDHandler from BlackOSPluginSDK");
                Environment.Exit(ErrorCodes.Failed_ToLoadService);
            }//BlackOSPluginSDK.CMD.INIT(CMD.CommandsList.CreateCMDHandlerForSDK());
            try
            {
                PluginController.INIT(PluginSettings.PluginPath);
            }
            catch
            {
                Console.WriteLine("Failed to Initulize PluginController from BlackOS");
                Environment.Exit(ErrorCodes.Failed_ToLoadService);
            }//PluginController.INIT(PluginSettings.PluginPath);
            Console.WriteLine("Services Loaded");

            Console.WriteLine("Hooking Devices . . .");
            try
            {
                BrickControll.LoadPorts();
            }
            catch
            {
                Console.WriteLine("Failed to load ports from Ev3DevLib");
                Environment.Exit(ErrorCodes.Failed_ToLoadService);
            }//BrickControll.LoadPorts();
            Console.WriteLine("Hooked Devices");

            Console.WriteLine("Hooking STD Commands . . .");
#if DebuggModel
            CommandsList.CreateCommand(CommandsList.CreateID(), new Action <CommandArgs>(ShutDown), "Shutdown", "This is a DebuggModel Command  /Shutdown");
            CommandsList.CreateCommand(CommandsList.CreateID(), new Action <CommandArgs>(TempCmd), "TestReciver", "This is a DebuggModel Command  /TestReciver");
#endif
            Ev3DevBotController.LoadHooks();
            Console.WriteLine("Hooked STD Commands");

            Console.WriteLine("Hook Plugin Commands");
            PluginController.LoadPluginHooks();
            Console.WriteLine("Hooked Plugin Commands");

            Console.WriteLine("Booting Services");
            try
            {
                Serv.StartServer();
            }
            catch
            {
                Console.WriteLine("Failed to Start ControllServer from BlackOS");
                Environment.Exit(ErrorCodes.Failed_ToStartServer);
            }//Serv.StartServer();
            Console.WriteLine("Fully Booted");

            Console.WriteLine("BlackOS Is Running . . .");
            while (!SHUTDOWN)
            {
                ;
            }

            Console.WriteLine("ShutdownCalled");

            Console.WriteLine("Stopping Plugins");
            PluginController.CleanUpPlugins();
            Console.WriteLine("Plugins Stopped, GoodBye!");
            Environment.Exit(0);
        }
Пример #23
0
 public IMemberService GetMemberService(PluginController controller)
 {
     return(controller.Services.MemberService);
 }
Пример #24
0
        public MainForm()
        {
            InitializeComponent();

            iptcView1.PreInit();
            exifGpsView1.PreInit();
            iptcGpsController                 = new IptcGpsController(this, this.iptcView1, this.exifGpsView1);
            this.buttonGpsViewSave.Click     += iptcGpsController.Save_Click;
            this.buttonGpsViewSaveAll.Click  += iptcGpsController.SaveToAll_Click;
            this.buttonIptcViewSave.Click    += iptcGpsController.Save_Click;
            this.buttonIptcViewSaveAll.Click += iptcGpsController.SaveToAll_Click;
            this.bindingSourceIptcGpsController.DataSource = iptcGpsController;

            renameView1.PreInit();
            renameController         = new RenameController(this, this.renameView1);
            this.buttonRename.Click += renameController.Rename_Click;
            renameController.ProcessFilesInSubdirectories = this.chkRenameSubdirs.Checked;

            pluginView1.PreInit();
            pluginController               = new PluginController(this, this.pluginView1);
            this.buttonPluginRun.Click    += this.pluginController.Execute_Click;
            this.buttonPluginRunAll.Click += this.pluginController.ExecuteForAll_Click;
            pluginController.ProcessFilesInSubdirectories = this.chkPluginSubdirs.Checked;

            exifDateView1.PreInit();
            exifDateController = new ExifDateController(this, exifDateView1);
            this.buttonExifDateViewSave.Click              += exifDateController.Save_Click;
            this.buttonExifDateViewSaveAll.Click           += exifDateController.SaveToAll_Click;
            this.bindingSourceExifDateController.DataSource = exifDateController;

            this.Icon = Resources.PTS;

            this.splitContainer1.Panel1MinSize = 100;
            this.splitContainer1.Panel2MinSize = 400;
            this.splitContainer2.Panel1MinSize = 100;
            this.splitContainer2.Panel2MinSize = 325;
            this.splitContainer3.Panel2MinSize = 100;
            this.splitContainer3.Panel1MinSize = 100;

            displayControls = new PictureDetailControlList();
            displayControls.Add(this.iptcGpsController);
            displayControls.Add(this.pictureDisplay);
            displayControls.Add(this.exifDisplay1);
            displayControls.Add(this.completeTagList1);
            displayControls.Add(this.imageDisplay1);
            displayControls.Add(this.renameController);
            displayControls.Add(this.pluginController);
            displayControls.Add(this.exifDateController);

            displayControls.RegisterEvents(this.RefreshDetailViews,
                                           this.RefreshCurrentDirectoryView,
                                           this.RefreshDirectoryTree,
                                           this.NavigateFiles,
                                           this.ListAllCheckedFiles,
                                           this.ListSelectedDirectory);

            // add the secondary status display
            this.toolStripProgressBar2         = new ToolStripProgressBar();
            this.toolStripProgressBar2.Margin  = new Padding(735, 3, 1, 3);
            this.toolStripProgressBar2.Name    = "toolStripProgressBar2";
            this.toolStripProgressBar2.Size    = new System.Drawing.Size(100, 16);
            this.toolStripProgressBar2.Visible = false;
            this.statusStrip.Items.Add(this.toolStripProgressBar2);
            secondStatusDisplay = new StatusDisplay(this.toolStripProgressBar2);
            this.pictureDisplay.SetStatusDisplay(secondStatusDisplay);

            UpdateRecentMacros();

            Default_PropertyChanged(null, new PropertyChangedEventArgs("VisibleTabs"));
            Settings.Default.PropertyChanged += new PropertyChangedEventHandler(Default_PropertyChanged);
        }
Пример #25
0
 static FakerConfig()
 {
     //Load Plugins
     pluginController = new PluginController();
     plugins          = pluginController.LoadPlugins("Plugins");
 }
        public void HandlePacket(Packets packet)
        {
            var packetType = packet.packetType;

            Console.WriteLine(packetType);
            var errorController   = new ErrorController(Client, packet);
            var windowsController = new WindowsController(Client, packet);

            if (packetType == PacketType.InvalidOrEmptyPacket)
            {
                errorController.InvalidPacket();
                return;
            }
            if (packetType == PacketType.InvalidApiKey)
            {
                errorController.InvalidApiKey();
                return;
            }
            if (packetType == PacketType.RequestWindowsInformation)
            {
                windowsController.GetWindowsInformation();
                return;
            }
            if (!authClient.Authenticated && packetType == PacketType.Authenticate)
            {
                var loginDecoder       = new UlteriusLoginDecoder();
                var password           = packet.args.First().ToString();
                var authenticationData = loginDecoder.Login(password, Client);
                Client.WriteStringAsync(authenticationData, CancellationToken.None);
            }

            if (authClient.Authenticated)
            {
                #region

                //Build a controller workshop!
                var fileController            = new FileController(Client, packet);
                var processController         = new ProcessController(Client, packet);
                var cpuController             = new CpuController(Client, packet);
                var systemController          = new SystemController(Client, packet);
                var operatingSystemController = new OperatingSystemController(Client, packet);
                var networkController         = new NetworkController(Client, packet);
                var serverController          = new ServerController(Client, packet);
                var settingsController        = new SettingsController(Client, packet);
                var gpuController             = new GpuController(Client, packet);
                var vncController             = new VncController(Client, packet);
                var pluginController          = new PluginController(Client, packet);
                var webcamController          = new WebCamController(Client, packet);

                #endregion

                switch (packetType)
                {
                case PacketType.DownloadFile:
                    fileController.DownloadFile();
                    break;

                case PacketType.RequestGpuInformation:
                    gpuController.GetGpuInformation();
                    break;

                case PacketType.Plugin:
                    pluginController.StartPlugin();
                    break;

                case PacketType.GetPlugins:
                    pluginController.ListPlugins();
                    break;

                case PacketType.GetBadPlugins:
                    pluginController.ListBadPlugins();
                    break;

                case PacketType.CreateFileTree:
                    fileController.CreateFileTree();
                    break;

                case PacketType.StartCamera:
                    webcamController.StartCamera();
                    break;

                case PacketType.StopCamera:
                    webcamController.StopCamera();
                    break;

                case PacketType.PauseCamera:
                    webcamController.PauseCamera();
                    break;

                case PacketType.GetCameras:
                    webcamController.GetCameras();
                    break;

                case PacketType.StartCameraStream:
                    webcamController.StartStream();
                    break;

                case PacketType.StopCameraStream:
                    webcamController.StopStream();
                    break;

                case PacketType.RequestProcess:
                    processController.RequestProcessInformation();
                    break;

                case PacketType.StreamProcesses:
                    processController.StreamProcessInformation();
                    break;

                case PacketType.StopProcessStream:
                    processController.StopProcessStream();
                    break;

                case PacketType.RequestCpuInformation:
                    cpuController.GetCpuInformation();
                    break;

                case PacketType.RequestOsInformation:
                    operatingSystemController.GetOperatingSystemInformation();
                    break;

                case PacketType.RestartServer:
                    serverController.RestartServer();
                    break;

                case PacketType.RequestNetworkInformation:
                    networkController.GetNetworkInformation();
                    break;

                case PacketType.UseWebServer:
                    settingsController.ChangeWebServerUse();
                    break;

                case PacketType.ChangeWebServerPort:
                    settingsController.ChangeWebServerPort();
                    break;

                case PacketType.ChangeWebFilePath:
                    settingsController.ChangeWebFilePath();
                    break;

                case PacketType.ChangeTaskServerPort:
                    settingsController.ChangeTaskServerPort();
                    break;

                case PacketType.ChangeVncPort:
                    settingsController.ChangeVncPort();
                    break;

                case PacketType.ChangeVncPass:
                    settingsController.ChangeVncPassword();
                    break;

                case PacketType.ChangeVncProxyPort:
                    settingsController.ChangeVncProxyPort();
                    break;

                case PacketType.ChangeNetworkResolve:
                    settingsController.ChangeNetworkResolve();
                    break;

                case PacketType.GetCurrentSettings:
                    settingsController.GetCurrentSettings();
                    break;

                case PacketType.RequestSystemInformation:
                    systemController.GetSystemInformation();
                    break;

                case PacketType.GetEventLogs:
                    Task.Factory.StartNew(() => operatingSystemController.GetEventLogs());
                    break;

                case PacketType.StartVncServer:
                    vncController.StartVncServer();
                    break;

                case PacketType.StartProcess:
                    processController.StartProcess();
                    break;

                case PacketType.KillProcess:
                    processController.KillProcess();
                    break;

                case PacketType.EmptyApiKey:
                    errorController.EmptyApiKey();
                    break;

                case PacketType.InvalidApiKey:
                    errorController.InvalidApiKey();
                    break;

                case PacketType.InvalidOrEmptyPacket:
                    errorController.InvalidPacket();
                    break;

                case PacketType.GenerateNewKey:
                    settingsController.GenerateNewAPiKey();
                    break;

                case PacketType.CheckUpdate:
                    serverController.CheckForUpdate();
                    break;

                case PacketType.GetActiveWindowsSnapshots:
                    windowsController.GetActiveWindowsImages();
                    break;

                case PacketType.RefreshCameras:
                    webcamController.RefreshCameras();
                    break;

                default:
                    break;
                }
            }
            else
            {
                errorController.NoAuth();
            }
        }