public void Start() { Instance = this; AsyncTasks = new Queue <Action>(300); FrameActions = new MapList <Action>(300); Config.InitConfig(); DataService.LoadData(); TextureService.LoadTextures(); DeckService.LoadForbiddenLists(); imgSelector = new Lazy <ImageSelector>(); tglSelector = new Lazy <ToggleSelector>(); confirmWindow = new Lazy <ConfirmWindow>(); annWindow = new Lazy <AnnounceWindow>(); opSelector = new Lazy <OptionSelector>(); inputBox = new Lazy <InputBox>(); hint = new Lazy <HintBox>(); lazyDescriptor = new Lazy <CardDescriptor>(); lazyChat = new Lazy <ChatWindow>(); ToolStrip = new ToolStrip(); DuelWindow = new DuelWindow(); DeckBuilder = new DeckBuilder(); RoomWindow = new RoomWindow(); Menu = new MainMenu(); ConfigWindow = new ConfigWindow(); ServerWindow = new ServerWindow(); Field = new Field(); Duel = new ClientDuel(); Menu.Show(); }
public static string GetProfileText() { string text = ""; var id = ""; var marker = ""; var handle = ""; var classname = ""; var integrity = "unconfirmed"; try { if (ServerWindow != null) { id = ServerWindow.Text; marker = ServerWindow.Marker; handle = ServerWindow.Handle.ToString(); classname = ServerWindow.GetWindowClassName(); } integrity = "confirmed"; } catch { integrity = "damaged"; } text += "Integrity: " + integrity + "\r\n"; text += "Id: " + id + "\r\n"; text += "Marker: " + marker + "\r\n"; text += "Handle: " + handle + "\r\n"; text += "Class: " + classname + "\r\n"; return(text); }
private void BTN_Server_Click(object sender, RoutedEventArgs e) { ServerWindow sw = new ServerWindow(); sw.Show(); this.Close(); }
public override bool Do(ServerWindow window, string channel, string[] args) { if (!base.Do(window, channel, args)) { return(false); } window.SendRaw("PRIVMSG " + args[0] + " :" + ChatWindow.A + args[1] + (args.Length > 2 ? " " + string.Join(" ", args, 2, args.Length - 2) : "") + ChatWindow.A); return(true); }
public override bool Do(ServerWindow window, string channel, string[] args) { if (!base.Do(window, channel, args)) { return(false); } window.queryUser((string)args[0]); return(true); }
private void SettingsButton_Click(object sender, RoutedEventArgs e) { ServerWindow nWindow = new ServerWindow(); nWindow.Left = window.Left; nWindow.Top = window.Top; nWindow.Show(); window.Close(); }
public virtual bool Do(ServerWindow window, string channel, string[] args) { if (args.Length < this.MinLength() || args.Length > this.MaxLength()) { this.ErrorLength(window, channel, args.Length, args.Length < this.MinLength()); return(false); } return(true); }
public static void CreateWindow() { ServerWindow = new ServerWindow(); ServerWindow.ShowInTaskbar = false; ServerWindow.WindowState = FormWindowState.Minimized; ServerWindow.Text = Persistence.ServerId; ServerWindow.Show(); Ide.ServerWindow = ServerWindow; }
public override bool Do(ServerWindow window, string channel, string[] args) { if (!base.Do(window, channel, args)) { return(false); } window.SendRaw(string.Join(" ", args)); return(true); }
public static void DestroyWindow() { if (ServerWindow != null) { ServerWindow.Close(); ServerWindow.Dispose(); } ServerWindow = null; Ide.ServerWindow = null; }
public override bool Do(ServerWindow window, string channel, string[] args) { if (!base.Do(window, channel, args)) { return(false); } window.PartChannel(args[0], string.Join(" ", args, 1, args.Length - 1)); return(true); }
public override bool Do(ServerWindow window, string channel, string[] args) { if (!base.Do(window, channel, args)) { return(false); } window.getChannel(channel).printText("This is an example command that prints to the channel you're on!"); return(true); }
public override bool Do(ServerWindow window, string channel, string[] args) { if (!base.Do(window, channel, args)) { return(false); } window.joinChannel(args); return(true); }
/** * args = 0:channel, 1: */ public override bool Do(ServerWindow window, string channel, string[] args) { if (!base.Do(window, channel, args)) { return(false); } window.SendRaw("PRIVMSG " + channel + " :" + ChatWindow.A + "ACTION " + string.Join(" ", args) + ChatWindow.A); window.getChannel(channel).printText("* " + window.nickName + " " + string.Join(" ", args)); return(true); }
public override bool Do(ServerWindow window, string channel, string[] args) { if (!base.Do(window, channel, args)) { return(false); } window.ChangeNickname(args[0]); return(true); }
/// <summary> /// Called by the base engine class when its safe to begin deinitialization. /// </summary> protected override void Finish() { // Remember me!!! Remember me!! if (_rememberUser == true) { _engineConfigFile.SetSetting("account:username", _currentUsername); _engineConfigFile.SetSetting("account:password", _currentPassword); } else { _engineConfigFile.SetSetting("account:username", ""); _engineConfigFile.SetSetting("account:password", ""); } // Ignore everything else if we are not running a game. if (_gameName == "") { _explorerWindow.Dispose(); _explorerWindow = null; GC.Collect(); return; } // Close network. if (_serverWindow != null) { NetworkManager.Finish(); } // Pump out a GameFinish event. EventManager.FireEvent(new Event("game_finish", this, null)); // Allow the processes some time to be notified of closing events. EventManager.ProcessEvents(); ProcessManager.RunProcesses(-1); // Close down the window. if (_window != null) { _window.Dispose(); _window = null; GC.Collect(); } // Close down the server window. if (_serverWindow != null) { _serverWindow.Dispose(); _serverWindow = null; GC.Collect(); } // Close the network connection. NetworkManager.Close(); }
private void btnServerConnect_Click(object sender, RoutedEventArgs e) { if (!BaseDataBase.CurrentUser.IT) { MyMessageBox.Show("ليس لديك صلاحيات للدخول"); return; } ServerWindow w = new ServerWindow(); w.ShowDialog(); }
public override bool Do(ServerWindow window, string channel, string[] args) { if (!base.Do(window, channel, args)) { return(false); } window.status = ServerWindow.Status.Disconnecting; window.SendRaw("QUIT " + string.Join(" ", args)); return(true); }
public virtual void ErrorLength(ServerWindow window, string channel, int length, bool small) { ChannelWindow chan = window.getChannel(channel); if (chan != null) { chan.printText("Error: " + Name() + " Args: " + length + (small ? " Not Enough Arguments." : " Too Many Arguments")); } else { Console.WriteLine("Error: " + Name() + " Args: " + length + (small ? " Not Enough Arguments." : " Too Many Arguments")); } }
public override bool Do(ServerWindow window, string channel, string[] args) { if (!base.Do(window, channel, args)) { return(false); } if (window.status == ServerWindow.Status.Disconnected) { window.connect(); } return(true); }
public override bool Do(ServerWindow window, string channel, string[] args) { if (!base.Do(window, channel, args)) { return(false); } window.SendRaw("PRIVMSG " + (string)args[0] + " :" + string.Join(" ", args, 1, args.Length - 1)); if (window.getChannel((string)args[0]) != null) { window.getChannel((string)args[0]).printText(window.nickName + ": " + string.Join(" ", args, 1, args.Length - 1)); } else { window.printText("-> *" + (string)args[0] + "* " + string.Join(" ", args, 1, args.Length - 1)); } return(true); }
public override bool Do(ServerWindow window, string channel, string[] args) { if (!base.Do(window, channel, args)) { return(false); } ChatWindow wind = window; if (!channel.Equals("") && window.getChannel(channel) != null) { wind = window.getChannel(channel); } if (args.Length == 1) { if (MainWindow.commands.ContainsKey(args[0])) { wind.printText("*** " + ((CommandBase)MainWindow.commands[args[0]]).Syntax()); wind.printText("*** " + ((CommandBase)MainWindow.commands[args[0]]).Help()); } else { wind.printText("Command " + args[0] + " not found!"); } } else { string text = "*** "; int i = 0; foreach (CommandBase com in MainWindow.commands.Values) { text = string.Format("{0}| {1,-10}", text, com.Name()); if (i % 5 == 4) { wind.printText(text + " |"); text = "*** "; } i++; } if (!text.Equals("*** ")) { wind.printText(text + " |"); } } return(true); }
public static ServerWindow AddMainWindow(ServerWindow mainWindow) { if (mainWindow == null) { var hidden = serverWindows.FirstOrDefault(w => w.Visibility != Visibility.Visible); if (hidden != null) { hidden.Show(); hidden.Activate(); return(hidden); } } var mw = mainWindow != null ? mainWindow : new ServerWindow("ServerWindow" + serverWindows.Count + 1); serverWindows.Add(mw); HedgeHog.Wcf.RegisterServer(mw); mw.Show(); return(mw); }
public static bool CheckStartupWindowsVersion(ServerWindow window) { if (LdpUtils.IsWindows7) { LdpLog.Info("Current OS: Windows 7."); return(true); } else if (LdpUtils.IsWindows8) { LdpLog.Info("Current OS: Windows 8."); return(true); } else { MessageBox.Show("Unsuported windows version.\nWorks only on Windows 7 or higher..", "Error", MessageBoxButton.OK, MessageBoxImage.Error); window.Close(); return(false); } }
public static bool CheckStartupWindowsVersion(ServerWindow window) { if (LdpUtils.IsWindows7) { LdpLog.Info("Current OS: Windows 7."); return true; } else if (LdpUtils.IsWindows8) { LdpLog.Info("Current OS: Windows 8."); return true; } else { MessageBox.Show("Unsuported windows version.\nWorks only on Windows 7 or higher..", "Error", MessageBoxButton.OK, MessageBoxImage.Error); window.Close(); return false; } }
public void UpdateServerWindow(string message, Color foreColor, Color backColor) { if (ServerWindow.InvokeRequired) { Invoke(new Action(() => { UpdateServerWindow(message, foreColor, backColor); })); } else { ServerWindow.SelectionStart = ServerWindow.TextLength; ServerWindow.SelectionLength = 0; ServerWindow.SelectionColor = foreColor; ServerWindow.SelectionBackColor = backColor; ServerWindow.AppendText(message + "\n"); ServerWindow.SelectionColor = ServerWindow.ForeColor; ServerWindow.SelectionStart = ServerWindow.Text.Length; ServerWindow.ScrollToCaret(); } }
public override void Add(ScreenManager screenManager) { base.Add(screenManager); Client.State = GameState.Lobby; imgBackground = new ImageBox(Manager) { Image = Client.Content["gui.background"], SizeMode = SizeMode.Stretched }; imgBackground.SetSize(Window.Width, Window.Height); imgBackground.SetPosition(0, 0); imgBackground.Init(); Window.Add(imgBackground); // Add the server window wndServer = new ServerWindow(Manager, this); wndServer.Init(); Window.Add(wndServer); wndServer.Show(); }
static void Init() { ServerWindow win = (ServerWindow)GetWindow(typeof(ServerWindow)); win.Show(); }
private void btnHost_Click(object sender, RoutedEventArgs e) { var window = new ServerWindow(); window.Show(); }
/// <summary> /// Called by the base engine class when its safe to begin initialization. /// </summary> protected override bool Begin() { Runtime.Debug.DebugLogger.WriteLog("Entered begin function", LogAlertLevel.Warning); // Create the fusion fuction set. new FusionFunctionSet(); new NetworkFunctionSet(); // Bind all function sets to the global virtual machine. NativeFunctionSet.RegisterCommandSetsToVirtualMachine(VirtualMachine.GlobalInstance); // Grab some config out of the games config file. ASCIIEncoding encoding = new ASCIIEncoding(); _currentPassword = _engineConfigFile["account:password", ""]; _currentUsername = _engineConfigFile["account:username", ""]; // Make sure we have a game we can run. if (_gameName != "") { // Create the loading window thread. _loading = true; new Thread(LoadingWindowThread).Start(); NetworkManager.IsServer = _isServer; if (_isServer == false) { // Setup graphics window. SetupGameWindow(); } else { // Setup graphics window. We are only actually doing this so the graphics and audio drivers have something to bind to. // Notice that we are hiding it as soon as its made. SetupGameWindow(); _window.Hide(); // Setup server window. _serverWindow = new ServerWindow(); _serverWindow.FormClosing += new FormClosingEventHandler(OnClosing); _serverWindow.Show(); // Setup server. if (NetworkManager.Start() == false) { throw new Exception("An error occured while attempting to setup network."); } } // Create some hooks into network events. NetworkManager.ClientConnected += new ClientConnectedEventHandler(ClientConnected); NetworkManager.ClientDisconnected += new ClientDisconnectedEventHandler(ClientDisconnected); NetworkManager.Disconnected += new DisconnectedEventHandler(Disconnected); NetworkManager.PacketRecieved += new PacketRecievedEventHandler(PacketRecieved); // If pak files are being used then load all of them in and register // them with the resource manager if (_usePakFiles == true) { ResourceManager.UsePakFiles = true; DebugLogger.WriteLog("Looking for resources in pak files..."); foreach (string file in Directory.GetFiles(Environment.CurrentDirectory)) { if (file.ToLower().EndsWith(".pk") == true) { DebugLogger.WriteLog("Looking for resources in \"" + Path.GetFileName(file) + "\"..."); PakFile pakFile = new PakFile(file); ResourceManager.RegisterPakFile(pakFile); } } } // Load in the default tileset if it exists and add it to the tileset list. if (ResourceManager.ResourceExists(_tilesetPath + "\\default.xml") == true) { DebugLogger.WriteLog("Found default tileset, loading..."); Tileset.AddToTilesetPool(new Tileset(_tilesetPath + "\\default.xml")); } // Load in the default font if it exists. if (ResourceManager.ResourceExists(_fontPath + "\\default.xml") == true) { DebugLogger.WriteLog("Found default bitmap font, loading..."); GraphicsManager.DefaultBitmapFont = new BitmapFont(_fontPath + "\\default.xml"); } // Load in the required language pack. string languageFile = _languagePath + "\\" + _language + ".xml"; if (ResourceManager.ResourceExists(languageFile) == true) { DebugLogger.WriteLog("Loading language pack for language " + _language + "."); LanguageManager.LoadLanguagePack(_languagePath + "\\" + _language + ".xml", _language); } else { DebugLogger.WriteLog("Unable to find language pack for language " + _language + ".", LogAlertLevel.Error); } // Register the console commands, incase we turn the console on later. new StatisticalConsoleCommands(); new FusionConsoleCommands(); new MapConsoleCommands(); new SystemConsoleCommands(); // Register all the command sets with the console. ConsoleCommandSet.RegisterCommandSets(); // Shall we setup the graphical console? if (_showConsole == true && _isServer == false) { // Enable the graphical console. GraphicalConsole.Enabled = true; } // Check if the start script exists. if (ResourceManager.ResourceExists(_startScript) == true) { // It does, w00t, lets create an execution process for it then. _gameScriptProcess = new ScriptExecutionProcess(_startScript); if (_gameScriptProcess.Process != null) { _gameScriptProcess.Priority = 1000000; // Always runs first, otherwise all hell breaks loose with the OnCreate events. _gameScriptProcess.IsPersistent = true; _gameScriptProcess.Process.OnStateChange += this.OnStateChange; ProcessManager.AttachProcess(_gameScriptProcess); OnStateChange(_gameScriptProcess.Process, _gameScriptProcess.Process.State); } } // Pump out a GameBegin event. EventManager.FireEvent(new Event("game_begin", this, null)); // Close the loading window. _loading = false; // Show the game window. if (_isServer == false) { _window.Show(); _window.BringToFront(); _window.Activate(); } else { _serverWindow.Show(); _serverWindow.BringToFront(); _serverWindow.Activate(); } } // Nope? Ok show the games explorer. else { _explorerWindow = new GamesExplorerWindow(); _explorerWindow.FormClosing += new FormClosingEventHandler(OnClosing); _explorerWindow.Show(); } return(false); }