// Token: 0x06000003 RID: 3 RVA: 0x000020A8 File Offset: 0x000002A8 private void SMTP(string pipe, string input) { if (global::MainDab.Classes.WeAreDevsAPI.ExploitAPI.NamedPipeExist(pipe)) { try { using (global::System.IO.Pipes.NamedPipeClientStream namedPipeClientStream = new global::System.IO.Pipes.NamedPipeClientStream(".", pipe, global::System.IO.Pipes.PipeDirection.Out)) { namedPipeClientStream.Connect(); using (global::System.IO.StreamWriter streamWriter = new global::System.IO.StreamWriter(namedPipeClientStream)) { streamWriter.Write(input); streamWriter.Dispose(); } namedPipeClientStream.Dispose(); } return; } catch (global::System.IO.IOException) { global::System.Windows.Forms.MessageBox.Show("Error occured sending message to the game!", "Connection Failed!", global::System.Windows.Forms.MessageBoxButtons.OK, global::System.Windows.Forms.MessageBoxIcon.Hand); return; } catch (global::System.Exception ex) { global::System.Windows.Forms.MessageBox.Show(ex.Message.ToString()); return; } } global::System.Windows.Forms.MessageBox.Show("Error occured. Did the dll properly inject?", "Oops", global::System.Windows.Forms.MessageBoxButtons.OK, global::System.Windows.Forms.MessageBoxIcon.Exclamation); }
// Token: 0x06000003 RID: 3 RVA: 0x00002094 File Offset: 0x00000294 public void Execute(string Script) { bool flag = RevenantAPI.namedPipeExist(this.pipeName); bool flag2 = flag; if (flag2) { using (global::System.IO.Pipes.NamedPipeClientStream namedPipeClientStream = new global::System.IO.Pipes.NamedPipeClientStream(".", this.pipeName, global::System.IO.Pipes.PipeDirection.Out)) { namedPipeClientStream.Connect(); using (global::System.IO.StreamWriter streamWriter = new global::System.IO.StreamWriter(namedPipeClientStream, global::System.Text.Encoding.Default, 0xF423F)) { streamWriter.Write(Script); streamWriter.Dispose(); } namedPipeClientStream.Dispose(); } } else { bool flag3 = global::System.IO.File.Exists("Arch.dll"); if (flag3) { global::System.Windows.Forms.MessageBox.Show("Please attach!", "Error!", global::System.Windows.Forms.MessageBoxButtons.OK, global::System.Windows.Forms.MessageBoxIcon.Hand); } } }
public async Task <string> SerializeMarshallAsync <T>(T t) { // if you can, only create one serializer // creating serializers is an expensive // operation and can be slow global::System.Xml.Serialization.XmlSerializer serializer = null; serializer = new global::System.Xml.Serialization.XmlSerializer(typeof(T)); // we will write the our result to memory //await using global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream(); // the string will be utf8 encoded //await using global::System.IO.StreamWriter writer = new global::System.IO.StreamWriter ( stream, global::System.Text.Encoding.UTF8 ); // here we go! serializer.Serialize(writer, t); // flush our write to make sure its all there await writer.FlushAsync(); // reset the stream back to 0 stream.Position = 0; using global::System.IO.StreamReader reader = new global::System.IO.StreamReader(stream); string xml = await reader.ReadToEndAsync(); return(xml); }
/// <summary> /// 通过密钥对文本进行加密 /// </summary> /// <param name="str"></param> /// <param name="SecretKey">密钥</param> /// <param name="SingleLine">True:单行;False:所有</param> /// <param name="Standard">是否使用标准方式</param> /// <returns>加密后的文本</returns> public static string Encrypt(this string str, string SecretKey, bool SingleLine = true, bool Standard = false) { DESCryptoServiceProvider des = new DESCryptoServiceProvider(); if (Standard) { des.Mode = CipherMode.ECB; des.Padding = PaddingMode.Zeros; } des.Key = SecretKey.ToMD5().Substring(0, 0x08).ToBytes(); des.IV = SecretKey.ToMD5().Substring(0, 0x08).ToBytes(); global::System.IO.MemoryStream ms = new global::System.IO.MemoryStream(); CryptoStream encStream = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write); global::System.IO.StreamWriter sw = new global::System.IO.StreamWriter(encStream); if (SingleLine) sw.WriteLine(str); else sw.Write(str); sw.Close(); encStream.Close(); byte[] buffer = ms.ToArray(); ms.Close(); StringBuilder hash = new StringBuilder(); foreach (byte b in buffer.ToArray()) { hash.AppendFormat("{0:X2}", b); } return hash.ToString(); }
/// <summary> /// Saves the diagram. /// </summary> /// <typeparam name="TModel">The type of the model.</typeparam> /// <param name="serializationResult">The serialization result.</param> /// <param name="modelRoot">The model root.</param> /// <param name="modelFileName">Name of the model file.</param> /// <param name="diagram">The diagram.</param> /// <param name="diagramFileName">Name of the diagram file.</param> /// <param name="encoding">The encoding.</param> /// <param name="writeOptionalPropertiesWithDefaultValue">if set to <c>true</c> [write optional properties with default value].</param> public void SaveDiagram <TModel>(DslModeling::SerializationResult serializationResult, TModel modelRoot, string modelFileName, ComponentModelDiagram diagram, string diagramFileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) where TModel : ModelElement { if (serializationResult.Failed) { return; } // MonikerResolver shouldn't be required in Save operation, so not calling SetupMonikerResolver() here. using (global::System.IO.MemoryStream diagramFileContent = new global::System.IO.MemoryStream()) { DslModeling::DomainClassXmlSerializer diagramSerializer = this.Directory.GetSerializer(diagram.GetDomainClass().Id); global::System.Diagnostics.Debug.Assert(diagramSerializer != null, "Cannot find serializer for " + diagram.GetDomainClass().Name + "!"); if (diagramSerializer != null) { DslModeling::SerializationContext serializationContext = new DslModeling::SerializationContext(this.Directory, diagramFileName, serializationResult); serializationContext.WriteOptionalPropertiesWithDefaultValue = writeOptionalPropertiesWithDefaultValue; global::System.Xml.XmlWriterSettings settings = new global::System.Xml.XmlWriterSettings(); settings.Indent = true; settings.Encoding = encoding; using (global::System.IO.StreamWriter streamWriter = new global::System.IO.StreamWriter(diagramFileContent, encoding)) { using (global::System.Xml.XmlWriter writer = global::System.Xml.XmlWriter.Create(streamWriter, settings)) { diagramSerializer.WriteRootElement(serializationContext, diagram, writer); } } } if (!serializationResult.Failed) { // Only write the contents if there's no error encountered during serialization. if (diagramFileContent != null) { IVsQueryEditQuerySave2 scc = ServiceLocator.Instance.GetService <IVsQueryEditQuerySave2>(typeof(SVsQueryEditQuerySave)); if (scc != null) { uint result; if (scc.QuerySaveFile(diagramFileName, 0, null, out result) != (int)tagVSQuerySaveResult.QSR_SaveOK) { return; } } using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(diagramFileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None)) { using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { writer.Write(diagramFileContent.ToArray()); } } } } } }
public void Close() { if (tr != null) { tr.Close(); } if (tw != null) { tw.Close(); } tr = null; tw = null; }
public bool Replace(string line, string to) { if (tw == null) { return(false); } try { FileInfo fi = new FileInfo(_path); fi.CopyTo(_path + ".tmp"); tw.Close(); tw = new StreamWriter(_path, false); StreamReader sr = new StreamReader(_path + ".tmp"); string l, id = ""; while ((l = sr.ReadLine()) != null) { int pos = l.IndexOf(":"); if (pos != -1) { id = l.Substring(0, pos); l = l.Substring(pos + 1, l.Length - pos - 1); } if (l == line) { tw.WriteLine(id + ":" + to); } else { tw.WriteLine(id + ":" + l); } } sr.Close(); tw.Close(); fi = new FileInfo(_path + ".tmp"); fi.Delete(); tw = new StreamWriter(_path, true); return(true); } catch { return(false); } }
public bool ReplaceHoleLine(string line, string to) { if (tw == null) { return(false); } try { bool ret = false; FileInfo fi = new FileInfo(_path); fi.CopyTo(_path + ".tmp"); tw.Close(); tw = new StreamWriter(_path, false); StreamReader sr = new StreamReader(_path + ".tmp"); string l; while ((l = sr.ReadLine()) != null) { if (l == line) { tw.WriteLine(to); ret = true; } else { tw.WriteLine(l); } } sr.Close(); tw.Close(); fi = new FileInfo(_path + ".tmp"); fi.Delete(); tw = new StreamWriter(_path, true); return(ret); } catch { return(false); } }
// Token: 0x06000488 RID: 1160 RVA: 0x00017428 File Offset: 0x00015628 public void SaveDictionary(string path) { this.EnsurePath(path); using (global::System.IO.StreamWriter streamWriter = new global::System.IO.StreamWriter(global::System.IO.File.Open(path, 4), global::System.Text.Encoding.UTF8)) { streamWriter.BaseStream.SetLength(0L); foreach (global::System.Reflection.FieldInfo fieldInfo in global::VRGIN.Controls.Speech.DictionaryReader.ExtractCommands(this.BaseType)) { streamWriter.WriteLine("[{0}]", fieldInfo.Name); global::VRGIN.Controls.Speech.VoiceCommand voiceCommand = fieldInfo.GetValue(null) as global::VRGIN.Controls.Speech.VoiceCommand; bool flag = voiceCommand != null; if (flag) { foreach (string text in voiceCommand.Texts) { streamWriter.WriteLine(text); } } streamWriter.WriteLine(); } } }
// Token: 0x06000004 RID: 4 RVA: 0x00002210 File Offset: 0x00000410 public void ExecuteScript(string Script) { if (Module.namedPipeExist("ocybedam")) { using (global::System.IO.Pipes.NamedPipeClientStream namedPipeClientStream = new global::System.IO.Pipes.NamedPipeClientStream(".", "ocybedam", global::System.IO.Pipes.PipeDirection.Out)) { namedPipeClientStream.Connect(); using (global::System.IO.StreamWriter streamWriter = new global::System.IO.StreamWriter(namedPipeClientStream, global::System.Text.Encoding.Default, 0xF423F)) { streamWriter.Write(Script); streamWriter.Dispose(); } namedPipeClientStream.Dispose(); } return; } if (global::System.IO.File.Exists("EasyExploitsDLL.dll")) { global::System.Windows.Forms.MessageBox.Show("Please attach!", "NamedPipeDoesntExist", global::System.Windows.Forms.MessageBoxButtons.OK, global::System.Windows.Forms.MessageBoxIcon.Hand); return; } //global::System.Windows.Forms.MessageBox.Show("Please turn off your antivirus! bruh", "DLLDoesntExist", global::System.Windows.Forms.MessageBoxButtons.OK, global::System.Windows.Forms.MessageBoxIcon.Hand); }
public ConfigTextStream(string name, bool write, bool append) { try { _path = SystemVariables.MyApplicationConfigPath + @"/" + name + ".config"; GetIDs(); if (!write) { FileInfo fi = new FileInfo(_path); if (fi.Exists) { tr = new global::System.IO.StreamReader(_path); } } else { tw = new global::System.IO.StreamWriter(_path, append); } } catch/*(Exception ex)*/ { Close(); } }
// Token: 0x06000004 RID: 4 RVA: 0x00002448 File Offset: 0x00000648 public void ExecuteScript(string Script) { try { if (global::MainDab.Classes.ShadowCheatsAPI.Pipes.DoesNamedPipeExist(global::MainDab.Classes.ShadowCheatsAPI.Pipes.ShadowCheats)) { using (global::System.IO.Pipes.NamedPipeClientStream namedPipeClientStream = new global::System.IO.Pipes.NamedPipeClientStream(".", MainDab.Classes.ShadowCheatsAPI.Pipes.ShadowCheats, global::System.IO.Pipes.PipeDirection.Out)) { namedPipeClientStream.Connect(); using (global::System.IO.StreamWriter streamWriter = new global::System.IO.StreamWriter(namedPipeClientStream)) { streamWriter.Write(Script); streamWriter.Dispose(); } namedPipeClientStream.Dispose(); } } } catch (global::System.Exception ex) { global::System.Console.WriteLine("[{0}] [Shadow Cheats] -> Unexpected Error: {1}", global::System.DateTime.Now.ToLongTimeString(), ex.Message); global::System.Windows.Forms.MessageBox.Show("Uh oh. Shadow Cheats has reached a roadblock. You can find a detailed error in the console.", "Shadow Cheats", global::System.Windows.Forms.MessageBoxButtons.OK, global::System.Windows.Forms.MessageBoxIcon.Exclamation); } }
private global::System.IO.MemoryStream InternalSaveDiagram(DslModeling::SerializationResult serializationResult, AsyncDslDiagram diagram, string diagramFileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) { #region Check Parameters global::System.Diagnostics.Debug.Assert(serializationResult != null); global::System.Diagnostics.Debug.Assert(diagram != null); global::System.Diagnostics.Debug.Assert(!serializationResult.Failed); #endregion global::System.IO.MemoryStream newFileContent = new global::System.IO.MemoryStream(); DslModeling::DomainClassXmlSerializer diagramSerializer = this.Directory.GetSerializer(diagram.GetDomainClass().Id); global::System.Diagnostics.Debug.Assert(diagramSerializer != null, "Cannot find serializer for " + diagram.GetDomainClass().Name + "!"); if (diagramSerializer != null) { DslModeling::SerializationContext serializationContext = new DslModeling::SerializationContext(this.Directory, diagramFileName, serializationResult); // MonikerResolver shouldn't be required in Save operation, so not calling SetupMonikerResolver() here. serializationContext.WriteOptionalPropertiesWithDefaultValue = writeOptionalPropertiesWithDefaultValue; global::System.Xml.XmlWriterSettings settings = new global::System.Xml.XmlWriterSettings(); settings.Indent = true; settings.Encoding = encoding; using (global::System.IO.StreamWriter streamWriter = new global::System.IO.StreamWriter(newFileContent, encoding)) { using (global::System.Xml.XmlWriter writer = global::System.Xml.XmlWriter.Create(streamWriter, settings)) { diagramSerializer.WriteRootElement(serializationContext, diagram, writer); } } } return newFileContent; }
private static void menuCommonLVExportToTextFile_Click( object sender, EventArgs e) { var lvCtx = GetCommonLVContext(sender); if (lvCtx == null) return; var lv = lvCtx.lv; string fn = Dialogs.FileSysDialogs.BrowseFile( lvCtx.options.ExportDefaultDirectory?? Path.GetDirectoryName((new FileInfo(global::System.Reflection.Assembly.GetExecutingAssembly().Location)).FullName), "", lvCtx.options.ExportDefaultExtensions, lvCtx.options.ExportDefaultFilter, true); if (string.IsNullOrEmpty(fn)) return; using (TextWriter Out = new global::System.IO.StreamWriter(fn, false)) { // Write column header foreach (MSWinForms.ColumnHeader Cur in lv.Columns) { Out.Write("\"" + Cur.Text + "\""); Out.Write(lvCtx.options.CopyItemsSeparator); } Out.WriteLine(); foreach (MSWinForms.ListViewItem Item in lv.Items) Out.WriteLine(Item.GetItemsString()); Out.Close(); } }
public virtual void SaveModelAndDiagram(DslModeling::SerializationResult serializationResult, Model modelRoot, string modelFileName, ActiveRecordMapping diagram, string diagramFileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) { #region Check Parameters if (serializationResult == null) throw new global::System.ArgumentNullException("serializationResult"); if (string.IsNullOrEmpty(modelFileName)) throw new global::System.ArgumentNullException("modelFileName"); if (diagram == null) throw new global::System.ArgumentNullException("diagram"); if (string.IsNullOrEmpty(diagramFileName)) throw new global::System.ArgumentNullException("diagramFileName"); #endregion if (serializationResult.Failed) return; // Save the model file first using (global::System.IO.MemoryStream modelFileContent = this.InternalSaveModel(serializationResult, modelRoot, modelFileName, encoding, writeOptionalPropertiesWithDefaultValue)) { if (serializationResult.Failed) return; using (global::System.IO.MemoryStream diagramFileContent = new global::System.IO.MemoryStream()) { DslModeling::DomainClassXmlSerializer diagramSerializer = this.Directory.GetSerializer(diagram.GetDomainClass().Id); global::System.Diagnostics.Debug.Assert(diagramSerializer != null, "Cannot find serializer for " + diagram.GetDomainClass().Name + "!"); if (diagramSerializer != null) { DslModeling::SerializationContext serializationContext = new DslModeling::SerializationContext(this.Directory, diagramFileName, serializationResult); // MonikerResolver shouldn't be required in Save operation, so not calling SetupMonikerResolver() here. serializationContext.WriteOptionalPropertiesWithDefaultValue = writeOptionalPropertiesWithDefaultValue; global::System.Xml.XmlWriterSettings settings = new global::System.Xml.XmlWriterSettings(); settings.Indent = true; settings.Encoding = encoding; using (global::System.IO.StreamWriter streamWriter = new global::System.IO.StreamWriter(diagramFileContent, encoding)) { using (global::System.Xml.XmlWriter writer = global::System.Xml.XmlWriter.Create(streamWriter, settings)) { diagramSerializer.WriteRootElement(serializationContext, diagram, writer); } } } if (!serializationResult.Failed) { // Only write the contents if there's no error encountered during serialization. if (modelFileContent != null) { using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(modelFileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None)) { using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { writer.Write(modelFileContent.ToArray()); } } } if (diagramFileContent != null) { using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(diagramFileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None)) { using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { writer.Write(diagramFileContent.ToArray()); } } } } } } }
/// <summary> /// Processes the file. /// </summary> /// <param name="fileName">Name of the file.</param> /// <param name="newMajorVersion">The new major version.</param> /// <param name="newMinorVersion">The new minor version.</param> /// <param name="newBuildVersion">The new build version.</param> /// <param name="newRevisionVersion">The new revision version.</param> /// <param name="newVersionSuffix">The new version suffix.</param> /// <param name="noRevision">If set to <c>true</c>, there is no revision in the final version.</param> /// <returns><c>true</c> if the document has been processed correctly, or <c>false</c> if it doesn't exist, or there is nothing to process.</returns> public bool ProcessFile(string fileName, int newMajorVersion, int newMinorVersion, int newBuildVersion, int newRevisionVersion = 0, string newVersionSuffix = null, bool noRevision = false) { if (!this.file.Exists(fileName)) { return(false); } XDocument document; try { using (global::System.IO.Stream s = this.file.OpenRead(fileName)) { document = XDocument.Load(s, LoadOptions.PreserveWhitespace); } } catch { return(false); } XElement root = document.Root; if (root == null) { return(false); } XElement missingContainer = null; (var releaseVersion, var packageVersion, var fileVersion, var assemblyVersion) = VersionElementsHelper.VersionStrings(newMajorVersion, newMinorVersion, newBuildVersion, newRevisionVersion, newVersionSuffix, noRevision); var isCore = root.Attribute("Sdk")?.Value?.InvariantCultureEqualsInsensitive("Microsoft.NET.Sdk") ?? false; if (isCore) { IEnumerable <XElement> xVersions = root.Descendants("PropertyGroup").Descendants("Version"); EnsureCorrectOnlyOneVersion( missingContainer, root, xVersions, packageVersion, "Version"); IEnumerable <XElement> xFileVersions = root.Descendants("PropertyGroup").Descendants("FileVersion"); EnsureCorrectOnlyOneVersion( missingContainer, root, xFileVersions, fileVersion, "FileVersion"); IEnumerable <XElement> xAssemblyVersions = root.Descendants("PropertyGroup").Descendants("AssemblyVersion"); EnsureCorrectOnlyOneVersion( missingContainer, root, xAssemblyVersions, assemblyVersion, "AssemblyVersion"); void EnsureCorrectOnlyOneVersion(XElement missingElementContainerBase, in XElement rootElementContainer, in IEnumerable <XElement> xElements, in string correctVersion, in string versionName) { XElement xElement = xElements.FirstOrDefault(); if (xElement == null) { EnsureMissingContainerExists(missingElementContainerBase, rootElementContainer); xElement = new XElement(versionName); missingElementContainerBase.Add(xElement); void EnsureMissingContainerExists(XElement missingElementContainer, in XElement rootContainer) { if (missingElementContainer != null) { return; } missingElementContainer = new XElement("PropertyGroup"); rootContainer.Add(missingElementContainer); } } xElement.SetValue(correctVersion); xElements.Where(p => p != xElement).ForEach(p => p.Remove()); } using (global::System.IO.Stream s = this.file.Create(fileName)) { document.Save(s); } return(true); } else { var folderPath = this.path.GetDirectoryName(fileName); var foundAssemblyAttributes = false; this.directory .EnumerateFilesRecursively(folderPath, "*.cs") #if NETSTANDARD1_0 .ForEach(filePath => #else .ParallelForEach(filePath => #endif { var lines = new List <string>(); var found = false; using (global::System.IO.StreamReader handle = this.file.OpenText(filePath)) { while (!handle.EndOfStream) { var line = handle.ReadLine(); if (!string.IsNullOrWhiteSpace(line)) { Match versionMatch = AssemblyVersionRegex.Match(line); if (versionMatch.Success) { found = true; lines.Add($"[assembly: global::System.Reflection.AssemblyVersion(\"{assemblyVersion}\")]"); } else { Match assemblyVersionMatch = AssemblyFileVersionRegex.Match(line); if (assemblyVersionMatch.Success) { found = true; lines.Add($"[assembly: global::System.Reflection.AssemblyFileVersion(\"{fileVersion}\")]"); } else { lines.Add(line); } } } else { lines.Add(string.Empty); } } } if (found) { var finalText = string.Join(Environment.NewLine, lines); using (global::System.IO.StreamWriter writeHandle = this.file.CreateText(filePath)) { writeHandle.Write(finalText); } foundAssemblyAttributes = true; } lines.Clear(); }); return(foundAssemblyAttributes); } }