public WorkerBackup(config.Configuration configuration,ProgressBar aProgressBar) { this.folderDst = configuration.folderPathCipher; this.folderSrc = configuration.folderPathOrig; this.password = configuration.password; this.progressBar = aProgressBar; }
private string GetProcedureBodyCode(config.models.Procedure proc) { var parameters = _sqlRepository.GetProcedureParameterCollection(proc.Schema, proc.ProcedureName); var recordsets = _sqlRepository.GetProcedureResultSetColumnCollection(proc.Schema, proc.ProcedureName); return $"{GetParameterCollectionCode(parameters)}public global::System.Int32 ReturnValue {{get; private set;}}{GetRecordsetsDefinitions(recordsets)}{GetExecuteCode(proc, parameters, recordsets)}"; }
void Awake() { if(CFG != null) GameObject.Destroy(CFG); else CFG = this; DontDestroyOnLoad(this); }
public ActionResult Edit(config config) { if (ModelState.IsValid) { Db.Entry(config).State = EntityState.Modified; Db.SaveChanges(); return(RedirectToAction("Index")); } return(View(config)); }
public AspNetv2TranslationTransport(string managerName, string nodeName, config.ClientConfig clientConfig) { this.managerName = managerName; this.nodeName = nodeName; this.clientConfig = clientConfig; this.inquiryService.Url = clientConfig.getUDDINode(nodeName).getInquiryUrl(); this.publisherService.Url = clientConfig.getUDDINode(nodeName).getJuddiApiUrl(); this.publishService.Url = clientConfig.getUDDINode(nodeName).getPublishUrl(); this.securityService.Url = clientConfig.getUDDINode(nodeName).getPublishUrl(); }
public ActionResult Edit(int num = 0) { config config = Db.config.Find(num); if (config == null) { return(HttpNotFound()); } return(View(config)); }
private void buttonOK_Click(object sender, EventArgs e) { try { labelMessage.Text = ""; labelMessage2.Text = ""; labelMessage.Visible = true; labelMessage2.Visible = true; String KeyData = "@UserID = '" + textBoxUserID.Text + "' , @UserPass = '******' , @ProKey = '" + textBoxProKeyID.Text + "'"; config callServer = new config(); DataTable dt = callServer.dialogServerInsert("CREATE_APPLICATION", KeyData); DataRow dr = dt.Rows[0]; if (dr["SUCESS"].ToString() == "1") { System.Text.RegularExpressions.Regex rgx = new System.Text.RegularExpressions.Regex("@"); string result = rgx.Replace(dr["KEYCODE"].ToString(), "Z0I4O0N5X"); if (!File.Exists(@"license.zionkey")) { File.Create(@"license.zionkey"); TextWriter tw = new StreamWriter(@"license.zionkey"); tw.Write(result); tw.Close(); MessageBox.Show("Created. Dialog message server application is ready to start. Run the application again.", "Product Key Activated Successful ", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Close(); } else if (File.Exists(@"license.zionkey")) { using (var stream = new FileStream(@"license.zionkey", FileMode.Truncate)) { using (var writer = new StreamWriter(stream)) { writer.Write(""); } } TextWriter tw = new StreamWriter(@"license.zionkey", true); tw.Write(result); tw.Close(); MessageBox.Show("Updated. Dialog message server application is ready to start. Run the application again.", "Product Key Activated Successful ", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Close(); } else { MessageBox.Show("Dialog message server application is ready to start. Run the application again.", "Product Key Activated Successful ", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Close(); } } else { labelMessage.ForeColor = Color.Red; labelMessage.Text = dr["MESAGE"].ToString(); labelMessage2.Text = dr["MESAGE2"].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public static enumResultLockProcess DoLockProcess(Func <bool> FuncName, string key, int repeat = 5, int TimeoutMilliseconds = 500) { bool Success = false; int counter = 0; enumResultLockProcess Result = enumResultLockProcess.Init; while (counter < repeat && Success == false) { using (var db = new SteinbachEntities()) { config res = db.config.Where(n => n.mkey == key).SingleOrDefault(); if (res == null) { res = LockProcess.addKeyIfMissing(db, key); if (res == null) { Success = false; Result = enumResultLockProcess.KeyNotFoundAndUnableToBeAdded; } } if (res != null && res.value == "0") { res.value = "1"; db.SaveChanges(); Success = true; Result = FuncName() == false ? enumResultLockProcess.FunctionReportsFalse : enumResultLockProcess.Succes; } } counter++; LockProcess.wait(new TimeSpan(0, 0, 0, 0, TimeoutMilliseconds)); } if (!Success) { if (Result != enumResultLockProcess.KeyNotFoundAndUnableToBeAdded) { Result = enumResultLockProcess.TimeOutWhileTryToLock; } } if (Success) { using (var db = new SteinbachEntities()) { config res = db.config.Where(n => n.mkey == key).SingleOrDefault(); res.value = "0"; db.SaveChanges(); } } return(Result); }
private void backgroundWorkerDialogMobileServer_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; config callServer = new config(); DataTable dt; dt = callServer.dialogServerInsert("TAB_LOAD_CUSTOMER_SMS"); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; ListViewItem listitem = new ListViewItem(dr["CustNumber"].ToString()); listitem.SubItems.Add(dr["CustName"].ToString()); listitem.SubItems.Add(dr["CustGender"].ToString()); listitem.SubItems.Add(dr["CustRegion"].ToString()); listitem.SubItems.Add(dr["CustEmail"].ToString()); listitem.SubItems.Add(dr["CustInsert"].ToString()); listitem.SubItems.Add(dr["CustModified"].ToString()); AddListViewItem(listitem); } dt.Dispose(); dt = callServer.dialogServerInsert("TAB_LOAD_CUSTOMER_NET"); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; ListViewItem listitem = new ListViewItem(dr["CustNumber"].ToString()); listitem.SubItems.Add(dr["CustName"].ToString()); listitem.SubItems.Add(dr["CustGender"].ToString()); listitem.SubItems.Add(dr["CustRegion"].ToString()); listitem.SubItems.Add(dr["CustEmail"].ToString()); listitem.SubItems.Add(dr["CustInsert"].ToString()); listitem.SubItems.Add(dr["CustModified"].ToString()); AddListViewItem(listitem); worker.ReportProgress(Convert.ToInt32((i / dt.Rows.Count) * (25 / 100))); } dt.Dispose(); dt = callServer.dialogServerInsert("TAB_LOAD_DIALOG_SITES"); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; ListViewItem listitem = new ListViewItem(dr["SiteID"].ToString()); listitem.SubItems.Add(dr["SiteName"].ToString()); listitem.SubItems.Add(dr["SiteUID"].ToString()); listitem.SubItems.Add(dr["Longitude"].ToString()); listitem.SubItems.Add(dr["Latitude"].ToString()); listitem.SubItems.Add(dr["SiteStatus"].ToString()); listitem.SubItems.Add(dr["TowerOwner"].ToString()); listitem.SubItems.Add(dr["TowerType"].ToString()); listitem.SubItems.Add(dr["Modified"].ToString()); AddListViewItem2(listitem); } dt.Dispose(); }
void ModifyConfig(config cfg) { if (configsDic.ContainsKey(cfg.key)) { oldCfg = configsDic[cfg.key]; int index = configs.IndexOf(configsDic[cfg.key]); config realCfg = config.GenConfigByIsNeedGenDic(configsDic[cfg.key], cfg); configs[index] = realCfg; configsDic[cfg.key] = realCfg; } }
static string get_nextid(config conf) { for (int i = 0; i < conf.properties.Count; i++) { if (conf.properties[i].name == "NextID" || conf.properties[i].name == "NextBreakID") { return(conf.properties[i].value); } } return(null); }
public property GetCurProperty(config cfg, string propertyName) { if (cfg.propertiesDic.ContainsKey(propertyName)) { return(cfg.propertiesDic[propertyName]); } else { return(null); } }
//save M091103 public void SaveM091103(int countSizeLevel, int showCountDownSizeLevel) { using (VanchBgDataContext vdc = new VanchBgDataContext()) { config linqData = vdc.configs.First(); linqData.countSizeLevel = countSizeLevel; linqData.showCountDownSizeLevel = showCountDownSizeLevel; vdc.SubmitChanges(); } }
//save M091101 public void SaveM091101(int mode, int levelSeconds) { using (VanchBgDataContext vdc = new VanchBgDataContext()) { config linqData = vdc.configs.First(); linqData.cusSvrMode = mode; linqData.levelSeconds = levelSeconds; vdc.SubmitChanges(); } }
private string GetExecuteBodyCode(bool async, IList<ProcedureParameter> parameters, IList<List<ProcedureResultSetColumn>> recordsets, config.models.Procedure proc) { var code = $"var retValue = new {Tools.ValidIdentifier(string.IsNullOrWhiteSpace(proc.Alias) ? proc.ProcedureName : proc.Alias)}();" + "{" + " var retryCycle = 0;" + " while (true) {" + $" global::System.Data.SqlClient.SqlConnection conn = executionScope == null ? new global::System.Data.SqlClient.SqlConnection(global::{_config.Namespace}.ExecutionScope.ConnectionString) : executionScope.Transaction.Connection;" + " try {" + " if (conn.State != global::System.Data.ConnectionState.Open) {" + " if (executionScope == null) {" + $" {(async ? "await" : "")} conn.Open{(async ? "Async" : "")}();" + " }" + " else {" + " retryCycle = int.MaxValue; " + " throw new global::System.Exception(\"Execution Scope must have an open connection.\"); " + " }" + " }" + " using (global::System.Data.SqlClient.SqlCommand cmd = conn.CreateCommand()) {" + " cmd.CommandType = global::System.Data.CommandType.StoredProcedure;" + " if (executionScope != null && executionScope.Transaction != null)" + " cmd.Transaction = executionScope.Transaction;" + " cmd.CommandTimeout = commandTimeout;" + $" cmd.CommandText = \"{Tools.QuoteName(proc.Schema)}.{Tools.QuoteName(proc.ProcedureName)}\";" + string.Join("", parameters.Select(p => p.IsTableType ? $"cmd.Parameters.Add(new global::System.Data.SqlClient.SqlParameter(\"@{p.ParameterName}\", global::System.Data.SqlDbType.Structured) {{TypeName = \"{p.SqlTypeName}\", Value = {p.AsLocalVariableName}.GetDataTable()}});" : $"cmd.Parameters.Add(new global::System.Data.SqlClient.SqlParameter(\"@{p.ParameterName}\", global::System.Data.SqlDbType.{Tools.SqlDbTypeName(p.SqlTypeName)}, {(("nchar nvarchar".Split(' ').Contains(p.SqlTypeName) && p.MaxByteLength != -1) ? (p.MaxByteLength/2) : p.MaxByteLength)}, global::System.Data.ParameterDirection.{(p.IsOutputParameter ? "Output" : "Input")}, true, {p.Precision}, {p.Scale}, null, global::System.Data.DataRowVersion.Default, {p.AsLocalVariableName}){{{("geography hierarchyid geometry".Split(' ').Contains(p.SqlTypeName) ? $"UdtTypeName = \"{p.SqlTypeName}\"" : "")}}});")) + "cmd.Parameters.Add(new global::System.Data.SqlClient.SqlParameter(\"@ReturnValue\", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, true, 0, 0, null, global::System.Data.DataRowVersion.Default, global::System.DBNull.Value));" + (recordsets.Count == 0 ? $"{(async ? "await" : "")} cmd.ExecuteNonQuery{(async ? "Async" : "")}();" : $"using (global::System.Data.SqlClient.SqlDataReader reader = {(async ? "await" : "")} cmd.ExecuteReader{(async ? "Async" : "")}()){{{MapRecordsetResults(async, recordsets)}}}") + $"retValue.Parameters = new ParametersCollection({string.Join(", ", parameters.Select(parameter => /* only copy from these the output parameters. Everything else shoud just be coming from the input params */ parameter.IsOutputParameter ? string.Format("cmd.Parameters[\"@{0}\"].Value == global::System.DBNull.Value ? null : (global::{1}) cmd.Parameters[\"@{0}\"].Value", parameter.ParameterName, $"{(parameter.IsTableType ? _config.Namespace + "." : "")}{parameter.ClrTypeName}") : parameter.AsLocalVariableName))});" + "retValue.ReturnValue = (global::System.Int32) cmd.Parameters[\"@ReturnValue\"].Value; " + "return retValue;" + "}" + "}" + "catch (global::System.Data.SqlClient.SqlException e) {" + "if (retryCycle++ > 9 || !ExecutionScope.RetryableErrors.Contains(e.Number))" + " throw;" + "global::System.Threading.Thread.Sleep(1000);" + "}" + "finally {" + "if (executionScope == null && conn != null) {" + "((global::System.IDisposable) conn).Dispose();" + "}" + "}" + "}" + // "}" + "}" ; return code; }
public void HideUnhideSpecificUi(config config, bool hide) { if (hide) { widgets[(int)config].Exit(); } else { widgets[(int)config].Enter(); } }
public ActionResult Create(config config) { if (ModelState.IsValid) { Db.config.Add(config); Db.SaveChanges(); return(RedirectToAction("Index")); } return(View(config)); }
private String LoadXmalDialogSite() { if (checkBoxSelectDialogSites.Checked == true) { try { int i = 0; String xmlSiteData = "<Folder>" + Environment.NewLine + "<name>DIALOG_SITE_DATA</name>" + Environment.NewLine; String ComplaintArea = "@ComLong = " + ComplaintCustLong + ", @ComLat = " + ComplaintCustLat + ", @ComCust = " + (numericUpDownCustomerAreaCircal.Value / 100).ToString(); config callServer = new config(); DataTable _dt_SelectCompalaintAreSite = callServer.dialogServerInsert("TAB_LOAD_COMPLAINT_BITWEEN", ComplaintArea); foreach (DataRow dr in _dt_SelectCompalaintAreSite.Rows) { i = i + 1; progressBarSite.Value = (i / _dt_SelectCompalaintAreSite.Rows.Count) * 100; this.Refresh(); xmlSiteData += "<Folder>" + Environment.NewLine + "<name>" + dr["SiteName"].ToString().ToUpper() + "</name>" + Environment.NewLine + "<Placemark>" + Environment.NewLine + "<name>" + dr["SiteName"].ToString() + "</name>" + Environment.NewLine + "<description><![CDATA[" + Environment.NewLine + "<table style='width:300px; background:#F08080'>" + Environment.NewLine + "<tr><td style='width:100px; padding: 5px;'>Site ID</td><td style='background:#FFC0CB; font-size: 90%;'>" + dr["SiteID"].ToString() + "</td></tr>" + Environment.NewLine + "<tr><td style='width:100px; padding: 5px;'>Site Name</td><td style='background:#FFC0CB; font-size: 90%;'>" + dr["SiteName"].ToString() + "</td></tr>" + Environment.NewLine + "<tr><td style='width:100px; padding: 5px;'>Site UID Name</td><td style='background:#FFC0CB; font-size: 90%;'>" + dr["SiteUID"].ToString() + "</td></tr>" + Environment.NewLine + "<tr><td style='width:100px; padding: 5px;'>Longitude</td><td style='background:#FFC0CB; font-size: 90%;'>" + dr["Longitude"].ToString() + "</td></tr>" + Environment.NewLine + "<tr><td style='width:100px; padding: 5px;'>Latitude</td><td style='background:#FFC0CB; font-size: 90%;'>" + dr["Latitude"].ToString() + "</td></tr>" + Environment.NewLine + "<tr><td style='width:100px; padding: 5px;'>Site Status</td><td style='background:#FFC0CB; font-size: 90%;'>" + dr["SiteStatus"].ToString() + "</td></tr>" + Environment.NewLine + "<tr><td style='width:100px; padding: 5px;'>Tower Owner</td><td style='background:#FFC0CB; font-size: 90%;'>" + dr["TowerOwner"].ToString() + "</td></tr>" + Environment.NewLine + "<tr><td style='width:100px; padding: 5px;'>Tower Type</td><td style='background:#FFC0CB; font-size: 90%;'>" + dr["TowerType"].ToString() + "</td></tr>" + Environment.NewLine + "</table>" + Environment.NewLine + "]]></description>" + Environment.NewLine + "<styleUrl>#m_ylw-pushpin</styleUrl>" + Environment.NewLine + "<Point>" + Environment.NewLine + "<gx:drawOrder>5</gx:drawOrder>" + Environment.NewLine + "<coordinates>" + dr["Longitude"].ToString() + "," + dr["Latitude"].ToString() + ",0</coordinates>" + Environment.NewLine + "</Point>" + Environment.NewLine + "</Placemark>" + Environment.NewLine; if (checkBoxViewAntennaBeamwidth.Checked == false && checkBoxViewAntennaDirection.Checked == false) { } else { xmlSiteData += LoadXmalDialogSectors(dr["SiteID"].ToString()); } xmlSiteData += "</Folder>" + Environment.NewLine + Environment.NewLine; } xmlSiteData += "</Folder>" + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine; return(xmlSiteData); } catch (Exception) { return(null); } } return(null); }
public void dlg_OnGenerateJpk(DateTime dateFrom, DateTime dateTo, MainForm view) { if (dateFrom > dateTo) { MessageBox.Show("Data do nie może być późniejsza niż data od", "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information); } JpkGenerator generator = new JpkGenerator(); IList <invoice> invoices = FetchListForJpk(dateFrom, dateTo); config config = GetConfigData(); generator.GenerateJpk(invoices, config, dateFrom, dateTo); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { config ds = new config(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public config(config config) { key = config.key; property property; for (int i = 0; i < config.properties.Count; i++) { property = new property(config.properties[i]); properties.Add(property); propertiesDic.Add(property.name, property); _IsNeedGenDic.Add(property.name, config.IsNeedGenDic[property.name]); } }
//save M091102 public void SaveM091102(int webDelay, int maxCusSvrConnLevel, int maxUserConnNum, int cusSvrUserMaxAmount) { using (VanchBgDataContext vdc = new VanchBgDataContext()) { config linqData = vdc.configs.First(); linqData.webDelay = webDelay; linqData.maxCusSvrConnLevel = maxCusSvrConnLevel; linqData.maxUserConnNum = maxUserConnNum; linqData.cusSvrUserMaxAmount = cusSvrUserMaxAmount; vdc.SubmitChanges(); } }
protected void Page_Load(object sender, EventArgs e) { config c = new config(); if (string.IsNullOrWhiteSpace(c.accessId)) { return; } if (string.IsNullOrWhiteSpace(c.accessKey)) { return; } if (string.IsNullOrWhiteSpace(c.bucketName)) { return; } try { // Get the data HttpPostedFile upload = Request.Files["Filedata"]; string firstName = DateTime.Now.ToString("yyyyMMddHHmmssfff"); string lastName = Path.GetExtension(upload.FileName); string fullName = firstName + lastName; if (!string.IsNullOrEmpty(c.prefix)) { fullName = c.prefix + "/" + fullName; } ObjectMetadata metadata = new ObjectMetadata(); // 可以设定自定义的metadata。 metadata.ContentType = upload.ContentType; OssClient ossClient = new OssClient(c.accessId, c.accessKey); using (var fs = upload.InputStream) { var ret = ossClient.PutObject(c.bucketName, fullName, fs, metadata); } Response.StatusCode = 200; Response.Write("http://" + c.bucketName + ".oss.aliyuncs.com/" + fullName); } catch { // If any kind of error occurs return a 500 Internal Server error Response.StatusCode = 500; Response.Write("An error occured"); Response.End(); } finally { // Clean up Response.End(); } }
private static void loadConfig() { FileStream fs = null; try { XmlSerializer xs = new XmlSerializer(typeof(config)); fs = new FileStream(config, FileMode.Open, FileAccess.Read, FileShare.Read); config c = (config)xs.Deserialize(fs); startconsol = c.startconsol; fs.Close(); } catch (Exception e) { System.Console.WriteLine("ConfigFileLoadError: " + e.Message); fs.Close(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string usuario = Session["nickUser"].ToString(); if (usuario != "") { config c = ent.config.ToList().ElementAt(0); txtIPDominio.Text = c.ip_dominio; txtNombreDominio.Text = c.nombre_dominio; txtDominio.Text = c.dominio; txtUsuario.Text = c.usuario_admin; if (c.usar_dominio == 0) { btNoDom.CssClass = "btn btn-danger btn-sm"; btYesDom.CssClass = "btn btn-default btn-sm"; btYesDom.Enabled = true; btNoDom.Enabled = false; } else { btYesDom.CssClass = "btn btn-info btn-sm"; btNoDom.CssClass = "btn btn-default btn-sm"; btYesDom.Enabled = false; btNoDom.Enabled = true; } if (c.usar_usuario == 0) { btNoUser.CssClass = "btn btn-danger btn-sm"; btSiUser.CssClass = "btn btn-default btn-sm"; panelUsuario.Enabled = false; btSiUser.Enabled = true; btNoUser.Enabled = false; } else { btSiUser.CssClass = "btn btn-info btn-sm"; btNoUser.CssClass = "btn btn-default btn-sm"; btSiUser.Enabled = false; btNoUser.Enabled = true; panelUsuario.Enabled = true; } } else { Response.Redirect("login.aspx"); } } }
public void saveConf() { config conf = new config(); conf.offset = masterTick.offset; using (System.IO.StreamWriter file = System.IO.File.CreateText(Application.dataPath + "\\settings.json")) { JsonSerializer serializer = new JsonSerializer(); serializer.Serialize(file, conf); } SceneManager.LoadScene("LoadingScene", LoadSceneMode.Single); }
void Application_ApplicationExit(object sender, EventArgs e) { viribot.Dispose(); Console.SetOut(_oldout); config c = config.FromFile("configv2.txt"); c.StartWidth = Width; c.StartX = Location.X; c.StartY = Location.Y; _config.StartWidth = Width; _config.StartX = Location.X; _config.StartY = Location.Y; _config.SaveToFile("configv2.txt"); }
/// <summary> /// ejecutar un comando cmd normalmente, no funciona en todas las ocaciones, puede producir un loop infinito, éste es mas propenso a funcionar /// </summary> /// <param name="directory">Directorio en el que trabajara el proceso, generalmente en system32</param> /// /// <param name="file">El archivo que ejecutará. Ej: CMD</param> /// /// <param name="usuario">Usuario de administrador para ejecutar el proceso, debe ser del equipo que utilice el sistema</param> /// /// <param name="pass">contraseña de administrador</param> /// /// <param name="cmd">comando cmd a ejecutar. Ej: ping ip -4</param> public string ExecuteCommand2(string directory, string file, string usuario, string pass, string cmd) { try { Process p = new Process(); ProcessStartInfo myProcessInfo = new ProcessStartInfo(); //Initializes a new ProcessStartInfo of name myProcessInfo config c = ent.config.ToList().ElementAt(0); myProcessInfo.WorkingDirectory = directory; myProcessInfo.FileName = file; myProcessInfo.Arguments = ""; myProcessInfo.UserName = usuario; var s = new SecureString(); for (int i = 0; i < pass.Length; i++) { s.AppendChar(pass[i]); } myProcessInfo.Password = s; myProcessInfo.Domain = c.dominio; myProcessInfo.WindowStyle = ProcessWindowStyle.Maximized; //Sets the WindowStyle of myProcessInfo which indicates the window state to use when the process is started to Hidden myProcessInfo.Verb = "runas"; myProcessInfo.UseShellExecute = false; myProcessInfo.RedirectStandardInput = true; myProcessInfo.RedirectStandardOutput = true; myProcessInfo.RedirectStandardError = true; myProcessInfo.CreateNoWindow = true; p.StartInfo = myProcessInfo; p.Start(); p.StandardInput.WriteLine(cmd); p.StandardInput.WriteLine("exit"); //p.WaitForExit(25000); string output = p.StandardError.ReadToEnd() + "\n " + p.StandardOutput.ReadToEnd(); //output = output + p.StandardError.ReadToEnd(); p.WaitForExit(); p.StandardInput.Close(); return(output); } catch (Exception ex) { if (ex.ToString() != null) { return(ex.ToString()); } else { return("Error desconocido, contacte al administrador."); } } }
public AspNetTransport(string managerName, string nodeName, config.ClientConfig clientConfig) { this.managerName = managerName; this.nodeName = nodeName; this.clientConfig = clientConfig; this.inquiryService.Url = clientConfig.getUDDINode(nodeName).getInquiryUrl(); this.inquiryService.Url = clientConfig.getUDDINode(nodeName).getInquiryUrl(); this.publisherService.Url = clientConfig.getUDDINode(nodeName).getJuddiApiUrl(); this.publishService.Url = clientConfig.getUDDINode(nodeName).getPublishUrl(); this.securityService.Url = clientConfig.getUDDINode(nodeName).getSecurityUrl(); this.custodyTransferService.Url = clientConfig.getUDDINode(nodeName).getCustodyTransferUrl(); this.subscriptionService.Url = clientConfig.getUDDINode(nodeName).getSubscriptionUrl(); this.subscriptionListenerService.Url = clientConfig.getUDDINode(nodeName).getSubscriptionListenerUrl(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string usuario = Session["nickUser"].ToString(); if (usuario != "") { usuario u = cont.getUsuario(usuario); lbid_usuario.Text = u.id_usuario.ToString(); config config = ent.config.ToList().ElementAt(0); List <string> pcs = cont.GetComputersFromDomain(config.dominio); //List<string> pcs = new List<string>(); //pcs.Add("DESKTOP-IFOB8Q2"); //pcs.Add("tal_lab0101"); //pcs.Add("DESKTOP-SGF53VS"); //pcs.Add("DESKTOP-AEHRM66"); //pcs.Add("ADOKYNSTORE-PC"); List <ComputadorDom> listaPcs = new List <ComputadorDom>(); foreach (var i in pcs) { listaPcs.Add(new ComputadorDom(i, "", "")); } tablaPcsDominio.DataSource = listaPcs; tablaPcsDominio.DataBind(); //obtener laboratorios para DropDownList List <laboratorio> labs = ent.laboratorio.ToList(); cbLaboratorio.DataSource = labs; cbLaboratorio.DataTextField = "nombre"; cbLaboratorio.DataValueField = "id_laboratorio"; cbLaboratorio.DataBind(); //obtener laboratorios para DropDownList de lista de pcs cbLaboratorio2.DataSource = labs; cbLaboratorio2.DataTextField = "nombre"; cbLaboratorio2.DataValueField = "id_laboratorio"; cbLaboratorio2.DataBind(); cbLaboratorio2_SelectedIndexChanged(sender, e); //modalPopupExtenderAgregarDesdeDom.Hide(); } else { Response.Redirect("login.aspx"); } } }
private static config addKeyIfMissing(SteinbachEntities Context, string key) { try { var res = new config(); res.mkey = key; res.value = "0"; Context.AddToconfig(res); Context.SaveChanges(); return(res); } catch (Exception) { return(null); } }
/// <summary> /// Creates an instance of this class using the provided <paramref name="layerName"/> and <paramref name="image"/>. /// </summary> /// <param name="layerName">The layer name</param> /// <param name="image"></param> public ImageGDILayer(string layerName, Image image, config incfg) { InterpolationMode = InterpolationMode.HighQualityBicubic; LayerName = layerName; _image = image; SetEnvelope(); cfg = incfg; //for test purposes //cfg.minX = 152203.122f; //cfg.maxX = 3158014f; //cfg.minY = 3086534.736f; //cfg.maxY = 6023337.07f; _envelope = new Envelope(cfg.minX, cfg.maxX, cfg.minY, cfg.maxY); }
private void pictureBox2_Click(object sender, EventArgs e) { form5 = new config(rutat, rutap, sound, mostrarmov, mostrarcoord); if (form5.ShowDialog() == System.Windows.Forms.DialogResult.OK) { rutat = "image\\board" + form5.t + "\\"; rutap = "image\\e" + form5.p + "\\"; sound = form5.sound; mostrarmov = form5.mostrar; mostrarcoord = form5.coord; actualizar(); cambiar_piezas(); cambiar_tablero(); } panel2.Location = new Point(0, -50); }
static config read_config(StreamReader sr) { //llex_lite.llex(sr); /* read key */ config config = new config(llex_lite.buff2str()); /* read key */ llex_lite.llex(sr, true); /* skip '{' */ string k, v = null; while (!sr.EndOfStream && llex_lite.llex(sr) != '}') { property p = read_property(sr); config.properties.Add(p); config.propertiesDic.Add(p.name, p); } return(config); }
static table read_table(StreamReader sr) { string md5Str = read_md5comment(sr); llex_lite.llex(sr); /* read key */ table t = new table(md5Str, llex_lite.buff2str()); llex_lite.llex(sr, true);/* skip '{' */ while (!sr.EndOfStream && llex_lite.llex(sr) != '}') { config conf = read_config(sr); t.configs.Add(conf); t.configsDic.Add(conf.key, conf); } return(t); }
private void FormMenu_Load(object sender, EventArgs e) { timer1.Start(); DateTime hoje = DateTime.Now.Date; try { using (var db = new dbEscala()) { dgvEscalas.DataSource = db.escala.Where(d => d.DT_INICIO <= hoje && d.DT_FINAL >= hoje && d.USE == 1).Select(d => new { Nome = d.sal_aluno.alunos.NOME, Sala = d.sal_aluno.salas.DESCRICAO, Data_Inicio = d.DT_INICIO, Data_Término = d.DT_FINAL }).OrderBy(d => d.Sala).ToList(); dgvAlunos.DataSource = db.escala.Where(d => d.sal_aluno.alunos.ATIVO == 1).Select(d => new { Nome = d.sal_aluno.alunos.NOME, CPF = d.sal_aluno.alunos.CPF, Escalas = d.sal_aluno.salas.DESCRICAO, DataEscala = d.DT_FINAL }).OrderBy(d => d.Nome).ToList(); config cf = db.config.Find(1); int hj = DateTime.Now.Day; //dias atuais int dt = cf.DT_FINAL.Day; // dias da escala gravada int date = dt - hj; // verifica quantos dias faltam para o término da escala lbDtInicio.Text = cf.DT_INICIO.ToString("dd/MM/yyyy"); lbDtFinal.Text = cf.DT_FINAL.ToString("dd/MM/yyyy"); if (date > 0) { lbFaltam.Text = "Faltam " + date + " dias para o fim da escala"; } else { lbFaltam.Text = "Ultima escala Finalizada!!"; } } } catch (Exception err) { MessageBox.Show("Erro " + err, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private string GetExecuteCode(config.models.Procedure proc, IList<ProcedureParameter> parameters, IList<List<ProcedureResultSetColumn>> recordsets) { return string.Join("", new[] { _supportsAsync, false }.Distinct().Select( async => String.Format( "public static {0}{1}{2} Execute{3} ({4} global::{5}.ExecutionScope executionScope = null, global::System.Int32 commandTimeout = 30){{{6}}}/*end*/", async ? "async global::System.Threading.Tasks.Task<" : "", Tools.ValidIdentifier(proc.ProcedureName), async ? ">" : "", async ? "Async" : "", string.Join("", parameters.Select( parameter => String.Format("global::{0} {1},", parameter.IsTableType ? $"{_config.Namespace}.{parameter.ClrTypeName}" : parameter.ClrTypeName, parameter.AsLocalVariableName))), _config.Namespace, GetExecuteBodyCode(async, parameters, recordsets, proc)))); }
public Device(string portn, string name, string processor, string version, int speed) { this.portName = portn; this.Baudrate = speed; this.name = name; this.port = new SerialPort(); this.port.PortName = portName; this.port.ReadBufferSize = 1024*1024; this.port.BaudRate = Baudrate; procConf = new config(); procConf.procType = processor; /*switch (processor) { case Defines.STM32F051: procConf.procType = Defines.STM32F051; break; case Defines.STM32F100: procConf.procType = Defines.STM32F100; break; case Defines.STM32F303: procConf.procType = Defines.STM32F303; break; case Defines.STM32F407: procConf.procType = Defines.STM32F407; break; case Defines.ADuC843: procConf.procType = Defines.ADuC843; break; default: break; }*/ tic(); this.version = version; this.port.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.serialPort_DataReceived); this.port.ErrorReceived += new System.IO.Ports.SerialErrorReceivedEventHandler(this.serialPort_ErrorReceived); }
private string GetEnumBodyCode(config.models.Enum enumInfo) { return string.Join(",", _sqlRepository.GetEnumKeyValues(enumInfo.Schema, enumInfo.TableName, enumInfo.ValueColumn, enumInfo.KeyColumn) .Select(kv => $"{Tools.ValidIdentifier(kv.Key)} = {kv.Value}")); }
// Use this for initialization void Start() { Time.fixedDeltaTime = 0.05f; cfg = FindObjectOfType<config>(); if (!creator) { Carregar (); } }
// Use this for initialization void Start() { CFG = config.CFG; consecutiveWeather.Add(EWeather.SOLEIL, 0); }
public void process_data(config.time_period select_period) { Debug.error(this, debug_level, "process_data"); stackPanel1.Children.Clear();//清掉stack上的值 period = select_period; switch (select_period) { case config.time_period.daily: add_daily_candlestick_chart(); break; case config.time_period.weekly: add_weekly_candlestick_chart(); break; case config.time_period.monthly: add_monthly_candlestick_chart(); break; } setting_price_line(); Debug.error(this, debug_level, "process_data X"); }
//Polygon pl; public void setConfig(config incfg) { cfg = incfg; //resolution = cfg.resolution; }
public static void newProject() { //Reset vars TimeTracking.projectConfig = null; currentTrackingState = timeTrackingStates.inactive; totalTimer = 0; breakingTimeAccumulated = 0; currentlyBreaking = false; currentBreak = null; previousBreaks = new List<timeTrackingBreak>(); marks = new List<timeTrackingMark>(); currentDeadlineState = deadlineStates.normal; mainInstance.dgv_marks.Rows.Clear(); //Reset vars for other classes timeTrackingBreak.index = 0; timeTrackingMark.index = 0; //Reset timers and vars mainInstance.timer_tracker.Enabled = false; mainInstance.la_totalTimer.Text = "00:00:00"; mainInstance.la_episodeTimer.Text = "00:00:00"; mainInstance.la_breakTimer.Text = "00:00:00"; mainInstance.la_deadlineTimer.Text = "00:00:00"; //Set colors to normal. mainInstance.la_status_tracking.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64); mainInstance.la_status_inactive.ForeColor = System.Drawing.Color.FromArgb(255, 255, 255); mainInstance.la_status_break.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64); mainInstance.la_status_deadline.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64); //SHOW Settings form settingsInstance = new frm_settings(); settingsInstance.Show(); settingsShown = true; mainInstance.SendToBack(); settingsInstance.Activate(); }
public static void openProject(string openPath) { //CLEAR VARS PRE_LOAD //Clear the breaks and marks. mainInstance.dgv_marks.Rows.Clear(); //Get the config file from the path string configContent = ""; using (StreamReader sr = new StreamReader(openPath)) { configContent = sr.ReadToEnd(); } config loadedConfig = (config)config.DeserializeObject<config>(configContent); projectConfig = loadedConfig; //Convert config-file to timetracking vals TimeTracking.breakingTimeAccumulated = projectConfig.breakingTimeAccumulated; TimeTracking.totalTimer = projectConfig.totalTimer; TimeTracking.marks = projectConfig.marks; TimeTracking.previousBreaks = projectConfig.previousBreaks; //Process, do visuals and stuff... //Visualize totaltimer, episodetimer and deadlinetimer (if activated). int episodeTimer = (totalTimer - breakingTimeAccumulated); if (currentlyBreaking) episodeTimer -= (totalTimer - currentBreak.totTimeStart); //Remove precut from timers totalTimer -= projectConfig.precutTimer; episodeTimer -= projectConfig.precutTimer; Tuple<string, string, string> timeVisualized = timeVisualiser(totalTimer); Tuple<string, string, string> episodeTimeVisualized= timeVisualiser(episodeTimer); mainInstance.la_totalTimer.Text = timeVisualized.Item1 + ":" + timeVisualized.Item2 + ":" + timeVisualized.Item3; mainInstance.la_episodeTimer.Text = episodeTimeVisualized.Item1 + ":" + episodeTimeVisualized.Item2 + ":" + episodeTimeVisualized.Item3; //Check for deadlinetimer if (projectConfig.deadline) { Tuple<string, string, string> deadlineTimeVisualized = timeVisualiser(projectConfig.deadlineTimer); mainInstance.la_deadlineTimer.Text = deadlineTimeVisualized.Item1 + ":" + deadlineTimeVisualized.Item2 + ":" + deadlineTimeVisualized.Item3; } configLoaded(); }
public WorkerRemote(config.Configuration configuration) { this.folderDst = configuration.folderPathOrig; this.folderSrc = configuration.folderPathCipher; this.password = configuration.password; }
new return DataCacheFactory(config);
public LAME_CONFIG(SOUND_INFO soundInfo, MP3_Settings settings) { dwConfig = BE_CONFIG_LAME; union = new config(soundInfo, settings); }