public void Atualizar() { rawfile.Rebuild(rawfile, "", ""); string path = pathf + @"\" + rawname; rawfile = new RAW(rawfile.Data); rawfile.ListInsert(treeView1, rawfile, path); }
public void Export(TreeView list, RAW file) { var save = new FolderBrowserDialog(); if (save.ShowDialog() == DialogResult.OK) { switch (treeView1.SelectedNode.Level) { case 1: if (file.Pastas[treeView1.SelectedNode.Index].type == RAW.Types.Texto && MessageBox.Show("Quer exportar o texto em formato TXT?", "Perguntinha", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { StringBuilder writer = new StringBuilder(); writer.AppendLine("#NUC#" + file.Pastas[treeView1.SelectedNode.Index].texto.SeqCount); writer.AppendLine("---------------------------"); foreach (var str in file.Pastas[treeView1.SelectedNode.Index].texto.sequences) { string texto = Encodings.Naruto.UzumakiChronicles2.GetString(str); writer.AppendLine(texto); writer.AppendLine("#--------------------#"); } File.WriteAllText(save.SelectedPath + "/" + treeView1.SelectedNode.Text + ".txt", writer.ToString(), Encoding.Default); } else { File.WriteAllBytes(save.SelectedPath + "/" + treeView1.SelectedNode.Text + ".sraw", file.Pastas[treeView1.SelectedNode.Index].FileData); } MessageBox.Show("Sucesso!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); break; case 2: if (file.Pastas[treeView1.SelectedNode.Parent.Index].Arquivos[treeView1.SelectedNode.Index].type == RAW.Types.Texto && MessageBox.Show("Quer exportar o texto em formato TXT?", "Perguntinha", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { StringBuilder writer = new StringBuilder(); writer.AppendLine("#NUC#" + file.Pastas[treeView1.SelectedNode.Parent.Index].Arquivos[treeView1.SelectedNode.Index].texto.SeqCount); writer.AppendLine("---------------------------"); foreach (var str in file.Pastas[treeView1.SelectedNode.Parent.Index].Arquivos[treeView1.SelectedNode.Index].texto.sequences) { string texto = Encodings.Naruto.UzumakiChronicles2.GetString(str); writer.AppendLine(texto); writer.AppendLine("#--------------------#"); } File.WriteAllText(save.SelectedPath + "/" + treeView1.SelectedNode.Text + ".txt", writer.ToString(), Encoding.Default); } else { File.WriteAllBytes(save.SelectedPath + "/" + treeView1.SelectedNode.Text + ".sraw", file.Pastas[treeView1.SelectedNode.Parent.Index].Arquivos[treeView1.SelectedNode.Index].FileData); } MessageBox.Show("Sucesso!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); break; case 3: rawfile.Pastas[treeView1.SelectedNode.Parent.Parent.Index].Arquivos[treeView1.SelectedNode.Parent.Index].textura.GetImage(treeView1.SelectedNode.Index).Save(save.SelectedPath + "/" + treeView1.SelectedNode.Text + ".png", System.Drawing.Imaging.ImageFormat.Png); MessageBox.Show("Sucesso!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); break; } } }
public static void HangUp(IntPtr hrasconn) { int err = RAW.RasHangUp(hrasconn); if (err != RAW.ERROR_SUCCESS) { throw new Win32Exception(err); } }
void ImportTextura(RAW file) { switch (treeView1.SelectedNode.Level) { case 3: if (file.Pastas[treeView1.SelectedNode.Parent.Parent.Index].Arquivos[treeView1.SelectedNode.Parent.Index].textura.texentries[treeView1.SelectedNode.Index].Bpp == 4) { MessageBox.Show("Atualmente suporto apenas texturas 8bpp!!", "Erro"); return; } OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Portable Network Graphics(*.png)|*.png"; if (ofd.ShowDialog() == DialogResult.OK) { if (Path.GetExtension(ofd.FileName).ToLower() != ".png") { MessageBox.Show("Formato de Imagem não suportado!!"); return; } Image input = Image.FromFile(ofd.FileName); Bitmap bit = new Bitmap(input); HashSet <Color> colors = new HashSet <Color>(); for (int y = 0; y < bit.Height; y++) { for (int x = 0; x < bit.Width; x++) { colors.Add(bit.GetPixel(x, y)); } } Color[] cores = colors.ToArray(); int colorcoutn = cores.Length; int bpp = file.Pastas[treeView1.SelectedNode.Parent.Parent.Index].Arquivos[treeView1.SelectedNode.Parent.Index].textura.texentries[treeView1.SelectedNode.Index].Bpp; int width = file.Pastas[treeView1.SelectedNode.Parent.Parent.Index].Arquivos[treeView1.SelectedNode.Parent.Index].textura.texentries[treeView1.SelectedNode.Index].Width; int height = file.Pastas[treeView1.SelectedNode.Parent.Parent.Index].Arquivos[treeView1.SelectedNode.Parent.Index].textura.texentries[treeView1.SelectedNode.Index].Height; if (input.Width == width && input.Height == height && bpp == 8 && colorcoutn <= 256) { file.Pastas[treeView1.SelectedNode.Parent.Parent.Index].Arquivos[treeView1.SelectedNode.Parent.Index].textura.ImportTexture(treeView1.SelectedNode.Index, input); MessageBox.Show("Importado!" + "\nLembre-se de salvar!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); var node = treeView1.SelectedNode; treeView1.SelectedNode = node; treeView1.Focus(); treeView1.Select(); pictureBox1.Visible = true; label5.Visible = false; this.Size = new Size(882, 460); pictureBox1.Image = rawfile.Pastas[treeView1.SelectedNode.Parent.Parent.Index].Arquivos[treeView1.SelectedNode.Parent.Index].textura.GetImage(treeView1.SelectedNode.Index); } else { MessageBox.Show("A imagem deve ter a mesma resolução da original\n[e atualmente suporto apenas texturas 8bpp]!!\n\nResolução esperada: " + width + "x" + height + "\n" + bpp.ToString() + " bpp 256 cores\n\nQuantia de cores da textura tentada: " + colorcoutn + " cores\nRecomendo usar o OptiPix ImageStudio para reduzir as cores!!", "Erro"); } } break; } }
public void WithSeveralExtraArguments() { // Arrange var raw = new RAW(); var expected = ":DISPlay:DATA? ON, OFF, TIFF"; // Act, command line style arguments var actual = raw.Command(":DISPlay:DATA?", "ON", "OFF", "TIFF"); // Assert Assert.Equal(expected, actual); }
public void EmbeddedArguments() { // Arrange var raw = new RAW(); var expected = ":DISPlay:DATA? ON, OFF, TIFF"; // Act, one command with arguments embedded var actual = raw.Command(":DISPlay:DATA? ON, OFF, TIFF"); // Assert Assert.Equal(expected, actual); }
public void NoExtraArguments() { // Arrange var raw = new RAW(); var expected = ":DISPlay:DATA?"; // Act var actual = raw.Command(":DISPlay:DATA?"); // Assert Assert.Equal(expected, actual); }
public void WithoutArguments() { // Arrange var raw = new RAW(); var expected = ""; // Act var actual = raw.Command(); // Assert Assert.Equal(expected, actual); }
public void Refresh() { if (rawfile.Data != null) { CloseFile(); ShowHide(); string path = pathf + @"\" + rawname; #region Arquivo raw = File.ReadAllBytes(path); rawfile = new RAW(raw); #endregion #region Rótulos rawname = Path.GetFileName(path); pathf = Path.GetDirectoryName(path); linkLabel1.Text += Path.GetDirectoryName(path); filename.Text += Path.GetFileName(path); size.Text += Sizes(raw.Length); archivescount.Text += rawfile.folderCount; foreach (var file in rawfile.Pastas) { if (file.type == RAW.Types.Textura) { //if (file.textura.errcount != 0) //{ // label4.Visible = true; // label4.Text = "Erros: " + file.textura.errcount; //} } if (file.Arquivos != null) { foreach (var fi in file.Arquivos) { if (fi.type == RAW.Types.Textura) { //if (fi.textura.errcount != 0) //{ // label4.Visible = true; // label4.Text = "Erros: " + fi.textura.errcount; //} } } } } #endregion #region Funções AddRecent(pathf + @"\" + rawname); #endregion timerSALVO.Enabled = true; timerSALVO.Start(); Salvo.Visible = true; } }
public static bool Dial(string entryName) { RAW.RASDIALDLG info = new RAW.RASDIALDLG(); info.dwSize = Marshal.SizeOf(info); bool ret = RAW.RasDialDlg(IntPtr.Zero, entryName, IntPtr.Zero, ref info); if (ret == false && info.dwError != RAW.ERROR_SUCCESS) { throw new Win32Exception(info.dwError); } return(ret); }
public void ExportTEXCLT(RAW file) { if (MessageBox.Show("Quer exportar a textura em formato RAW?", "Perguntinha", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { FolderBrowserDialog folder = new FolderBrowserDialog(); if (folder.ShowDialog() == DialogResult.OK) { File.WriteAllBytes(folder.SelectedPath + @"\" + treeView1.SelectedNode.Text + ".tex", file.Pastas[treeView1.SelectedNode.Parent.Parent.Index].Arquivos[treeView1.SelectedNode.Parent.Index].textura.Entries[file.Pastas[treeView1.SelectedNode.Parent.Parent.Index].Arquivos[treeView1.SelectedNode.Parent.Index].textura.texentries[treeView1.SelectedNode.Index].pixelindex]); File.WriteAllBytes(folder.SelectedPath + @"\" + treeView1.SelectedNode.Text + ".clt", file.Pastas[treeView1.SelectedNode.Parent.Parent.Index].Arquivos[treeView1.SelectedNode.Parent.Index].textura.Entries[file.Pastas[treeView1.SelectedNode.Parent.Parent.Index].Arquivos[treeView1.SelectedNode.Parent.Index].textura.texentries[treeView1.SelectedNode.Index].paletteindex]); MessageBox.Show("Sucesso!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { Export(treeView1, file); } }
public static IntPtr GetConnection(string entryName) { RAW.RASCONN[] connections = new RAW.RASCONN[1]; connections[0].dwSize = Marshal.SizeOf(typeof(RAW.RASCONN)); int connectionsCount = 0; int cb = Marshal.SizeOf(typeof(RAW.RASCONN)); int nRet = RAW.RasEnumConnections(connections, ref cb, out connectionsCount); if (nRet != RAW.ERROR_SUCCESS && nRet != RAW.ERROR_BUFFER_TOO_SMALL) { throw new Win32Exception(nRet); } if (connectionsCount == 0) { return(IntPtr.Zero); } connections = new RAW.RASCONN[connectionsCount]; for (int i = 0; i < connections.Length; i++) { connections[i].dwSize = Marshal.SizeOf(typeof(RAW.RASCONN)); } nRet = RAW.RasEnumConnections(connections, ref cb, out connectionsCount); if (nRet != RAW.ERROR_SUCCESS) { throw new Win32Exception((int)nRet); } int index = Array.FindIndex <RAW.RASCONN>(connections, delegate(RAW.RASCONN cnn) { return(cnn.szEntryName.ToLower() == entryName.ToLower()); } ); if (index == -1) { return(IntPtr.Zero); } return(connections[index].hrasconn); }
public void ExportTexturas(TreeView list, RAW file) { var save = new FolderBrowserDialog(); if (save.ShowDialog() == DialogResult.OK) { if (treeView1.SelectedNode.Level == 2) { Directory.CreateDirectory(save.SelectedPath + @"/" + treeView1.SelectedNode.Text); int k = 0; for (int i = 0; i < rawfile.Pastas[treeView1.SelectedNode.Parent.Index].Arquivos[treeView1.SelectedNode.Index].textura.TextureCount; i++) { rawfile.Pastas[treeView1.SelectedNode.Parent.Index].Arquivos[treeView1.SelectedNode.Index].textura.GetImage(i).Save(save.SelectedPath + @"/" + treeView1.SelectedNode.Text + @"/" + k.ToString() + ".png", ImageFormat.Png); k++; } MessageBox.Show("Sucesso!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public static EntryName[] GetRasEntries() { int cb = Marshal.SizeOf(typeof(RAW.RASENTRYNAME)); int entries = 0; RAW.RASENTRYNAME[] entryNames = new RAW.RASENTRYNAME[1]; entryNames[0].dwSize = Marshal.SizeOf(typeof(RAW.RASENTRYNAME)); int nRet = RAW.RasEnumEntries(IntPtr.Zero, IntPtr.Zero, entryNames, ref cb, ref entries); if (nRet != RAW.ERROR_SUCCESS && nRet != RAW.ERROR_BUFFER_TOO_SMALL) { throw new Win32Exception((int)nRet); } if (entries == 0) { return(new EntryName[0]); } entryNames = new RAW.RASENTRYNAME[entries]; for (int i = 0; i < entryNames.Length; i++) { entryNames[i].dwSize = Marshal.SizeOf(typeof(RAW.RASENTRYNAME)); } nRet = RAW.RasEnumEntries(IntPtr.Zero, IntPtr.Zero, entryNames, ref cb, ref entries); if (nRet != RAW.ERROR_SUCCESS) { throw new Win32Exception((int)nRet); } return(Array.ConvertAll <RAW.RASENTRYNAME, EntryName>(entryNames, delegate(RAW.RASENTRYNAME entry) { return new EntryName(entry.szEntryName); } )); }
public void CloseFile() { rawfile = null; raw = null; linkLabel1.ResetText(); ShowHide(); archivescount.Text = "Pastas: "; size.Text = "Tamanho: "; filename.Text = "Arquivo: "; path.Text = "Local: "; exportarToolStripMenuItem.Enabled = false; importarToolStripMenuItem.Enabled = false; importarTexturaToolStripMenuItem.Enabled = false; exportarTexturaToolStripMenuItem.Enabled = false; groupBox2.Visible = false; exporttexbt.Visible = false; exportbt.Visible = false; importbt.Visible = false; label4.Visible = false; pictureBox1.Visible = false; this.Size = new Size(520, 460); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment var view = inflater.Inflate(Resource.Layout.quotepanelfragment, container, false); cardViewGridLayout = view.FindViewById <GridLayout>(Resource.Id.gridCardLayout); var activity = (MainActivity)Activity; cardViewDict = new Dictionary <string, CardView>(); //GenerateCards(); GenerateCardsFromDatabase(); UpdateCoinBalances(); webQuoteTimer.Elapsed += async(sender, e) => { CryptoCompareJSON crypotCompareJSON = await GetQuotes(); if (crypotCompareJSON == null) { return; } RAW raw = crypotCompareJSON.Raw; System.Reflection.PropertyInfo[] propertyInfo = raw.GetType().GetProperties(); foreach (var propInfo in propertyInfo) { var value = propInfo.GetValue(raw, null); SYMBOL sym = value as SYMBOL; if (sym == null) { continue; } string symbol = sym.Usd.FROMSYMBOL; double price = sym.Usd.PRICE; DateTime lastUpdate = DateTimeOffset.FromUnixTimeSeconds(sym.Usd.LASTUPDATE).LocalDateTime; double change = sym.Usd.CHANGEDAY; double changePct = sym.Usd.CHANGEPCTDAY; Activity.RunOnUiThread(() => { UpdateCardView(symbol, price, change, changePct, lastUpdate); activity.SetTotalValue(symbolValues.Sum(x => x.Value)); }); } }; webQuoteTimer.Start(); return(view); }
public void Abrir(bool isDrag, string fileName) { if (isDrag) { #region Se arquivo já aberto if (rawfile != null) { CloseFile(); } #endregion #region Arquivo raw = File.ReadAllBytes(fileName); rawfile = new RAW(raw); #endregion #region Rótulos rawname = Path.GetFileName(fileName); pathf = Path.GetDirectoryName(fileName); linkLabel1.Text += Path.GetDirectoryName(fileName); filename.Text += Path.GetFileName(fileName); size.Text += Sizes(raw.Length); archivescount.Text += rawfile.folderCount; foreach (var file in rawfile.Pastas) { if (file.type == RAW.Types.Textura) { //if (file.textura.errcount != 0) //{ // label4.Visible = true; // label4.Text = "Erros: " + file.textura.errcount; //} } if (file.Arquivos != null) { foreach (var fi in file.Arquivos) { if (fi.type == RAW.Types.Textura) { //if (fi.textura.errcount != 0) //{ // label4.Visible = true; // label4.Text = "Erros: " + fi.textura.errcount; //} } } } } #endregion #region Funções rawfile.ListInsert(treeView1, rawfile, fileName); ShowHide(); AddRecent(pathf + @"\" + rawname); #endregion } else { opened = new OpenFileDialog(); opened.Filter = "Arquivo RAW NUC|*.raw"; if (opened.ShowDialog() == DialogResult.OK) { #region Se arquivo já aberto if (rawfile != null) { CloseFile(); } #endregion #region Arquivo raw = File.ReadAllBytes(opened.FileName); rawfile = new RAW(raw); #endregion #region Rótulos rawname = Path.GetFileName(opened.FileName); pathf = Path.GetDirectoryName(opened.FileName); linkLabel1.Text += Path.GetDirectoryName(opened.FileName); filename.Text += Path.GetFileName(opened.FileName); size.Text += Sizes(raw.Length); archivescount.Text += rawfile.folderCount; foreach (var file in rawfile.Pastas) { if (file.type == RAW.Types.Textura) { //if (file.textura.errcount != 0) //{ // label4.Visible = true; // label4.Text = "Erros: " + file.textura.errcount; //} } if (file.Arquivos != null) { foreach (var fi in file.Arquivos) { if (fi.type == RAW.Types.Textura) { //if (fi.textura.errcount != 0) //{ // label4.Visible = true; // label4.Text = "Erros: " + fi.textura.errcount; //} } } } } #endregion #region Funções rawfile.ListInsert(treeView1, rawfile, opened.FileName); ShowHide(); AddRecent(pathf + @"\" + rawname); #endregion } } }
public void Import(TreeView list, RAW file) { var import = new OpenFileDialog(); import.Filter = "Arquivo RAW|*.raw;*.sraw;*.bin;|Arquivo de Texto|*.txt"; if (import.ShowDialog() == DialogResult.OK) { bool done = false; byte[] filebin = File.ReadAllBytes(import.FileName); switch (treeView1.SelectedNode.Level) { case 1: if (filebin.Length != 0) { if (file.Pastas[treeView1.SelectedNode.Index].type == RAW.Types.Texto && Path.GetExtension(import.FileName).ToLower() == ".txt") { string input = File.ReadAllText(import.FileName, Encoding.Default); ImportTXT(input, file.Pastas[treeView1.SelectedNode.Index].texto); } else { file.Pastas[treeView1.SelectedNode.Index].FileData = new byte[filebin.Length]; file.Pastas[treeView1.SelectedNode.Index].FileData = filebin; file.Pastas[treeView1.SelectedNode.Index].Size = (uint)filebin.Length; } MessageBox.Show("Importado!" + "\nLembre-se de salvar!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); done = true; } else { MessageBox.Show("Arquivo incompatível!" + "\nVerifique a estrutura do container!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; case 2: if (filebin.Length != 0) { if (file.Pastas[treeView1.SelectedNode.Parent.Index].Arquivos[treeView1.SelectedNode.Index].type == RAW.Types.Texto && Path.GetExtension(import.FileName).ToLower() == ".txt") { string input = File.ReadAllText(import.FileName, Encoding.Default); ImportTXT(input, file.Pastas[treeView1.SelectedNode.Parent.Index].Arquivos[treeView1.SelectedNode.Index].texto); } else { file.Pastas[treeView1.SelectedNode.Parent.Index].Arquivos[treeView1.SelectedNode.Index].FileData = new byte[filebin.Length]; file.Pastas[treeView1.SelectedNode.Parent.Index].Arquivos[treeView1.SelectedNode.Index].FileData = filebin; file.Pastas[treeView1.SelectedNode.Parent.Index].Arquivos[treeView1.SelectedNode.Index].Size = (uint)filebin.Length; } MessageBox.Show("Importado!" + "\nLembre-se de salvar!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); done = true; } else { MessageBox.Show("Arquivo incompatível!" + "\nVerifique a estrutura do container!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; } if (done) { var node = treeView1.SelectedNode; //Refresh(); Atualizar(); treeView1.Focus(); treeView1.Select(); treeView1.SelectedNode = node; } } }
private static void OpenConnectionFinal(Connection.Info newConnectionInfo, Connection.Info.Force Force, Form ConForm) { try { if (newConnectionInfo.Hostname == "" && newConnectionInfo.Protocol != Protocols.IntApp) { MessageCollector.AddMessage(MessageClass.WarningMsg, Language.strConnectionOpenFailedNoHostname); return; } if (newConnectionInfo.PreExtApp != "") { ExternalTool extA = GetExtAppByName(newConnectionInfo.PreExtApp); if (extA != null) { extA.Start(newConnectionInfo); } } //TODO if (!(((Force & Info.Force.DoNotJump) == Info.Force.DoNotJump) || !SwitchToOpenConnection(newConnectionInfo))) { return; } Base newProtocol; // Create connection based on protocol type switch (newConnectionInfo.Protocol) { case Protocols.RDP: newProtocol = new RDP(); break; case Protocols.VNC: newProtocol = new VNC(); break; case Protocols.SSH1: newProtocol = new SSH1(); break; case Protocols.SSH2: newProtocol = new SSH2(); break; case Protocols.Telnet: newProtocol = new Telnet(); break; case Protocols.Rlogin: newProtocol = new Rlogin(); break; case Protocols.Serial: newProtocol = new Serial(); break; case Protocols.RAW: newProtocol = new RAW(); break; case Protocols.HTTP: newProtocol = new HTTP(newConnectionInfo.RenderingEngine); break; case Protocols.HTTPS: newProtocol = new HTTPS(newConnectionInfo.RenderingEngine); break; case Protocols.TeamViewer: newProtocol = new TeamViewer(); break; case Protocols.RAdmin: newProtocol = new RAdmin(); break; case Protocols.ICA: newProtocol = new ICA(); break; case Protocols.IntApp: newProtocol = new IntApp(); if (newConnectionInfo.ExtApp == "") { throw (new Exception(Language.strNoExtAppDefined)); } break; default: return; } string cPnl; if (((newConnectionInfo.Panel == "") | ((Force & Connection.Info.Force.OverridePanel) == Connection.Info.Force.OverridePanel)) | Settings.Default.AlwaysShowPanelSelectionDlg) { var frmPnl = new frmChoosePanel(); if (frmPnl.ShowDialog() == DialogResult.OK) { cPnl = frmPnl.Panel; } else { return; } } else { cPnl = newConnectionInfo.Panel; } Form cForm = ConForm ?? WindowList.FromString(cPnl); if (cForm == null) { cForm = AddPanel(cPnl); cForm.Focus(); } else { (cForm as UI.Window.Connection).Show(frmMain.Default.pnlDock); (cForm as UI.Window.Connection).Focus(); } Control cContainer = (cForm as UI.Window.Connection).AddConnectionTab(newConnectionInfo); if (newConnectionInfo.Protocol == Protocols.IntApp) { if (GetExtAppByName(newConnectionInfo.ExtApp).Icon != null) { (cContainer as TabPage).Icon = GetExtAppByName(newConnectionInfo.ExtApp).Icon; } } newProtocol.Closed += (cForm as UI.Window.Connection).Prot_Event_Closed; newProtocol.Connected += (cForm as UI.Window.Connection).Prot_Event_Connected; newProtocol.Disconnected += Prot_Event_Disconnected; newProtocol.Connected += Prot_Event_Connected; newProtocol.Closed += Prot_Event_Closed; newProtocol.ErrorOccured += Prot_Event_ErrorOccured; (cForm as UI.Window.Connection).ResizeBegin += newProtocol.ResizeBegin; (cForm as UI.Window.Connection).ResizeEnd += newProtocol.ResizeEnd; (cForm as UI.Window.Connection).Resize += newProtocol.Resize; newProtocol.InterfaceControl = new InterfaceControl(cContainer, newProtocol, newConnectionInfo); newProtocol.Force = Force; if (newProtocol.SetProps() == false) { newProtocol.Close(); return; } if (newProtocol.Connect() == false) { newProtocol.Close(); if (newProtocol is PuttyBase&&!ProblemFixer.IsPuTTYOk()) { ProblemFixer.FixPuTTYProblem(); } if (newProtocol is TeamViewer && !ProblemFixer.IsTeamViewerOk()) { ProblemFixer.FixTVProblem(); } if (newProtocol is RAdmin && !ProblemFixer.IsRAdminOk()) { ProblemFixer.FixRAdminProblem(); } return; } newConnectionInfo.OpenConnections.Add(newProtocol); if (newConnectionInfo.IsQuicky == false) { if (newConnectionInfo.Protocol != Protocols.IntApp) { Node.SetNodeImage(newConnectionInfo.TreeNode, Enums.TreeImage.ConnectionOpen); } else { ExternalTool extApp = GetExtAppByName((string)newConnectionInfo.ExtApp); if (extApp != null) { if (extApp.TryIntegrate) { if (newConnectionInfo.TreeNode != null) { Node.SetNodeImage(newConnectionInfo.TreeNode, Enums.TreeImage.ConnectionOpen); } } } } } } catch (Exception ex) { MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strConnectionOpenFailed + Constants.vbNewLine + ex.Message); } }
private void speechR_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { Random random = new Random(); string r = e.Result.Text; RAW.AppendText(r + "\n"); if (r == "margery" || r == "ok computer" || r == "margery wake up you lepton" && active == false) { speak("Margery?", "Yes?", false); active = true; } if (r == "cancel" && alwaysActive == false && active == true) { speak("Cancel.", "Cancelled.", false); } if (r == "stop" || r == "shut up") { speechS.SpeakAsyncCancelAll(); } if (active == true) { if (r == "sorry" || r == "what was that" || r == "i didn't get that") { speak("What was that?", @"I said """ + lastCommand + @""" you deaf c**t.", false); } if (r == "how are you") { speak("How are you?", "I am a bot. I do not have feelings.", true); } if (r == "say text") { speak("Say text.", SayBox.Text, true); } if (r == "what do you think of dogs") { speak("What do you think of dogs?", "They look sexy.", true); } if (r == "what is the weather") { speak("What is the weather?", "Google it or something, I don't f*****g know.", true); } if (r == "is this guy annoying") { speak("Is this guy annoying?", "Yes he is very annoying, I will beat his face with my dick if he doesnt shut up.", true); } if (r == "is radiohead good") { speak("Is radiohead good?", "Radiohead is good.", true); } if (r == "always active") { alwaysActive = !alwaysActive; speak("Always active.", "Always active is now set to " + alwaysActive, true); } if (r == "what are you") { speak("What are you?", "I am a thot.", true); } if (r == "what is the time") { speak("What is the time?", "Local time is " + DateTime.Now.ToString("h:mm tt") + ".", true); } if (r == "what is the date") { speak("What is the date?", "Local date is " + DateTime.Now.ToString("dd/MM/yyyy") + ".", true); } /*if (r == "do you like") * speak("Do you like", opinions[random.Next(opinions.Length)], true); * * //if(r == "hello" || r == "hi" || r == "hey" || r == "yo" || r == "greetings") * //speak("Hello.", greetings[random.Next(greetings.Length)], true); * * if (r == "tell me a joke") * speak("Tell me a joke.", jokes[random.Next(jokes.Length)], true); * * if(r == "insult me") * speak("Insult me.", "You " + swears[random.Next(swears.Length)] + " " + swears[random.Next(swears.Length)] + " " + swears[random.Next(swears.Length)] + ".", true); * * if (r == "tell me a story") * { * int randAdjective = random.Next(adjectives.Length); * int randAdjective2 = random.Next(adjectives.Length); * int randAdjective3 = random.Next(adjectives.Length); * int randNoun = random.Next(nouns.Length); * int randNoun2 = random.Next(nouns.Length); * int randPlace = random.Next(places.Length); * int randVerb = random.Next(verbs.Length); * int randAdverb = random.Next(adverbs.Length); * * speak("Tell me a story", "The " + adjectives[randAdjective] + " " + adjectives[randAdjective2] + " " + nouns[randNoun] + * " went to the " + places[randPlace] + " and " + adverbs[randAdverb] + " " + verbs[randVerb] + " a " + * adjectives[randAdjective3] + " " + nouns[randNoun2] + ".", true); * }*/ } }