예제 #1
0
        public new void Load(Data.Server _serverData, Tabs tabs)
        {
            this.serverData = _serverData;
            foreach (Tab t in tabs.tabs)
            {
                if (t.control is Console)
                {
                    Console c = (Console) t.control;
                    if (c.serverData == serverData)
                    {
                        tabs.SelectTab(t);
                        return;
                    }
                }
            }
            startButton_MouseLeave(null, null);
            stopButton_MouseLeave(null, null);
            restartButton_MouseLeave(null, null);
            killButton_MouseLeave(null, null);

            tabs.AddTab(serverData.ToString(), this);

            this.text.Clear();
            this.text.TextChanged += new EventHandler<TextChangedEventArgs>(FileEditor.Log.Parse);
        }
        public new void Load(Tabs _tabs)
        {
            for (int i = 0; i < Properties.Length; i += 3)
            {
                int y = i * 9;

                string propertyName = Properties[i];
                string text = Properties[i + 1];
                string type = Properties[i + 2];

                Label label = new Label();
                label.Text = text;
                label.Location = new Point(0, y);
                label.Font = new Font("Calibri", 12);
                this.Controls.Add(label);

                switch (type)
                {
                    case "boolean":
                        break;
                }
            }
            this.tabs = _tabs;
            tabs.AddTab("Ustawienia", this);
        }
 public new void Load(Data.RemoteServer _data, string name, Tabs tabs)
 {
     DataFileName = Utils.Main.RemoteDirectory + name + Path.DirectorySeparatorChar + "MainData.xml";
     this.data = _data;
     if (File.Exists(Utils.Main.RemoteDirectory + name + Path.DirectorySeparatorChar + "RconData.xml"))
     {
         LoadFromFile(name, tabs);
     }
 }
        public new void Load(Tabs _tabs)
        {
            this.tabs = _tabs;
            foreach (Tab t in tabs.tabs)
            {
                if (t.control is StyleEditor)
                {
                    tabs.SelectTab(t);
                    return;
                }
            }
            if (File.Exists(Main.DataDirectory + "Styles.xml"))
            {
                styles = Data.Styles.Deserialize();
            }
            else
            {
                styles = new Data.Styles();
                Data.Style brightGold = new Data.Style();
                brightGold.ForeColor = Color.Black;
                brightGold.ControlBackColor = Color.White;
                brightGold.WindowBackColor = Color.Gold;
                brightGold.Name = Language.GetString("StyleBrightGold");
                brightGold.Selected = true;
                brightGold.BuiltIn = true;
                Data.Style dark = new Data.Style();
                dark.ForeColor = Color.FromArgb(224, 224, 224);
                dark.ControlBackColor = Color.FromArgb(32, 32, 32);
                dark.WindowBackColor = Color.Black;
                dark.Name = Language.GetString("StyleDark");
                dark.BuiltIn = true;
                styles.styles.Add(brightGold);
                styles.styles.Add(dark);
            }
            foreach (Data.Style s in styles.styles)
            {
                if (s.Selected)
                    this.tabs.mainWindow.SetStyle(s);

                //fix old style names
                if (s.BuiltIn && (s.Name.ToLower() == "jasne złoto (wbudowany)" || s.Name.ToLower() == "bright gold (built-in)"))
                    s.Name = Language.GetString("StyleBrightGold");
                if (s.BuiltIn && (s.Name.ToLower() == "ciemny (wbudowany)" || s.Name.ToLower() == "dark (build-in)"))
                    s.Name = Language.GetString("StyleDark");

                //change language of style names
                if (s.BuiltIn && (s.Name == Resources.LanguagePL.StyleBrightGold || s.Name == Resources.LanguageEN.StyleBrightGold))
                    s.Name = Language.GetString("StyleBrightGold");
                if (s.BuiltIn && (s.Name == Resources.LanguagePL.StyleDark || s.Name == Resources.LanguageEN.StyleDark))
                    s.Name = Language.GetString("StyleDark");

                Style style = new Style();
                style.Load(this, s);
            }
            newStyle.Load(this);
            tabs.AddTab(Language.GetString("StyleEditorName"), this);
        }
예제 #5
0
 public new void Load(ServersTreeNodes.RemoteFileNode node, Tabs tabs)
 {
     ftp = true;
     Data = node.data;
     ftpFile = node.GetFile();
     FtpDownloader downloader = new FtpDownloader();
     string ftpIp = node.data.adress.Replace("/", "").Split(':')[1];
     string ftpLocalFileName = Main.TempRemoteDirectory + ftpIp + Path.DirectorySeparatorChar + Path.GetFileName(node.GetFile());
     downloader.Download(node.data, ftpLocalFileName, node.GetFile());
     Load(new FileInfo(ftpLocalFileName), tabs);
 }
