private static void XMLReader(object sender, ElapsedEventArgs e) { XmlDocument doc = new XmlDocument(); doc.Load("Category.xml"); XmlNodeList list = doc.DocumentElement.ChildNodes; XmlNodeList olds = list.Item(0).ChildNodes; XmlNodeList dancess = list.Item(1).ChildNodes; XmlNodeList programs = list.Item(2).ChildNodes; Olds = new Old[olds.Count]; for (int i = 0; i < olds.Count; i++) { Olds[i] = new Old { name = olds.Item(i).Name, old = Convert.ToByte(olds.Item(i).InnerText) }; } dances = new string[dancess.Count]; for (int i = 0; i < dancess.Count; i++) { dances[i] = dancess.Item(i).Name; } program = new string[programs.Count]; for (int i = 0; i < programs.Count; i++) { program[i] = programs.Item(i).Name; } }
private void PropertyPage_FormClosing(object sender, FormClosingEventArgs e) { if (!Confirm) { Old.Copy(Program.Character); } }
protected override void Execute(CodeActivityContext executionContext) { var text = Text.Get <string>(executionContext); var old = Old.Get <string>(executionContext); var @new = New.Get <string>(executionContext); if (@new == null) { @new = String.Empty; } var result = string.Empty; if (!CaseSensitive.Get <bool>(executionContext)) { if (!String.IsNullOrEmpty(text) && !String.IsNullOrEmpty(old)) { result = text.Replace(old, @new); } } else { result = CompareAndReplace(text, old, @new, StringComparison.CurrentCultureIgnoreCase); } Result.Set(executionContext, result); }
protected override async Task <ExitCode> Run() { Utils.Log("Loading Meta files"); var oldState = (AbstractDownloadState)await DownloadDispatcher.ResolveArchive(Old.WithExtension(Consts.MetaFileExtension).LoadIniFile()); var newState = (AbstractDownloadState)await DownloadDispatcher.ResolveArchive(New.WithExtension(Consts.MetaFileExtension).LoadIniFile()); Utils.Log("Hashing archives"); var oldHash = await Old.FileHashCachedAsync(); var newHash = await New.FileHashCachedAsync(); var oldArchive = new Archive(oldState) { Hash = oldHash, Size = Old.Size }; var newArchive = new Archive(newState) { Hash = newHash, Size = New.Size }; Utils.Log($"Contacting Server to request patch ({oldHash} -> {newHash}"); Utils.Log($"Response: {await ClientAPI.GetModUpgrade(oldArchive, newArchive, useAuthor: true)}"); return(ExitCode.Ok); }
//Ładowanie STK dla ANC private void LoadSTKtoAction() { TextBox OldANC; TextBox OldANCQ; TextBox NewANC; TextBox NewANCQ; Label OldSTK; Label NewSTK; Label Delta; string ANCOLD; string ANCNEW; decimal ANCOLDQ; decimal ANCNEWQ; decimal Old; decimal New; for (int counter = 1; counter <= ANCChangeNumber; counter++) { OldANC = (TextBox)mainProgram.TabControl.Controls.Find("TB_OldANC" + counter.ToString(), true).First(); OldANCQ = (TextBox)mainProgram.TabControl.Controls.Find("TB_OldANCQ" + counter.ToString(), true).First(); NewANC = (TextBox)mainProgram.TabControl.Controls.Find("TB_NewANC" + counter.ToString(), true).First(); NewANCQ = (TextBox)mainProgram.TabControl.Controls.Find("TB_NewANCQ" + counter.ToString(), true).First(); OldSTK = (Label)mainProgram.TabControl.Controls.Find("lab_OldSTK" + counter.ToString(), true).First(); NewSTK = (Label)mainProgram.TabControl.Controls.Find("lab_NewSTK" + counter.ToString(), true).First(); Delta = (Label)mainProgram.TabControl.Controls.Find("lab_Delta" + counter.ToString(), true).First(); ANCOLD = OldANC.Text; ANCNEW = NewANC.Text; ANCOLDQ = decimal.Parse(OldANCQ.Text); ANCNEWQ = decimal.Parse(NewANCQ.Text); if (ANCOLD != "") { Old = STKDictionary[ANCOLD] * ANCOLDQ; } else { Old = 0; } if (ANCNEW != "") { New = STKDictionary[ANCNEW] * ANCNEWQ; } else { New = 0; } OldSTK.Text = Old.ToString(); NewSTK.Text = New.ToString(); Delta.Text = (Old - New).ToString(); DeltaColor(Delta); } DeltaSum(); }
/// <summary> /// Clone this Activation completly /// </summary> /// <returns>the clone</returns> public override AnimationActivation Clone() { var act = new StatusChange(); act.Enabled = (ValueWrapper <bool>)Enabled.Clone(); act.Old = (ValueWrapper <Status>)Old.Clone(); act.New = (ValueWrapper <Status>)New.Clone(); return(act); }
private New GetNewItemFromDto(Old item, ref New newItem) { //Write the file into the directory from the byte stream string filePath = Path.Combine(DbConstants.ImageDirectory, item.filename); File.WriteAllBytes(filePath, item.image); newItem.imagePath = filePath; return(newItem); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.name == "LevelCompleteCheck") { Old = Current; CurrentLevelPosition.y -= 25; CurrentLevelPosition.z += 6; Old.GetComponent <LevelHandler>().Control = false; StartCoroutine(DestroyAfter5Seconds(Old)); Current = Instantiate(Prefab, CurrentLevelPosition, Quaternion.identity) as GameObject; } }
/// <summary> /// Code activity performs a search and replace on a string /// </summary> /// <param name="executionContext">The code activity context</param> /// <param name="crmWorkflowContext">The CRM workflow context</param> public override void ExecuteCRMWorkFlowActivity(CodeActivityContext executionContext, LocalWorkflowContext crmWorkflowContext) { var tracingService = executionContext.GetExtension <ITracingService>(); tracingService.Trace("Replace starting..."); try { if (crmWorkflowContext == null) { throw new ArgumentNullException(nameof(crmWorkflowContext)); } string text = Text.Get <string>(executionContext); string old = Old.Get <string>(executionContext); string @new = New.Get <string>(executionContext) ?? String.Empty; tracingService.Trace("Replace old '{0}' with new '{1}' on text '{3}'", old, @new, text); string result = string.Empty; if (!CaseSensitive.Get <bool>(executionContext)) { if (!String.IsNullOrEmpty(text) && !String.IsNullOrEmpty(old)) { result = text.Replace(old, @new); } } else { result = CompareAndReplace(text, old, @new, StringComparison.CurrentCultureIgnoreCase); } Result.Set(executionContext, result); } catch (Exception ex) { // Todo: Log the Error tracingService.Trace("Exception: " + ex); throw ex; } }
public static void UpdateTrigramDB(string fname, string newfname) { HashSet <TriGram> Old; using (Stream stream = File.Open(fname, FileMode.Open)) { Old = Serializer.Deserialize <HashSet <TriGram> >(stream); } TriGram[] New = Old.Where(t => t.PrePrevious != "*").ToArray(); using (Stream stream = File.Open(newfname, FileMode.Create)) { Serializer.Serialize <TriGram[]>(stream, New); } //test var test = new TrigramMarkovGenerator(); test.LoadFromFile(newfname); ; }
protected bool IsRowModified(GridViewRow r) { int ID; //int SignupTotalid; string Name; string IDnumber; string Birthday; string Old; string Who; string Bigbus; string Eat; string PS; ID = Convert.ToInt32(GridView3.DataKeys[r.RowIndex].Value); //SignupTotalid = int.Parse(((Label)r.FindControl("SignupTotalid")).Text); Name = ((TextBox)r.FindControl("Name")).Text; IDnumber = ((TextBox)r.FindControl("IDnumber")).Text; Birthday = ((TextBox)r.FindControl("Birthday")).Text; Old = ((TextBox)r.FindControl("Old")).Text; Who = ((TextBox)r.FindControl("Who")).Text; Bigbus = ((TextBox)r.FindControl("Bigbus")).Text; Eat = ((TextBox)r.FindControl("Eat")).Text; PS = ((TextBox)r.FindControl("PS")).Text; DataRow row = originalDataTable.Select(String.Format("ID = {0}", ID))[0]; //if (!SignupTotalid.Equals(row["SignupTotalid"].ToString())) { return true; } if (!Name.Equals(row["Name"].ToString())) { return(true); } if (!IDnumber.Equals(row["IDnumber"].ToString())) { return(true); } if (!Birthday.Equals(row["Birthday"].ToString())) { return(true); } if (!Old.Equals(row["Old"].ToString())) { return(true); } if (!Who.Equals(row["Who"].ToString())) { return(true); } if (!Bigbus.Equals(row["Bigbus"].ToString())) { return(true); } if (!Eat.Equals(row["Eat"].ToString())) { return(true); } if (!PS.Equals(row["PS"].ToString())) { return(true); } return(false); }
private void btnCancel_Click(object sender, EventArgs e) { Old.Copy(Program.Character); Confirm = false; Close(); }
private void btnReset_Click(object sender, EventArgs e) { Old.Copy(Program.Character); oPropertyGrid.SelectedObject = Program.Character; Invalidate(); }
public bool IsKeyToggleUp(Keys key) { return(New.IsKeyUp(key) && Old.IsKeyDown(key)); }
public bool Open(string path) { try { names.Clear(); msg.Clear(); XDocument xDoc = XDocument.Load(path, LoadOptions.PreserveWhitespace); XElement MSG1Doc = xDoc.Element("MSG1"); foreach (var NAME in MSG1Doc.Element("CharacterNames").Elements()) { int Index = Convert.ToInt32(NAME.Attribute("Index").Value); string OldNameSource = NAME.Element("OldNameSource").Value; string NewName = NAME.Element("NewName").Value; names.Add(new Names(Index, OldNameSource, NewName, NewCharList)); } foreach (var Message in MSG1Doc.Element("MSG").Elements()) { int Index = Convert.ToInt32(Message.Attribute("Index").Value); string Type = Message.Element("Type").Value; string Name = Message.Element("Name").Value; int CharacterNameIndex = Convert.ToInt32(Message.Element("CharacterNameIndex").Value); string SourceBytes_str = Message.Element("SourceBytes").Value; MSG temp = new MSG(Index, Type, Name, CharacterNameIndex, SourceBytes_str); msg.Add(temp); foreach (var Strings in Message.Element("MessageStrings").Elements()) { int StringIndex = Convert.ToInt32(Strings.Attribute("Index").Value); string NewString = Strings.Element("NewString").Value; MSG.MSGstr temp2 = new MSG.MSGstr(StringIndex, NewString, NewCharList) { CharacterIndex = CharacterNameIndex }; temp.Strings.Add(temp2); foreach (var Prefix in Strings.Elements("PrefixBytes")) { int PrefixIndex = Convert.ToInt32(Prefix.Attribute("Index").Value); string PrefixType = Prefix.Attribute("Type").Value; string PrefixBytes = Prefix.Value; temp2.Prefix.Add(new TextBaseElement(PrefixType, Utilities.String.SplitString(PrefixBytes, '-'))); } foreach (var Old in Strings.Elements("OldStringBytes")) { int OldIndex = Convert.ToInt32(Old.Attribute("Index").Value); string OldType = Old.Attribute("Type").Value; string OldBytes = Old.Value; temp2.OldString.Add(new TextBaseElement(OldType, Utilities.String.SplitString(OldBytes, '-'))); } foreach (var Postfix in Strings.Elements("PostfixBytes")) { int PostfixIndex = Convert.ToInt32(Postfix.Attribute("Index").Value); string PostfixType = Postfix.Attribute("Type").Value; string PostfixBytes = Postfix.Value; temp2.Postfix.Add(new TextBaseElement(PostfixType, Utilities.String.SplitString(PostfixBytes, '-'))); } } } OpenFileName = Path.GetFileName(Path.GetFullPath(path)); return(true); } catch (Exception e) { names.Clear(); msg.Clear(); OpenFileName = ""; Logging.Write("PTPfactory", e.ToString()); return(false); } }
public override string ToString() { return(Old.ToString() + " -> " + New.ToString()); }
public void SHowAge() { Old = Old.SetYear(YearOfProduction); Console.WriteLine($"Car {Name} is {Old} years old. Product {YearOfProduction} year"); }
private void OpenXmlPTP(Stream stream) { XDocument xDoc = XDocument.Load(stream, LoadOptions.PreserveWhitespace); XElement MSG1Doc = xDoc.Element("MSG1"); foreach (var NAME in MSG1Doc.Element("CharacterNames").Elements()) { int Index = Convert.ToInt32(NAME.Attribute("Index").Value); string OldNameSource = NAME.Element("OldNameSource").Value; string NewName = NAME.Element("NewName").Value; Names.Add(new PTPName(Index, OldNameSource, NewName)); } foreach (var Message in MSG1Doc.Element("MSG").Elements()) { int Index = Convert.ToInt32(Message.Attribute("Index").Value); int Type = Message.Element("Type").Value == "MSG" ? 0 : 1; string Name = Message.Element("Name").Value; int CharacterNameIndex = Convert.ToInt32(Message.Element("CharacterNameIndex").Value); PTPMSG temp = new PTPMSG(Index, Type, Name, CharacterNameIndex); Msg.Add(temp); foreach (var Strings in Message.Element("MessageStrings").Elements()) { int StringIndex = Convert.ToInt32(Strings.Attribute("Index").Value); string NewString = Strings.Element("NewString").Value; PTPMSGstr temp2 = new PTPMSGstr(StringIndex, NewString) { CharacterIndex = CharacterNameIndex }; temp.Strings.Add(temp2); foreach (var Prefix in Strings.Elements("PrefixBytes")) { int PrefixIndex = Convert.ToInt32(Prefix.Attribute("Index").Value); string PrefixType = Prefix.Attribute("Type").Value; string PrefixBytes = Prefix.Value; temp2.Prefix.Add(new TextBaseElement(PrefixType == "Text" ? true : false, StringTool.SplitString(PrefixBytes, '-'))); } foreach (var Old in Strings.Elements("OldStringBytes")) { int OldIndex = Convert.ToInt32(Old.Attribute("Index").Value); string OldType = Old.Attribute("Type").Value; string OldBytes = Old.Value; temp2.OldString.Add(new TextBaseElement(OldType == "Text" ? true : false, StringTool.SplitString(OldBytes, '-'))); } foreach (var Postfix in Strings.Elements("PostfixBytes")) { int PostfixIndex = Convert.ToInt32(Postfix.Attribute("Index").Value); string PostfixType = Postfix.Attribute("Type").Value; string PostfixBytes = Postfix.Value; temp2.Postfix.Add(new TextBaseElement(PostfixType == "Text" ? true : false, StringTool.SplitString(PostfixBytes, '-'))); } } } }
private void OldString_ListChanged(object sender, ListChangedEventArgs e) { Old?.Invoke(OldString); Notify("OldString"); }