//---------- Save Remaining Time ---------- //********* Save App Monitoring ********* void SaveAppMonitoring() { try { Directory.CreateDirectory(PathMS + "/MonitoringReports/App/"); save.Destroy(); save = new SaveWriter(PathMS + "/MonitoringReports/App/" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".apprep"); save.AddItem("Count", appinfo.Count); for (int i = 0; i < appinfo.Count; i++) { appinfo[i].CalcTime(); save.AddItem("Title_" + i, appinfo[i].ApplicationName); save.AddItem("Module_" + i, appinfo[i].ExecutableName); save.AddItem("TimeMin_" + i, appinfo[i].GetMinutes()); save.AddItem("TimeHours_" + i, appinfo[i].GetHours()); } save.AddItem("PCTimeHour", PCHour); save.AddItem("PCTimeMinutes", PCMin); save.Save(); save.Destroy(); }catch (Exception ex) { DebugService.WriteError("" + ex); } }
}//----- Form 1 Load ----- //******* Get notice ******** void GetNotice() { Directory.CreateDirectory(PathMS + "/MonitoringReports/Notes/"); Directory.CreateDirectory(PathMS + "/Temp/"); DirectoryInfo dir = new DirectoryInfo(PathMS + "/MonitoringReports/Notes/"); SaveWriter load = new SaveWriter(); if (File.Exists(PathMS + "/Temp/Rnotes.dat")) { File.Delete(PathMS + "/Temp/Rnotes.dat"); } SaveWriter save = new SaveWriter(PathMS + "/Temp/Rnotes.dat"); int k = 0; foreach (FileInfo file in dir.GetFiles("*.notesp")) { load.Destroy(); load.PathToFile = file.FullName; load.Load(); if (load.GetItemBool("Warn")) { save.AddItem("NotePath" + k, file.FullName); save.AddItem("NoteDate" + k, load.GetItem("WarnTimeDate")); k++; } } save.AddItem("Count", k); save.Save(); }
//********* Load App Monitoring ********* public static List <ApplicationInfo> LoadAppMonitoring(string name) { List <ApplicationInfo> appinfo = new List <ApplicationInfo>(); try { SaveWriter save = new SaveWriter(); if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/MonitoringReports/App/" + name + ".apprep")) { save = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/MonitoringReports/App/" + name + ".apprep"); save.Load(); for (int i = 0; i < save.GetItemInt("Count"); i++) { ApplicationInfo inf = new ApplicationInfo(save.GetItem("Title_" + i), save.GetItem("Module_" + i)); inf.SetTime(save.GetItemInt("TimeHours_" + i), save.GetItemInt("TimeMin_" + i)); appinfo.Add(inf); } PCHour = save.GetItemInt("PCTimeHour"); PCMin = save.GetItemInt("PCTimeMinutes"); save.Destroy(); } } catch (Exception ex) { Debug.WriteLine("" + ex); return(appinfo); } return(appinfo); }
/// <summary> /// Updates any changes made to the object data. /// </summary> /// <param name="reader"> /// The SaveWriter to write to. /// It should point to the same stream that was used to load the object data, as seeking will be done automatically. /// </param> public virtual void Update(SaveWriter writer) { long chunkStartOffset = _entry.FileOffset + 0x08 + (long)TableOffset.ObjectPool; // Strength info writer.SeekTo(chunkStartOffset + StrengthInfoOffset); _healthInfo.WriteTo(writer); // Position1 writer.SeekTo(chunkStartOffset + PositionOffset1); writer.WriteFloat(_positionMain.X); writer.WriteFloat(_positionMain.Y); writer.WriteFloat(_positionMain.Z); // Calculate extra position vectors Vector3 position2 = Vector3.Add(_position2Delta, _positionMain); Vector3 position3 = Vector3.Add(_position3Delta, _positionMain); // Position2 writer.SeekTo(chunkStartOffset + PositionOffset2); writer.WriteFloat(position2.X); writer.WriteFloat(position2.Y); writer.WriteFloat(position2.Z); // Position3 writer.SeekTo(chunkStartOffset + PositionOffset3); writer.WriteFloat(position3.X); writer.WriteFloat(position3.Y); writer.WriteFloat(position3.Z); }
/// <summary> /// Write the header of the save /// </summary> /// <param name="writer">The SaveWriter stream of the save.</param> /// <seealso cref="SaveIO.SaveWriter"/> public void WriteTo(SaveWriter writer) { //// Write Map Scenario //writer.Seek(8, System.IO.SeekOrigin.Begin); //writer.WriteASCII(_mapScenario, 0x100); //// Write Engine Build //writer.Seek(0x108, System.IO.SeekOrigin.Begin); //writer.WriteASCII(_engineBuild, 0x20); //// Write Disk Map Location //writer.Seek(0x154, System.IO.SeekOrigin.Begin); //writer.WriteASCII(_mapDiskLocation, 0x25); //// Write Difficulty //writer.Seek(0xE72B, SeekOrigin.Begin); //writer.WriteByte((byte)_difficulty); //// Write Gamertag1 //writer.Seek(0xE6D8, System.IO.SeekOrigin.Begin); //writer.WriteUTF16(_gamertag); //// Write ServiceTag //writer.Seek(0xE70E, System.IO.SeekOrigin.Begin); //writer.WriteUTF16(_serviceTag); //// Write Gamertag2 //writer.Seek(0xE7A0, System.IO.SeekOrigin.Begin); //writer.WriteUTF16(_gamertag); }
private void btnFix_Click(object sender, EventArgs e) { if (_stream != null && _stream.CanWrite && streamReader != null && textBox1.Text != "") { streamWriter = new SaveWriter(new FileStream(textBox1.Text, FileMode.OpenOrCreate)); // Load the whole stream into memory MemoryStream memoryStream = new MemoryStream((int)streamReader.Length); memoryStream.SetLength(streamReader.Length); streamReader.Seek(0x00, SeekOrigin.Begin); streamReader.ReadBlock(memoryStream.GetBuffer(), 0, (int)memoryStream.Length); // Hash the contents memoryStream.Position = 0x2D25C; memoryStream.Write(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 20); byte[] hash = SaveSHA1.ComputeHash(memoryStream.GetBuffer()); // Write the new digest streamWriter.Seek(0x2D25C, SeekOrigin.Begin); foreach (byte hashPart in hash) { streamWriter.WriteByte(hashPart); } streamWriter.Close(); MessageBox.Show("Save resigned."); } }
//---------- Save App Monitoring ---------- //********* Load App Monitoring ********* void LoadAppMonitoring() { try { Directory.CreateDirectory(PathMS + "/MonitoringReports/App/"); if (File.Exists(PathMS + "/MonitoringReports/App/" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".apprep")) { save = new SaveWriter(PathMS + "/MonitoringReports/App/" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".apprep"); save.Load(); for (int i = 0; i < save.GetItemInt("Count"); i++) { ApplicationInfo inf = new ApplicationInfo(save.GetItem("Title_" + i), save.GetItem("Module_" + i)); inf.SetTime(save.GetItemInt("TimeHours_" + i), save.GetItemInt("TimeMin_" + i)); appinfo.Add(inf); } PCHour = save.GetItemInt("PCTimeHour"); PCMin = save.GetItemInt("PCTimeMinutes"); save.Destroy(); } } catch (Exception ex) { DebugService.WriteError("" + ex); } }
public override XElement GetSaveElement() { XElement element = SaveWriter.GetActionSaveElement(targetAction); element.SetAttributeValue("Delay", Delay); element.SetAttributeValue("DelayHost", DelayHost); return(element); }
public override void Update(SaveWriter writer) { base.Update(writer); writer.SeekTo(SourceOffset + AmmoOffset); writer.WriteInt16(_remainingAmmo); writer.WriteInt16(_clipAmmo); }
public override void Update(SaveWriter writer) { base.Update(writer); // Grenades writer.SeekTo(SourceOffset + GrenadesOffset); writer.WriteSByte(_fragGrenades); writer.WriteSByte(_plasmaGrenades); }
public void Update(SaveWriter writer) { foreach (GameObject obj in _objects) { if (obj != null) { obj.Update(writer); } } }
internal static void Save(ref SaveWriter sw) { String r = ""; foreach (var rec in areas) { r = r + rec.X.ToString() + ";" + rec.Y.ToString() + ";" + rec.Width.ToString() + ";" + rec.Height.ToString() + "\r\n"; } sw.WriteLine(r.Length.ToString()); sw.WriteLine(r); }
private void Form1_Load(object sender, EventArgs e) { notifyIcon1.MouseClick += notifyIcon1_MouseClick; NotifyText = notifyIcon1.Text; MinutesText = labelremtime.Text; if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Block/ComputerTime.dat")) { SaveWriter save = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Block/ComputerTime.dat"); save.Load(); if (save.GetItemBool("Enable")) { Time = save.GetItemInt("WarningTime"); labelremtime.Text = "" + Time + " " + MinutesText; notifyIcon1.Text = NotifyText + " " + Time + " " + MinutesText; } save.Destroy(); } else { Application.Exit(); } if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/shwwrn.dat")) { File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/shwwrn.dat"); } else { // Application.Exit(); } try { SoundPlayer player = new SoundPlayer(Properties.Resources.warning); player.Play(); }catch (Exception ex) { } try { IntPtr lHwnd = FindWindow("Shell_TrayWnd", null); SendMessage(lHwnd, WM_COMMAND, (IntPtr)MIN_ALL, IntPtr.Zero); WindowState = FormWindowState.Normal; } catch (Exception ex) { } }
private void button1_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(textBoxuser.Text)) { if (!string.IsNullOrWhiteSpace(textBoxpass.Text)) { try { string pass = encrypt.EncryptText(textBoxpass.Text, "ZuhajoLafyNAYjCAw2VZfaYo"); XmppClient client = new XmppClient(Server, AppPrefix + textBoxuser.Text, pass); client.Connect(); Debug.WriteLine("Logged in as: " + client.Jid); XmppClient clientad = new XmppClient(Server, "Admin_" + AppPrefix + textBoxuser.Text, pass); clientad.Connect(); Debug.WriteLine("Logged in as: " + clientad.Jid); Directory.CreateDirectory(PathMS + "/Settings/"); if (File.Exists(PathMS + "/Settings/chat.dat")) { File.Delete(PathMS + "/Settings/chat.dat"); } SaveWriter save = new SaveWriter(PathMS + "/Settings/chat.dat"); save.AddItem("Username", AppPrefix + textBoxuser.Text); save.AddItem("Password", encryptpass.EncryptString(pass, "1cPOnaLrV2MusS4Cq3aU6dja")); save.AddItem("Admin", radioButtonAdmin.Checked); save.Save(); save.Destroy(); pass = ""; MessageBox.Show("Logged in", "OK"); Application.Exit(); } catch (Exception ex) { MessageBox.Show("User not exist, or bad password", "Error"); } } else { MessageBox.Show("Empty password"); } } else { MessageBox.Show("Empty Username"); } }
void changelocation() { try { bool showw = bool.Parse(HelpClass.GETHtml("http://myspy.diodegames.eu/ShowWeather.txt")); if (showw) { bool change = false; if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/location.dat")) { File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/location.dat"); } CityLocator city = new CityLocator(); city.GetGeoCoordByCityNameEmail(textBoxlocation.Text, "*****@*****.**"); SaveWriter Loc = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/location.dat"); Loc.AddItem("City", city.PlaceDisplayName); Loc.AddItem("Latitude", city.Latitude); Loc.AddItem("Longtitude", city.Longtitude); Loc.Save(); textBoxlocation.Text = city.PlaceDisplayName; change = true; if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathersettings.dat")) { File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathersettings.dat"); } SaveWriter wsave = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathersettings.dat"); wsave.AddItem("Unit", radioButton2.Checked); wsave.Save(); if (change) { if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weather.dat")) { File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weather.dat"); } if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathericon.dat")) { File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathericon.dat"); } } } } catch (Exception ex) { Debug.WriteLine("" + ex); } }
private void WriteToStream(Stream stream) { SaveWriter writer = new SaveWriter(stream); // Update the object list _objectList.Update(writer); // Now update the file header (this is done last so the file is resigned correctly) writer.SeekTo(0); _fileHeader.Update(writer, stream); }
private void Form1_Load(object sender, EventArgs e) { //Thread na zrychlenie nacitania niektorych veci new Thread(() => { Thread.CurrentThread.IsBackground = true; try { Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/"); SaveWriter save = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/appreport.dat"); try { if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/appreport.dat")) { File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/appreport.dat"); } } catch (Exception ex) { } int k = 0; Process[] processes = Process.GetProcesses(); foreach (Process pr in processes) { try { if (!string.IsNullOrEmpty(pr.MainWindowTitle)) { // Debug.WriteLine(pr.MainWindowTitle + " (" + pr.MainModule.ModuleName + ") " + pr.Id + " Session: " + pr.SessionId); save.AddItem("Title_" + k, pr.MainWindowTitle); save.AddItem("Module_" + k, pr.MainModule.ModuleName); k++; } } catch (Exception ex) { } } save.AddItem("Count", k); save.Save(); } catch (Exception ex) { } Application.Exit(); }).Start(); //koniec threadu }
private void Form1_Load(object sender, EventArgs e) { day = DateTime.Now.Day; keylogger = bool.Parse((string)registry.GetValue("Keylogger", "False")); internet = bool.Parse((string)registry.GetValue("Internet", "False")); if (keylogger) { ShowWarning(); } if (internet) { try { RegistryKey registryi = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true); registryi.SetValue("ProxyEnable", 1); registryi.SetValue("ProxyServer", "127.0.0.1:8333"); InternetReports.BlockSites = bool.Parse((string)registry.GetValue("InternetBlockList", "False")); InternetReports.BlockSocialSites = bool.Parse((string)registry.GetValue("InternetBlockSocial", "False")); if (InternetReports.BlockSites) { if (File.Exists(PathMS + "/Block/BlockWebsites.dat")) { SaveWriter set = new SaveWriter(PathMS + "/Block/BlockWebsites.dat"); set.Load(); for (int i = 0; i < set.GetItemInt("Count"); i++) { InternetReports.WebBlock.Add(set.GetItem("Website" + i)); } } } Directory.CreateDirectory(PathMS + "/MonitoringReports/Internet/"); InternetReports.save = new StreamWriter(PathMS + "/MonitoringReports/Internet/" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".dat", true); int port = 8333; //const bool bUseIPv6 = false; TcpServer Server = new TcpServer(port, false); Server.Start(TransparentProxy.CreateProxy); }catch (Exception ex) { Debug.WriteLine("" + ex); } } }
//----- Start Worker ----- //******** Work With Running Applications ******** //Skontroluje spustene aplikacie void WorkWithRunningApplications() { if (day != ((short)DateTime.Now.Day)) { PCHour = 0; PCMin = 0; appinfo.Clear(); day = (short)DateTime.Now.Day; } if (File.Exists(PathMS + "/Temp/appreport.dat")) { try { save.Destroy(); save = new SaveWriter(PathMS + "/Temp/appreport.dat"); save.Load(); int count = save.GetItemInt("Count"); for (int i = 0; i < count; i++) { bool found = false; string executable = save.GetItem("Module_" + i); for (int j = 0; j < appinfo.Count; j++) { if (appinfo[j].ExecutableName.Equals(executable)) { found = true; appinfo[j].AddTime(5); } } if (!found) { appinfo.Add(new ApplicationInfo(save.GetItem("Title_" + i), executable)); } } save.Destroy(); } catch (Exception ex) { ApplicationLoader.PROCESS_INFORMATION procInfos; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/GetRunningApplications.exe", out procInfos); DebugService.WriteError("Bad load data: " + ex); return; } } ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/GetRunningApplications.exe", out procInfo); }
/// <summary> /// Write data to the mmiof.bmf file /// </summary> /// <param name="stream">Stream of the mmiof.bmf file.</param> private void WriteToStream(Stream stream) { SaveIO.SaveWriter writer = new SaveWriter(stream); // Write Save Header _saveHeader.WriteTo(writer); writer.SeekTo(0); // Write the object list _objectList.Update(writer); writer.SeekTo(0); // Resign the Save _saveHeader.Resign(writer, stream); }
/// <summary> /// Fix the SHA-1 Salted hash in the header of the save. /// </summary> /// <param name="writer">The SaveWriter stream of the save.</param> /// <param name="stream">An Open Stream of the file</param> /// <seealso cref="Security.SaveSHA1"/> /// <seealso cref="SaveIO.SaveWriter"/> public void Resign(SaveWriter writer, Stream stream) { // Load the whole stream into memory MemoryStream memoryStream = new MemoryStream((int)stream.Length); memoryStream.SetLength(stream.Length); stream.Position = 0; stream.Read(memoryStream.GetBuffer(), 0, (int)memoryStream.Length); // Hash the contents memoryStream.Position = 0x2D25C; memoryStream.Write(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 20); byte[] hash = Security.SaveSHA1.ComputeHash(memoryStream.GetBuffer()); // Write the new digest stream.Position = 0x2D25C; stream.Write(hash, 0, 20); }
public frmEuroTracker(frmProfileSelector profiles) { mainThread = profiles; profile = profiles.GetProfileReader(); InitializeComponent(); data = new DataHandler(); client = new Ets2SdkTelemetry(); save = new SaveReader(profile.GetAutosaveLocation(), profile.GetQuicksaveLocation()); savewriter = new SaveWriter(profile.GetAutosaveLocation(), profile.GetQuicksaveLocation()); maxSpeed = 0; avgFuelConsumption = 0; //Setup Syncing Voids client.Data += UpdateData; client.JobFinished += TelemetryOnJobFinished; client.JobStarted += TelemetryOnJobStarted; }
/// <summary> /// Updates any changes made to the object data. /// </summary> /// <param name="reader"> /// The SaveWriter to write to. /// It should point to the same stream that was used to load the object data, as seeking will be done automatically. /// </param> public virtual void Update(SaveWriter writer) { // Strength info writer.SeekTo(SourceOffset + StrengthInfoOffset); _healthInfo.WriteTo(writer); // Position writer.SeekTo(SourceOffset + PositionOffset1); writer.WriteFloat(Position.X); writer.WriteFloat(Position.Y); writer.WriteFloat(Position.Z); Vector3 position2 = Vector3.Add(_unkPosition, _position); writer.SeekTo(SourceOffset + PositionOffset2); writer.WriteFloat(position2.X); writer.WriteFloat(position2.Y); writer.WriteFloat(position2.Z); }
//---------- Load App Monitoring ---------- void LoadStatistics() { try { if (File.Exists(PathMS + "/Stats/Today.sts")) { SaveWriter save = new SaveWriter(PathMS + "/Stats/Today.sts"); save.Load(); if (save.GetItemInt("Day") == DateTime.Now.Day) { allhour = save.GetItemInt("Hours"); allmin = save.GetItemShort("Mins"); } } }catch (Exception ex) { DebugService.WriteError("" + ex); } }
private void imageButtonAlert_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show(ResourcesFiles.ProgramStrings.Cancelremindtext, ResourcesFiles.ProgramStrings.Cancelremind, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { SaveWriter save = new SaveWriter(pthspc); save.Load(); save.LoadedValuesToSaveValues(); File.Delete(pthspc); save.RemoveItem("Warn"); save.AddItem("Warn", false); save.Save(); imageButtonAlert.Visible = false; HelpClass.NotesChange = true; } else if (dialogResult == DialogResult.No) { } }
private void NoteForm_Load(object sender, EventArgs e) { if (remindshow) { TopMost = true; } this.Paint += NoteForm_Paint; labelText.Text = File.ReadAllText(Path); pthspc = Path.Replace(".note", ".notesp"); save = new SaveWriter(pthspc); save.Load(); password = save.GetItemBool("Password"); tt.InitialDelay = 10; if (save.GetItemBool("Warn")) { imageButtonAlert.Visible = true; imageButtonAlert.MouseHover += PictureBoxAlert_MouseHover; } if (password) { groupBox1.Visible = true; } if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/FavoriteNote.dat")) { if (File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/FavoriteNote.dat").Equals(Path)) { FavoriteClick = true; imageButtonfavorite.normalImage = Properties.Resources.starfull; imageButtonfavorite.NormalImage = Properties.Resources.starfull; imageButtonfavorite.HoverImage = Properties.Resources.starfullhover; imageButtonfavorite.ClickImage = Properties.Resources.starfullclick; } } }
/// <summary> /// Updates any changes made to the object data. /// </summary> /// <param name="reader"> /// The SaveWriter to write to. /// It should point to the same stream that was used to load the object data, as seeking will be done automatically. /// </param> public virtual void Update(SaveWriter writer) { // Strength info long chunkStartOffset = _entry.ObjectAddress + (long)TableOffset.ObjectPool; writer.SeekTo(chunkStartOffset + StrengthInfoOffset); _healthInfo.WriteTo(writer); // BSP Zone writer.SeekTo(chunkStartOffset + 0x18); writer.WriteUInt16(_zone); // Position1 writer.SeekTo(chunkStartOffset + PositionOffset1); writer.WriteFloat(_positionMain.X); writer.WriteFloat(_positionMain.Y); writer.WriteFloat(_positionMain.Z); // Calculate extra position vectors Vector3 position2 = Vector3.Add(_position2Delta, _positionMain); Vector3 position3 = Vector3.Add(_position3Delta, _positionMain); Vector3 position4 = Vector3.Add(_position4Delta, _positionMain); // Position2 writer.SeekTo(chunkStartOffset + PositionOffset2); writer.WriteFloat(position2.X); writer.WriteFloat(position2.Y); writer.WriteFloat(position2.Z); // Position3 writer.SeekTo(chunkStartOffset + PositionOffset3); writer.WriteFloat(position3.X); writer.WriteFloat(position3.Y); writer.WriteFloat(position3.Z); // Position4 writer.SeekTo(chunkStartOffset + PositionOffset4); writer.WriteFloat(position4.X); writer.WriteFloat(position4.Y); writer.WriteFloat(position4.Z); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { string password = encryption.DecryptString((string)registry.GetValue("Properties"), "2pqB7l4eRM6nHaZPtetkkHePguacGTvrMhvnE4fy"); if (textBoxPassword.Text.Equals(password)) { SaveWriter save = new SaveWriter(PathMS + "/Temp/secure.pas"); save.AddItem("Token", encryption.EncryptString("M0F2s1Pwza", "BduIfxDmGPn5Xmk4DYqCHFkqg")); int time = (DateTime.Now.Hour * 60) + DateTime.Now.Minute; save.AddItem("Time", encryption.EncryptString("" + time, "f0Hy3j4tU5")); save.Save(); backgroundWorker1.ReportProgress(0, ""); } else { SoundPlayer player = new SoundPlayer(Properties.Resources.error); player.Play(); backgroundWorker1.ReportProgress(1, ""); } password = ""; }
void NewWeather(string latitude, string longtitude, string cityName) { if (File.Exists(PathMS + "/Temp/weather.dat")) { File.Delete(PathMS + "/Temp/weather.dat"); } if (File.Exists(PathMS + "/Temp/weathericon.dat")) { File.Delete(PathMS + "/Temp/weathericon.dat"); } if (weather.GetWeatherData(latitude, longtitude)) { weather.weatherinfo.CityName = cityName; SaveWriter save = new SaveWriter(PathMS + "/Temp/weather.dat"); save.AddItem("City", weather.weatherinfo.CityName); save.AddItem("Temperature", weather.weatherinfo.Temperature); save.AddItem("Clouds", weather.weatherinfo.Cloudiness); save.AddItem("Day", DateTime.Now.Day); save.AddItem("Hour", DateTime.Now.Hour); save.Save(); if (DateTime.Now.Hour > 21 || DateTime.Now.Hour < 6) { weathericon = weather.GetIcon(1); } else { weathericon = weather.GetIcon(0); } weathericon.Save(PathMS + "/Temp/weathericon.dat", ImageFormat.Png); backgroundWorkerWeather.ReportProgress(0, ""); } }
//--------- Work With Running Applications ---------- //********* Save Remaining Time ********* void SaveRemainingTime() { try { Directory.CreateDirectory(PathMS + "/Block/"); string rpath = PathMS + "/Block/RemTime.dat"; if (File.Exists(rpath)) { File.Delete(rpath); } save.Destroy(); save = new SaveWriter(rpath); save.AddItem("Day", DateTime.Now.Day); save.AddItem("Time", MaxTimePC); save.Save(); } catch (Exception ex) { DebugService.WriteError("" + ex); } }