예제 #6
0
 public new void Load(Data.RemoteServer _data, string file, Tabs tabs)
 {
     ftp = true;
     Data = _data;
     ftpFile = file;
     FtpDownloader downloader = new FtpDownloader();
     string ftpIp = this.Data.adress.Replace("/", "").Split(':')[1];
     string ftpLocalFileName = Main.TempRemoteDirectory + ftpIp + Path.DirectorySeparatorChar + Path.GetFileName(file);
     downloader.Download(Data, ftpLocalFileName, file);
     Load(new FileInfo(ftpLocalFileName), tabs);
 }
 public new void Load(FileInfo _file, Tabs tabs)
 {
     this.file = _file;
     foreach (string extension in disallowedExtensions)
     {
         if (file.Extension == "." + extension) {
             MessageBox.Show("Nie można otworzyć pliku, ponieważ nie jest on plikiem tekstowym!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
     }
     if (file.Length > 1024 * 1024)
     {
         MessageBox.Show("Nie można otworzyć pliku, ponieważ jest za duży!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     foreach (Tab t in tabs.tabs)
     {
         if (t.control is TextEditor)
         {
             TextEditor te = (TextEditor)t.control;
             if (te.file.FullName == file.FullName)
             {
                 tabs.SelectTab(t);
                 return;
             }
         }
     }
     if (file.Extension == ".properties")
         this.text.TextChanged += new EventHandler<TextChangedEventArgs>(PropertiesParser);
     else if (file.Extension == ".yml")
         this.text.TextChanged += new EventHandler<TextChangedEventArgs>(YamlParser);
     else if (file.Extension == ".json")
         this.text.TextChanged += new EventHandler<TextChangedEventArgs>(JsonParser);
     else if (file.Extension == ".log")
         this.text.TextChanged += new EventHandler<TextChangedEventArgs>(Parsers.Log.Parse);
     else if (file.Extension == ".sk")
         this.text.TextChanged += new EventHandler<TextChangedEventArgs>(SkriptParser);
     this.text.TextChanged += new EventHandler<TextChangedEventArgs>(Parser);
     try
     {
         StreamReader sr = new StreamReader(file.FullName);
         text.Text = sr.ReadToEnd();
         sr.Close();
         saved = true;
     }
     catch (IOException)
     {
         MessageBox.Show("Nie można otworzyć pliku!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     tabs.AddTab(file.Name, this);
 }
 public new void Load(Tabs tabs)
 {
     foreach (Tab t in tabs.tabs)
     {
         if (t.control is EngineEditor)
         {
             tabs.SelectTab(t);
             return;
         }
     }
     this.FullRefresh();
     tabs.AddTab("Organizuj silniki", this);
 }
 public new void Load(Tabs tabs)
 {
     foreach (Tab t in tabs.tabs)
     {
         if (t.control is EngineEditor)
         {
             tabs.SelectTab(t);
             return;
         }
     }
     this.FullRefresh();
     tabs.AddTab(Language.GetString("EngineEditorName"), this);
 }
예제 #10
0
 public Tab(string _text, Control _control, Tabs _panel)
 {
     InitializeComponent();
     this.text.Text = _text;
     this.Width = this.text.Width + 26;
     this.closeButton.Location = new Point(this.Width - 20, 0);
     this.control = _control;
     this.panel = _panel;
     this.control.Hide();
     this.control.Location = new Point(0, 20);
     this.BackColor = Color.LightGray;
     this.panel.Controls.Add(_control);
     if (panel.Style != null)
         SetStyle(panel.Style);
 }
 public new void Load(Tabs _tabs)
 {
     this.tabs = _tabs;
     foreach (Tab t in tabs.tabs)
     {
         if (t.control is StyleEditor)
         {
             tabs.SelectTab(t);
             return;
         }
     }
     if (File.Exists(Utils.Main.DataDirectory + "Styles.xml"))
     {
         styles = Data.Styles.Deserialize();
     }
     else
     {
         styles = new Data.Styles();
         Data.Style brightGold = new Data.Style();
         brightGold.ForeColor = Color.Black;
         brightGold.ControlBackColor = Color.White;
         brightGold.WindowBackColor = Color.Gold;
         brightGold.Name = "Jasne złoto (Wbudowany)";
         brightGold.Selected = true;
         brightGold.BuiltIn = true;
         Data.Style dark = new Data.Style();
         dark.ForeColor = Color.FromArgb(224, 224, 224);
         dark.ControlBackColor = Color.FromArgb(32, 32, 32);
         dark.WindowBackColor = Color.Black;
         dark.Name = "Ciemny (Wbudowany)";
         dark.BuiltIn = true;
         styles.styles.Add(brightGold);
         styles.styles.Add(dark);
     }
     foreach (Data.Style s in styles.styles)
     {
         if (s.Selected)
             this.tabs.mainWindow.SetStyle(s);
         Style style = new Style();
         style.Load(this, s);
     }
     newStyle.Load(this);
     tabs.AddTab("Zarządzaj stylami", this);
 }
 public new void Load(Tabs _tabs)
 {
     this.tabs = _tabs;
     tabs.AddTab("Podłącz serwer zdalny", this);
 }
 public void Load(Tabs _tabs)
 {
     this.tabs = _tabs;
     FullRefresh();
 }
 public new void Load(Tabs _tabs)
 {
     this.tabs = _tabs;
     tabs.AddTab("Nowy serwer lokalny", this);
 }
 public new void Load(Tabs _tabs)
 {
     tabs = _tabs;
     tabs.AddTab(Language.GetString("ConnectRemoteServer"), this);
 }
 public new void Load(Tabs _tabs)
 {
     this.tabs = _tabs;
     tabs.AddTab(Language.GetString("NewLocalServerName"), this);
 }
예제 #17
0
 public new void Load(Tabs _tabs)
 {
     this.tabs = _tabs;
     tabs.AddTab(Language.GetString("NewLocalServerName"), this);
 }
예제 #18
0
 private void LoadFromFile(string name, Tabs tabs)
 {
     Data.RemoteServerRcon serverData = new Data.RemoteServerRcon();
     XmlSerializer serializer = new XmlSerializer(typeof(Data.RemoteServerRcon));
     StreamReader reader = new StreamReader(Utils.Main.RemoteDirectory + name + Path.DirectorySeparatorChar + "RconData.xml");
     serverData = (Data.RemoteServerRcon)serializer.Deserialize(reader);
     reader.Close();
     rcon = RconClient.INSTANCE;
     rcon.setupStream(serverData.adress, serverData.port, serverData.password);
     text.Clear();
     text.TextChanged += new EventHandler<TextChangedEventArgs>(FileEditor.Log.Parse);
     foreach (Tab t in tabs.tabs)
     {
         if (t.control is RemoteConsole)
         {
             RemoteConsole c = (RemoteConsole) t.control;
             if (c.data == data)
             {
                 tabs.SelectTab(t);
                 return;
             }
         }
     }
     tabs.AddTab(name, this);
     logThread = new Thread(new ThreadStart(logThreadWork));
     logThread.Start();
 }
예제 #19
0
        public new void Load(FileInfo _file, Tabs tabs)
        {
            fileType = FileType.Text;
            file = _file;
            foreach (Tab t in tabs.tabs)
            {
                if (t.control is FileEditor)
                {
                    FileEditor te = (FileEditor)t.control;
                    if (te.file.FullName == file.FullName)
                    {
                        tabs.SelectTab(t);
                        return;
                    }
                }
            }
            foreach (string extension in imageExtensions)
            {
                if (file.Extension == "." + extension)
                {
                    fileType = FileType.Image;
                    break;
                }
            }
            foreach (string extension in disallowedExtensions)
            {
                if (file.Extension == "." + extension) {
                    Error.Show("ErrorFileNotText");
                    return;
                }
            }
            switch (fileType)
            {
                case FileType.Text:
                    if (file.Length > 1024 * 1024)
                    {
                        Error.Show("ErrorFileTooBig");
                        return;
                    }

                    if (file.Extension == ".properties")
                        text.TextChanged += new EventHandler<TextChangedEventArgs>(PropertiesParser);
                    else if (file.Extension == ".yml")
                        text.TextChanged += new EventHandler<TextChangedEventArgs>(YamlParser);
                    else if (file.Extension == ".json")
                        text.TextChanged += new EventHandler<TextChangedEventArgs>(JsonParser);
                    else if (file.Extension == ".log")
                        text.TextChanged += new EventHandler<TextChangedEventArgs>(Log.Parse);
                    else if (file.Extension == ".sk")
                        text.TextChanged += new EventHandler<TextChangedEventArgs>(SkriptParser);

                    try
                    {
                        StreamReader sr = new StreamReader(file.FullName);
                        text.Text = sr.ReadToEnd();
                        sr.Close();
                        saved = true;
                    }
                    catch (IOException)
                    {
                        Error.Show("ErrorFileUnknown");
                        return;
                    }

                    text.TextChanged += new EventHandler<TextChangedEventArgs>(Parser);

                    text.Visible = true;
                    saveButton.Visible = true;
                    break;
                case FileType.Image:
                    picturePanel.Visible = true;
                    picturePanel.Location = new Point(0, 0);
                    pictureBox.Image = new Bitmap(file.FullName);
                    break;
            }
            tabs.AddTab(file.Name, this);
        }