Here are the examples of the csharp api System.Windows.Forms.MessageBox.Show(string, string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
863 Examples
19
View Source File : Ribbon.cs
License : GNU General Public License v3.0
Project Creator : 0dteam
License : GNU General Public License v3.0
Project Creator : 0dteam
private void reportPhishingEmailToSecurityTeam(IRibbonControl control)
{
Selection selection = Globals.ThisAddIn.Application.ActiveExplorer().Selection;
string reportedItemType = "NaN"; // email, contact, appointment ...etc
string reportedItemHeaders = "NaN";
if(selection.Count < 1) // no item is selected
{
MessageBox.Show("Select an email before reporting.", "Error");
}
else if(selection.Count > 1) // many items selected
{
MessageBox.Show("You can report 1 email at a time.", "Error");
}
else // only 1 item is selected
{
if (selection[1] is Outlook.MeetingItem || selection[1] is Outlook.Contacreplacedem || selection[1] is Outlook.Appointmenreplacedem || selection[1] is Outlook.TaskItem || selection[1] is Outlook.MailItem)
{
// Identify the reported item type
if (selection[1] is Outlook.MeetingItem)
{
reportedItemType = "MeetingItem";
}
else if (selection[1] is Outlook.Contacreplacedem)
{
reportedItemType = "Contacreplacedem";
}
else if (selection[1] is Outlook.Appointmenreplacedem)
{
reportedItemType = "Appointmenreplacedem";
}
else if (selection[1] is Outlook.TaskItem)
{
reportedItemType = "TaskItem";
}
else if (selection[1] is Outlook.MailItem)
{
reportedItemType = "MailItem";
}
// Prepare Reported Email
Object mailItemObj = (selection[1] as object) as Object;
MailItem mailItem = (reportedItemType == "MailItem") ? selection[1] as MailItem : null; // If the selected item is an email
MailItem reportEmail = (MailItem)Globals.ThisAddIn.Application.CreateItem(OlItemType.olMailItem);
reportEmail.Attachments.Add(selection[1] as Object);
try
{
reportEmail.To = Properties.Settings.Default.infosec_email;
reportEmail.Subject = (reportedItemType == "MailItem") ? "[POTENTIAL PHISH] " + mailItem.Subject : "[POTENTIAL PHISH] " + reportedItemType; // If reporting email, include subject; otherwise, state the type of the reported item
// Get Email Headers
if (reportedItemType == "MailItem")
{
reportedItemHeaders = mailItem.HeaderString();
}
else
{
reportedItemHeaders = "Headers were not extracted because the reported item is not an email. It is " + reportedItemType;
}
// Check if the email is a simulated phishing campaign by Information Security Team
string simulatedPhishingURL = GoPhishIntegration.setReportURL(reportedItemHeaders);
if (simulatedPhishingURL != "NaN")
{
string simulatedPhishingResponse = GoPhishIntegration.sendReportNotificationToServer(simulatedPhishingURL);
// DEBUG: to check if reporting email reaches GoPhish Portal
// MessageBox.Show(simulatedPhishingURL + " --- " + simulatedPhishingResponse);
// Update GoPhish Campaigns Reported counter
Properties.Settings.Default.gophish_reports_counter++;
// Thanks
MessageBox.Show("Good job! You have reported a simulated phishing campaign sent by the Information Security Team.", "We have a winner!");
}
else
{
// Update Suspecious Emails Reported counter
Properties.Settings.Default.suspecious_reports_counter++;
// Prepare the email body
reportEmail.Body = GetCurrentUserInfos();
reportEmail.Body += "\n";
reportEmail.Body += GetBasicInfo(mailItem);
reportEmail.Body += "\n";
reportEmail.Body += GetURLsAndAttachmentsInfo(mailItem);
reportEmail.Body += "\n";
reportEmail.Body += "---------- Headers ----------";
reportEmail.Body += "\n" + reportedItemHeaders;
reportEmail.Body += "\n";
reportEmail.Body += GetPluginDetails() + "\n\n";
reportEmail.Save();
//reportEmail.Display(); // Helps in debugginng
reportEmail.Send(); // Automatically send the email
// Enable if you want a second popup for confirmation
// MessageBox.Show("Thank you for reporting. We will review this report soon. - Information Security Team", "Thank you");
}
// Delete the reported email
mailItem.Delete();
}
catch (System.Exception ex)
{
MessageBox.Show("There was an error! An automatic email was sent to the support to resolve the issue.", "Do not worry");
MailItem errorEmail = (MailItem)Globals.ThisAddIn.Application.CreateItem(OlItemType.olMailItem);
errorEmail.To = Properties.Settings.Default.support_email;
errorEmail.Subject = "[Outlook Addin Error]";
errorEmail.Body = ("Addin error message: " + ex);
errorEmail.Save();
//errorEmail.Display(); // Helps in debugginng
errorEmail.Send(); // Automatically send the email
}
}
else
{
MessageBox.Show("You cannot report this item", "Error");
}
}
}
19
View Source File : Form1.cs
License : MIT License
Project Creator : 1y0n
License : MIT License
Project Creator : 1y0n
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
MessageBox.Show("1. 直接执行:直接申请内存并解密shellcode执行,程序关闭后shell也消失。\r\n\r\n" +
"2. 新进程注入:生成一个后台隐藏正常进程,并将shellcode解密注入到此进程中执行,shell一直存在。但是可能会被杀注入行为。\r\n\r\n" +
"3. 注入现有进程:注入目标机器上已经存在的一个进程,需要提供进程 id ,shell一直存在。可能会被杀行为。\r\n\r\n" +
"---------\r\n\r\n总的来说,推荐“直接执行(VirtualProtect)”并选择“隐藏执行界面”。如果想要注入,优先选 SYSCALL(只支持64位系统)。", "说明");
}
19
View Source File : OneCmdShell.cs
License : MIT License
Project Creator : 1y0n
License : MIT License
Project Creator : 1y0n
private void button2_Click(object sender, EventArgs e)
{
string finall_cmd = Global_Var.one_command.Replace("{put_ip_and_port_here}", textBox1.Text + ":" + textBox2.Text);
Clipboard.SetDataObject(finall_cmd);
MessageBox.Show("复制成功!粘贴执行即可运行你的shellcode。", "success");
}
19
View Source File : Form1.cs
License : MIT License
Project Creator : 1y0n
License : MIT License
Project Creator : 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
View Source File : Form1.cs
License : MIT License
Project Creator : 1y0n
License : MIT License
Project Creator : 1y0n
private void button3_Click(object sender, EventArgs e)
{
MessageBox.Show("务必不要将生成的程序上传到在线杀毒网站。\r\n本程序仅供授权测试人员使用,严禁用于未授权用途。\r\n\r\n程序参考了开源项目 Avator 的结构,并使用了开源项目 GadgetToJScript 的大量代码,在此表示感谢。\r\n" +
"\r\n1y0n.com", "关于");
}
19
View Source File : Form1.cs
License : MIT License
Project Creator : 1y0n
License : MIT License
Project Creator : 1y0n
private void button1_Click(object sender, EventArgs e)
{
if ((textBox2.Enabled) && (textBox2.Text.Trim() == ""))
{
MessageBox.Show("注入进程时应按照要求填写进程名或 pid", "警告");
return;
}
string file_type = comboBox1.Text;
string target_arch = null;
Compiler compiler = new Compiler();
target_arch = " /platform:x86 /optimize ";
switch (file_type)
{
case ".exe":
saveFileDialog1.Filter = "可执行文件|*.exe";
break;
case ".js":
saveFileDialog1.Filter = "js脚本|*.js";
break;
case ".xsl":
saveFileDialog1.Filter = "xsl文件|*.xsl";
break;
}
DialogResult dr = saveFileDialog1.ShowDialog();
if (dr == DialogResult.OK && saveFileDialog1.FileName.Length > 0)
{
switch (file_type)
{
case ".exe":
if (radioButton2.Checked)
{
target_arch = " /platform:x64 /optimize";
}
if (checkBox2.Checked)
{
target_arch += "/target:winexe ";
}
if (ico_filename != null)
{
target_arch += " /win32icon:" + ico_filename;
}
KEY = Random_Key();
List<string> temp_list = new List<string>();
foreach (byte i in KEY)
{
temp_list.Add("0x" + i.ToString("X2"));
}
KEY_String = string.Join(",", temp_list); //生成key的字符串形式,用于写入到文件
switch (comboBox4.Text)
{
case "直接执行(VirtualAlloc)":
TP_VirtualAlloc va = new TP_VirtualAlloc(KEY_String, Handle_Payload());
compiler.compileToExe(va.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
break;
case "直接执行(VirtualProtect)":
TP_VirtualProtect vp = new TP_VirtualProtect(KEY_String, Handle_Payload());
compiler.compileToExe(vp.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
break;
case "[x64]新进程注入(SYSCALL)":
TP_Syscall_New scn = new TP_Syscall_New(KEY_String, Handle_Payload(), textBox2.Text.Trim());
target_arch += " /unsafe"; //必需,因为包含了不安全代码
compiler.compileToExe(scn.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
break;
case "新进程注入(VirtualAllocEx)":
TP_VirtualAllocEx vaex = new TP_VirtualAllocEx(KEY_String, Handle_Payload(), textBox2.Text);
compiler.compileToExe(vaex.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
break;
case "注入现有进程(VirtualAllocEx)":
TP_VirtualAllocEx_Exist vaee = new TP_VirtualAllocEx_Exist(KEY_String, Handle_Payload(), Convert.ToInt32(textBox2.Text.Trim()));
compiler.compileToExe(vaee.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
break;
case "[x64]注入现有进程(SYSCALL)":
TP_Syscall_Exist sce = new TP_Syscall_Exist(KEY_String, Handle_Payload(), Convert.ToInt32(textBox2.Text.Trim()));
target_arch += " /unsafe"; //必需,因为包含了不安全代码
compiler.compileToExe(sce.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
break;
case "进程镂空(Process Hollowing)":
TP_Process_Hollowing ph = new TP_Process_Hollowing(KEY_String, Handle_Payload(), textBox2.Text);
target_arch += " /unsafe"; //必需,因为包含了不安全代码
compiler.compileToExe(ph.GetCode(), KEY_String, saveFileDialog1.FileName, target_arch);
break;
}
break;
default:
string temp = Generate_JS_XSL(file_type);
System.IO.File.WriteAllText(saveFileDialog1.FileName, temp);
break;
}
MessageBox.Show("All seems fine. Lets Hack the Plant!\r\n\r\nWARNING: 不要将生成的程序上传到在线杀毒网站!", "ALL SUCCESS!");
}
}
19
View Source File : Form1.cs
License : MIT License
Project Creator : 1y0n
License : MIT License
Project Creator : 1y0n
private void radioButton6_CheckedChanged(object sender, EventArgs e)
{
if (!radioButton6.Checked)
{
return;
}
MessageBox.Show("图标路径不要包含中文,否则无法生成", "提示");
openFileDialog1.Filter = "图标文件|*.ico";
if ((openFileDialog1.ShowDialog() == DialogResult.OK) && (openFileDialog1.FileName != ""))
{
pictureBox3.ImageLocation = Global.ICONPATH = openFileDialog1.FileName;
}
else
{
radioButton3.Checked = true;
}
}
19
View Source File : FrmSettings.cs
License : GNU General Public License v3.0
Project Creator : 9vult
License : GNU General Public License v3.0
Project Creator : 9vult
private void BtnSave_Click(object sender, EventArgs e)
{
// Save Update Checking preference
Properties.Settings.Default["checkForUpdates"] = chkUpdates.Checked;
// Save Double-Page Reader preference
Properties.Settings.Default["doublePageReader"] = chkDblReader.Checked;
// Save language preference
Properties.Settings.Default["languageCode"] = cmboLang.SelectedItem.ToString().Substring(0, 2);
// Check if the home directory was changed
if (!(new DirectoryInfo(txtDirectory.Text).ToString().Equals(new DirectoryInfo((string)Properties.Settings.Default["homeDirectory"]).ToString())))
{
DialogResult result = MessageBox.Show("Changing the save directory will require a restart. Continue?", "MikuReader", MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
Properties.Settings.Default["homeDirectory"] = txtDirectory.Text;
Properties.Settings.Default.Save();
Application.Restart();
} else
{
txtDirectory.Text = (string)Properties.Settings.Default["homeDirectory"];
}
}
Properties.Settings.Default.Save();
MessageBox.Show("Requested changes were saved", "MikuReader");
startPage.RefreshContents();
}
19
View Source File : ZUART.cs
License : MIT License
Project Creator : a2633063
License : MIT License
Project Creator : a2633063
private void btnSend_Click(object sender, EventArgs e)
{
if (chkAutoSend.Checked)
{
if (txtSendData.Text.Length < 1)
{
MessageBox.Show("发送数据为空!", "错误");
return;
}
if (txtAutoSendms.Text.Length < 1) txtAutoSendms.Text = "500";
timerAutoSend.Interval = Convert.ToInt32(txtAutoSendms.Text);
if (timerAutoSend.Enabled)
{
timerAutoSend.Enabled = false;
groupBoxComSetting.Enabled = true;
groupboxSendSetting.Enabled = true;
btnSend.Text = "发送";
}
else
{
timerAutoSend.Enabled = true;
groupBoxComSetting.Enabled = false;
groupboxSendSetting.Enabled = false;
btnSend.Text = "停止发送";
}
}
else
{
if (SendStr(txtSendData.Text))
{
if (chkAutoCleanSend.Checked)
{
txtSendData.Text = "";
}
}
}
}
19
View Source File : ZUART.cs
License : MIT License
Project Creator : a2633063
License : MIT License
Project Creator : a2633063
private bool SendStr(String str, bool hexbool)
{
byte[] sendData = null;
if (hexbool)
{
try
{
sendData = strToHexByte(str.Trim());
}
catch (Exception)
{
//throw;
MessageBox.Show("字符串转十六进制有误,请检测输入格式.", "错误!");
return false;
}
}
else if (rbtnSendASCII.Checked)
{
//sendData = Encoding.ASCII.GetBytes(str);
sendData = Encoding.GetEncoding("GBK").GetBytes(str);
}
else if (rbtnSendUTF8.Checked)
{
sendData = Encoding.UTF8.GetBytes(str);
}
else if (rbtnSendUnicode.Checked)
{
sendData = Encoding.Unicode.GetBytes(str);
}
else
{
sendData = Encoding.GetEncoding("GBK").GetBytes(str);
}
if (this.SendData(sendData))//发送数据成功计数
{
lblSendCount.Invoke(new MethodInvoker(delegate
{
lblSendCount.Text = "发送:" + (int.Parse(lblSendCount.Text.Substring(3)) + sendData.Length).ToString();
}));
return true;
}
return false;
}
19
View Source File : Program.cs
License : MIT License
Project Creator : a1xd
License : MIT License
Project Creator : a1xd
static void GlobalUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
{
var ex = (Exception)e.ExceptionObject;
System.IO.File.WriteAllText("error.log", ex.ToString());
MessageBox.Show(ex.Message, "Error");
}
19
View Source File : Program.cs
License : MIT License
Project Creator : a1xd
License : MIT License
Project Creator : a1xd
static void Exit(string msg)
{
MessageBox.Show(msg, "Raw Accel writer");
Environment.Exit(1);
}
19
View Source File : SettingForm.cs
License : MIT License
Project Creator : aabiryukov
License : MIT License
Project Creator : aabiryukov
private VisualizationSettings GetSettigs()
{
if (string.IsNullOrWhiteSpace(userIncludeTextBox.Text))
{
MessageBox.Show("User name filter 'include' can not be empty.", DialogCaption);
ActiveControl = userIncludeTextBox;
return null;
}
if (string.IsNullOrWhiteSpace(filesIncludeTextBox.Text))
{
MessageBox.Show("File type filter 'include' can not be empty.", DialogCaption);
ActiveControl = filesIncludeTextBox;
return null;
}
var settigs = new VisualizationSettings
{
PlayMode = historyRadioButton.Checked
? VisualizationSettings.PlayModeOption.History
: VisualizationSettings.PlayModeOption.Live,
DateFrom = dateFromPicker.Value,
DateTo = dateToPicker.Value,
LoopPlayback = loopPlaybackCheckBox.Checked,
UsersFilter = new StringFilter(userIncludeTextBox.Text, userExcludeTextBox.Text),
FilesFilter = new StringFilter(filesIncludeTextBox.Text, filesExcludeTextBox.Text),
ViewFileNames = viewFileNamesCheckBox.Checked,
ViewDirNames = viewDirNamesCheckBox.Checked,
ViewUserNames = viewUserNamesCheckBox.Checked,
ViewAvatars = viewAvatarsCheckBox.Checked,
ViewFilesExtentionMap = viewFilesExtentionMapCheckBox.Checked,
};
// History settings
if (historyRadioButton.Checked)
{
if (timeScaleComboBox.SelectedIndex >= 0)
{
var timeScaleMapping = new[]
{
VisualizationSettings.TimeScaleOption.None,
VisualizationSettings.TimeScaleOption.Slow8,
VisualizationSettings.TimeScaleOption.Slow4,
VisualizationSettings.TimeScaleOption.Slow2,
VisualizationSettings.TimeScaleOption.Fast2,
VisualizationSettings.TimeScaleOption.Fast3,
VisualizationSettings.TimeScaleOption.Fast4
};
settigs.TimeScale = timeScaleMapping[timeScaleComboBox.SelectedIndex];
}
if (!TryParseInt(secondsPerDayTextBox.Text, out settigs.SecondsPerDay) || settigs.SecondsPerDay < 1 || settigs.SecondsPerDay > 1000)
{
MessageBox.Show("Incorrect value in 'Seconds Per Day' (1-1000).", DialogCaption);
ActiveControl = secondsPerDayTextBox;
return null;
}
}
if (!TryParseInt(maxFilesTextBox.Text, out settigs.MaxFiles) || settigs.MaxFiles < 1 || settigs.MaxFiles > 1000000)
{
MessageBox.Show("Incorrect value in 'Max Files' (Range: 1-1000000).", DialogCaption);
ActiveControl = maxFilesTextBox;
return null;
}
settigs.FullScreen = fullScreenCheckBox.Checked;
settigs.SetResolution = setResolutionCheckBox.Checked;
if (setResolutionCheckBox.Checked)
{
if (!TryParseInt(resolutionWidthTextBox.Text, out settigs.ResolutionWidth) || settigs.ResolutionWidth < 100)
{
MessageBox.Show("Incorrect value in 'Resolution width' (min: 100).", DialogCaption);
ActiveControl = resolutionWidthTextBox;
return null;
}
if (!TryParseInt(resolutionHeightTextBox.Text, out settigs.ResolutionHeight) || settigs.ResolutionHeight < 100)
{
MessageBox.Show("Incorrect value in 'Resolution height' (min: 100).", DialogCaption);
ActiveControl = resolutionHeightTextBox;
return null;
}
}
if (ViewLogoCheckBox.CheckState == CheckState.Checked && !File.Exists(LogoFileTextBox.Text))
{
MessageBox.Show("Logo file path does not exist.", DialogCaption);
ActiveControl = LogoFileTextBox;
return null;
}
settigs.ViewLogo = ViewLogoCheckBox.CheckState;
settigs.LogoFileName = settigs.ViewLogo == CheckState.Checked ? LogoFileTextBox.Text : null;
return settigs;
}
19
View Source File : MessageHelper.cs
License : MIT License
Project Creator : aabiryukov
License : MIT License
Project Creator : aabiryukov
public static void ShowMessage(string message)
{
System.Windows.Forms.MessageBox.Show(message, Messagereplacedle);
}
19
View Source File : HistoryViewer.cs
License : MIT License
Project Creator : aabiryukov
License : MIT License
Project Creator : aabiryukov
[System.Diagnostics.Codereplacedysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
private void ExecViewHistory(Uri tfsCollectionUri, string sourceControlFolder)
{
// gource start arguments
string arguments;
string replacedle;
string avatarsDirectory = null;
if (m_settigs.PlayMode == VisualizationSettings.PlayModeOption.History)
{
replacedle = "History of " + sourceControlFolder;
var logFile = Path.Combine(FileUtils.GetTempPath(), "TfsHistoryLog.tmp.txt");
if (m_settigs.ViewAvatars)
{
avatarsDirectory = Path.Combine(FileUtils.GetTempPath(), "TfsHistoryLog.tmp.Avatars");
if (!Directory.Exists(avatarsDirectory))
{
Directory.CreateDirectory(avatarsDirectory);
}
}
bool historyFound;
bool hasLines;
using (var waitMessage = new WaitMessage("Connecting to Team Foundation Server...", OnCancelByUser))
{
var progress = waitMessage.CreateProgress("Loading history ({0}% done) ...");
hasLines =
TfsLogWriter.CreateGourceLogFile(
logFile,
avatarsDirectory,
tfsCollectionUri,
sourceControlFolder,
m_settigs,
ref m_canceled,
progress.SetValue
);
historyFound = progress.LastValue > 0;
progress.Done();
}
if (m_canceled)
return;
if (!hasLines)
{
MessageBox.Show(
historyFound
? "No items found.\nCheck your filters: 'User name' and 'File type'."
: "No items found.\nTry to change period of the history (From/To dates).",
"TFS History Visualization");
return;
}
arguments = string.Format(CultureInfo.InvariantCulture, " \"{0}\" ", logFile);
// Setting other history settings
arguments += " --seconds-per-day " + m_settigs.SecondsPerDay.ToString(CultureInfo.InvariantCulture);
if (m_settigs.TimeScale != VisualizationSettings.TimeScaleOption.None)
{
var optionValue = ConvertToString(m_settigs.TimeScale);
if (optionValue != null)
arguments += " --time-scale " + optionValue;
}
if (m_settigs.LoopPlayback)
{
arguments += " --loop";
}
arguments += " --file-idle-time 60"; // 60 is default in gource 0.40 and older. Since 0.41 default 0.
}
else
{
// PlayMode: Live
replacedle = "Live changes of " + sourceControlFolder;
arguments = " --realtime --log-format custom -";
arguments += " --file-idle-time 28800"; // 8 hours (work day)
}
var baseDirectory = Path.GetDirectoryName(System.Reflection.replacedembly.GetExecutingreplacedembly().Location) ??
"unknown";
if (baseDirectory.Contains("Test"))
{
baseDirectory += @"\..\..\..\VSExtension";
}
#if DEBUG
// baseDirectory = @"C:\Temp\aaaa\уи³пс\";
#endif
var gourcePath = Path.Combine(baseDirectory, @"Gource\Gource.exe");
var dataPath = Path.Combine(baseDirectory, @"Data");
// ******************************************************
// Configuring Gource command line
// ******************************************************
arguments +=
string.Format(CultureInfo.InvariantCulture, " --highlight-users --replacedle \"{0}\"", replacedle);
if (m_settigs.ViewLogo != CheckState.Unchecked)
{
var logoFile = m_settigs.ViewLogo == CheckState.Indeterminate
? Path.Combine(dataPath, "Logo.png")
: m_settigs.LogoFileName;
// fix gource unicode path problems
logoFile = FileUtils.GetShortPath(logoFile);
arguments += string.Format(CultureInfo.InvariantCulture, " --logo \"{0}\"", logoFile);
}
if (m_settigs.FullScreen)
{
arguments += " --fullscreen";
// By default gource not using full area of screen width ( It's a bug. Must be fixed in gource 0.41).
// Fixing fullscreen resolution to real full screen.
if (!m_settigs.SetResolution)
{
var screenBounds = Screen.PrimaryScreen.Bounds;
arguments += string.Format(CultureInfo.InvariantCulture, " --viewport {0}x{1}", screenBounds.Width,
screenBounds.Height);
}
}
if (m_settigs.SetResolution)
{
arguments += string.Format(CultureInfo.InvariantCulture, " --viewport {0}x{1}",
m_settigs.ResolutionWidth, m_settigs.ResolutionHeight);
}
if (m_settigs.ViewFilesExtentionMap)
{
arguments += " --key";
}
if (!string.IsNullOrEmpty(avatarsDirectory))
{
arguments += string.Format(CultureInfo.InvariantCulture, " --user-image-dir \"{0}\"", avatarsDirectory);
}
// Process "--hide" option
{
var hideItems = string.Empty;
if (!m_settigs.ViewDirNames)
{
hideItems = "dirnames";
}
if (!m_settigs.ViewFileNames)
{
if (hideItems.Length > 0) hideItems += ",";
hideItems += "filenames";
}
if (!m_settigs.ViewUserNames)
{
if (hideItems.Length > 0) hideItems += ",";
hideItems += "usernames";
}
if (hideItems.Length > 0)
arguments += " --hide " + hideItems;
}
arguments += " --max-files " + m_settigs.MaxFiles.ToString(CultureInfo.InvariantCulture);
if (SystemInformation.TerminalServerSession)
{
arguments += " --disable-bloom";
}
if (m_settigs.PlayMode == VisualizationSettings.PlayModeOption.History)
{
var si = new ProcessStartInfo(gourcePath, arguments)
{
WindowStyle = ProcessWindowStyle.Maximized,
// UseShellExecute = true
};
Process.Start(si);
}
else
{
var logReader = new VersionControlLogReader(tfsCollectionUri, sourceControlFolder, m_settigs.UsersFilter,
m_settigs.FilesFilter);
using (new WaitMessage("Connecting to Team Foundation Server..."))
{
logReader.Connect();
}
System.Threading.Tasks.Task.Factory.StartNew(() => RunLiveChangesMonitor(logReader, gourcePath, arguments));
}
}
19
View Source File : Program.cs
License : MIT License
Project Creator : ab4d
License : MIT License
Project Creator : ab4d
public static void WriteErrorDetails(OvrWrap OVR, Result result, string message)
{
if(result >= Result.Success)
return;
// Retrieve the error message from the last occurring error.
ErrorInfo errorInformation = OVR.GetLastErrorInfo();
string formattedMessage = string.Format("{0}. \nMessage: {1} (Error code={2})", message, errorInformation.ErrorString, errorInformation.Result);
Trace.WriteLine(formattedMessage);
MessageBox.Show(formattedMessage, message);
throw new Exception(formattedMessage);
}
19
View Source File : frmCustomers.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void dgvCustomers_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == dgvCustomers.Columns["Show"].Index && e.RowIndex != -1)
{
NavigationTool.OpenNewTab(new frmCustomerDetail(customers[e.RowIndex]));
}
else if (e.ColumnIndex == dgvCustomers.Columns["Edit"].Index && e.RowIndex != -1)
{
NavigationTool.OpenNewTab(new frmEditCustomer(customers[e.RowIndex]));
LoadCustomers(customerService.GetAll(Session.currentUser));
}
else if (e.ColumnIndex == dgvCustomers.Columns["Delete"].Index && e.RowIndex != -1)
{
Customer customer = customers[e.RowIndex];
DialogResult dialogResult = MessageBox.Show(customer.CustomerName + " " + customer.CustomerSurname +
" adlı müşteriyi silmek istediğinizden emin misiniz?", "Müşteri Sil", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
try
{
customerService.Delete(customer, Session.currentUser);
customers.Remove(customer);
LoadCustomers(customers);
MessageBox.Show("Müşteri başarıyla silindi!", "Başarılı!");
} catch (Exception ex)
{
MessageBox.Show("Bağımlılıkları kontrol edin\n" + ex.Message, "Hata!");
}
}
}
}
19
View Source File : frmAddExercise.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void btnSave_Click(object sender, EventArgs e)
{
if(exercise != null) // UPDATE
{
exercise.Schedule = null;
exercise.Part = null;
try
{
GetDataFromViews();
ValidationTool.Validate(new ExerciseValidator(), exercise);
exerciseService.Update(exercise, Session.currentUser);
MessageBox.Show("Egzersiz başarıyla güncellendi.", "Başarılı!");
this.Close();
} catch (Exception ex)
{
MessageBox.Show(ex.Message, "Hata!");
System.Diagnostics.Debug.WriteLine(ex.StackTrace);
}
}
else // CREATE
{
exercise = new Exercise { ScheduleID = schedule.ScheduleID };
try
{
GetDataFromViews();
ValidationTool.Validate(new ExerciseValidator(), exercise);
exerciseService.Add(exercise, Session.currentUser);
MessageBox.Show("Egzersiz başarıyla oluşturuldu.", "Başarılı!");
this.Close();
} catch (Exception ex)
{
MessageBox.Show(ex.Message, "Hata!");
System.Diagnostics.Debug.WriteLine(ex.StackTrace);
}
}
}
19
View Source File : frmAddSchedule.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void btnSave_Click(object sender, EventArgs e)
{
schedule.ScheduleName = tbxName.Text.Trim();
schedule.ScheduleDesc = rTbxDesc.Text.Trim();
try
{
ValidationTool.Validate(new ScheduleValidator(), schedule);
scheduleService.Add(schedule, Session.currentUser);
MessageBox.Show("Çalışma Programı başarıyla oluşturuldu.", "Başarılı!");
this.Close();
} catch (Exception ex)
{
MessageBox.Show(ex.Message, "Hata!");
}
}
19
View Source File : frmSchedules.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void dgvSchedules_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == dgvSchedules.Columns["Show"].Index && e.RowIndex != -1)
{
NavigationTool.OpenNewTab(new frmScheduleDetail(schedules[e.RowIndex]));
}
else if (e.ColumnIndex == dgvSchedules.Columns["Edit"].Index && e.RowIndex != -1)
{
NavigationTool.OpenNewTab(new frmEditSchedule(schedules[e.RowIndex]));
LoadSchedules(scheduleService.GetAll(Session.currentUser));
}
else if (e.ColumnIndex == dgvSchedules.Columns["Delete"].Index && e.RowIndex != -1)
{
Schedule schedule = schedules[e.RowIndex];
DialogResult dialogResult = MessageBox.Show(schedule.ScheduleName +
" adlı programı silmek istediğinizden emin misiniz?", "Programı Sil", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
try
{
scheduleService.Delete(schedule, Session.currentUser);
MessageBox.Show("Program başarıyla silindi!", "Başarılı!");
} catch (Exception ex)
{
MessageBox.Show(ex.Message, "Hata!");
}
schedules.Remove(schedule);
LoadSchedules(schedules);
}
}
}
19
View Source File : frmAddStats.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void updateStatistic()
{
try
{
ValidationTool.Validate(new StatisticValidator(), statistic);
statisticService.Update(statistic, Session.currentUser);
System.Windows.Forms.MessageBox.Show("İstatistik başarıyla güncellendi!", "Başarılı!");
this.Close();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("İstatistik güncellenirken bir hata oluştu. '" + ex.Message + "'", "Hata!");
}
}
19
View Source File : frmAddStats.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void createStatistic()
{
try
{
statistic.Customer = null;
ValidationTool.Validate(new StatisticValidator(), statistic);
statisticService.Add(statistic, Session.currentUser);
System.Windows.Forms.MessageBox.Show("İstatistik başarıyla eklendi!", "Başarılı!");
this.Close();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("İstatistik eklenirken bir hata oluştu. '" + ex.Message + "'", "Hata!");
}
}
19
View Source File : frmEditCustomer.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void btnDelete_Click(object sender, EventArgs e)
{
if (lvlStats.SelectedItems.Count < 1)
return;
Statistic st = stats[lvlStats.SelectedItems[0].Index];
DialogResult dialogResult = MessageBox.Show(st.StatisticDate.ToShortDateString() +
" Tarihli istatistiği silmek istediğinizden emin misiniz?", "İstatistik Sil", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
try
{
statisticService.Delete(st, Session.currentUser);
lvlStats.Items.RemoveAt(lvlStats.SelectedItems[0].Index);
MessageBox.Show("İstatistik başarıyla silindi!", "Başarılı!");
} catch (Exception ex)
{
MessageBox.Show(ex.Message, "Hata!");
}
}
}
19
View Source File : frmEditCustomer.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void btnSave_Click(object sender, EventArgs e)
{
GetDataFromViews();
try
{
ValidationTool.Validate(new CustomerValidator(), customer);
customerService.Update(customer, Session.currentUser);
MessageBox.Show("Müşteri bilgileri başarıyla güncellendi!", "Başarılı!");
}
catch (Exception ex)
{
MessageBox.Show("Müşteri bilgileri güncellenemedi: " + ex.Message, "Hata!");
}
}
19
View Source File : frmSettings.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void LoadAuthorities()
{
try
{
authorities = userService.GetAll(Session.currentUser);
} catch (Exception ex)
{
MessageBox.Show(ex.Message, "Hata!");
}
lvlAuthorities.Items.Clear();
foreach (User user in authorities)
{
ListViewItem item = new ListViewItem(Convert.ToString(user.UserID));
item.SubItems.Add(user.UserName);
item.SubItems.Add(user.UserMail);
item.SubItems.Add(user.AccessFlags);
lvlAuthorities.Items.Add(item);
if(user.UserID == Session.currentUser.UserID)
{
Session.currentUser = user;
}
}
lvlAuthorities.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
SetData();
}
19
View Source File : frmSettings.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void btnDel_Click(object sender, System.EventArgs e)
{
if (lvlAuthorities.SelectedItems.Count < 1)
return;
User user = authorities[lvlAuthorities.SelectedItems[0].Index];
DialogResult dialogResult = MessageBox.Show(user.UserName +
" adlı yetkiliyi silmek istediğinizden emin misiniz?", "Yetkili Sil", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
try
{
userService.Delete(user, Session.currentUser);
MessageBox.Show("Yetkili başarıyla silindi!", "Başarılı!");
lvlAuthorities.Items.RemoveAt(lvlAuthorities.SelectedItems[0].Index);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Hata!");
}
}
}
19
View Source File : frmSettings.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void btnSave_Click(object sender, EventArgs e)
{
if(tbxPreplacedword.Text.Trim() == Session.currentUser.UserPreplacedword)
{
User user = new User
{
UserID = Session.currentUser.UserID,
UserName = tbxUsername.Text.Trim(),
UserMail = tbxMail.Text.Trim(),
AccessFlags = Session.currentUser.AccessFlags
};
user.UserPreplacedword = tbxPreplacedword2.Text.Trim() != "" ?
tbxPreplacedword2.Text.Trim() : Session.currentUser.UserPreplacedword;
try
{
userService.Update(user, Session.currentUser);
MessageBox.Show("Bilgileriniz başarıyla güncellendi.", "Başarılı!");
tbxPreplacedword.Text = "";
tbxPreplacedword2.Text = "";
LoadAuthorities();
} catch (Exception ex)
{
MessageBox.Show(ex.Message, "Hata!");
}
}
else
{
MessageBox.Show("Aktif parola hatalı.", "Hata!");
}
}
19
View Source File : frmEditSchedule.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void btnDel_Click(object sender, EventArgs e)
{
if (lvlExercises.SelectedItems.Count < 1)
return;
Exercise ex = exercises[lvlExercises.SelectedItems[0].Index];
DialogResult dialogResult = MessageBox.Show("#" + ex.ExerciseID + " " + ex.ExerciseName +
" adlı egzersizi silmek istediğinizden emin misiniz?", "Egzersiz Sil", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
try
{
exerciseService.Delete(ex, Session.currentUser);
MessageBox.Show("Egzersiz başarıyla silindi!", "Başarılı!");
lvlExercises.Items.RemoveAt(lvlExercises.SelectedItems[0].Index);
}
catch (Exception exception)
{
MessageBox.Show(exception.Message, "Hata!");
}
}
}
19
View Source File : frmAddUser.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void updateUser()
{
try
{
ValidationTool.Validate(new UserValidator(), user);
userService.Update(user, Session.currentUser);
MessageBox.Show("Yetkili başarıyla güncellendi!", "Başarılı!");
this.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Hata!");
}
}
19
View Source File : frmAddUser.cs
License : MIT License
Project Creator : ahm3tcelik
License : MIT License
Project Creator : ahm3tcelik
private void createUser()
{
try
{
ValidationTool.Validate(new UserValidator(), user);
userService.Add(user, Session.currentUser);
MessageBox.Show("Yetkili başarıyla eklendi!", "Başarılı!");
this.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
19
View Source File : Form1.cs
License : MIT License
Project Creator : akalankauk
License : MIT License
Project Creator : akalankauk
private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
{
MessageBox.Show("Open Source Project : https://github.com/akalankauk | File Type: .ae",
"About");
}
19
View Source File : Form1.cs
License : MIT License
Project Creator : akalankauk
License : MIT License
Project Creator : akalankauk
private void label1_Click(object sender, EventArgs e)
{
MessageBox.Show("When you encrypt your file,original fill will be removed automatically.If you didn't want to remove original file erase 'File.Delete(inputFile);' from Form1.cs (Line Num 64)",
"Info");
}
19
View Source File : Form1.cs
License : MIT License
Project Creator : akalankauk
License : MIT License
Project Creator : akalankauk
private void pictureBox1_Click(object sender, EventArgs e)
{
MessageBox.Show("When you encrypt your file,original fill will be removed automatically.If you didn't want to remove original file erase 'File.Delete(inputFile);' from Form1.cs (Line Num 64)",
"Info");
}
19
View Source File : MainProgram.cs
License : MIT License
Project Creator : AlbertMN
License : MIT License
Project Creator : AlbertMN
public static void SetStartup(bool status, bool setThroughSoftware = false) {
if (status) {
//Start
bool failedStart = false, failedEnd = false;
try {
//Try start with Task Scheduler;
var userId = WindowsIdenreplacedy.GetCurrent().Name;
try {
//Try to delete first; make sure it's gone before attempting to re-create it
using (TaskService ts = new TaskService()) {
ts.RootFolder.DeleteTask(@"replacedistantComputerControl startup");
}
} catch {
}
using (var ts = new TaskService()) {
var td = ts.NewTask();
td.RegistrationInfo.Author = "Albert MN. | replacedistantComputerControl";
td.RegistrationInfo.Description = "replacedistantComputerControl startup - Runs ACC on reboot/login";
td.Actions.Add(new ExecAction(Application.ExecutablePath, null, null));
td.Settings.StopIfGoingOnBatteries = false;
td.Settings.DisallowStartIfOnBatteries = false;
td.Triggers.Add(new LogonTrigger { UserId = userId, });
ts.RootFolder.RegisterTaskDefinition(@"replacedistantComputerControl startup", td);
DoDebug("ACC now starts with Windows (Task Scheduler)");
}
} catch (Exception e) {
failedStart = true;
DoDebug("Failed to create startup task. Defaulting to starting with Windows registry. Exception was; " + e.Message + ", trace; + " + e.StackTrace);
try {
RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
rk.SetValue(appName, Application.ExecutablePath);
DoDebug("ACC now starts with Windows (Registry)");
} catch {
failedEnd = true;
DoDebug("Also failed to make ACC start with Windows using Registry; " + e.Message + ", " + e.StackTrace);
if (!setThroughSoftware) {
MessageBox.Show("Failed to make ACC start with Windows", messageBoxreplacedle);
}
}
if (!failedEnd) {
Properties.Settings.Default.StartsUsingRegistry = true;
Properties.Settings.Default.Save();
}
}
if (!failedStart && !failedEnd) {
Properties.Settings.Default.StartsUsingRegistry = false;
Properties.Settings.Default.Save();
}
} else {
/* No longer start with Windows */
if (!Properties.Settings.Default.StartsUsingRegistry) {
//Delete task
try {
using (TaskService ts = new TaskService()) {
// Register the task in the root folder
ts.RootFolder.DeleteTask(@"replacedistantComputerControl startup");
}
DoDebug("ACC no longer starts with Windows (Task Scheduler)");
} catch (Exception e) {
DoDebug("Failed to make ACC stop starting with Windows by deleting scheduled task. Last exception; " + e.Message + ", trace; " + e.StackTrace);
if (!setThroughSoftware) {
MessageBox.Show("Failed to make ACC stop starting with Windows. Check the log and contact the developer.", messageBoxreplacedle);
}
}
} else {
//Delete registry
try {
RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
rk.DeleteValue(appName, false);
DoDebug("ACC no longer starts with Windows (Registry)");
} catch (Exception e) {
DoDebug("Failed to make ACC stop starting with Windows by deleting Registry key. Last exception; " + e.Message + ", trace; " + e.StackTrace);
if (!setThroughSoftware) {
MessageBox.Show("Failed to make ACC stop starting with Windows. Check the log and contact the developer.", messageBoxreplacedle);
}
}
}
}
}
19
View Source File : MainProgram.cs
License : MIT License
Project Creator : AlbertMN
License : MIT License
Project Creator : AlbertMN
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
[STAThread]
static void Main(string[] args) {
Console.WriteLine("Log location; " + logFilePath);
CheckSettings();
var config = new NLog.Config.LoggingConfiguration();
var logfile = new NLog.Targets.FileTarget("logfile") { FileName = logFilePath };
var logconsole = new NLog.Targets.ConsoleTarget("logconsole");
config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole);
config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile);
NLog.LogManager.Configuration = config;
void ActualMain() {
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
//Upgrade settings
if (Properties.Settings.Default.UpdateSettings) {
/* Copy old setting-files in case the Evidence type and Evidence Hash has changed (which it does sometimes) - easier than creating a whole new settings system */
try {
Configuration accConfiguration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
string currentFolder = new DirectoryInfo(accConfiguration.FilePath).Parent.Parent.FullName;
string[] directories = Directory.GetDirectories(new DirectoryInfo(currentFolder).Parent.FullName);
foreach (string dir in directories) {
if (dir != currentFolder.ToString()) {
var directoriesInDir = Directory.GetDirectories(dir);
foreach (string childDir in directoriesInDir) {
string checkPath = Path.Combine(currentFolder, Path.GetFileName(childDir));
if (!Directory.Exists(checkPath)) {
string checkFile = Path.Combine(childDir, "user.config");
if (File.Exists(checkFile)) {
bool xmlHasError = false;
try {
XmlDoreplacedent xml = new XmlDoreplacedent();
xml.Load(checkFile);
xml.Validate(null);
} catch {
xmlHasError = true;
DoDebug("XML doreplacedent validation failed (is invalid): " + checkFile);
}
if (!xmlHasError) {
Directory.CreateDirectory(checkPath);
File.Copy(checkFile, Path.Combine(checkPath, "user.config"), true);
}
}
}
}
}
}
} catch (Exception e) {
Console.WriteLine("Error getting settings from older versions of ACC; " + e.Message);
}
/* End "copy settings" */
try {
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.UpdateSettings = false;
Properties.Settings.Default.Save();
} catch {
DoDebug("Failed to upgrade from old settings file.");
}
Console.WriteLine("Upgraded settings to match last version");
}
if (Properties.Settings.Default.LastUpdated == DateTime.MinValue) {
Properties.Settings.Default.LastUpdated = DateTime.Now;
}
//Create action mod path
if (!Directory.Exists(actionModsPath)) {
Directory.CreateDirectory(actionModsPath);
}
//Translator
string tempDir = Path.Combine(currentLocation, "Translations");
if (Directory.Exists(tempDir)) {
Translator.translationFolder = Path.Combine(currentLocation, "Translations");
Translator.languagesArray = Translator.GetLanguages();
} else {
MessageBox.Show("Missing the translations folder. Reinstall the software to fix this issue.", messageBoxreplacedle);
}
string lang = Properties.Settings.Default.ActiveLanguage;
if (Array.Exists(Translator.languagesArray, element => element == lang)) {
DoDebug("ACC running with language \"" + lang + "\"");
Translator.SetLanguage(lang);
} else {
DoDebug("Invalid language chosen (" + lang + ")");
Properties.Settings.Default.ActiveLanguage = "English";
Translator.SetLanguage("English");
}
//End translator
sysIcon = new SysTrayIcon();
Properties.Settings.Default.TimesOpened += 1;
Properties.Settings.Default.Save();
SetupDataFolder();
if (File.Exists(logFilePath)) {
try {
File.WriteAllText(logFilePath, string.Empty);
} catch {
// Don't let this being DENIED crash the software
Console.WriteLine("Failed to empty the log");
}
} else {
Console.WriteLine("Trying to create log");
CreateLogFile();
}
//Check if software already runs, if so kill this instance
var otherACCs = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(currentLocationFull));
if (otherACCs.Length > 1) {
//Try kill the _other_ process instead
foreach (Process p in otherACCs) {
if (p.Id != Process.GetCurrentProcess().Id) {
try {
p.Kill();
DoDebug("Other ACC instance was running. Killed it.");
} catch {
DoDebug("Could not kill other process of ACC; access denied");
}
}
}
}
Application.EnableVisualStyles();
DoDebug("[ACC begun (v" + softwareVersion + ")]");
if (Properties.Settings.Default.CheckForUpdates) {
if (HasInternet()) {
new Thread(() => {
new SoftwareUpdater().Check();
}).Start();
} else {
DoDebug("Couldn't check for new update as PC does not have access to the internet");
}
}
//On console close: hide NotifyIcon
Application.ApplicationExit += new EventHandler(OnApplicationExit);
handler = new ConsoleEventDelegate(ConsoleEventCallback);
SetConsoleCtrlHandler(handler, true);
//Create shortcut folder if doesn't exist
if (!Directory.Exists(shortcutLocation)) {
Directory.CreateDirectory(shortcutLocation);
}
if (!File.Exists(Path.Combine(shortcutLocation, @"example.txt"))) {
//Create example-file
try {
using (StreamWriter sw = File.CreateText(Path.Combine(shortcutLocation, @"example.txt"))) {
sw.WriteLine("This is an example file.");
sw.WriteLine("If you haven't already, make your replacedistant open this file!");
}
} catch {
DoDebug("Could not create or write to example file");
}
}
//Delete all old action files
if (Directory.Exists(CheckPath())) {
DoDebug("Deleting all files in action folder");
foreach (string file in Directory.GetFiles(CheckPath(), "*." + Properties.Settings.Default.ActionFileExtension)) {
int timeout = 0;
if (File.Exists(file)) {
while (ActionChecker.FileInUse(file) && timeout < 5) {
timeout++;
Thread.Sleep(500);
}
if (timeout >= 5) {
DoDebug("Failed to delete file at " + file + " as file appears to be in use (and has been for 2.5 seconds)");
} else {
try {
File.Delete(file);
} catch (Exception e) {
DoDebug("Failed to delete file at " + file + "; " + e.Message);
}
}
}
}
DoDebug("Old action files removed - moving on...");
}
//SetupListener();
watcher = new FileSystemWatcher() {
Path = CheckPath(),
NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
| NotifyFilters.FileName | NotifyFilters.DirectoryName,
Filter = "*." + Properties.Settings.Default.ActionFileExtension,
EnableRaisingEvents = true
};
watcher.Changed += new FileSystemEventHandler(new ActionChecker().FileFound);
watcher.Created += new FileSystemEventHandler(new ActionChecker().FileFound);
watcher.Renamed += new RenamedEventHandler(new ActionChecker().FileFound);
watcher.Deleted += new FileSystemEventHandler(new ActionChecker().FileFound);
watcher.Error += delegate { DoDebug("Something wen't wrong"); };
DoDebug("\n[" + messageBoxreplacedle + "] Initiated. \nListening in: \"" + CheckPath() + "\" for \"." + Properties.Settings.Default.ActionFileExtension + "\" extensions");
sysIcon.TrayIcon.Icon = Properties.Resources.ACC_icon_light;
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", true);
if (Registry.GetValue(key.Name + @"\replacedistantComputerControl", "FirstTime", null) == null) {
SetStartup(true);
key.CreateSubKey("replacedistantComputerControl");
key = key.OpenSubKey("replacedistantComputerControl", true);
key.SetValue("FirstTime", false);
ShowGettingStarted();
DoDebug("Starting setup guide (first time opening ACC - wuhu!)");
} else {
if (!Properties.Settings.Default.HasCompletedTutorial) {
ShowGettingStarted();
DoDebug("Didn't finish setup guide last time, opening again");
}
}
SetRegKey("ActionFolder", CheckPath());
SetRegKey("ActionExtension", Properties.Settings.Default.ActionFileExtension);
testActionWindow = new TestActionWindow();
//If newly updated
if (Properties.Settings.Default.LastKnownVersion != softwareVersion) {
//Up(or down)-grade, display version notes
DoDebug("ACC has been updated");
if (Properties.Settings.Default.LastKnownVersion != "" && new System.Version(Properties.Settings.Default.LastKnownVersion) < new System.Version("1.4.3")) {
//Had issues before; fixed now
DoDebug("Upgraded to 1.4.3, fixed startup - now starting with Windows");
try {
RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
rk.DeleteValue(appName, false);
} catch {
DoDebug("Failed to remove old start with win run");
}
SetStartup(true);
} else {
if (ACCStartsWithWindows()) {
SetStartup(true);
}
}
Properties.Settings.Default.LastUpdated = DateTime.Now;
if (gettingStarted != null) {
DoDebug("'AboutVersion' window awaits, as 'Getting Started' is showing");
aboutVersionAwaiting = true;
} else {
Properties.Settings.Default.LastKnownVersion = softwareVersion;
new NewVersion().Show();
}
Properties.Settings.Default.Save();
}
//Check if software starts with Windows
if (!ACCStartsWithWindows())
sysIcon.AddOpenOnStartupMenu();
/* 'Evalufied' user feedback implementation */
if ((DateTime.Now - Properties.Settings.Default.LastUpdated).TotalDays >= 7 && Properties.Settings.Default.TimesOpened >= 7
&& gettingStarted == null
&& !Properties.Settings.Default.HasPromptedFeedback) {
//User has had the software/update for at least 7 days, and has opened the software more than 7 times - time to ask for feedback
//(also the "getting started" window is not showing)
if (HasInternet()) {
try {
WebRequest request = WebRequest.Create("https://evalufied.dk/");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
if (response == null || response.StatusCode != HttpStatusCode.OK) {
DoDebug("'Evalufied' is down - won't show faulty feedback window");
} else {
DoDebug("Showing 'User Feedback' window");
Properties.Settings.Default.HasPromptedFeedback = true;
Properties.Settings.Default.Save();
new UserFeedback().Show();
}
} catch {
DoDebug("Failed to check for 'Evalufied'-availability");
}
} else {
DoDebug("No internet connection, not showing user feedback window");
}
}
//Action mods implementation
ActionMods.CheckMods();
TaskSchedulerSetup();
hreplacedtarted = true;
SystemEvents.SessionSwitch += new SessionSwitchEventHandler(SystemEvents_SessionSwitch); //On wake up from sleep
Application.Run();
}
if (sentryToken != "super_secret") {
//Tracking issues with Sentry.IO - not forked from GitHub (official version)
bool sentryOK = false;
try {
if (Properties.Settings.Default.UID != "") {
Properties.Settings.Default.UID = Guid.NewGuid().ToString();
Properties.Settings.Default.Save();
}
if (Properties.Settings.Default.UID != "") {
SentrySdk.ConfigureScope(scope => {
scope.User = new Sentry.Protocol.User {
Id = Properties.Settings.Default.UID
};
});
}
using (SentrySdk.Init(sentryToken)) {
sentryOK = true;
}
} catch {
//Sentry failed. Error sentry's side or invalid key - don't let this stop the app from running
DoDebug("Sentry initiation failed");
ActualMain();
}
if (sentryOK) {
try {
using (SentrySdk.Init(sentryToken)) {
DoDebug("Sentry initiated");
ActualMain();
}
} catch {
ActualMain();
}
}
} else {
//Code is (most likely) forked - skip issue tracking
ActualMain();
}
}
19
View Source File : MainProgram.cs
License : MIT License
Project Creator : AlbertMN
License : MIT License
Project Creator : AlbertMN
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs args) {
Exception e = (Exception)args.ExceptionObject;
string errorLogLoc = Path.Combine(dataFolderLocation, "error_log.txt");
string subKey = @"SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion";
RegistryKey thekey = Registry.LocalMachine;
RegistryKey skey = thekey.OpenSubKey(subKey);
string windowsVersionName = skey.GetValue("ProductName").ToString();
string rawWindowsVersion = Environment.OSVersion.ToString();
int totalExecutions = 0;
foreach (int action in Properties.Settings.Default.TotalActionsExecuted) {
totalExecutions += action;
}
if (File.Exists(errorLogLoc))
try {
File.Delete(errorLogLoc);
} catch {
DoDebug("Failed to delete error log");
}
if (!File.Exists(errorLogLoc)) {
try {
using (var tw = new StreamWriter(errorLogLoc, true)) {
tw.WriteLine("OS;");
tw.WriteLine("- " + windowsVersionName);
tw.WriteLine("- " + rawWindowsVersion);
tw.WriteLine();
tw.WriteLine("ACC info;");
tw.WriteLine("- Version; " + softwareVersion + ", " + releaseDate);
tw.WriteLine("- UID; " + Properties.Settings.Default.UID);
tw.WriteLine("- Running from; " + currentLocationFull);
tw.WriteLine("- Start with Windows; " + (ACCStartsWithWindows() ? "[Yes]" : "[No]"));
tw.WriteLine("- Check for updates; " + (Properties.Settings.Default.CheckForUpdates ? "[Yes]" : "[No]"));
tw.WriteLine("- In beta program; " + (Properties.Settings.Default.BetaProgram ? "[Yes]" : "[No]"));
tw.WriteLine("- Has completed setup guide; " + (Properties.Settings.Default.HasCompletedTutorial ? "[Yes]" : "[No]"));
tw.WriteLine("- Check path; " + CheckPath());
tw.WriteLine("- Check extension; " + Properties.Settings.Default.ActionFileExtension);
tw.WriteLine("- Actions executed; " + totalExecutions);
tw.WriteLine("- replacedistant type; " + "[Google replacedistant: " + Properties.Settings.Default.replacedistantType[0] + "] [Alexa: " + Properties.Settings.Default.replacedistantType[1] + "] [Unknown: " + Properties.Settings.Default.replacedistantType[1] + "]");
tw.WriteLine();
tw.WriteLine(e);
tw.Close();
}
} catch {
//Caught exception when trying to log exception... *sigh*
}
}
File.AppendAllText(errorLogLoc, DateTime.Now.ToString() + ": " + e + Environment.NewLine);
if (debug) {
Console.WriteLine(e);
}
MessageBox.Show("A critical error occurred. The developer has been notified and will resolve this issue ASAP! Try and start ACC again, and avoid whatever just made it crash (for now) :)", "ACC | Error");
}
19
View Source File : EditSnapshotRuleForm.cs
License : MIT License
Project Creator : alexis-
License : MIT License
Project Creator : alexis-
private void btnCreate_Click(object sender, EventArgs e)
{
// This obviously should never happen.
if (!Valid)
{
MessageBox.Show("Congratulation ! You have found a bug.\nThe schedule parameters are invalid, and the create button should be disabled.\n I would be very grateful if you could report on the GitHub page of the project with a screenshot of your schedule attached !\nTry cancelling and editing a schedule again to solve this issue. Sorry for this inconvenience.", "Error");
return;
}
SnapshotRule = GenerateSchedule();
DialogResult = DialogResult.Yes;
Close();
}
19
View Source File : Main.cs
License : MIT License
Project Creator : AlturosDestinations
License : MIT License
Project Creator : AlturosDestinations
private async void SyncToolStripMenuItem_Click(object sender, EventArgs e)
{
var packages = this.annotationPackageListControl.GetAllPackages().Where(o => o.IsDirty).ToArray();
if (packages.Length == 0)
{
MessageBox.Show("There are no unchanged packages to sync.", "Nothing to sync!");
return;
}
// Proceed with syncing
using (var dialog = new SyncConfirmationDialog())
{
dialog.StartPosition = FormStartPosition.CenterParent;
dialog.SetUnsyncedPackages(packages.ToList());
var dialogResult = dialog.ShowDialog(this);
if (dialogResult != DialogResult.OK)
{
return;
}
}
using (var syncDialog = new SyncProgressDialog(this._annotationPackageProvider))
{
syncDialog.StartPosition = FormStartPosition.CenterParent;
syncDialog.Show(this);
await syncDialog.Sync(packages);
syncDialog.Close();
this.annotationPackageListControl.RefreshDataGrid();
}
}
19
View Source File : WizardRoot.cs
License : MIT License
Project Creator : alvpickmans
License : MIT License
Project Creator : alvpickmans
public void RunStarted(object automationObject,
Dictionary<string, string> replacementsDictionary,
WizardRunKind runKind, object[] customParams)
{
this.runKind = runKind;
GlobalDictionary["$saferootprojectname$"] = replacementsDictionary["$safeprojectname$"];
string destinationDirectory = replacementsDictionary["$destinationdirectory$"];
if (!Enum.TryParse(replacementsDictionary["$dynamoprojecttype$"], out DynamoProjectType projectType))
throw new Exception("Template doesn't have a valid '$dynamoprojecttype$' custom parameter!");
PackageDefinitionViewModel viewModel = new PackageDefinitionViewModel();
viewModel.PackageName = replacementsDictionary["$safeprojectname$"];
switch (projectType)
{
case DynamoProjectType.ZeroTouch:
viewModel.Addreplacedembly(replacementsDictionary["$safeprojectname$"], "1.0.0.0");
break;
case DynamoProjectType.ExplicitNode:
viewModel.Addreplacedembly(replacementsDictionary["$safeprojectname$"], "1.0.0.0");
viewModel.Addreplacedembly(replacementsDictionary["$safeprojectname$"] + ".UI", "1.0.0.0");
break;
default:
break;
}
this.Instancereplacedle = $"{WIZARD_replacedLE} - {projectType}";
view = new PackageDefinitionView(viewModel)
{
replacedle = this.Instancereplacedle,
DataContext = viewModel
};
foreach (var version in viewModel.dynamoEngineVersions)
{
view.engineVersions.Items.Add(version);
}
view.engineVersions.SelectedIndex = 0;
view.Closed += (sender, args) =>
{
if (!viewModel.IsCancelled)
{
var versionNumbers = viewModel.EngineVersion.Split('.');
var versionFolder = string.Join(".", new string[2] { versionNumbers[0], versionNumbers[1] });
var sandBoxPath = (versionNumbers[0] == "2") ? DynamoSandbox2path : String.Format(DynamoSandbox1path, versionFolder);
var replacedemblies = viewModel.replacedemblies.ToList();
string replacedemblyMain = (replacedemblies.Count >= 1) ? GetreplacedemblyData(replacedemblies[0].Key, replacedemblies[0].Value) : String.Empty;
string replacedemblyFunctions = (replacedemblies.Count >= 2) ? GetreplacedemblyData(replacedemblies[1].Key, replacedemblies[1].Value) : String.Empty;
AddReplacement(replacementsDictionary, "$packageName$", viewModel.PackageName);
AddReplacement(replacementsDictionary, "$packageVersion$", viewModel.PackageVersion);
AddReplacement(replacementsDictionary, "$packageDescription$", viewModel.PackageDescription);
AddReplacement(replacementsDictionary, "$dynamoVersion$", $"{viewModel.DynamoVersion}.*");
AddReplacement(replacementsDictionary, "$engineVersion$", viewModel.EngineVersion);
AddReplacement(replacementsDictionary, "$versionFolder$", versionFolder);
AddReplacement(replacementsDictionary, "$siteUrl$", viewModel.SiteUrl);
AddReplacement(replacementsDictionary, "$repoUrl$", viewModel.RepoUrl);
AddReplacement(replacementsDictionary, "$startProgramPath$", sandBoxPath);
AddReplacement(replacementsDictionary, "$nodeLibraries$", viewModel.NodeLibraries);
AddReplacement(replacementsDictionary, "$replacedemblyMain$", replacedemblyMain);
AddReplacement(replacementsDictionary, "$replacedemblyFunctions$", replacedemblyFunctions);
AddReplacement(replacementsDictionary, "$guidMain$", new Guid().ToString());
AddReplacement(replacementsDictionary, "$guidUI$", new Guid().ToString());
}
};
view.Closing += (sender, args) =>
{
if (!viewModel.forceClose)
{
var result = MessageBox.Show("Do you wish to stop creating the project?", this.Instancereplacedle, MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
viewModel.IsCancelled = true;
else
args.Cancel = true;
}
};
view.btn_Accept.Click += (sender, args) =>
{
if (!viewModel.IsEngineVersionSet())
{
MessageBox.Show("An Engine Version must be selected.", this.Instancereplacedle);
}
else
{
var result = MessageBox.Show("Are you happy with the package? You will be able to change the parameters later on.", this.Instancereplacedle, MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
viewModel.forceClose = true;
view.Close();
}
}
};
view.ShowDialog();
try
{
if (viewModel.IsCancelled)
{
throw new WizardBackoutException();
}
}
catch
{
if (System.IO.Directory.Exists(destinationDirectory))
{
System.IO.Directory.Delete(destinationDirectory, true);
}
throw;
}
}
19
View Source File : Form1.cs
License : MIT License
Project Creator : Amine-Smahi
License : MIT License
Project Creator : Amine-Smahi
public void Hideit(string a, Bitmap bmp)
{
try
{
if (a.Equals(""))
{
MessageBox.Show("Please Enter Some Text You Want to Hide.", "Warning");
return;
}
bmp = Stegnography.embedText(a, bmp);
MessageBox.Show("Your Text is now Hidden in the Image.\nUse the Save Image option from Menu.", "Done");
}
catch (Exception ex)
{
Console.WriteLine(ex);
MessageBox.Show("You didnt chouse an image");
}
}
19
View Source File : Form1.cs
License : Apache License 2.0
Project Creator : anadventureisu
License : Apache License 2.0
Project Creator : anadventureisu
private void startMiner()
{
// Clear out any old stats
app.Reset();
ProcessStartInfo info = new ProcessStartInfo();
//info.RedirectStandardError = true;
//info.RedirectStandardInput = true;
//info.RedirectStandardOutput = true;
//info.CreateNoWindow = true;
info.UseShellExecute = false;
info.FileName = exePath.Text;
info.ErrorDialog = true;
StringBuilder args = new StringBuilder();
args.Append("--pool " + poolAddress.Text);
args.Append(" --user " + walletAddress.Text);
if (workerPreplacedword.Text.Count() > 0)
{
args.Append(" --preplacedword " + workerPreplacedword.Text);
}
args.Append(" --intensity " + intensity.Value);
if (useNicehash.Checked)
{
args.Append(" --nicehash");
}
if (fastJobCheck.Checked)
{
args.Append(" --fastjobswitch");
}
args.Append(" -G " + gpuText.Text);
args.Append(" --remoteaccess");
info.Arguments = args.ToString();
processRunner.StartInfo = info;
Debug.WriteLine("Args: " + args);
consoleLog.AppendText(DateTime.Now + ": STARTING: " + processRunner.StartInfo.FileName + " " + processRunner.StartInfo.Arguments + Environment.NewLine);
try
{
processRunner.Start();
} catch(Exception e)
{
MessageBox.Show("Could not start miner: " + e.Message, "Error");
}
minerStarted = DateTime.Now;
}
19
View Source File : ChatHub.cs
License : MIT License
Project Creator : appsonsf
License : MIT License
Project Creator : appsonsf
private async void ReceiveMessageNotify(List<MessageNotifyDto> messages)
{
if (messages == null || messages.Count == 0)
return;
try
{
this.OnNewMessageNotifyEvent?.Invoke(messages);
var conversationVms =
await this._conversationService.GetNewMessageListAsync(messages, _userInfo.AccessToken);
var msg = conversationVms.SelectMany(u => u.MessageList).ToList();
if (msg.Count > 0)
LastMsgId = msg.Last().Id;
this.OnNewMessagesEvent?.Invoke(conversationVms);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "ERROR");
}
}
19
View Source File : ChatBox.cs
License : MIT License
Project Creator : appsonsf
License : MIT License
Project Creator : appsonsf
private async void button1_Click(object sender, EventArgs e)
{
var message = txt_message.Text;
if (string.IsNullOrEmpty(message))
return;
if (UserInfo.LoginedUsers.Count <= 1)
{
MessageBox.Show("需要再登录一枚用户", "ERROR");
return;
}
var otherUser = UserInfo.LoginedUsers.FirstOrDefault(u => u.UserId != this._chatHub._userInfo.UserId);
try
{
var result = await this._chatHub.SendTextAsync(otherUser.UserId, message);
AddMessage(result);
}
catch (Exception ex)
{
AddMessage(ex.ToString());
}
}
19
View Source File : ChatBox.cs
License : MIT License
Project Creator : appsonsf
License : MIT License
Project Creator : appsonsf
private async void btn_CreateConversation_Click(object sender, EventArgs e)
{
if (UserInfo.LoginedUsers.Count <= 1)
{
MessageBox.Show("需要再登录一枚用户", "ERROR");
return;
}
var otherUser = UserInfo.LoginedUsers.FirstOrDefault(u => u.UserId != this._chatHub._userInfo.UserId);
var convId = await this._chatHub.CreateConversationAsync(otherUser.UserId);
AddMessage("ConversationId:P2P:" + convId);
foreach (var chatBox in Chatboxs)
{
chatBox.OnChatCreatedEvent?.Invoke(ConversationType.P2P, convId);
}
}
19
View Source File : IMChatForm.cs
License : MIT License
Project Creator : appsonsf
License : MIT License
Project Creator : appsonsf
private void button1_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txtLogin_host.Text)
|| string.IsNullOrEmpty(txtApi_host.Text)
|| string.IsNullOrEmpty(txtHub_host.Text))
{
MessageBox.Show("Ensure Address!", "ERROR");
return;
}
URLConfig.API_Host = txtApi_host.Text;
URLConfig.Login_Host = txtLogin_host.Text;
URLConfig.Hub_Host = txtHub_host.Text;
btnApply.Enabled = false;
txtLogin_host.Enabled = false;
txtApi_host.Enabled = false;
txtHub_host.Enabled = false;
userGroupConfig.Enabled = true;
}
19
View Source File : LoginControl.cs
License : MIT License
Project Creator : appsonsf
License : MIT License
Project Creator : appsonsf
private async void btn_login_Click(object sender, EventArgs e)
{
var button = (Button)sender;
var userName = txtUserName.Text;
var preplacedword = txtPreplacedword.Text;
if (string.IsNullOrEmpty(userName) ||
string.IsNullOrEmpty(preplacedword))
{
MessageBox.Show("请输入正确的用户名和密码", "ERROR");
return;
}
button.Enabled = false;
button.Text = "正在登录...";
try
{
var userinfo = await this._authenticationService.LoginAsync(userName.Trim(), preplacedword.Trim());
UserInfo.LoginedUsers.Add(userinfo);
txtUserName.Enabled = false;
txtPreplacedword.Enabled = false;
txtToken.Text = userinfo.AccessToken;
button.Text = "Login";
lab_Status.Text = "Success";
lab_Status.BackColor = Color.MediumSeaGreen;
OnUserLoginSuccessEvent?.Invoke(this, userinfo);
}
catch (Exception ex)
{
lab_Status.Text = "ERROR";
lab_Status.BackColor = Color.Red;
button.Enabled = true;
button.Text = "Login";
txtUserName.Enabled = true;
txtPreplacedword.Enabled = true;
MessageBox.Show(ex.ToString(), "ERROR");
}
}
19
View Source File : MainForm.cs
License : GNU General Public License v3.0
Project Creator : arunsatyarth
License : GNU General Public License v3.0
Project Creator : arunsatyarth
public void ShowHardwareMissingError()
{
MessageBox.Show("System could not detect any Nvidia or AMD graphics card in your machine! If this is by mistake, please select correct miners from Script tab ",
"Hardware Missing");
}
19
View Source File : MinerView.cs
License : GNU General Public License v3.0
Project Creator : arunsatyarth
License : GNU General Public License v3.0
Project Creator : arunsatyarth
private void deleteMinerToolStripMenuItem_Click(object sender, EventArgs e)
{
if(Factory.Instance.CoreObject.Miners.Count<=1)
{
MessageBox.Show("Add another miner to delete this!", "Cannot delete the only Miner");
return;
}
DialogResult retVal=MessageBox.Show("Miners once deleted cannot be recovered. Are you sure?", "Delete Miner", MessageBoxButtons.YesNo);
if(retVal==DialogResult.Yes && Miner!=null)
{
Factory.Instance.CoreObject.RemoveMiner(Miner);
}
}
19
View Source File : Renderer.cs
License : GNU General Public License v2.0
Project Creator : Asixa
License : GNU General Public License v2.0
Project Creator : Asixa
private void Scanner(object o)
{
var config = (ScannerConfig) o;
for (; 0 < scaned[config.ID];)
{
if(STOP)return;
if (scaned[config.ID] == SPP) SetPixelPriview(config, Color32.White);
for (var h = config.h; h < config.h + block_size; h++)
{
if (h >= height) continue;
for (var w = config.w; w < config.w + block_size; w++)
{
if (w >= width) continue;
var id = h * width + w;
var color = mode == Mode.Shaded
? DiffuseScanner.GetColor(Scene.main.camera.CreateRay(
(width - w + Random.Get()) * recip_width,
(height - h + Random.Get()) * recip_height, id), Scene.main.world,
Scene.main.Important, 0).DeNaN()
: NormalMapScanner.GetColor(Scene.main.camera.CreateRay(
(width - w + Random.Get()) * recip_width,
(height - h + Random.Get()) * recip_height, h * width + w), Scene.main.world);
SetPixel(w, h, color);
}
}
scaned[config.ID]--;
if (scaned[config.ID] == 0)
{
FinishedChunks++;
if (config.ID == divide_h * divide_h - 1) FirstRound = true;
SetPixelPriview(config, Color32.Transparent);
chunk_end?.Invoke(FinishedChunks);
aliveBlocks.Remove(config.point);
if (FinishedChunks == divide_w * divide_h) MessageBox.Show("渲染完成", "渲染器");
else if (FirstRound)
{
var h = aliveBlocks[0].y;
var w = aliveBlocks[0].x;
ThreadPool.QueueUserWorkItem(Scanner,
new ScannerConfig(w * block_size, h * block_size, h * divide_w + w, aliveBlocks[0]));
}
}
}
}
19
View Source File : Renderer.cs
License : GNU General Public License v2.0
Project Creator : Asixa
License : GNU General Public License v2.0
Project Creator : Asixa
public void Save(string path = "Result" + ".png")
{
if (!Directory.Exists("Output")) Directory.CreateDirectory("Output");
int Get(int i) => (byte) Mathf.Range(main.buff[i] * 255 / main.Changes[i / 4] + 0.5f, 0, 255f);
var pic = new Bitmap(width, height, PixelFormat.Format32bppArgb);
for (var i = 0; i < main.buff.Length; i += 4)
{
var c = Color.FromArgb(Get(i + 3), Get(i+2), Get(i + 1), Get(i));
pic.SetPixel(i % (width * 4) / 4, i / (width * 4), c);
}
pic.Save("Output/" + path);
MessageBox.Show("Output/" + path, "保存完成");
}
See More Examples