Here are the examples of the csharp api System.Windows.Forms.MessageBox.Show(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4099 Examples
19
Source : BotMainWindow.xaml.cs
with GNU General Public License v3.0
from 00000vish
with GNU General Public License v3.0
from 00000vish
private void initLogics()
{
if (File.Exists(STEAM_GAME_CONTROLLER))
{
if (!File.Exists(gameListFile))
{
do
{
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { }));
} while (!SteamBotController.loggedIn);
generateGames();
}
getGamesFromFile();
}
else
{
System.Windows.Forms.MessageBox.Show("FILES MISSING >> download at \n https://github.com/vishwenga/Steam-Boost/."
+ " \n\n\n MISSING FOLDER >> \n\n"
+ Environment.CurrentDirectory.ToString() + STEAM_BOOST_DIRECTORY
+ " \n\n\n MISSING FILES IN FOLDER >> \n\n"
+ Environment.CurrentDirectory.ToString() + STEAM_GAME_CONTROLLER + "\n\n"
+ Environment.CurrentDirectory.ToString() + SAM_GAME + "\n\n"
+ Environment.CurrentDirectory.ToString() + "\\steamBoost\\CSteamworks.dll \n\n"
+ Environment.CurrentDirectory.ToString() + "\\steamBoost\\Newtonsoft.Json.dll \n\n"
+ Environment.CurrentDirectory.ToString() + "\\steamBoost\\Newtonsoft.Json.xml \n\n"
+ Environment.CurrentDirectory.ToString() + "\\steamBoost\\steam_api.dll \n\n"
+ Environment.CurrentDirectory.ToString() + "\\steamBoost\\Steamworks.NET.dll \n\n");
Close();
}
}
19
Source : ToolWindow.xaml.cs
with GNU General Public License v3.0
from 00000vish
with GNU General Public License v3.0
from 00000vish
private void initLogics()
{
if (File.Exists(STEAM_GAME_CONTROLLER))
{
if (!File.Exists(GAME_LIST_FILE))
{
generateGames();
}
getGamesFromFile();
}
else
{
System.Windows.Forms.MessageBox.Show("FILES MISSING >> download at \n https://github.com/vishwenga/Steam-Boost/."
+ " \n\n\n MISSING FOLDER >> \n\n"
+ Environment.CurrentDirectory.ToString() + STEAM_BOOST_DIRECTORY
+ " \n\n\n MISSING FILES IN FOLDER >> \n\n"
+ Environment.CurrentDirectory.ToString() + STEAM_GAME_CONTROLLER + "\n\n"
+ Environment.CurrentDirectory.ToString() + SAM_GAME + "\n\n"
+ Environment.CurrentDirectory.ToString() + "\\steamBoost\\CSteamworks.dll \n\n"
+ Environment.CurrentDirectory.ToString() + "\\steamBoost\\Newtonsoft.Json.dll \n\n"
+ Environment.CurrentDirectory.ToString() + "\\steamBoost\\Newtonsoft.Json.xml \n\n"
+ Environment.CurrentDirectory.ToString() + "\\steamBoost\\steam_api.dll \n\n"
+ Environment.CurrentDirectory.ToString() + "\\steamBoost\\Steamworks.NET.dll \n\n");
Close();
}
}
19
Source : Program.cs
with GNU General Public License v3.0
from 00000vish
with GNU General Public License v3.0
from 00000vish
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try
{
//since cant detect if user open or started with windows
//this app will only open with windows and opens app with -startup let main know its open with windowws
checkArgs();
}
catch (Exception D) { MessageBox.Show(D.ToString());}
Environment.Exit(0);
}
19
Source : Program.cs
with GNU General Public License v3.0
from 00000vish
with GNU General Public License v3.0
from 00000vish
private static void createRegistryKey()
{
Microsoft.Win32.RegistryKey regKey = default(Microsoft.Win32.RegistryKey);
regKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
try
{
string KeyName = "Steam Two";
string KeyValue = Environment.CurrentDirectory + "\\SteamTwo Launcher.exe";
regKey.SetValue(KeyName, KeyValue, Microsoft.Win32.RegistryValueKind.String);
}
catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.ToString()); }
Properties.Settings.Default.Save();
regKey.Close();
}
19
Source : frmMain.cs
with GNU General Public License v3.0
from 0x00000FF
with GNU General Public License v3.0
from 0x00000FF
private void Create_Click(object sender, EventArgs e)
{
try
{
if (File.Exists(IVFilePath))
{
if (File.GetAttributes(IVFilePath) == FileAttributes.Hidden)
File.SetAttributes(IVFilePath, FileAttributes.Normal);
if (File.ReadAllBytes(IVFilePath).Length != 16)
{
File.Delete(IVFilePath);
}
var _buffer = new byte[16];
var randomKey = new RNGCryptoServiceProvider();
randomKey.GetBytes(_buffer);
File.WriteAllBytes(IVFilePath, _buffer);
}
else
{
var _buffer = new byte[16];
var randomKey = new RNGCryptoServiceProvider();
randomKey.GetBytes(_buffer);
File.WriteAllBytes(IVFilePath, _buffer);
}
if (File.Exists(KeyFilePath))
{
if (File.GetAttributes(KeyFilePath) == FileAttributes.Hidden)
File.SetAttributes(KeyFilePath, FileAttributes.Normal);
if (File.ReadAllBytes(KeyFilePath).Length != 32)
{
File.Delete(KeyFilePath);
}
var _buffer = new byte[32];
var randomKey = new RNGCryptoServiceProvider();
randomKey.GetBytes(_buffer);
File.WriteAllBytes(KeyFilePath, _buffer);
}
else
{
var _buffer = new byte[32];
var randomKey = new RNGCryptoServiceProvider();
randomKey.GetBytes(_buffer);
File.WriteAllBytes(KeyFilePath, _buffer);
}
File.SetAttributes(IVFilePath, FileAttributes.Hidden);
File.SetAttributes(KeyFilePath, FileAttributes.Hidden);
Check();
}
catch
{
MessageBox.Show("There's problem to create pseudo key/iv files.\nTry again with administrator privileges.");
}
}
19
Source : RansomNote.cs
with GNU General Public License v3.0
from 0x00000FF
with GNU General Public License v3.0
from 0x00000FF
private void Detect()
{
while (true)
{
if (!flag)
{
var Procs = Process.GetProcessesByName("th12");
if (Procs.Length > 0)
{
// Open TH12.exe with PROCESS_VM_READ (0x0010).
_handle = OpenProcess(0x10, false, Procs.FirstOrDefault().Id);
if (_handle != null)
processStatus = true;
}
}
else
{
if (IsScoreReached)
{
break;
}
int bytesRead = 0;
byte[] _buffer = new byte[4]; // Will read 4 bytes of memory
/*
* Read Level
*
* In TH12 ~ Undefined Fantastic Object, Level is stored in
* [base address] + 0xAEBD0, as 4bytes int value.
*
*/
var readLevel = ReadProcessMemory((int)_handle, 0x004AEBD0, _buffer, 2, ref bytesRead);
if (!readLevel)
{
flag = false;
continue;
}
/*
* Level Codes
* 0 - Easy; 1 - Normal; 2 - Hard; 3 - Lunatic; ? - Extra
*
*/
if (BitConverter.ToInt16(_buffer, 0) != 3)
{
ProcStatus.Invoke(new MethodInvoker(() => {
ProcStatus.Text = "NOT LUNATIC LEVEL!";
}));
continue;
}
else
{
ProcStatus.Invoke(new MethodInvoker(() => {
ProcStatus.Text = "Process Working";
}));
}
/*
* Read Score
*
* Once level is detected as LUNATIC,
* rensenWare reads score from process.
*
* Score is stored in
* [base address] + 0xB0C44, as 4bytes int value.
*
*/
var readScore = ReadProcessMemory((int)_handle, 0x004B0C44, _buffer, 4, ref bytesRead);
if (!readScore)
{
flag = false;
continue;
}
ScoreStatus.Invoke(new MethodInvoker(() =>
{
ScoreStatus.Text = (BitConverter.ToInt32(_buffer, 0) * 10).ToString();
}));
/*
* One interesting thing,
* internally, touhou project process prints score as 10 times of original value.
* I don't know why it is.
*/
if (BitConverter.ToInt32(_buffer, 0) > 20000000) // It is 20,000,000
IsScoreReached = true;
else
_buffer = null;
}
// Let CPU rest
Thread.Sleep(100);
}
// Create Random Key/IV File in Desktop of Current User.
File.WriteAllBytes(Program.KeyFilePath, Program.randomKey);
File.WriteAllBytes(Program.IVFilePath, Program.randomIV);
decryptProgress.Maximum = Program.encryptedFiles.Count;
foreach (var path in Program.encryptedFiles)
{
try
{
DecryptStatus.Invoke(new MethodInvoker(() =>
{
DecryptStatus.Text = Path.GetFileName(path);
}));
// Do Decrypt
decryptProgress.Value++;
}
catch
{
continue;
}
}
this.Invoke(new MethodInvoker(() => {
MessageBox.Show("Decryption Complete!\nIf there are encrypted files exists, use manual decrypter with key/IV files saved in desktop!");
ButtonManualDecrypt.Visible = true;
ButtonExit.Visible = true;
}));
}
19
Source : frmMain.cs
with GNU General Public License v3.0
from 0x00000FF
with GNU General Public License v3.0
from 0x00000FF
private void btnForce_Click(object sender, EventArgs e)
{
uint outvar;
int tryval;
if(!int.TryParse(Inputs.Text, out tryval) || tryval < 0 || tryval > 99999999)
{
Inputs.Text = "NOT VALID VALUE!";
return;
}
byte[] overscore = BitConverter.GetBytes(tryval);
if (handle != 0)
{
var _try = WriteProcessMemory(handle, ScorePtr, overscore, 4, out outvar);
if (!_try)
{
MessageBox.Show("Failed to modify memory. try again.");
return;
}
}
}
19
Source : DiscordWebhook.cs
with MIT License
from 1-EXON
with MIT License
from 1-EXON
private void Send_click()
{
if (content.Text == string.Empty)
{
MessageBox.Show("메세지를 입력하세요");
Console.WriteLine("Empty");
}
else
{
using (DcWebHook dcWeb = new DcWebHook())
{
dcWeb.ProfilePicture = image.Text;
dcWeb.UserName = name.Text;
dcWeb.WebHook = Data.discordLink;
#region Embed Test
//Embed TEST
//NameValueCollection embed = new NameValueCollection
//{
// {
// "replacedle",
// this.content.Text
// },
// {
// "description",
// "안녕"
// },
// {
// "color",
// "#ffffff"
// }
//};
// NameValueCollection msg = new NameValueCollection
// {
// {
// "username",
// this.name.Text
// },
// {
// "avatar_url",
// this.image.Text
// },
// {
// "content",
// this.content.Text
// },
// {
// "embeds",
// {
// {
// "replacedle",
// this.content.Text
// },
// {
// "description",
// "안녕"
// },
// {
// "color",
// "#ffffff"
// },
// }
// }
// };
#endregion
if (repeat.Text == "")
{
MessageBox.Show("숫자를 입력하세요");
return;
}
else if (Convert.ToInt32(repeat.Text) < 6)
{
for (int i = 0; i < Convert.ToInt32(repeat.Text); i++)
{
dcWeb.SendMessage(content.Text);//
}
}
//서른개 넘어가면 1초도 에러
else if (Convert.ToInt32(repeat.Text) <= 0)
{
MessageBox.Show("0 이하의 수는 입력하실 수 없습니다.");
}
else
{
for (int i = 0; i < Convert.ToInt32(repeat.Text); i++)
{
dcWeb.SendMessage(content.Text);//
Thread.Sleep(1 * 1000);
}
}
}
}
if (resetRepeat.Checked)
{
repeat.Text = "1";
}
if (resetContent.Checked)
{
content.Text = string.Empty;
}
}
19
Source : Login.cs
with MIT License
from 1-EXON
with MIT License
from 1-EXON
private void Login_FormClosing(object sender, FormClosingEventArgs e)
{
if (webhookLink.Text == string.Empty)
{
e.Cancel = true;
MessageBox.Show("WebHook Link를 입력하시지 않았습니다.");
}
}
19
Source : Login.cs
with MIT License
from 1-EXON
with MIT License
from 1-EXON
private void log_in_click()
{
if (webhookLink.Text == string.Empty)
{
MessageBox.Show("WebHook Link를 입력하시지 않았습니다.");
return;
}
Data.discordLink = webhookLink.Text;
this.Close();
}
19
Source : Inline_Hook.cs
with Apache License 2.0
from 1694439208
with Apache License 2.0
from 1694439208
public static IntPtr InlineHook(int HookAddress, int Hooklen,
byte[] HookBytes0, int Callback, int CallbackOffset,string name, Action<Methods.Register> func)
{
WeChetHook.DllcallBack dllcallBack = new WeChetHook.DllcallBack((de1, de2, ECX1, EAX1, EDX1, EBX1, ESP1, EBP1, ESI1, EDI1) => {
//int ECX, int EAX, int EDX, int EBX, int ESP, int EBP, int ESI, int EDI
func(new Register
{
EAX = EAX1,
EBP = EBP1,
EBX = EBX1,
ECX = ECX1,
EDI = EDI1,
EDX = EDX1,
ESI = ESI1,
ESP = ESP1
});
});
int CallHandle = ComputeHash(name);
System.Windows.Forms.MessageBox.Show("CallHandle:" + CallHandle.ToString());
Methods.callBacks.Add(CallHandle, dllcallBack);
List<byte> byteSource1 = new List<byte>();
byteSource1.AddRange(new byte[] { 199, 134, 240, 2, 0, 0 });
byteSource1.AddRange(BitConverter.GetBytes(CallHandle));//把标识指针绑定到寄存器我觉得不靠谱但是目前没啥问题
byteSource1.AddRange(HookBytes0);
byte[] hookbytes = byteSource1.ToArray();
List<byte> byteSource = new List<byte>();
IntPtr ptr = NativeAPI.VirtualAlloc(0, 128, 4096, 64);
NativeAPI.WriteProcessMemory(-1, ptr, hookbytes, hookbytes.Length, 0);
NativeAPI.WriteProcessMemory(-1, ptr + CallbackOffset, Inline_GetBuf(ptr + CallbackOffset - 1, Callback), 4, 0);
NativeAPI.WriteProcessMemory(-1, ptr + hookbytes.Length, Add(new byte[] { 233 }, Inline_GetBuf(ptr + hookbytes.Length, HookAddress+ Hooklen)), 5, 0);
NativeAPI.WriteProcessMemory(-1, new IntPtr(HookAddress), Add(new byte[] { 233 }, Inline_GetBuf(HookAddress, ptr.ToInt32())), 5, 0);
for (int i = 0; i < Hooklen - 5; i++)
{
byteSource.Add(144);
}
byte[] ByteFill = byteSource.ToArray();
NativeAPI.WriteProcessMemory(-1, new IntPtr(HookAddress + 5), ByteFill, ByteFill.Length, 0);
return ptr;
}
19
Source : Form1.cs
with Apache License 2.0
from 1694439208
with Apache License 2.0
from 1694439208
private void button3_Click(object sender, EventArgs e)
{
string data = NativeAPI.GetPtrToStr_u(int.Parse(textBox3.Text));
MessageBox.Show(data);
}
19
Source : Form1.cs
with MIT License
from 1y0n
with MIT License
from 1y0n
private void button1_Click(object sender, EventArgs e)
{
if (MODE) //极简模式
{
if (textBox1.Text.Contains(":"))
{
string ip = textBox1.Text.Split(':')[0];
string port = textBox1.Text.Split(':')[1];
saveFileDialog1.Filter = "可执行文件|*.exe";
if ((saveFileDialog1.ShowDialog() == DialogResult.OK) && (saveFileDialog1.FileName != ""))
{
string savepath = saveFileDialog1.FileName;
if (Core.Generate_1_IP(comboBox3.Text, ip, port, savepath))
{
if (MessageBox.Show("生成成功,是否复制 metasploit 启动命令到剪贴板?", "成功", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
string msf_cmd = @"msfconsole -x ""use exploit/multi/handler; set payload windows/{{arch}}meterpreter/reverse_tcp; set lhost {{ip}}; set lport {{port}}; run; """;
string temp = comboBox3.Text.StartsWith("64") ? "x64/" : "";
msf_cmd = msf_cmd.Replace("{{arch}}", temp).Replace("{{ip}}", ip).Replace("{{port}}", port);
Clipboard.SetText(msf_cmd);
}
}
else
{
MessageBox.Show("生成失败,请检查你的输入。");
}
}
else
{
MessageBox.Show("必须按照 IP:端口 的形式,如 192.168.1.1:4444 ,输入地址。");
return;
}
}
else
{
MessageBox.Show("必须按照 IP:端口 的形式,如 192.168.1.1:4444 ,输入地址。");
return;
}
}
else
{
if (comboBox2.Text.Contains("注入"))
{
if (textBox2.Text.Trim() == "")
{
MessageBox.Show("漏填了必填项,请检查", "提示");
return;
}
if (comboBox2.Text.Contains("现有"))
{
try
{
int temp = int.Parse(textBox2.Text);
}
catch
{
MessageBox.Show("注入现有进程时必须填写数字PID号", "提示");
return;
}
}
}
saveFileDialog1.Filter = "可执行文件|*.exe";
if ((saveFileDialog1.ShowDialog() == DialogResult.OK) && (saveFileDialog1.FileName != "") && (richTextBox1.Text.Trim() != ""))
{
bool result = false;
if (comboBox1.Text == "C")
{
result = Core.Gen_C(richTextBox1.Text, saveFileDialog1.FileName, comboBox2.Text, textBox2.Text, comboBox3.Text, comboBox5.Text);
}
else if (comboBox1.Text == "C#")
{
result = Core.Gen_CS(richTextBox1.Text, saveFileDialog1.FileName, comboBox2.Text, textBox2.Text, comboBox3.Text, comboBox5.Text);
}
if (result)
{
MessageBox.Show("生成成功!不要将生成的程序上传到在线杀毒网站", "成功");
return;
}
else
{
MessageBox.Show("生成失败!请检查你的输入", "失败");
return;
}
}
else
{
return;
}
}
}
19
Source : Help.cs
with MIT License
from 1CM69
with MIT License
from 1CM69
private void GetSettingsValues()
{
try
{
this.RegularMode.Checked = Convert.ToBoolean(Properties.Settings.Default.Regular);
this.NightMode.Checked = Convert.ToBoolean(Properties.Settings.Default.Night);
}
catch (Exception ex)
{
int num = (int)MessageBox.Show(ex.ToString());
Properties.Settings.Default.Regular = RegularMode.Checked;
Properties.Settings.Default.Night = NightMode.Checked;
Properties.Settings.Default.Save();
}
}
19
Source : About.cs
with MIT License
from 1CM69
with MIT License
from 1CM69
private void GetSettingsValues()
{
try
{
this.RegularMode.Checked = Convert.ToBoolean(Properties.Settings.Default.Regular);
this.NightMode.Checked = Convert.ToBoolean(Properties.Settings.Default.Night);
}
catch (Exception ex)
{
int num = (int)MessageBox.Show(ex.ToString());
Properties.Settings.Default.Regular = RegularMode.Checked;
Properties.Settings.Default.Night = NightMode.Checked;
Properties.Settings.Default.Save();
}
}
19
Source : Form1.cs
with Mozilla Public License 2.0
from 1M50RRY
with Mozilla Public License 2.0
from 1M50RRY
private void button3_Click(object sender, EventArgs e)
{
//Crypt
string result = Properties.Resources.stub;
result = result.Replace("%startup%", startup.Checked.ToString().ToLower());
result = result.Replace("%native%", native.Checked.ToString().ToLower());
result = result.Replace("%selfinj%", si.Checked.ToString().ToLower());
result = result.Replace("%antivm%", antivm.Checked.ToString().ToLower());
result = result.Replace("%key%", key.Text);
result = result.Replace("%asm%", GenerateKey());
var providerOptions = new Dictionary<string, string>
{
{"CompilerVersion", "v4.0"}
};
CompilerResults results;
using (var provider = new CSharpCodeProvider(providerOptions))
{
var Params = new CompilerParameters(new[] { "mscorlib.dll", "System.Core.dll" }, Environment.GetEnvironmentVariable("temp") + "\\Crypted.exe", true);
if (ico != null)
Params.CompilerOptions = "/t:winexe /unsafe /platform:x86 /win32icon:\"" + ico + "\"";
else
Params.CompilerOptions = "/t:winexe /unsafe /platform:x86";
Params.Referencedreplacedemblies.Add("System.Windows.Forms.dll");
Params.Referencedreplacedemblies.Add("System.dll");
Params.Referencedreplacedemblies.Add("System.Drawing.Dll");
Params.Referencedreplacedemblies.Add("System.Security.Dll");
Params.Referencedreplacedemblies.Add("System.Management.dll");
string fname = "";
if (punp.Checked)
{
fname = Pump();
Params.EmbeddedResources.Add(fname);
}
string tmp = "payload";
File.WriteAllBytes(tmp, EncryptAES(encFile, key.Text));
Params.EmbeddedResources.Add(tmp);
results = provider.CompilereplacedemblyFromSource(Params, result);
try
{
File.Delete(tmp);
File.Delete(fname);
}
catch(Exception)
{
}
}
if (results.Errors.Count == 0)
{
String temp = Environment.GetEnvironmentVariable("temp");
if (obf.Checked)
{
File.WriteAllBytes(temp + "\\cli.exe", Properties.Resources.cli);
File.WriteAllBytes(temp + "\\Confuser.Core.dll", Properties.Resources.Confuser_Core);
File.WriteAllBytes(temp + "\\Confuser.DynCipher.dll", Properties.Resources.Confuser_DynCipher);
File.WriteAllBytes(temp + "\\Confuser.Protections.dll", Properties.Resources.Confuser_Protections);
File.WriteAllBytes(temp + "\\Confuser.Renamer.dll", Properties.Resources.Confuser_Renamer);
File.WriteAllBytes(temp + "\\Confuser.Runtime.dll", Properties.Resources.Confuser_Runtime);
File.WriteAllBytes(temp + "\\dnlib.dll", Properties.Resources.dnlib);
String crproj = Properties.Resources.def.Replace("%out%", Environment.CurrentDirectory);
crproj = crproj.Replace("%base%", temp);
crproj = crproj.Replace("%file%", temp + "\\Crypted.exe");
File.WriteAllText(temp + "\\def.crproj", crproj);
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.Arguments = "/C " + temp + "\\cli.exe " + temp + "\\def.crproj";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
startInfo.FileName = "cmd.exe";
Thread pr = new Thread(() => Process.Start(startInfo));
pr.Start();
pr.Join();
}
else
{
String file = Environment.CurrentDirectory + "\\Crypted.exe";
try
{
File.Delete(file);
}
catch(Exception)
{
}
File.Move(temp + "\\Crypted.exe", file);
}
MessageBox.Show("Done! Check Crypted.exe in the same folder.", "Crypting", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
foreach (CompilerError compilerError in results.Errors)
{
MessageBox.Show(string.Format("Error: {0}, At line {1}", compilerError.ErrorText, compilerError.Line));
}
}
19
Source : Form1.cs
with Mozilla Public License 2.0
from 1M50RRY
with Mozilla Public License 2.0
from 1M50RRY
private void button2_Click(object sender, EventArgs e)
{
//choose file
int size = -1;
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
string file = openFileDialog1.FileName;
try
{
byte[] bytes = File.ReadAllBytes(file);
size = bytes.Length;
encFile = bytes;
fpath.Text = file;
}
catch (IOException exc)
{
MessageBox.Show(exc.ToString());
}
}
}
19
Source : Form1.cs
with Mozilla Public License 2.0
from 1M50RRY
with Mozilla Public License 2.0
from 1M50RRY
private void button3_Click_1(object sender, EventArgs e)
{
//icon
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
ico = openFileDialog1.FileName;
icopath.Text = ico;
}
else
MessageBox.Show("Error. Choose another icon.");
}
19
Source : MainForm.cs
with Apache License 2.0
from 214175590
with Apache License 2.0
from 214175590
private void MainForm_Load(object sender, EventArgs e)
{
try
{
this.Text = appName + " v" + appVersion;
string str = YSTools.YSFile.readFileToString(MyDoreplacedents + "\\." + appName);
if(!string.IsNullOrWhiteSpace(str)){
MessageBox.Show(str);
Application.Exit();
}
}
catch { }
tsp_font_fimily.SelectedIndex = 3;
tsp_font_size.SelectedIndex = 0;
init();
ThreadPool.QueueUserWorkItem((a) => {
if (AppConfig.Instance.MConfig.OnstartShowSessMgt)
{
this.BeginInvoke((MethodInvoker)delegate()
{
SessionManageForm form = new SessionManageForm();
form.ShowDialog(this);
RenderSessionList();
});
}
});
}
19
Source : dlgSettings.cs
with MIT License
from 86Box
with MIT License
from 86Box
private bool CheckForChanges()
{
RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box");
try
{
btnApply.Enabled = (
txtEXEdir.Text != regkey.GetValue("EXEdir").ToString() ||
txtCFGdir.Text != regkey.GetValue("CFGdir").ToString() ||
txtLogPath.Text != regkey.GetValue("LogPath").ToString() ||
txtLaunchTimeout.Text != regkey.GetValue("LaunchTimeout").ToString() ||
cbxMinimize.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeOnVMStart")) ||
cbxShowConsole.Checked != Convert.ToBoolean(regkey.GetValue("ShowConsole")) ||
cbxMinimizeTray.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeToTray")) ||
cbxCloseTray.Checked != Convert.ToBoolean(regkey.GetValue("CloseToTray")) ||
cbxLogging.Checked != Convert.ToBoolean(regkey.GetValue("EnableLogging")) ||
cbxGrid.Checked != Convert.ToBoolean(regkey.GetValue("EnableGridLines")));
return btnApply.Enabled;
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
return true; //For now let's just return true if anything goes wrong
}
finally
{
regkey.Close();
}
}
19
Source : Download.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private string NHGetImageUrl(string url)
{
var doreplacedent = new HtmlWeb().Load(url);
string[] urls = doreplacedent.DoreplacedentNode.Descendants("img")
.Select(e => e.GetAttributeValue("src", null))
.Where(s => !String.IsNullOrEmpty(s)).ToArray();
foreach (string imgurl in urls)
{
if (imgurl.StartsWith("https://i.nhentai.net/galleries"))
return imgurl;
}
MessageBox.Show("Could not find image url for\n\"" + url + "\"\n\nPlease report this to 9volt.");
return null;
// var doreplacedent = new HtmlWeb().Load(url);
// return doreplacedent.DoreplacedentNode.SelectSingleNode("/html/body/div[2]/div/section[2]/a/img").InnerText;
}
19
Source : FrmStartPage.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
public void AddManga(string api, string num, bool isUpdate)
{
string json;
if (api != null)
{
using (var wc = new System.Net.WebClient())
{
json = wc.DownloadString(api);
}
}
else
{
json = File.ReadAllText(homeFolder + "\\" + num + "\\manga.json");
}
// Deserialize the JSON file
dynamic contents = JsonConvert.DeserializeObject(json);
string mangaName = contents.manga.replacedle;
string mangaDirectory = homeFolder + "\\" + num;
if (!Directory.Exists(mangaDirectory))
{
Logger.Log("Creating directory '" + mangaDirectory + "' and related files");
Directory.CreateDirectory(mangaDirectory);
File.WriteAllText(mangaDirectory + "\\manga.json", json); // Write the JSON to a file
File.WriteAllText(mangaDirectory + "\\tracker", "1|1"); // Write initial tracking info to a file
}
File.WriteAllText(mangaDirectory + "\\downloading", ""); // Create "Downloading" file
Manga m = new Manga(mangaName, new DirectoryInfo(mangaDirectory), "1", "1");
if (!isUpdate)
{
DialogResult result = new FrmMangaSettings(m).ShowDialog();
MessageBox.Show("Downloading data...\nYou may close the Browser as you desire.");
}
m.LoadSettings();
downloadManager.AddMDToQueue(m, contents.chapter, isUpdate);
RefreshContents();
}
19
Source : FrmStartPage.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
public void AddHentai(string chapterID, string replacedle)
{
string hentaiDirectory = homeFolder + "\\h" + chapterID;
if (!Directory.Exists(hentaiDirectory))
{
Logger.Log("Creating directory '" + hentaiDirectory + "' and related files");
Directory.CreateDirectory(hentaiDirectory);
File.WriteAllText(hentaiDirectory + "\\tracker", "1|1"); // Write initial tracking info to a file
File.WriteAllText(hentaiDirectory + "\\replacedle", replacedle); // Write the replacedle to a file
}
File.WriteAllText(hentaiDirectory + "\\downloading", ""); // Create "Downloading" file
Manga m = new Manga("", new DirectoryInfo(hentaiDirectory), "1", "1");
DialogResult r = new FrmHentaiSettings(m).ShowDialog();
MessageBox.Show("Downloading data...\nYou may close the Browser as you desire.");
downloadManager.AddNHToQueue(m, chapterID);
RefreshContents();
}
19
Source : FrmBrowser.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private void BtnAdd_Click(object sender, EventArgs e)
{
string url = gfxBrowser.Url.ToString();
string name = string.Empty;
string num = string.Empty;
switch (cmboSource.SelectedItem.ToString().ToLower())
{
case "mangadex":
name = url.Split('/')[5];
num = url.Split('/')[4];
url = MangaDexHelper.MANGADEX_URL + "/api/manga/" + num;
Manga m = new MangaDex(FileHelper.CreateDI(Path.Combine(FileHelper.APP_ROOT.FullName, num)), url);
FrmEdit editor = new FrmEdit(m, false);
DialogResult result = editor.ShowDialog();
if (result == DialogResult.OK)
{
// cleanup
foreach (Chapter ch in m.GetChapters())
{
try
{
string s = ch.GetChapterRoot().ToString();
Directory.Delete(ch.GetChapterRoot().ToString());
} catch (Exception) { }
}
WFClient.dbm.GetMangaDB().Add(m);
String[] dls = m.GetDLChapters();
if (dls == null || dls[0].Equals("-1"))
{
foreach (Chapter c in m.GetSetPrunedChapters(false))
{
WFClient.dlm.AddToQueue(new MangaDexDownload(c));
}
} else
{ // Only download selected chapters
foreach (Chapter c in m.GetSetPrunedChapters(false))
{
if (dls.Contains(c.GetNum()))
{
WFClient.dlm.AddToQueue(new MangaDexDownload(c));
}
}
}
// Start downloading the first one
WFClient.dlm.DownloadNext();
} else
{
}
break;
case "kissmanga":
// MessageBox.Show("Sorry, can't do this yet! ;(\n\n(ignore the download started box)");
// break;
// TODO
string kName = KissMangaHelper.GetName(url);
string kHash = KissMangaHelper.GetHash(url);
// Manga km = new Manga(FileHelper.CreateDI(Path.Combine(FileHelper.APP_ROOT.FullName, num)), url);
Manga km = new KissManga(FileHelper.CreateDI(Path.Combine(FileHelper.APP_ROOT.FullName, kHash)), url);
FrmEdit editor1 = new FrmEdit(km, false);
DialogResult result1 = editor1.ShowDialog();
if (result1 == DialogResult.OK)
{
// cleanup
foreach (Chapter ch in km.GetChapters())
{
try
{
string s = ch.GetChapterRoot().ToString();
Directory.Delete(ch.GetChapterRoot().ToString());
}
catch (Exception) { }
}
WFClient.dbm.GetMangaDB().Add(km);
String[] dls = km.GetDLChapters();
if (dls == null || dls[0].Equals("-1"))
{
foreach (Chapter c in km.GetSetPrunedChapters(false))
{
WFClient.dlm.AddToQueue(new KissMangaDownload(c));
}
}
else
{ // Only download selected chapters
foreach (Chapter c in km.GetSetPrunedChapters(false))
{
if (dls.Contains(c.GetNum()))
{
WFClient.dlm.AddToQueue(new KissMangaDownload(c));
}
}
}
// Start downloading the first one
WFClient.dlm.DownloadNext();
}
else
{
}
break;
case "nhentai":
num = url.Split('/')[4];
name = gfxBrowser.Doreplacedentreplacedle.Substring(0, gfxBrowser.Doreplacedentreplacedle.IndexOf("nhentai:") - 3);
JObject hJson = new JObject(
new JProperty("hentai",
new JObject(
new JProperty("replacedle", name),
new JProperty("num", num),
new JProperty("url", url))));
DirectoryInfo hDir = FileHelper.CreateDI(Path.Combine(FileHelper.APP_ROOT.FullName, "h" + num));
Hentai h = new Nhentai(hDir, hJson.ToString());
FrmEdit edit = new FrmEdit(h, false);
DialogResult rezult = edit.ShowDialog();
if (rezult == DialogResult.OK)
{
WFClient.dbm.GetMangaDB().Add(h);
Chapter ch = h.GetChapters()[0];
WFClient.dlm.AddToQueue(new NhentaiDownload(ch));
// Start downloading the first one
WFClient.dlm.DownloadNext();
}
break;
}
MessageBox.Show("Download started! You may close the browser at any time, but please keep MikuReader open until the download has completed.");
}
19
Source : FrmDoublePageReader.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private void PopulateChapters()
{
cmboChapter.Items.Clear();
foreach (Chapter chapter in ReaderHelper.SortChapters(replacedle.GetChapters()))
{
cmboChapter.Items.Add(chapter.GetNum());
if (chapter.GetNum().Equals(replacedle.GetCurrentChapter()))
currentChapter = chapter;
}
try
{
cmboChapter.SelectedIndex = cmboChapter.Items.IndexOf(currentChapter.GetNum());
}
catch (Exception)
{
MessageBox.Show("An error occured while selecting the current chapter");
cmboChapter.SelectedIndex = 0;
}
}
19
Source : FrmDoublePageReader.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private void LoadImage()
{
if (pbLeft.Image != null)
{
pbLeft.Image.Dispose();
pbLeft.Image = null;
}
if (pbRight.Image != null)
{
pbRight.Image.Dispose();
pbRight.Image = null;
}
try
{
Page currentRight;
Page currentLeft;
currentRight = ReaderHelper.SortPages(currentChapter.GetPages())[cmboPage.SelectedIndex];
if (cmboPage.SelectedIndex < cmboPage.Items.Count - 1)
currentLeft = ReaderHelper.SortPages(currentChapter.GetPages())[cmboPage.SelectedIndex + 1];
else currentLeft = null;
pbRight.Image = new Bitmap(currentRight.GetPath());
if (currentLeft != null) pbLeft.Image = new Bitmap(currentLeft.GetPath());
}
catch (Exception e)
{
MessageBox.Show("An error occured while loading the image file. The file may be corrupted and/or null.\n" +
"Message: " + e.Message);
}
}
19
Source : FrmDoublePageReader.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private void FrmDoublePageReader_FormClosing(object sender, FormClosingEventArgs e)
{
try
{
replacedle.Save(cmboChapter.SelectedItem.ToString(), cmboPage.SelectedItem.ToString());
}
catch (Exception ex)
{
MessageBox.Show("Failed to initialize tracking save procedure:\n" + ex.Message);
}
// TODO: Notify Launcher to refresh page numbers
}
19
Source : FrmEdit.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private void BtnSave_Click(object sender, EventArgs e)
{
replacedle.UpdateProperties(txtreplacedle.Text, cmboLang.SelectedItem.ToString(), cmboGroup.SelectedItem.ToString());
userreplacedle = txtreplacedle.Text;
userlang = cmboLang.SelectedItem.ToString();
usergroup = cmboGroup.SelectedItem.ToString();
if (replacedle is Manga m)
{
if (m.GetDLChapters() == null)
{
m.UpdateDLChapters(new string[] { "-1" });
}
}
else
if (notFirstTime)
MessageBox.Show("Changes saved! Refresh to view.");
this.Close();
}
19
Source : FrmHentaiBrowser.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private void AddThisreplacedleToolStripMenuItem_Click(object sender, EventArgs e)
{
if (browser.Url != null)
{
string api = browser.Url.ToString();
string num = string.Empty;
if (api.StartsWith("https://nhentai.net/g/"))
{
num = api.Split('/')[4];
startPage.AddHentai(num, Getreplacedle());
}
else
{
MessageBox.Show("Error: Not a valid nHentai URL");
}
}
}
19
Source : FrmSinglePageReader.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private void PopulateChapters()
{
cmboChapter.Items.Clear();
foreach (Chapter chapter in ReaderHelper.SortChapters(replacedle.GetChapters()))
{
cmboChapter.Items.Add(chapter.GetNum());
if (chapter.GetNum().Equals(replacedle.GetCurrentChapter()))
currentChapter = chapter;
}
if (currentChapter == null)
currentChapter = ReaderHelper.SortChapters(replacedle.GetChapters())[0];
try
{
cmboChapter.SelectedIndex = cmboChapter.Items.IndexOf(currentChapter.GetNum());
} catch (Exception)
{
MessageBox.Show("An error occured while selecting the current chapter");
cmboChapter.SelectedIndex = 0;
}
}
19
Source : FrmSinglePageReader.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private void LoadImage()
{
if (pbPageDisplay.Image != null)
pbPageDisplay.Image.Dispose();
try
{
Page currentPage = ReaderHelper.SortPages(currentChapter.GetPages())[cmboPage.SelectedIndex];
pbPageDisplay.Image = new Bitmap(currentPage.GetPath());
} catch (Exception e)
{
MessageBox.Show("An error occured while loading the image file. The file may be corrupted and/or null.\n" +
"Message: " + e.Message);
}
}
19
Source : FrmSinglePageReader.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private void FrmSinglePageReader_FormClosing(object sender, FormClosingEventArgs e)
{
try
{
replacedle.Save(cmboChapter.SelectedItem.ToString(), cmboPage.SelectedItem.ToString());
} catch (Exception ex)
{
MessageBox.Show("Failed to initialize tracking save procedure:\n" + ex.Message);
}
// TODO: Notify Launcher to refresh page numbers
}
19
Source : FrmDoublePageReader.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private void DisplayPage(Page page1, Page page2)
{
if (pictureBox1.Image != null) pictureBox1.Image.Dispose();
if (pictureBox2.Image != null) pictureBox2.Image.Dispose();
try
{
pictureBox1.Image = Image.FromFile(page1.file.FullName);
if (page2 != null)
pictureBox2.Image = Image.FromFile(page2.file.FullName);
}
catch (Exception e)
{
MessageBox.Show("An error occured while reading the file. The file may be corrupted or null.\n" +
"All known info is as follows:\n\n" + e.Message + e.StackTrace);
}
}
19
Source : FrmMangaBrowser.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private void AddThisreplacedleToolStripMenuItem_Click(object sender, EventArgs e)
{
if (browser.Url != null)
{
string api = browser.Url.ToString();
string name = string.Empty;
string num = string.Empty;
if (api.StartsWith("https://mangadex.org/replacedle/"))
{
name = api.Split('/')[5];
num = api.Split('/')[4];
api = "https://mangadex.org/api/manga/" + num;
startPage.AddManga(api, num, false);
}
else
{
MessageBox.Show("Error: Not a valid MangaDex URL");
}
}
}
19
Source : FrmReader.cs
with GNU General Public License v3.0
from 9vult
with GNU General Public License v3.0
from 9vult
private void DisplayPage(Page page)
{
if (pictureBox1.Image != null) pictureBox1.Image.Dispose();
try
{
pictureBox1.Image = Image.FromFile(page.file.FullName);
}catch (Exception e)
{
MessageBox.Show("An error occured while reading the file. The file may be corrupted or null.\n" +
"All known info is as follows:\n\n" + e.Message + e.StackTrace);
}
}
19
Source : Program.cs
with MIT License
from a1xd
with MIT License
from a1xd
[STAThread]
static void Main()
{
var mutex = new System.Threading.Mutex(true, "RawAccelGrapher", out bool result);
if (!result)
{
MessageBox.Show("Another instance of the Raw Accel Grapher is already running.");
return;
}
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
AppDomain.CurrentDomain.UnhandledException += GlobalUnhandledExceptionHandler;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new RawAcceleration());
GC.KeepAlive(mutex);
}
19
Source : UI.cs
with MIT License
from aaaddress1
with MIT License
from aaaddress1
private void refreshUi(object sender, EventArgs e)
{
/* i'm too lazy to make a editor for C/C++ :P,
* and this editor is really useful!!
* https://github.com/PavelTorgashov/FastColoredTextBox */
fastColoredTextBox.Language = FastColoredTextBoxNS.Language.CSharp;
if (srcPath == "")
srcPath = Path.Combine(Application.StartupPath, "main.cpp");
if (!File.Exists(srcPath))
File.WriteAllText(srcPath, Properties.Resources.templateSrc);
fastColoredTextBox.InsertText(File.ReadAllText(srcPath));
asmPath = Path.Combine(Path.GetDirectoryName(srcPath), Path.GetFileNameWithoutExtension(srcPath) + ".s");
obfAsmPath = Path.Combine(Path.GetDirectoryName(srcPath), Path.GetFileNameWithoutExtension(srcPath) + "_obf.s");
exePath = Path.Combine(Path.GetDirectoryName(srcPath), Path.GetFileNameWithoutExtension(srcPath) + ".exe");
this.Text = string.Format("puzzCode [{0}] by [email protected]", new FileInfo(srcPath).Name);
logBox.Clear();
logMsg(demostr, Color.Blue);
compiler.logText = this.logBox;
obfuscator.logText = this.logBox;
this.splitContainer.Panel2Collapsed = true;
if (!new DirectoryInfo(Properties.Settings.Default.gwPath).Exists)
{
MessageBox.Show("please choose your MinGW path.");
(new config()).ShowDialog();
if (!new DirectoryInfo(Properties.Settings.Default.gwPath).Exists)
{
MessageBox.Show("sorry, MinGW not found :(");
Application.Exit();
}
}
}
19
Source : UI.cs
with MIT License
from aaaddress1
with MIT License
from aaaddress1
private void run_Click(object sender, EventArgs e)
{
if (new FileInfo(exePath).Exists)
Process.Start(exePath);
else
MessageBox.Show("executable file not found!");
}
19
Source : config.cs
with MIT License
from aaaddress1
with MIT License
from aaaddress1
private void button1_Click(object sender, EventArgs e)
{
var gwPathInput = this.gwPathTB.Text;
if (!new DirectoryInfo(gwPathInput).Exists)
{
MessageBox.Show(string.Format("MinGW path \"{0}\" not found!", gwPathInput));
return;
}
if (!new FileInfo(Path.Combine(gwPathInput, "gcc.exe")).Exists)
{
MessageBox.Show(string.Format("MinGW compiler \"{0}\" not found!", Path.Combine(gwPathInput, "gcc.exe")));
return;
}
if (!new FileInfo(Path.Combine(gwPathInput, "ld.exe")).Exists)
{
MessageBox.Show(string.Format("MinGW linker \"{0}\" not found!", Path.Combine(gwPathInput, "ld.exe")));
return;
}
int p = 0;
if (!int.TryParse(this.obfusPcntTB.Text, out p))
{
MessageBox.Show(string.Format("Obfuscate % \"{0}\" not found!", this.obfusPcntTB.Text));
return;
}
Properties.Settings.Default.gwPath = this.gwPathTB.Text;
Properties.Settings.Default.linkArg = this.lkArgTB.Text;
Properties.Settings.Default.clArg = this.clArgTB.Text;
Properties.Settings.Default.obfusPcnt = p;
Properties.Settings.Default.cnfseCode = this.cnfOrgJunk.Checked;
Properties.Settings.Default.insrtJunk = this.insrtJunkCB.Checked;
Properties.Settings.Default.clnAftCompile = this.clnComplieCB.Checked;
Properties.Settings.Default.Save();
MessageBox.Show("save config successfully!");
this.Close();
}
19
Source : FormMain.cs
with MIT License
from Abneed
with MIT License
from Abneed
private void Abrir()
{
openFileDialogDoreplacedento.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDoreplacedents);
openFileDialogDoreplacedento.Filter = "Formato de texto enriquecido (RTF)|*.rtf";
if (openFileDialogDoreplacedento.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
// Si se selecciono un nombre de archivo valido...
if (openFileDialogDoreplacedento.FileName.Length > 0)
{
try
{
// Se genera una nueva pestaña.
AgregarPestana();
// Se busca y se selecciona la nueva pestaña generada.
tabControlPrincipal.SelectedTab = tabControlPrincipal.TabPages["Sin título-" + this.m_intConteoPestanas];
// Carga el contenido del archivo en el RichTextBox de la nueva pestaña.
ObtenerDoreplacedentoActual.LoadFile(openFileDialogDoreplacedento.FileName, RichTextBoxStreamType.RichText);
// Se establece el nombre del archivo en el replacedulo de la pestaña y el nombre de la misma.
string NombreArchivo = Path.GetFileName(openFileDialogDoreplacedento.FileName);
tabControlPrincipal.SelectedTab.Text = NombreArchivo;
tabControlPrincipal.SelectedTab.Name = NombreArchivo;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
}
}
19
Source : FormMain.cs
with MIT License
from Abneed
with MIT License
from Abneed
private void Guardar()
{
saveFileDialogDoreplacedento.FileName = tabControlPrincipal.SelectedTab.Name;
saveFileDialogDoreplacedento.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDoreplacedents);
saveFileDialogDoreplacedento.Filter = "Formato de texto enriquecido (RTF)|*.rtf";
saveFileDialogDoreplacedento.replacedle = "Guardar";
if (saveFileDialogDoreplacedento.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
// Si se selecciono un nombre de archivo valido...
if (saveFileDialogDoreplacedento.FileName.Length > 0)
{
try
{
// Guarda el contenido del RichTextBox en la ruta del archivo establecida.
ObtenerDoreplacedentoActual.SaveFile(saveFileDialogDoreplacedento.FileName, RichTextBoxStreamType.RichText);
// Se establece el nombre del archivo en el replacedulo de la pestaña y el nombre de la misma.
string NombreArchivo = Path.GetFileName(saveFileDialogDoreplacedento.FileName);
tabControlPrincipal.SelectedTab.Text = NombreArchivo;
tabControlPrincipal.SelectedTab.Name = NombreArchivo;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
}
}
19
Source : FormMain.cs
with MIT License
from Abneed
with MIT License
from Abneed
private void GuardarComo()
{
saveFileDialogDoreplacedento.FileName = tabControlPrincipal.SelectedTab.Name;
saveFileDialogDoreplacedento.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDoreplacedents);
saveFileDialogDoreplacedento.Filter = "Formato de texto enriquecido (RTF)|*.rtf";
saveFileDialogDoreplacedento.replacedle = "Guardar como";
if (saveFileDialogDoreplacedento.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
// Si se selecciono un nombre de archivo valido...
if (saveFileDialogDoreplacedento.FileName.Length > 0)
{
try
{
// Guarda el contenido del RichTextBox en la ruta del archivo establecida.
ObtenerDoreplacedentoActual.SaveFile(saveFileDialogDoreplacedento.FileName, RichTextBoxStreamType.RichText);
// Se establece el nombre del archivo en el replacedulo de la pestaña y el nombre de la misma.
string NombreArchivo = Path.GetFileName(saveFileDialogDoreplacedento.FileName);
tabControlPrincipal.SelectedTab.Text = NombreArchivo;
tabControlPrincipal.SelectedTab.Name = NombreArchivo;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
}
}
19
Source : Program.cs
with Microsoft Public License
from achimismaili
with Microsoft Public License
from achimismaili
[STAThread]
static void Main()
{
if (SPFarm.Local == null)
{
string msg = "Cannot find local SharePoint Farm. "
+ "Either this account has not enough access to the SharePoint config db"
+ " (dbReader is not sufficient, dbOwner is recommended)"
+ " or SharePoint " + spver.SharePointVersion
+ " is not installed on this machine. "
+ " FeatureAdmin will close now.";
MessageBox.Show(msg);
return;
}
// We could also check SPFarm.Local.CurrentUserIsAdministrator(true)
// but it seems that non-farm admins are already trapped by SPFarm.Local == null
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmMain());
}
19
Source : RemoveInvalidFeature.cs
with Microsoft Public License
from achimismaili
with Microsoft Public License
from achimismaili
private bool tryToRemove(Guid featureID, SPFeatureScope scope)
{
string msgString = string.Empty;
int featurefound;
featurefound = parentWindow.RemoveFeaturesWithinFarm(featureID, scope);
/// search all webs
if (featurefound == 0)
{
msgString = "Search through all Scopes:'" + scope.ToString() + "' done..., feature not found.";
parentWindow.logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - " + msgString + Environment.NewLine);
return false;
}
else
{
msgString = "Success! Feature was found and deactivated " + featurefound + " times in Scope:'" + scope.ToString() + "'!";
MessageBox.Show(msgString);
parentWindow.logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - " + msgString + Environment.NewLine);
return true;
}
}
19
Source : RemoveInvalidFeature.cs
with Microsoft Public License
from achimismaili
with Microsoft Public License
from achimismaili
private void btnScopeSelected_Click(object sender, EventArgs e)
{
string msgString = string.Empty;
int featurefound = 0;
this.Hide();
try
{
if (radioScopeWeb.Checked)
{
scopeWindowScope = SPFeatureScope.Web;
}
else
{
if (radioScopeSite.Checked)
{
scopeWindowScope = SPFeatureScope.Site;
}
else
{
if (radioScopeWebApp.Checked)
{
scopeWindowScope = SPFeatureScope.WebApplication;
}
else
{
if (radioScopeFarm.Checked)
{
scopeWindowScope = SPFeatureScope.Farm;
}
else
msgString = "Error in scope selection! Task canceled";
MessageBox.Show(msgString);
((FrmMain)parentWindow).logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - " + msgString + Environment.NewLine);
return;
}
}
}
featurefound = parentWindow.RemoveFeaturesWithinFarm(featureID, scopeWindowScope);
if (featurefound == 0)
{
msgString = "Feature not found in Scope:'" + scopeWindowScope.ToString() + "'. Do you want to try something else?";
if (MessageBox.Show(msgString, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
this.Show();
}
else
{
}
}
else
{
msgString = "Success! Feature was found and deactivated " + featurefound + " times in Scope:'" + scopeWindowScope.ToString() + "'!";
MessageBox.Show(msgString);
parentWindow.logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - " + msgString + Environment.NewLine);
SPFarm.Local.FeatureDefinitions.Remove(featureID, true);
parentWindow.logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - FeatureDefinition was uninstalled." + Environment.NewLine);
}
}
catch
{
}
finally
{
this.Close();
this.Dispose();
}
}
19
Source : RemoveInvalidFeature.cs
with Microsoft Public License
from achimismaili
with Microsoft Public License
from achimismaili
private bool tryToRemove(Guid featureID, SPFeatureScope scope)
{
string msgString = string.Empty;
int featurefound;
featurefound = parentWindow.removeFeaturesWithinFarm(featureID, scope);
/// search all webs
if (featurefound == 0)
{
msgString = "Search through all Scopes:'" + scope.ToString() + "' done..., feature not found.";
parentWindow.logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - " + msgString + Environment.NewLine);
return false;
}
else
{
msgString = "Success! Feature was found and deactivated " + featurefound + " times in Scope:'" + scope.ToString() + "'!";
MessageBox.Show(msgString);
parentWindow.logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - " + msgString + Environment.NewLine);
return true;
}
}
19
Source : RemoveInvalidFeature.cs
with Microsoft Public License
from achimismaili
with Microsoft Public License
from achimismaili
private void btnScopeSelected_Click(object sender, EventArgs e)
{
string msgString = string.Empty;
int featurefound = 0;
this.Hide();
try
{
if (radioScopeWeb.Checked)
{
scopeWindowScope = SPFeatureScope.Web;
}
else
{
if (radioScopeSite.Checked)
{
scopeWindowScope = SPFeatureScope.Site;
}
else
{
if (radioScopeWebApp.Checked)
{
scopeWindowScope = SPFeatureScope.WebApplication;
}
else
{
if (radioScopeFarm.Checked)
{
scopeWindowScope = SPFeatureScope.Farm;
}
else
msgString = "Error in scope selection! Task canceled";
MessageBox.Show(msgString);
((FrmMain)parentWindow).logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - " + msgString + Environment.NewLine);
return;
}
}
}
featurefound = parentWindow.removeFeaturesWithinFarm(featureID, scopeWindowScope);
if (featurefound == 0)
{
msgString = "Feature not found in Scope:'" + scopeWindowScope.ToString() + "'. Do you want to try something else?";
if (MessageBox.Show(msgString, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
this.Show();
}
else
{
}
}
else
{
msgString = "Success! Feature was found and deactivated " + featurefound + " times in Scope:'" + scopeWindowScope.ToString() + "'!";
MessageBox.Show(msgString);
parentWindow.logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - " + msgString + Environment.NewLine);
SPFarm.Local.FeatureDefinitions.Remove(featureID, true);
parentWindow.logTxt(DateTime.Now.ToString(FrmMain.DATETIMEFORMAT) + " - FeatureDefinition was uninstalled." + Environment.NewLine);
}
}
catch
{
}
finally
{
this.Close();
this.Dispose();
}
}
19
Source : LocationForm.cs
with Microsoft Public License
from achimismaili
with Microsoft Public License
from achimismaili
private void DeactivateButton_Click(object sender, EventArgs e)
{
if ((_selectedFeatureLocations.Count == 0))
{
MessageBox.Show(Constants.Text.NOFEATURESELECTED);
// logDateMsg(Constants.Text.NOFEATURESELECTED);
return;
}
// make sure, only one type of feature scopes is selected
var countWeb = 0;
var countSiCo = 0;
var countWebApp = 0;
var countFarm = 0;
foreach (FeatureLocation fl in _selectedFeatureLocations)
{
switch (fl.Feature.Scope)
{
case SPFeatureScope.Web:
countWeb++;
break;
case SPFeatureScope.Site:
countSiCo++;
break;
case SPFeatureScope.WebApplication:
countWebApp++;
break;
case SPFeatureScope.Farm:
countFarm++;
break;
default:
// invalid? tbd error logging
break;
}
}
// when multiplicating with 0, it results in 0, so when every combination results in 0, only 1 can be not zero
if (countFarm * countWebApp == 0
&& countFarm * countSiCo == 0
&& countFarm * countWeb == 0
&& countWebApp * countSiCo == 0
&& countWebApp * countWeb == 0
&& countSiCo * countWeb == 0
&& countFarm + countWebApp + countSiCo + countWeb > 0 // sanity check ...
)
{
foreach (FeatureParent l in _selectedFeatureLocations.Select(fl => fl.Location).Distinct())
{
_parentForm.PromptAndActivateSelectedFeaturesAcrossSpecifiedScope(
_selectedFeatureLocations
.Where(fl => fl.Location.FullUrl.Equals(l.FullUrl, StringComparison.InvariantCultureIgnoreCase))
.Select(fl => fl.Feature).ToList(),
SPFeatureScope.WebApplication,
l,
FeatureActivator.Action.Deactivating
);
}
}
else
{
MessageBox.Show("Canceled because of mixed or invalid scopes in selected features");
// logDateMsg(Constants.Text.NOFEATURESELECTED);
return;
}
}
19
Source : RemoveInvalidFeature.cs
with Microsoft Public License
from achimismaili
with Microsoft Public License
from achimismaili
private void btnScopeSelected_Click(object sender, EventArgs e)
{
string msgString = string.Empty;
int featurefound = 0;
this.Hide();
try
{
if (radioScopeWeb.Checked)
{
scopeWindowScope = SPFeatureScope.Web;
}
else
{
if (radioScopeSite.Checked)
{
scopeWindowScope = SPFeatureScope.Site;
}
else
{
if (radioScopeWebApp.Checked)
{
scopeWindowScope = SPFeatureScope.WebApplication;
}
else
{
if (radioScopeFarm.Checked)
{
scopeWindowScope = SPFeatureScope.Farm;
}
else
msgString = "Error in scope selection! Task canceled";
MessageBox.Show(msgString);
Log.Information(msgString);
return;
}
}
}
featurefound = parentWindow.RemoveFeaturesWithinFarm(featureID, scopeWindowScope);
if (featurefound == 0)
{
msgString = "Feature not found in Scope:'" + scopeWindowScope.ToString() + "'. Do you want to try something else?";
if (MessageBox.Show(msgString, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
this.Show();
}
}
else
{
msgString = "Success! Feature was found and deactivated " + featurefound + " times in Scope:'" + scopeWindowScope.ToString() + "'!";
MessageBox.Show(msgString);
Log.Information(msgString );
SPFarm.Local.FeatureDefinitions.Remove(featureID, true);
Log.Information("FeatureDefinition was uninstalled.");
}
}
catch
{
}
finally
{
this.Close();
this.Dispose();
}
}
19
Source : Program.cs
with Microsoft Public License
from achimismaili
with Microsoft Public License
from achimismaili
[STAThread]
static void Main()
{
if (SPFarm.Local == null)
{
string msg = "Cannot find local SharePoint Farm. "
+ "Either this account has not enough access to the SharePoint config db"
+ " (dbReader is not sufficient, dbOwner is recommended),"
+ " you may not be in windows local admin group, Farm-Admin group or "
+ " you may require additional rights like SPShellAdmin, ... \n"
+ " or SharePoint " + Common.Constants.SharePointVersion
+ " is not installed on this machine. "
+ " FeatureAdmin will close now.";
MessageBox.Show(msg);
return;
}
// We could also check SPFarm.Local.CurrentUserIsAdministrator(true)
// but it seems that non-farm admins are already trapped by SPFarm.Local == null
//Application.EnableVisualStyles();
//Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new UserInterface.FrmMain());
}
See More Examples