Here are the examples of the csharp api System.IO.TextWriter.WriteLine(string, params object[]) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2139 Examples
19
View Source File : LogWriter.cs
License : MIT License
Project Creator : 0x0ade
License : MIT License
Project Creator : 0x0ade
public override void WriteLine(string? value) {
STDOUT?.WriteLine(value);
File?.WriteLine(value);
File?.Flush();
}
19
View Source File : Logger.cs
License : MIT License
Project Creator : 0x0ade
License : MIT License
Project Creator : 0x0ade
public static void LogDetailedException(/*this*/ Exception? e, string? tag = null) {
if (e == null)
return;
TextWriter w = Writer;
if (tag == null) {
w.WriteLine("--------------------------------");
w.WriteLine("Detailed exception log:");
}
for (Exception? e_ = e; e_ != null; e_ = e_.InnerException) {
w.WriteLine("--------------------------------");
w.WriteLine(e_.GetType().FullName + ": " + e_.Message + "\n" + e_.StackTrace);
switch (e_) {
case ReflectionTypeLoadException rtle:
if (rtle.Types != null)
for (int i = 0; i < rtle.Types.Length; i++)
w.WriteLine("ReflectionTypeLoadException.Types[" + i + "]: " + rtle.Types[i]);
if (rtle.LoaderExceptions != null)
for (int i = 0; i < rtle.LoaderExceptions.Length; i++)
LogDetailedException(rtle.LoaderExceptions[i], tag + (tag == null ? "" : ", ") + "rtle:" + i);
break;
case TypeLoadException tle:
w.WriteLine("TypeLoadException.TypeName: " + tle.TypeName);
break;
case BadImageFormatException bife:
w.WriteLine("BadImageFormatException.FileName: " + bife.FileName);
break;
}
}
}
19
View Source File : Program.cs
License : zlib License
Project Creator : 0x0ade
License : zlib License
Project Creator : 0x0ade
public static void Main(string[] args) {
XnaToFnaUtil xtf = new XnaToFnaUtil();
Console.WriteLine($"XnaToFna {XnaToFnaUtil.Version}");
Console.WriteLine($"using MonoMod {MonoModder.Version}");
bool showHelp = false;
bool showVersion = false;
bool relinkOnly = false;
OptionSet options = new OptionSet {
{ "h|help", "Show this message and exit.", v => showHelp = v != null },
{ "v|version", "Show the version and exit.", v => showVersion = v != null },
{ "profile=", "Choose between multiple base profiles:\ndefault, minimal, forms", v => {
switch (v.ToLowerInvariant()) {
case "default":
xtf.HookCompat = true;
xtf.HookHacks = true;
xtf.HookEntryPoint = false;
xtf.HookLocks = false;
xtf.FixOldMonoXML = false;
xtf.HookBinaryFormatter = true;
xtf.HookReflection = true;
break;
case "minimal":
xtf.HookCompat = false;
xtf.HookHacks = false;
xtf.HookEntryPoint = false;
xtf.HookLocks = false;
xtf.FixOldMonoXML = false;
xtf.HookBinaryFormatter = false;
xtf.HookReflection = false;
break;
case "forms":
xtf.HookCompat = true;
xtf.HookHacks = false;
xtf.HookEntryPoint = true;
xtf.HookLocks = false;
xtf.FixOldMonoXML = false;
xtf.HookBinaryFormatter = false;
xtf.HookReflection = false;
break;
}
} },
{ "relinkonly=", "Only read and write the replacedemblies listed.", (bool v) => relinkOnly = v },
{ "hook-compat=", "Toggle Forms and P/Invoke compatibility hooks.", (bool v) => xtf.HookCompat = v },
{ "hook-hacks=", "Toggle some hack hooks, f.e.\nXNATOFNA_DISPLAY_FULLSCREEN", (bool v) => xtf.HookEntryPoint = v },
{ "hook-locks=", "Toggle if locks should be \"destroyed\" or not.", (bool v) => xtf.HookLocks = v },
{ "hook-oldmonoxml=", "Toggle basic XML serialization fixes.\nPlease try updating mono first!", (bool v) => xtf.FixOldMonoXML = v },
{ "hook-binaryformatter=", "Toggle BinaryFormatter-related fixes.", (bool v) => xtf.HookBinaryFormatter = v },
{ "hook-reflection=", "Toggle reflection-related fixes.", (bool v) => xtf.HookBinaryFormatter = v },
{ "hook-patharg=", "Hook the given method to receive fixed paths.\nCan be used multiple times.", v => xtf.FixPathsFor.Add(v) },
{ "ilplatform=", "Choose the target IL platform:\nkeep, x86, x64, anycpu, x86pref", v => xtf.PreferredPlatform = ParseEnum(v, ILPlatform.Keep) },
{ "mixeddeps=", "Choose the action performed to mixed dependencies:\nkeep, stub, remove", v => xtf.MixedDeps = ParseEnum(v, MixedDepAction.Keep) },
{ "removepublickeytoken=", "Remove the public key token of a dependency.\nCan be used multiple times.", v => xtf.DestroyPublicKeyTokens.Add(v) },
};
void WriteHelp(TextWriter writer) {
writer.WriteLine("Usage: <mono> XnaToFna.exe [options] <--> FileOrDir <FileOrDir> <...>");
options.WriteOptionDescriptions(writer);
}
List<string> extra;
try {
extra = options.Parse(args);
} catch (OptionException e) {
Console.Error.Write("Command parse error: ");
Console.Error.WriteLine(e.Message);
Console.Error.WriteLine();
WriteHelp(Console.Error);
return;
}
if (showVersion) {
return;
}
if (showHelp) {
WriteHelp(Console.Out);
return;
}
foreach (string arg in extra)
xtf.ScanPath(arg);
if (!relinkOnly && !Debugger.IsAttached) // Otherwise catches XnaToFna.vshost.exe
xtf.ScanPath(Directory.GetCurrentDirectory());
xtf.OrderModules();
xtf.RelinkAll();
xtf.Log("[Main] Done!");
if (Debugger.IsAttached) // Keep window open when running in IDE
Console.ReadKey();
}
19
View Source File : Program.cs
License : MIT License
Project Creator : 0x1000000
License : MIT License
Project Creator : 0x1000000
private static int Run<TOpts>(TOpts opts, Func<TOpts,Task> task)
{
try
{
task(opts).Wait();
return 0;
}
catch (SqExpressCodeGenException e)
{
Console.WriteLine(e.Message);
return 1;
}
catch (AggregateException e) when (e.InnerException is SqExpressCodeGenException sqExpressCodeGenException)
{
Console.Error.WriteLine(sqExpressCodeGenException.Message);
return 1;
}
catch (Exception e)
{
Console.Error.WriteLine("Unhandled Exception: ");
Console.Error.WriteLine(e);
return 1;
}
}
19
View Source File : Disassembler.cs
License : MIT License
Project Creator : 0xd4d
License : MIT License
Project Creator : 0xd4d
public void Disreplacedemble(Formatter formatter, TextWriter output, DisasmInfo method) {
formatterOutput.writer = output;
targets.Clear();
sortedTargets.Clear();
bool uppercaseHex = formatter.Options.UppercaseHex;
output.Write(commentPrefix);
output.WriteLine("================================================================================");
output.Write(commentPrefix);
output.WriteLine(method.MethodFullName);
uint codeSize = 0;
foreach (var info in method.Code)
codeSize += (uint)info.Code.Length;
var codeSizeHexText = codeSize.ToString(uppercaseHex ? "X" : "x");
output.WriteLine($"{commentPrefix}{codeSize} (0x{codeSizeHexText}) bytes");
var instrCount = method.Instructions.Count;
var instrCountHexText = instrCount.ToString(uppercaseHex ? "X" : "x");
output.WriteLine($"{commentPrefix}{instrCount} (0x{instrCountHexText}) instructions");
void Add(ulong address, TargetKind kind) {
if (!targets.TryGetValue(address, out var addrInfo))
targets[address] = new AddressInfo(kind);
else if (addrInfo.Kind < kind)
addrInfo.Kind = kind;
}
if (method.Instructions.Count > 0)
Add(method.Instructions[0].IP, TargetKind.Unknown);
foreach (ref var instr in method.Instructions) {
switch (instr.FlowControl) {
case FlowControl.Next:
case FlowControl.Interrupt:
break;
case FlowControl.UnconditionalBranch:
Add(instr.NextIP, TargetKind.Unknown);
if (instr.Op0Kind == OpKind.NearBranch16 || instr.Op0Kind == OpKind.NearBranch32 || instr.Op0Kind == OpKind.NearBranch64)
Add(instr.NearBranchTarget, TargetKind.Branch);
break;
case FlowControl.ConditionalBranch:
case FlowControl.XbeginXabortXend:
if (instr.Op0Kind == OpKind.NearBranch16 || instr.Op0Kind == OpKind.NearBranch32 || instr.Op0Kind == OpKind.NearBranch64)
Add(instr.NearBranchTarget, TargetKind.Branch);
break;
case FlowControl.Call:
if (instr.Op0Kind == OpKind.NearBranch16 || instr.Op0Kind == OpKind.NearBranch32 || instr.Op0Kind == OpKind.NearBranch64)
Add(instr.NearBranchTarget, TargetKind.Call);
break;
case FlowControl.IndirectBranch:
Add(instr.NextIP, TargetKind.Unknown);
// Unknown target
break;
case FlowControl.IndirectCall:
// Unknown target
break;
case FlowControl.Return:
case FlowControl.Exception:
Add(instr.NextIP, TargetKind.Unknown);
break;
default:
Debug.Fail($"Unknown flow control: {instr.FlowControl}");
break;
}
var baseReg = instr.MemoryBase;
if (baseReg == Register.RIP || baseReg == Register.EIP) {
int opCount = instr.OpCount;
for (int i = 0; i < opCount; i++) {
if (instr.GetOpKind(i) == OpKind.Memory) {
if (method.Contains(instr.IPRelativeMemoryAddress))
Add(instr.IPRelativeMemoryAddress, TargetKind.Branch);
break;
}
}
}
else if (instr.MemoryDisplSize >= 2) {
ulong displ;
switch (instr.MemoryDisplSize) {
case 2:
case 4: displ = instr.MemoryDisplacement; break;
case 8: displ = (ulong)(int)instr.MemoryDisplacement; break;
default:
Debug.Fail($"Unknown mem displ size: {instr.MemoryDisplSize}");
goto case 8;
}
if (method.Contains(displ))
Add(displ, TargetKind.Branch);
}
}
foreach (var map in method.ILMap) {
if (targets.TryGetValue(map.nativeStartAddress, out var info)) {
if (info.Kind < TargetKind.BlockStart && info.Kind != TargetKind.Unknown)
info.Kind = TargetKind.BlockStart;
}
else
targets.Add(map.nativeStartAddress, info = new AddressInfo(TargetKind.Unknown));
if (info.ILOffset < 0)
info.ILOffset = map.ilOffset;
}
int labelIndex = 0, methodIndex = 0;
string GetLabel(int index) => LABEL_PREFIX + index.ToString();
string GetFunc(int index) => FUNC_PREFIX + index.ToString();
foreach (var kv in targets) {
if (method.Contains(kv.Key))
sortedTargets.Add(kv);
}
sortedTargets.Sort((a, b) => a.Key.CompareTo(b.Key));
foreach (var kv in sortedTargets) {
var address = kv.Key;
var info = kv.Value;
switch (info.Kind) {
case TargetKind.Unknown:
info.Name = null;
break;
case TargetKind.Data:
info.Name = GetLabel(labelIndex++);
break;
case TargetKind.BlockStart:
case TargetKind.Branch:
info.Name = GetLabel(labelIndex++);
break;
case TargetKind.Call:
info.Name = GetFunc(methodIndex++);
break;
default:
throw new InvalidOperationException();
}
}
foreach (ref var instr in method.Instructions) {
ulong ip = instr.IP;
if (targets.TryGetValue(ip, out var lblInfo)) {
output.WriteLine();
if (!(lblInfo.Name is null)) {
output.Write(lblInfo.Name);
output.Write(':');
output.WriteLine();
}
if (lblInfo.ILOffset >= 0) {
if (ShowSourceCode) {
foreach (var info in sourceCodeProvider.GetStatementLines(method, lblInfo.ILOffset)) {
output.Write(commentPrefix);
var line = info.Line;
int column = commentPrefix.Length;
WriteWithTabs(output, line, 0, line.Length, '\0', ref column);
output.WriteLine();
if (info.Partial) {
output.Write(commentPrefix);
column = commentPrefix.Length;
WriteWithTabs(output, line, 0, info.Span.Start, ' ', ref column);
output.WriteLine(new string('^', info.Span.Length));
}
}
}
}
}
if (ShowAddresses) {
var address = FormatAddress(bitness, ip, uppercaseHex);
output.Write(address);
output.Write(" ");
}
else
output.Write(formatter.Options.TabSize > 0 ? "\t\t" : " ");
if (ShowHexBytes) {
if (!method.TryGetCode(ip, out var nativeCode))
throw new InvalidOperationException();
var codeBytes = nativeCode.Code;
int index = (int)(ip - nativeCode.IP);
int instrLen = instr.Length;
for (int i = 0; i < instrLen; i++) {
byte b = codeBytes[index + i];
output.Write(b.ToString(uppercaseHex ? "X2" : "x2"));
}
int missingBytes = HEXBYTES_COLUMN_BYTE_LENGTH - instrLen;
for (int i = 0; i < missingBytes; i++)
output.Write(" ");
output.Write(" ");
}
formatter.Format(instr, formatterOutput);
output.WriteLine();
}
}
19
View Source File : OneCmdShell.cs
License : MIT License
Project Creator : 1y0n
License : MIT License
Project Creator : 1y0n
public void Http_server_task()
{
HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://" + textBox1.Text + ":" + textBox2.Text + "/");
listener.Start();
Global_Var.Http_server_status = true;
label4.Text = "服务已开启在 " + textBox2.Text + " 端口";
label4.ForeColor = Color.Green;
Global_Var.HTTP_Port = textBox2.Text;
Task task = Task.Factory.StartNew(() => {
while (listener.IsListening && !stop)
{
HttpListenerContext context = listener.GetContext();
HttpListenerRequest request = context.Request;
HttpListenerResponse response = context.Response;
using (StreamWriter writer = new StreamWriter(response.OutputStream))
{
writer.WriteLine(Global_Var.XSL_code);
}
}
});
Task.WaitAll();
}
19
View Source File : GrblSettingsWindow.xaml.cs
License : MIT License
Project Creator : 3RD-Dimension
License : MIT License
Project Creator : 3RD-Dimension
private void ButtonGrblExport_Click(object sender, RoutedEventArgs e)
{
if (MessageBox.Show("This will export the currently displayed settings to a file - even any modified values that you have entered. If you need to export the settings before modifications, please export before changing. Continue To Export?", "Important", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
{ // YES - Export
SaveFileDialog exportFileName = new SaveFileDialog();
exportFileName.Filter = "Text File (*.txt)|*.txt";
exportFileName.replacedle = "Save exported GRBL Settings";
exportFileName.FileName = "Exported_GRBL_Settings.txt";
if (exportFileName.ShowDialog() == true)
{
List<Tuple<int, double>> ToExport = new List<Tuple<int, double>>();
foreach (KeyValuePair<int, double> kvp in CurrentSettings)
{
ToExport.Add(new Tuple<int, double>(kvp.Key, kvp.Value));
}
using (StreamWriter sw = new StreamWriter(exportFileName.FileName))
{
sw.WriteLine("{0,-10} {1,-10} {2,-18} {3, -35}", "Setting", "Value", "Units", "Description");
foreach (Tuple<int, double> setting in ToExport)
// setting.Item1 = GRBL Code, setting.Item2 = Setting Value, Util.GrblCodeTranslator.Settings[setting.Item1].Item1 = Setting Description, Util.GrblCodeTranslator.Settings[setting.Item1].Item2 = Units
{
sw.WriteLine("{0,-10} {1,-10} {2,-18} {3, -35}", "$" + setting.Item1, setting.Item2.ToString(Util.Constants.DecimalOutputFormat), Util.GrblCodeTranslator.Settings[setting.Item1].Item2, Util.GrblCodeTranslator.Settings[setting.Item1].Item1);
}
MessageBox.Show("Settings Exported to " + exportFileName.FileName, "Exported GRBL Settings", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
}
else
{ // NO
return;
}
}
19
View Source File : GrblSettingsWindow.xaml.cs
License : MIT License
Project Creator : 3RD-Dimension
License : MIT License
Project Creator : 3RD-Dimension
private void ButtonGrblExport_Click(object sender, RoutedEventArgs e)
{
if (MessageBox.Show("This will export the currently displayed settings to a file - even any modified values that you have entered. If you need to export the settings before modifications, please export before changing. Continue To Export?", "Important", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
{ // YES - Export
SaveFileDialog exportFileName = new SaveFileDialog();
exportFileName.Filter = "Text File (*.txt)|*.txt";
exportFileName.replacedle = "Save exported GRBL Settings";
exportFileName.FileName = "Exported_GRBL_Settings.txt";
if (exportFileName.ShowDialog() == true)
{
List<Tuple<int, double>> ToExport = new List<Tuple<int, double>>();
foreach (KeyValuePair<int, double> kvp in CurrentSettings)
{
ToExport.Add(new Tuple<int, double>(kvp.Key, kvp.Value));
}
using (StreamWriter sw = new StreamWriter(exportFileName.FileName))
{
sw.WriteLine("{0,-10} {1,-10} {2,-18} {3, -35}", "Setting", "Value", "Units", "Description");
foreach (Tuple<int, double> setting in ToExport)
// setting.Item1 = GRBL Code, setting.Item2 = Setting Value, Util.GrblCodeTranslator.Settings[setting.Item1].Item1 = Setting Description, Util.GrblCodeTranslator.Settings[setting.Item1].Item2 = Units
{
sw.WriteLine("{0,-10} {1,-10} {2,-18} {3, -35}", "$" + setting.Item1, setting.Item2.ToString(Util.Constants.DecimalOutputFormat), Util.GrblCodeTranslator.Settings[setting.Item1].Item2, Util.GrblCodeTranslator.Settings[setting.Item1].Item1);
}
MessageBox.Show("Settings Exported to " + exportFileName.FileName, "Exported GRBL Settings", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
}
else
{ // NO
return;
}
}
19
View Source File : ExternalCommunicator.cs
License : Apache License 2.0
Project Creator : A7ocin
License : Apache License 2.0
Project Creator : A7ocin
void HandleLog(string logString, string stackTrace, LogType type)
{
logWriter = new StreamWriter(logPath, true);
logWriter.WriteLine(type.ToString());
logWriter.WriteLine(logString);
logWriter.WriteLine(stackTrace);
logWriter.Close();
}
19
View Source File : HistoryViewer.cs
License : MIT License
Project Creator : aabiryukov
License : MIT License
Project Creator : aabiryukov
private static void RunLiveChangesMonitor(VersionControlLogReader reader, string gourcePath, string arguments)
{
var gourceStartInfo = new ProcessStartInfo(gourcePath, arguments)
{
WindowStyle = ProcessWindowStyle.Maximized,
RedirectStandardInput = true,
UseShellExecute = false
};
var process = Process.Start(gourceStartInfo);
if (process == null)
throw new InvalidDataException("Failed to start process: " + gourceStartInfo.FileName);
using (var gourceWriter = new StreamWriter(process.StandardInput.BaseStream, Encoding.UTF8))
{
gourceWriter.AutoFlush = process.StandardInput.AutoFlush;
gourceWriter.NewLine = process.StandardInput.NewLine;
while (!process.HasExited)
{
var line = reader.ReadLine();
Debug.WriteLine("LOG: " + (line ?? "<NULL>"));
if (line == null)
{
// Waiting for second to avoid frequent server calls
System.Threading.Thread.Sleep(1000);
}
else
{
gourceWriter.WriteLine(line);
// System.Threading.Thread.Sleep(100);
}
}
}
}
19
View Source File : TfsLogWriter.cs
License : MIT License
Project Creator : aabiryukov
License : MIT License
Project Creator : aabiryukov
private static bool CreateGourceLogFile(
string outputFile,
HashSet<string> outputCommiters,
VersionControlServer vcs,
string serverPath,
VisualizationSettings settings,
ref bool cancel,
Action<int> progressReporter)
{
// int latestChangesetId = vcs.GetLatestChangesetId();
if (cancel) return false;
var versionFrom = new DateVersionSpec(settings.DateFrom);
var versionTo = new DateVersionSpec(settings.DateTo);
int latestChangesetId;
// Getting latest changeset ID for current search criteria
{
var latestChanges = vcs.QueryHistory(
serverPath,
VersionSpec.Latest,
0,
RecursionType.Full,
null, //any user
versionFrom, // from first changeset
versionTo, // to last changeset
1,
false, // with changes
false,
false,
false); // sorted
var latestChangeset = latestChanges.Cast<Changeset>().FirstOrDefault();
if (latestChangeset == null)
{
// History not found
return false;
}
latestChangesetId = latestChangeset.ChangesetId;
if (cancel) return false; //-V3022
}
var firstChangesetId = 0;
var changesetConverter = new ChangesetConverter(settings.UsersFilter, settings.FilesFilter);
using (var writer = new StreamWriter(outputFile))
{
var csList = vcs.QueryHistory(
serverPath,
VersionSpec.Latest,
0,
RecursionType.Full,
null, //any user
versionFrom, // from first changeset
versionTo, // to last changeset
int.MaxValue,
true, // with changes
false,
false,
true); // sorted
var hasLines = false;
foreach (var changeset in csList.Cast<Changeset>())
{
if (cancel) return false; //-V3022
if (firstChangesetId == 0) firstChangesetId = changeset.ChangesetId;
if (progressReporter != null)
{
var progressValue = changeset.ChangesetId - firstChangesetId;
var progressTotal = latestChangesetId - firstChangesetId;
progressReporter(progressTotal > 0 ? progressValue * 100 / progressTotal : 100);
}
var usefulChangeset = false;
foreach (var line in changesetConverter.GetLogLines(changeset))
{
usefulChangeset = true;
writer.WriteLine(line);
}
if (usefulChangeset)
{
hasLines = true;
if (outputCommiters != null)
outputCommiters.Add(changeset.OwnerDisplayName);
}
}
return hasLines;
}
}
19
View Source File : ServerManager.cs
License : Apache License 2.0
Project Creator : AantCoder
License : Apache License 2.0
Project Creator : AantCoder
public bool StartPrepare(string path)
{
var jsonFile = GetSettingsFileName(path);
if (!File.Exists(jsonFile))
{
using (StreamWriter file = File.CreateText(jsonFile))
{
var jsonText = JsonSerializer.Serialize(ServerSettings, new JsonSerializerOptions() { WriteIndented = true });
file.WriteLine(jsonText);
}
Console.WriteLine("Created Settings.json, server was been stopped");
Console.WriteLine($"RU: Настройте сервер, заполните {jsonFile}");
Console.WriteLine("Enter some key");
Console.ReadKey();
return false;
}
else
{
try
{
using (var fs = new StreamReader(jsonFile, Encoding.UTF8))
{
var jsonString = fs.ReadToEnd();
ServerSettings = JsonSerializer.Deserialize<ServerSettings>(jsonString);
}
ServerSettings.WorkingDirectory = path;
var results = new List<ValidationResult>();
var context = new ValidationContext(ServerSettings);
if (!Validator.TryValidateObject(ServerSettings, context, results, true))
{
foreach (var error in results)
{
Console.WriteLine(error.ErrorMessage);
Loger.Log(error.ErrorMessage);
}
Console.ReadKey();
return false;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine($"RU: Проверьте настройки сервера {jsonFile}");
Console.WriteLine("EN: Check Settings.json");
Console.ReadKey();
return false;
}
}
MainHelper.OffAllLog = false;
Loger.PathLog = path;
Loger.IsServer = true;
var rep = Repository.Get;
rep.SaveFileName = GetWorldFileName(path);
rep.Load();
CheckDiscrordUser();
FileHashChecker = new FileHashChecker(ServerSettings);
return true;
}
19
View Source File : CreateInvertedIndex.cs
License : MIT License
Project Creator : ABTSoftware
License : MIT License
Project Creator : ABTSoftware
private static void WriteIndexToFile()
{
var location = replacedembly.GetExecutingreplacedembly().Location;
var index = location.IndexOf(@"\bin", StringComparison.InvariantCulture);
var filePath = location.Substring(0, index) + InvertedIndexRelativePath;
using (var outFile = new StreamWriter(filePath))
{
foreach (KeyValuePair<string, Posting> posting in _invertedIndex)
{
var postingList = new List<string>();
foreach (var termInfo in posting.Value.TermInfos)
{
string indexes = string.Join(",", termInfo.TermEntryIndexes);
postingList.Add(string.Format("{0}:{1}", termInfo.ExamplePageId, indexes));
}
string postingData = string.Join(";", postingList);
var termFrequencies = posting.Value.TermInfos.Select(x => x.TermFrequency);
string termFrequency = string.Join(",", termFrequencies);
outFile.WriteLine("{0}|{1}|{2}|{3}", posting.Key, postingData, termFrequency,
posting.Value.InvertedDoreplacedentFrequency);
}
}
}
19
View Source File : LandblockInstanceWriter.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
public void CreateSQLINSERTStatement(IList<LandblockInstance> input, StreamWriter writer)
{
var instanceWcids = input.ToDictionary(i => i.Guid, i => i.WeenieClreplacedId);
input = input.OrderBy(r => r.Guid).ToList();
foreach (var value in input)
{
if (value != input[0])
writer.WriteLine();
writer.WriteLine("INSERT INTO `landblock_instance` (`guid`, `weenie_Clreplaced_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)");
string label = null;
if (WeenieNames != null)
WeenieNames.TryGetValue(value.WeenieClreplacedId, out label);
var output = "VALUES (" +
$"0x{value.Guid.ToString("X8")}, " +
$"{value.WeenieClreplacedId.ToString().PadLeft(5)}, " +
$"0x{value.ObjCellId:X8}, " +
$"{TrimNegativeZero(value.OriginX):0.######}, " +
$"{TrimNegativeZero(value.OriginY):0.######}, " +
$"{TrimNegativeZero(value.OriginZ):0.######}, " +
$"{TrimNegativeZero(value.AnglesW):0.######}, " +
$"{TrimNegativeZero(value.AnglesX):0.######}, " +
$"{TrimNegativeZero(value.AnglesY):0.######}, " +
$"{TrimNegativeZero(value.AnglesZ):0.######}, " +
$"{value.IsLinkChild.ToString().PadLeft(5)}, " +
$"'{value.LastModified:yyyy-MM-dd HH:mm:ss}'" +
$"); /* {label} */" +
Environment.NewLine + $"/* @teleloc 0x{value.ObjCellId:X8} [{TrimNegativeZero(value.OriginX):F6} {TrimNegativeZero(value.OriginY):F6} {TrimNegativeZero(value.OriginZ):F6}] {TrimNegativeZero(value.AnglesW):F6} {TrimNegativeZero(value.AnglesX):F6} {TrimNegativeZero(value.AnglesY):F6} {TrimNegativeZero(value.AnglesZ):F6} */";
output = FixNullFields(output);
writer.WriteLine(output);
if (value.LandblockInstanceLink != null && value.LandblockInstanceLink.Count > 0)
{
writer.WriteLine();
CreateSQLINSERTStatement(value.LandblockInstanceLink.OrderBy(r => r.ChildGuid).ToList(), instanceWcids, writer);
}
}
}
19
View Source File : BiotaSQLWriter.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
public void CreateSQLINSERTStatement(uint id, IList<BiotaPropertiesEmote> input, StreamWriter writer)
{
foreach (var value in input)
{
writer.WriteLine();
writer.WriteLine("INSERT INTO `biota_properties_emote` (`object_Id`, `category`, `probability`, `biota_Clreplaced_Id`, `style`, `substyle`, `quest`, `vendor_Type`, `min_Health`, `max_Health`)");
var categoryLabel = Enum.GetName(typeof(EmoteCategory), value.Category);
if (categoryLabel != null)
categoryLabel = $" /* {categoryLabel} */";
string weenieClreplacedIdLabel = null;
if (WeenieNames != null && value.WeenieClreplacedId.HasValue)
{
WeenieNames.TryGetValue(value.WeenieClreplacedId.Value, out weenieClreplacedIdLabel);
if (weenieClreplacedIdLabel != null)
weenieClreplacedIdLabel = $" /* {weenieClreplacedIdLabel} */";
}
string styleLabel = null;
if (value.Style.HasValue)
{
styleLabel = Enum.GetName(typeof(MotionStance), value.Style.Value);
if (styleLabel != null)
styleLabel = $" /* {styleLabel} */";
}
string substyleLabel = null;
if (value.Substyle.HasValue)
{
substyleLabel = Enum.GetName(typeof(MotionCommand), value.Substyle.Value);
if (substyleLabel != null)
substyleLabel = $" /* {substyleLabel} */";
}
string vendorTypeLabel = null;
if (value.VendorType.HasValue)
{
vendorTypeLabel = Enum.GetName(typeof(VendorType), value.VendorType.Value);
if (vendorTypeLabel != null)
vendorTypeLabel = $" /* {vendorTypeLabel} */";
}
var output = "VALUES (" +
$"{id}, " +
$"{value.Category.ToString().PadLeft(2)}{categoryLabel}, " +
$"{value.Probability.ToString(CultureInfo.InvariantCulture).PadLeft(6)}, " +
$"{value.WeenieClreplacedId}{weenieClreplacedIdLabel}, " +
$"{value.Style}{styleLabel}, " +
$"{value.Substyle}{substyleLabel}, " +
$"{GetSQLString(value.Quest)}, " +
$"{value.VendorType}{vendorTypeLabel}, " +
$"{value.MinHealth}, " +
$"{value.MaxHealth}" +
");";
output = FixNullFields(output);
writer.WriteLine(output);
if (value.BiotaPropertiesEmoteAction != null && value.BiotaPropertiesEmoteAction.Count > 0)
{
writer.WriteLine();
writer.WriteLine("SET @parent_id = LAST_INSERT_ID();");
writer.WriteLine();
CreateSQLINSERTStatement(value.BiotaPropertiesEmoteAction.OrderBy(r => r.Order).ToList(), writer);
}
}
}
19
View Source File : RecipeSQLWriter.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
public void CreateSQLINSERTStatement(Recipe input, StreamWriter writer)
{
writer.WriteLine("INSERT INTO `recipe` (`id`, `unknown_1`, `skill`, `difficulty`, `salvage_Type`, `success_W_C_I_D`, `success_Amount`, `success_Message`, `fail_W_C_I_D`, `fail_Amount`, `fail_Message`, " +
"`success_Destroy_Source_Chance`, `success_Destroy_Source_Amount`, `success_Destroy_Source_Message`, `success_Destroy_Target_Chance`, `success_Destroy_Target_Amount`, `success_Destroy_Target_Message`, " +
"`fail_Destroy_Source_Chance`, `fail_Destroy_Source_Amount`, `fail_Destroy_Source_Message`, `fail_Destroy_Target_Chance`, `fail_Destroy_Target_Amount`, `fail_Destroy_Target_Message`, " +
"`data_Id`, `last_Modified`)");
string skillLabel = null;
if (input.Skill != 0)
skillLabel = Enum.GetName(typeof(Skill), input.Skill);
string successWeenieLabel = null;
if (WeenieNames != null)
WeenieNames.TryGetValue(input.SuccessWCID, out successWeenieLabel);
string failWeenieLabel = null;
if (WeenieNames != null)
WeenieNames.TryGetValue(input.FailWCID, out failWeenieLabel);
var output = "VALUES (" +
$"{input.Id}, " +
$"{input.Unknown1}, " +
$"{input.Skill} /* {skillLabel} */, " +
$"{input.Difficulty}, " +
$"{input.SalvageType}, " +
$"{input.SuccessWCID} /* {successWeenieLabel} */, " +
$"{input.SuccessAmount}, " +
$"{GetSQLString(input.SuccessMessage)}, " +
$"{input.FailWCID} /* {failWeenieLabel} */, " +
$"{input.FailAmount}, " +
$"{GetSQLString(input.FailMessage)}, " +
$"{input.SuccessDestroySourceChance}, " +
$"{input.SuccessDestroySourceAmount}, " +
$"{GetSQLString(input.SuccessDestroySourceMessage)}, " +
$"{input.SuccessDestroyTargetChance}, " +
$"{input.SuccessDestroyTargetAmount}, " +
$"{GetSQLString(input.SuccessDestroyTargetMessage)}, " +
$"{input.FailDestroySourceChance}, " +
$"{input.FailDestroySourceAmount}, " +
$"{GetSQLString(input.FailDestroySourceMessage)}, " +
$"{input.FailDestroyTargetChance}, " +
$"{input.FailDestroyTargetAmount}, " +
$"{GetSQLString(input.FailDestroyTargetMessage)}, " +
$"{input.DataId}, " +
$"'{input.LastModified:yyyy-MM-dd HH:mm:ss}'" +
");";
output = FixNullFields(output);
writer.WriteLine(output);
if (input.RecipeRequirementsInt != null && input.RecipeRequirementsInt.Count > 0)
{
writer.WriteLine();
CreateSQLINSERTStatement(input.Id, input.RecipeRequirementsInt.ToList(), writer);
}
if (input.RecipeRequirementsDID != null && input.RecipeRequirementsDID.Count > 0)
{
writer.WriteLine();
CreateSQLINSERTStatement(input.Id, input.RecipeRequirementsDID.ToList(), writer);
}
if (input.RecipeRequirementsIID != null && input.RecipeRequirementsIID.Count > 0)
{
writer.WriteLine();
CreateSQLINSERTStatement(input.Id, input.RecipeRequirementsIID.ToList(), writer);
}
if (input.RecipeRequirementsFloat != null && input.RecipeRequirementsFloat.Count > 0)
{
writer.WriteLine();
CreateSQLINSERTStatement(input.Id, input.RecipeRequirementsFloat.ToList(), writer);
}
if (input.RecipeRequirementsString != null && input.RecipeRequirementsString.Count > 0)
{
writer.WriteLine();
CreateSQLINSERTStatement(input.Id, input.RecipeRequirementsString.ToList(), writer);
}
if (input.RecipeRequirementsBool != null && input.RecipeRequirementsBool.Count > 0)
{
writer.WriteLine();
CreateSQLINSERTStatement(input.Id, input.RecipeRequirementsBool.ToList(), writer);
}
if (input.RecipeMod != null && input.RecipeMod.Count > 0)
{
//writer.WriteLine(); // This is not needed because CreateSQLINSERTStatement will take care of it for us on each Recipe.
CreateSQLINSERTStatement(input.Id, input.RecipeMod.ToList(), writer);
}
}
19
View Source File : EventSQLWriter.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
public void CreateSQLINSERTStatement(Event input, StreamWriter writer)
{
writer.WriteLine("INSERT INTO `event` (`name`, `start_Time`, `end_Time`, `state`, `last_Modified`)");
var output = "VALUES (" +
$"{GetSQLString(input.Name)}, " +
$"{(input.StartTime == -1 ? $"{input.StartTime}" : $"{input.StartTime} /* {DateTimeOffset.FromUnixTimeSeconds(input.StartTime).DateTime.ToUniversalTime().ToString(CultureInfo.InvariantCulture)} */")}, " +
$"{(input.EndTime == -1 ? $"{input.EndTime}" : $"{input.EndTime} /* {DateTimeOffset.FromUnixTimeSeconds(input.EndTime).DateTime.ToUniversalTime().ToString(CultureInfo.InvariantCulture)} */")}, " +
$"{input.State}, " +
$"'{input.LastModified:yyyy-MM-dd HH:mm:ss}'" +
");";
output = FixNullFields(output);
writer.WriteLine(output);
}
19
View Source File : TreasureDeathSQLWriter.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
public void CreateSQLINSERTStatement(TreasureDeath input, StreamWriter writer)
{
writer.WriteLine("INSERT INTO `treasure_death` (`treasure_Type`, `tier`, `loot_Quality_Mod`, `unknown_Chances`, `item_Chance`, `item_Min_Amount`, `item_Max_Amount`, `item_Treasure_Type_Selection_Chances`, `magic_Item_Chance`, `magic_Item_Min_Amount`, `magic_Item_Max_Amount`, `magic_Item_Treasure_Type_Selection_Chances`, `mundane_Item_Chance`, `mundane_Item_Min_Amount`, `mundane_Item_Max_Amount`, `mundane_Item_Type_Selection_Chances`, `last_Modified`)");
var output = "VALUES (" +
$"{input.TreasureType}, " +
$"{input.Tier}, " +
$"{input.LootQualityMod}, " +
$"{input.UnknownChances}, " +
$"{input.ItemChance}, " +
$"{input.ItemMinAmount}, " +
$"{input.ItemMaxAmount}, " +
$"{input.ItemTreasureTypeSelectionChances}, " +
$"{input.MagicItemChance}, " +
$"{input.MagicItemMinAmount}, " +
$"{input.MagicItemMaxAmount}, " +
$"{input.MagicItemTreasureTypeSelectionChances}, " +
$"{input.MundaneItemChance}, " +
$"{input.MundaneItemMinAmount}, " +
$"{input.MundaneItemMaxAmount}, " +
$"{input.MundaneItemTypeSelectionChances}, " +
$"'{input.LastModified:yyyy-MM-dd HH:mm:ss}'" +
");";
output = FixNullFields(output);
writer.WriteLine(output);
}
19
View Source File : WeenieSQLWriter.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator
public void CreateSQLINSERTStatement(uint weenieClreplacedID, IList<WeeniePropertiesEmote> input, StreamWriter writer)
{
foreach (var value in input)
{
writer.WriteLine();
writer.WriteLine("INSERT INTO `weenie_properties_emote` (`object_Id`, `category`, `probability`, `weenie_Clreplaced_Id`, `style`, `substyle`, `quest`, `vendor_Type`, `min_Health`, `max_Health`)");
var categoryLabel = Enum.GetName(typeof(EmoteCategory), value.Category);
if (categoryLabel != null)
categoryLabel = $" /* {categoryLabel} */";
string weenieClreplacedIdLabel = null;
if (WeenieNames != null && value.WeenieClreplacedId.HasValue)
{
WeenieNames.TryGetValue(value.WeenieClreplacedId.Value, out weenieClreplacedIdLabel);
if (weenieClreplacedIdLabel != null)
weenieClreplacedIdLabel = $" /* {weenieClreplacedIdLabel} */";
}
string styleLabel = null;
if (value.Style.HasValue)
{
styleLabel = Enum.GetName(typeof(MotionStance), value.Style.Value);
if (styleLabel != null)
styleLabel = $" /* {styleLabel} */";
}
string substyleLabel = null;
if (value.Substyle.HasValue)
{
substyleLabel = Enum.GetName(typeof(MotionCommand), value.Substyle.Value);
if (substyleLabel != null)
substyleLabel = $" /* {substyleLabel} */";
}
string vendorTypeLabel = null;
if (value.VendorType.HasValue)
{
vendorTypeLabel = Enum.GetName(typeof(VendorType), value.VendorType.Value);
if (vendorTypeLabel != null)
vendorTypeLabel = $" /* {vendorTypeLabel} */";
}
var output = "VALUES (" +
$"{weenieClreplacedID}, " +
$"{value.Category.ToString().PadLeft(2)}{categoryLabel}, " +
$"{value.Probability.ToString("0.######", CultureInfo.InvariantCulture).PadLeft(6)}, " +
$"{value.WeenieClreplacedId}{weenieClreplacedIdLabel}, " +
$"{(value.Style.HasValue ? "0x" : "")}{value.Style:X8}{styleLabel}, " +
$"{(value.Substyle.HasValue ? "0x" : "")}{value.Substyle:X8}{substyleLabel}, " +
$"{GetSQLString(value.Quest)}, " +
$"{value.VendorType}{vendorTypeLabel}, " +
$"{value.MinHealth:0.######}, " +
$"{value.MaxHealth:0.######}" +
");";
output = FixNullFields(output);
writer.WriteLine(output);
if (value.WeeniePropertiesEmoteAction != null && value.WeeniePropertiesEmoteAction.Count > 0)
{
writer.WriteLine();
writer.WriteLine("SET @parent_id = LAST_INSERT_ID();");
writer.WriteLine();
CreateSQLINSERTStatement(value.WeeniePropertiesEmoteAction.OrderBy(r => r.Order).ToList(), writer);
}
}
}
19
View Source File : Program.cs
License : MIT License
Project Creator : action-bi-toolkit
License : MIT License
Project Creator : action-bi-toolkit
static int Main(string[] args)
{
// When invoked w/o args, print usage and exit immediately (do not trigger ArgException)
if ((args ?? new string[0]).Length == 0)
{
ArgUsage.GenerateUsageFromTemplate<CmdLineActions>().WriteLine();
return (int)ExitCode.NoArgsProvided;
}
var result = default(ExitCode);
try
{
var action = Args.ParseAction<CmdLineActions>(args);
action.Invoke(); // throws ArgException (DuplicateArg, MissingArg, UnexpectedArg, UnknownArg, ValidationArg)
// in Debug compilation, propagates any exceptions thrown by executing action
// in Release compilation, a user friendly error message is displayed, and exceptions thrown are available via the HandledException property
/* This branch only applies in Release (StandardExceptionHandling enabled) mode, and only to __parser__ exceptions */
if (action.HandledException != null)
{
// Standard output has been generated by PowerArgs framework already
Console.WriteLine();
Log.Verbose(action.HandledException, "PowerArgs exception");
}
// TODO Define and handle specific exceptions to report back to user directly (No PBI install, etc...)
result = action.HandledException == null ? ExitCode.Success : ExitCode.InvalidArgs;
}
catch (ArgException ex)
{
// In RELEASE mode, the PowerArgs error has already been emitted, and the usage docs have been printed to the console at this stage
if (!Environment.UserInteractive)
{
Log.Fatal(ex, "Bad user input.");
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.Error.WriteLine(ex.Message);
Console.ResetColor();
#if DEBUG
ArgUsage.GenerateUsageFromTemplate(ex.Context.Definition).WriteLine();
#endif
}
result = ExitCode.InvalidArgs;
}
catch (PbiToolsCliException ex)
{
Log.Error(ex.Message);
result = ex.ErrorCode;
}
catch (Exception ex) /* Any unhandled exception */
{
// TODO Explicitly log into crash file...
// If CWD is not writable, put into user profile and show path...
Log.Fatal(ex, "An unhandled exception occurred.");
result = ExitCode.UnexpectedError;
}
// Prevent closing of window when debugging
if (Debugger.IsAttached && Environment.UserInteractive)
{
Console.WriteLine();
Console.Write("Press ENTER to exit...");
Console.ReadLine();
}
// ExitCode:
return (int)result;
}
19
View Source File : Program.cs
License : Apache License 2.0
Project Creator : adamralph
License : Apache License 2.0
Project Creator : adamralph
private static int Main(string[] args)
{
using var app = new CommandLineApplication { Name = "minver", FullName = $"MinVer CLI {informationalVersion}" };
app.HelpOption();
var workDirArg = app.Argument("workingDirectory", "Working directory (optional)");
var autoIncrementOption = app.Option("-a|--auto-increment <VERSION_PART>", VersionPartExtensions.ValidValues, CommandOptionType.SingleValue);
var buildMetaOption = app.Option("-b|--build-metadata <BUILD_METADATA>", "", CommandOptionType.SingleValue);
var defaultPreReleasePhaseOption = app.Option("-d|--default-pre-release-phase <PHASE>", "alpha (default), preview, etc.", CommandOptionType.SingleValue);
var minMajorMinorOption = app.Option("-m|--minimum-major-minor <MINIMUM_MAJOR_MINOR>", MajorMinor.ValidValues, CommandOptionType.SingleValue);
var tagPrefixOption = app.Option("-t|--tag-prefix <TAG_PREFIX>", "", CommandOptionType.SingleValue);
var verbosityOption = app.Option("-v|--verbosity <VERBOSITY>", VerbosityMap.ValidValues, CommandOptionType.SingleValue);
#if MINVER
var versionOverrideOption = app.Option("-o|--version-override <VERSION>", "", CommandOptionType.SingleValue);
#endif
app.OnExecute(() =>
{
var workDir = workDirArg.Value ?? ".";
if (!Directory.Exists(workDir))
{
Logger.ErrorWorkDirDoesNotExist(workDir);
return 2;
}
if (!Options.TryParse(
autoIncrementOption.Value(),
buildMetaOption.Value(),
defaultPreReleasePhaseOption.Value(),
minMajorMinorOption.Value(),
tagPrefixOption.Value(),
verbosityOption.Value(),
#if MINVER
versionOverrideOption.Value(),
#endif
out var options))
{
return 2;
}
#if MINVER_CLI
if (!Options.TryParseEnvVars(out var envOptions))
{
return 2;
}
options = options.Mask(envOptions);
#endif
var log = new Logger(options.Verbosity);
if (log.IsDebugEnabled)
{
log.Debug($"MinVer {informationalVersion}.");
}
if (options.VersionOverride != null)
{
log.Info($"Using version override {options.VersionOverride}.");
Console.Out.WriteLine(options.VersionOverride);
return 0;
}
var version = Versioner.GetVersion(workDir, options.TagPrefix, options.MinMajorMinor, options.BuildMeta, options.AutoIncrement, options.DefaultPreReleasePhase, log);
Console.Out.WriteLine(version);
return 0;
});
return app.Execute(args);
}
19
View Source File : StrictFieldDiffVisitor.cs
License : MIT License
Project Creator : adrianoc
License : MIT License
Project Creator : adrianoc
public bool VisitFieldType(FieldDefinition source, FieldDefinition target)
{
output.WriteLine("[{0}] Field type differs. Expected '{1}' got '{2}'.", target.FullName, source.FieldType.FullName, target.FieldType.FullName);
return false;
}
19
View Source File : StrictFieldDiffVisitor.cs
License : MIT License
Project Creator : adrianoc
License : MIT License
Project Creator : adrianoc
public bool VisitName(IMemberDefinition source, IMemberDefinition target)
{
output.WriteLine("Field simple name ('{0}') matches, but not FQN. Expected {1} got {2}.", source.Name, source.FullName, target.FullName);
return false;
}
19
View Source File : StrictFieldDiffVisitor.cs
License : MIT License
Project Creator : adrianoc
License : MIT License
Project Creator : adrianoc
public bool VisitDeclaringType(IMemberDefinition source, IMemberDefinition target)
{
output.WriteLine("Declaring type differs. Expected '{0}' got '{1}'.", source.FullName, target.FullName);
return false;
}
19
View Source File : StrictFieldDiffVisitor.cs
License : MIT License
Project Creator : adrianoc
License : MIT License
Project Creator : adrianoc
public bool VisitMissing(IMemberDefinition member, TypeDefinition target)
{
output.WriteLine("[{0}] Field {1} not found.", target.FullName, member.FullName);
return false;
}
19
View Source File : StrictFieldDiffVisitor.cs
License : MIT License
Project Creator : adrianoc
License : MIT License
Project Creator : adrianoc
public bool VisitConstant(FieldDefinition source, FieldDefinition target)
{
output.WriteLine("[{0}] Field constant values differs. Expected '{1}' got '{2}'.", target.FullName, source.Constant, target.Constant);
return false;
}
19
View Source File : Formatter.cs
License : MIT License
Project Creator : adrianoc
License : MIT License
Project Creator : adrianoc
private static void WriteExceptionHandlers(TextWriter writer, MethodBody body)
{
if (!body.HasExceptionHandlers)
{
return;
}
foreach (var handler in body.ExceptionHandlers)
{
writer.Write("\t");
writer.WriteLine(".try {0} to {1} {2} handler {3} to {4}",
FormatLabel(handler.TryStart),
FormatLabel(handler.TryEnd),
FormatHandlerType(handler),
FormatLabel(handler.HandlerStart),
FormatLabel(handler.HandlerEnd));
}
}
19
View Source File : StrictFieldDiffVisitor.cs
License : MIT License
Project Creator : adrianoc
License : MIT License
Project Creator : adrianoc
public bool VisitAttributes(FieldDefinition source, FieldDefinition target)
{
output.WriteLine("[{0}] Field attributes differs. Expected '{1}' got '{2}'.", target.FullName, source.Attributes, target.Attributes);
return false;
}
19
View Source File : ErrorHandler.cs
License : MIT License
Project Creator : AgathokakologicalBit
License : MIT License
Project Creator : AgathokakologicalBit
public static void LogErrorTokensPart(State state, int index, int leftBound, int rightBound)
{
var reader = state.Tokens.Skip(index - leftBound);
var tokensToPrint = reader.Take(leftBound + rightBound + 1);
Console.Error.WriteLine(
String.Join(
" ",
tokensToPrint.Select(t => t.Value)
)
);
var codePointerString = new String(
'^',
state.Tokens[index].Length
);
var shift = tokensToPrint.Take(leftBound).Select(t => t.Value.Length).Sum() + leftBound;
var underline = new String(' ', shift) + codePointerString;
Console.Error.WriteLine(underline);
}
19
View Source File : ErrorHandler.cs
License : MIT License
Project Creator : AgathokakologicalBit
License : MIT License
Project Creator : AgathokakologicalBit
private static void LogCodePart(State state, string underline, int from)
{
Console.Error.WriteLine(
state.Code
.Substring(from, underline.Length)
.Replace('\n', ' ') +
"\n" + underline + "\n"
);
}
19
View Source File : MainForm.cs
License : GNU General Public License v3.0
Project Creator : AgentRev
License : GNU General Public License v3.0
Project Creator : AgentRev
void SaveSettings()
{
if (saveSettings && !currentlyReading)
{
try
{
StreamWriter sw = null;
try
{
if (!Directory.Exists(settingsPath))
Directory.CreateDirectory(settingsPath);
using (sw = new StreamWriter(settingsFile))
{
sw.WriteLine("ToolVersion=" + c_toolVer);
sw.WriteLine("Beep=" + chkBeep.Checked);
sw.WriteLine("FoV=" + fFoV);
sw.WriteLine("FoVOffset=" + pFoV.ToString("x"));
sw.WriteLine("UpdateNotify=" + chkUpdate.Checked);
sw.WriteLine("DisableHotkeys=" + chkHotkeys.Checked);
sw.WriteLine("HotkeyIncrease=" + (int)catchKeys[0]);
sw.WriteLine("HotkeyDecrease=" + (int)catchKeys[1]);
sw.WriteLine("HotkeyReset=" + (int)catchKeys[2]);
}
}
catch
{
if (sw != null)
sw.Close();
File.Delete(settingsFile);
throw;
}
SaveGameMode();
}
catch
{
saveSettings = false;
}
}
}
19
View Source File : MainForm.cs
License : GNU General Public License v3.0
Project Creator : AgentRev
License : GNU General Public License v3.0
Project Creator : AgentRev
private void SaveData()
{
if (saveSettings && !currentlyReading)
{
try
{
StreamWriter sw = null;
try
{
if (!Directory.Exists(settingsPath)) Directory.CreateDirectory(settingsPath);
sw = new StreamWriter(Path.Combine(settingsPath, settingsFile));
sw.WriteLine("ToolVersion=" + c_toolVer);
sw.WriteLine("Beep=" + chkBeep.Checked.ToString().ToLower());
sw.WriteLine("FoV=" + ((int)fFoV).ToString());
sw.WriteLine("FoVOffset=" + pFoV.ToString("x"));
sw.WriteLine("UpdatePopup=" + chkUpdate.Checked.ToString().ToLower());
sw.WriteLine("DisableHotkeys=" + chkHotkeys.Checked.ToString().ToLower());
sw.WriteLine("HotkeyIncrease=" + (int)catchKeys[0]);
sw.WriteLine("HotkeyDecrease=" + (int)catchKeys[1]);
sw.WriteLine("HotkeyReset=" + (int)catchKeys[2]);
}
catch
{
//MessageBox.Show("catch");
if (sw != null) sw.Close();
File.Delete(settingsFile);
saveSettings = false;
}
finally
{
if (sw != null) sw.Close();
}
}
catch
{
saveSettings = false;
}
}
}
19
View Source File : MainForm.cs
License : GNU General Public License v3.0
Project Creator : AgentRev
License : GNU General Public License v3.0
Project Creator : AgentRev
void SaveSettings()
{
if (saveSettings && !currentlyReading)
{
try
{
StreamWriter sw = null;
try
{
if (!Directory.Exists(settingsPath))
Directory.CreateDirectory(settingsPath);
using (sw = new StreamWriter(settingsFile))
{
sw.WriteLine("ToolVersion=" + c_toolVer);
sw.WriteLine("Beep=" + chkBeep.Checked);
sw.WriteLine("FoV=" + fFoV);
sw.WriteLine("FoVOffset=" + pFoV.ToString("x"));
sw.WriteLine("UpdatePopup=" + chkUpdate.Checked);
sw.WriteLine("DisableHotkeys=" + chkHotkeys.Checked);
sw.WriteLine("HotkeyIncrease=" + (int)catchKeys[0]);
sw.WriteLine("HotkeyDecrease=" + (int)catchKeys[1]);
sw.WriteLine("HotkeyReset=" + (int)catchKeys[2]);
}
}
catch
{
if (sw != null)
sw.Close();
File.Delete(settingsFile);
throw;
}
}
catch
{
saveSettings = false;
}
}
}
19
View Source File : DisassembleOutput.cs
License : GNU General Public License v3.0
Project Creator : ahmed605
License : GNU General Public License v3.0
Project Creator : ahmed605
public void Process(File file, TextWriter writer)
{
var decoder = new Decoder(file);
int length = file.Code.Length;
int offset = 0;
while (offset < length)
{
Instruction instruction = decoder.Decode(offset);
writer.WriteLine(instruction.ToString());
//instruction.ToString();
offset += instruction.InstructionLength;
}
/*
foreach (uint item in Scruff.Script.Natives.UnknownNatives)
{
writer.WriteLine(string.Format("0x{0:x}", item));
}
* */
}
19
View Source File : DecompileFullOutput.cs
License : GNU General Public License v3.0
Project Creator : ahmed605
License : GNU General Public License v3.0
Project Creator : ahmed605
private void ProcessCodePath(TextWriter writer, CodePath path, string indent)
{
HLInstruction instruction = path.GetFirstInstruction();
while (instruction != null)
{
Annotate(writer, indent, instruction);
if (instruction.UnconditionalBranch)
{
// Not used
}
else if (instruction.IsConditionalBranch)
{
if (_nextIfIsAnElseIf)
{
writer.Write(string.Format("{0}else if", indent));
_nextIfIsAnElseIf = false;
}
else
{
writer.Write(string.Format("{0}if", indent));
}
writer.WriteLine(string.Format(" ({0})", instruction.ProcessedStackValue));
writer.WriteLine(indent + "{");
ProcessCodePath(writer, instruction.BranchCodesPaths[instruction.DefaultConditional],
indent + " ");
writer.WriteLine(indent + "}");
if (instruction.BranchCodesPaths.ContainsKey(!instruction.DefaultConditional))
{
CodePath elsePath = instruction.BranchCodesPaths[!instruction.DefaultConditional];
if (elsePath.StartInstruction != null)
{
if (IsCodePathAnIfPath(elsePath))
{
_nextIfIsAnElseIf = true;
ProcessCodePath(writer, elsePath, indent);
}
else
{
writer.WriteLine(indent + "else");
writer.WriteLine(indent + "{");
ProcessCodePath(writer, elsePath, indent + " ");
writer.WriteLine(indent + "}");
}
}
}
}
else if (instruction.IsSwitchBranch)
{
// Do switch cases ever fall through?? I'm replaceduming they don't here!
writer.WriteLine(indent + string.Format("switch ({0})", instruction.ProcessedStackValue));
writer.WriteLine(indent + "{");
// Keep track of code paths are have already outputted to keep
// track of offsets that lead to the same codepath
var swDonePaths = new List<CodePath>();
foreach (var item in instruction.BranchCodesPaths)
{
if (swDonePaths.Contains(item.Value))
{
continue;
}
foreach (var item2 in instruction.BranchCodesPaths)
{
// O(n^2) loop here, there's probably a better way to optimize it
if (item2.Value == item.Value)
{
if (item2.Key.GetType() == typeof (int))
{
writer.WriteLine(string.Format("{0} case {1}:", indent, LiteralFormatter.FormatInteger((int)item2.Key)));
}
else
{
writer.WriteLine(string.Format("{0} default:", indent));
}
}
}
writer.WriteLine(indent + " {");
ProcessCodePath(writer, item.Value, indent + " ");
if (item.Value.EndInstruction == null || !item.Value.EndInstruction.ExitFunction)
{
writer.WriteLine(indent + " break;");
}
writer.WriteLine(indent + " }");
swDonePaths.Add(item.Value);
}
writer.WriteLine(indent + "}");
}
else if (instruction.LoopCodePath != null)
{
// First of a loop instruction (hopefully, someday, this will be extracted out by the Programreplacedyzer)
// Can we ever break out of a loop? I replacedume we can't here!
while (!instruction.IsConditionalBranch)
{
instruction = instruction.NextInstruction;
Annotate(writer, indent, instruction);
}
writer.WriteLine(indent + string.Format("while ({0})", instruction.ProcessedStackValue));
writer.WriteLine(indent + "{");
ProcessCodePath(writer, instruction.BranchCodesPaths[true], indent + " ");
writer.WriteLine(indent + "}");
}
else
{
WriteInstruction(writer, instruction, indent);
}
instruction = instruction.NextInstruction;
}
}
19
View Source File : StudiomdlExport.cs
License : GNU General Public License v3.0
Project Creator : ahmed605
License : GNU General Public License v3.0
Project Creator : ahmed605
private static void ExportVertex(TextWriter sw, Mesh m, Vertex v)
{
var boneIndex = m.VertexHasBlendInfo ? v.BlendIndices[0] : 0;
var normal = m.VertexHasNormal ? v.Normal : new Vector3();
var uv = m.VertexHasTexture ? v.TextureCoordinates[0] : new Vector2();
var position = v.Position;
sw.WriteLine("{0} {1} {2} {3} {4} {5} {6} {7} {8} 1 0 1.000000", boneIndex,
F(position.X), F(position.Y), F(position.Z),
F(normal.X), F(normal.Y), F(normal.Z),
F(uv.X), F(uv.Y));
}
19
View Source File : StudiomdlExport.cs
License : GNU General Public License v3.0
Project Creator : ahmed605
License : GNU General Public License v3.0
Project Creator : ahmed605
private static void ExportNodes(TextWriter sw, Bone bone, Bone parentBone)
{
sw.WriteLine("{0} \"{1}\" {2}", bone.Index, bone.Name, parentBone == null ? -1 : parentBone.Index);
foreach (var childBone in bone.Children)
{
ExportNodes(sw, childBone, bone);
}
}
19
View Source File : StudiomdlExport.cs
License : GNU General Public License v3.0
Project Creator : ahmed605
License : GNU General Public License v3.0
Project Creator : ahmed605
private static void ExportSkeleton(TextWriter sw, Bone bone)
{
sw.WriteLine("{0} {1} {2} {3} {4} {5} {6}", bone.Index,
F(bone.Position.X), F(bone.Position.Y), F(bone.Position.Z),
F(bone.Rotation.X), F(bone.Rotation.Y), F(bone.Rotation.Z));
foreach (var childBone in bone.Children)
{
ExportSkeleton(sw, childBone);
}
}
19
View Source File : CodePathOutput.cs
License : GNU General Public License v3.0
Project Creator : ahmed605
License : GNU General Public License v3.0
Project Creator : ahmed605
public void Process(File file, TextWriter writer)
{
var decoder = new Decoder(file);
var program = new ScriptProgram(decoder);
var replacedyzer = new ControlFlowreplacedyzer(program);
replacedyzer.replacedyze();
// Dump the code paths
foreach (Function function in program.Functions)
{
writer.WriteLine("function " + function.Name);
foreach (CodePath path in function.CodePaths)
{
writer.WriteLine(" " + path.Name + ":");
writer.WriteLine(string.Format(" 0x{0:x} --> 0x{1:x}", path.StartOffset, path.EndOffset));
if (path.ParentCodePath != null)
{
writer.WriteLine(" parent: {0}, exit: 0x{1:x}, reentry: 0x{2:x}",
path.ParentCodePath.Name, path.ParentExitInstruction.Instruction.Offset,
path.ParentEntryTargetInstruction.Instruction.Offset);
}
}
writer.WriteLine();
}
}
19
View Source File : Program.cs
License : GNU Affero General Public License v3.0
Project Creator : aianlinb
License : GNU Affero General Public License v3.0
Project Creator : aianlinb
static void Main(string[] args)
{
string path = args.Length > 0 && Path.GetFileName(args[0]) == "_.index.bin" ? args[0] : "_.index.bin";
if (!File.Exists(path))
{
Console.WriteLine("File not found: " + path);
Console.WriteLine("Click enter to exit . . .");
Console.ReadLine();
return;
}
Console.WriteLine("Loading . . .");
var ic = new IndexContainer(path);
Console.WriteLine("Found:");
Console.WriteLine(ic.Bundles.Length.ToString() + " BundleRecords");
Console.WriteLine(ic.Files.Length.ToString() + " FileRecords");
Console.WriteLine(ic.Directorys.Length.ToString() + " DirectoryRecords");
Console.WriteLine(Environment.NewLine + "Generating FileList . . .");
var sw = File.CreateText("FileList.yml");
foreach (var b in ic.Bundles)
{
sw.WriteLine(b.Name + ":");
foreach (var f in b.Files)
sw.WriteLine("- " + f.path);
}
sw.Flush();
sw.Close();
Console.WriteLine("Done!");
Console.WriteLine(Environment.NewLine + "Click enter to exit . . .");
Console.ReadLine();
}
19
View Source File : PackageImporter.cs
License : MIT License
Project Creator : ai-traders
License : MIT License
Project Creator : ai-traders
public async Task ImportAsync(string pkgDirectory, TextWriter output)
{
var files = GetDirectoryFiles(pkgDirectory, "*.nupkg", SearchOption.AllDirectories, output);
foreach (string file in files)
{
output.Write("Importing package {0} ", file);
using (var uploadStream = File.OpenRead(file))
{
var result = await _indexingService.IndexAsync(uploadStream, CancellationToken.None);
output.WriteLine(result);
}
}
}
19
View Source File : MainProgram.cs
License : MIT License
Project Creator : AlbertMN
License : MIT License
Project Creator : AlbertMN
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs args) {
Exception e = (Exception)args.ExceptionObject;
string errorLogLoc = Path.Combine(dataFolderLocation, "error_log.txt");
string subKey = @"SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion";
RegistryKey thekey = Registry.LocalMachine;
RegistryKey skey = thekey.OpenSubKey(subKey);
string windowsVersionName = skey.GetValue("ProductName").ToString();
string rawWindowsVersion = Environment.OSVersion.ToString();
int totalExecutions = 0;
foreach (int action in Properties.Settings.Default.TotalActionsExecuted) {
totalExecutions += action;
}
if (File.Exists(errorLogLoc))
try {
File.Delete(errorLogLoc);
} catch {
DoDebug("Failed to delete error log");
}
if (!File.Exists(errorLogLoc)) {
try {
using (var tw = new StreamWriter(errorLogLoc, true)) {
tw.WriteLine("OS;");
tw.WriteLine("- " + windowsVersionName);
tw.WriteLine("- " + rawWindowsVersion);
tw.WriteLine();
tw.WriteLine("ACC info;");
tw.WriteLine("- Version; " + softwareVersion + ", " + releaseDate);
tw.WriteLine("- UID; " + Properties.Settings.Default.UID);
tw.WriteLine("- Running from; " + currentLocationFull);
tw.WriteLine("- Start with Windows; " + (ACCStartsWithWindows() ? "[Yes]" : "[No]"));
tw.WriteLine("- Check for updates; " + (Properties.Settings.Default.CheckForUpdates ? "[Yes]" : "[No]"));
tw.WriteLine("- In beta program; " + (Properties.Settings.Default.BetaProgram ? "[Yes]" : "[No]"));
tw.WriteLine("- Has completed setup guide; " + (Properties.Settings.Default.HasCompletedTutorial ? "[Yes]" : "[No]"));
tw.WriteLine("- Check path; " + CheckPath());
tw.WriteLine("- Check extension; " + Properties.Settings.Default.ActionFileExtension);
tw.WriteLine("- Actions executed; " + totalExecutions);
tw.WriteLine("- replacedistant type; " + "[Google replacedistant: " + Properties.Settings.Default.replacedistantType[0] + "] [Alexa: " + Properties.Settings.Default.replacedistantType[1] + "] [Unknown: " + Properties.Settings.Default.replacedistantType[1] + "]");
tw.WriteLine();
tw.WriteLine(e);
tw.Close();
}
} catch {
//Caught exception when trying to log exception... *sigh*
}
}
File.AppendAllText(errorLogLoc, DateTime.Now.ToString() + ": " + e + Environment.NewLine);
if (debug) {
Console.WriteLine(e);
}
MessageBox.Show("A critical error occurred. The developer has been notified and will resolve this issue ASAP! Try and start ACC again, and avoid whatever just made it crash (for now) :)", "ACC | Error");
}
19
View Source File : MixtureDocumentationWindow.cs
License : MIT License
Project Creator : alelievr
License : MIT License
Project Creator : alelievr
void GenerateNodeMarkdownDoc(BaseNodeView view)
{
using (var fs = new FileStream(nodeManualDir + view.nodeTarget.GetType().ToString() + ".md", FileMode.OpenOrCreate))
{
fs.SetLength(0);
using (var sw = new StreamWriter(fs))
{
// Append replacedle
sw.WriteLine($"# {view.nodeTarget.name}");
// Add link to node image
sw.WriteLine($"})");
// Add node input tooltips
if (view.inputPortViews.Count > 0)
{
sw.WriteLine($"## Inputs");
sw.WriteLine("Port Name | Description");
sw.WriteLine("--- | ---");
foreach (var pv in view.inputPortViews)
sw.WriteLine($"{pv.portData.displayName} | {pv.portData.tooltip ?? ""}");
}
// Empty line to end the table
sw.WriteLine();
// Add node output tooltips
if (view.outputPortViews.Count > 0)
{
sw.WriteLine($"## Output");
sw.WriteLine("Port Name | Description");
sw.WriteLine("--- | ---");
foreach (var pv in view.outputPortViews)
sw.WriteLine($"{pv.portData.displayName} | {pv.portData.tooltip ?? ""}");
}
// Empty line to end the table
sw.WriteLine();
sw.WriteLine("## Description");
// Add node doreplacedentation if any
var docAttr = view.nodeTarget.GetType().GetCustomAttribute<DoreplacedentationAttribute>();
if (docAttr != null)
{
sw.WriteLine(docAttr.markdown.Trim());
}
sw.WriteLine();
if (view.nodeTarget is ShaderNode s)
{
// In case a node doesn't support all dimensions:
if (s.supportedDimensions.Count != 3)
{
sw.WriteLine("Please note that this node only support " + string.Join(" and ", s.supportedDimensions) + " dimension(s).");
}
}
sw.Flush();
}
}
}
19
View Source File : CrashHandler.cs
License : GNU General Public License v3.0
Project Creator : alexgracianoarj
License : GNU General Public License v3.0
Project Creator : alexgracianoarj
private static void CreateCrashLog(string directory, Exception exception)
{
StreamWriter writer = null;
try
{
string filePath = Path.Combine(directory, "crash.log");
writer = new StreamWriter(filePath);
writer.WriteLine(string.Format(
Strings.SendLogFile, Properties.Resources.MailAddress));
writer.WriteLine();
writer.WriteLine("Version: {0}", Program.GetVersionString());
writer.WriteLine("Mono: {0}", MonoHelper.IsRunningOnMono ? "yes" : "no");
if (MonoHelper.IsRunningOnMono)
writer.WriteLine("Mono version: {0}", MonoHelper.Version);
writer.WriteLine("OS: {0}", Environment.OSVersion.VersionString);
writer.WriteLine();
writer.WriteLine(exception.Message);
Exception innerException = exception.InnerException;
while (innerException != null)
{
writer.WriteLine(innerException.Message);
innerException = innerException.InnerException;
}
writer.WriteLine();
writer.WriteLine(exception.StackTrace);
}
catch
{
// Do nothing
}
finally
{
if (writer != null)
writer.Close();
}
}
19
View Source File : Computer.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : AlexGyver
private static void ReportHardwareSensorTree(
IHardware hardware, TextWriter w, string space)
{
w.WriteLine("{0}|", space);
w.WriteLine("{0}+- {1} ({2})",
space, hardware.Name, hardware.Identifier);
ISensor[] sensors = hardware.Sensors;
Array.Sort(sensors, CompareSensor);
foreach (ISensor sensor in sensors) {
w.WriteLine("{0}| +- {1,-14} : {2,8:G6} {3,8:G6} {4,8:G6} ({5})",
space, sensor.Name, sensor.Value, sensor.Min, sensor.Max,
sensor.Identifier);
}
foreach (IHardware subHardware in hardware.SubHardware)
ReportHardwareSensorTree(subHardware, w, "| ");
}
19
View Source File : Computer.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : AlexGyver
private static void ReportHardwareParameterTree(
IHardware hardware, TextWriter w, string space) {
w.WriteLine("{0}|", space);
w.WriteLine("{0}+- {1} ({2})",
space, hardware.Name, hardware.Identifier);
ISensor[] sensors = hardware.Sensors;
Array.Sort(sensors, CompareSensor);
foreach (ISensor sensor in sensors) {
string innerSpace = space + "| ";
if (sensor.Parameters.Length > 0) {
w.WriteLine("{0}|", innerSpace);
w.WriteLine("{0}+- {1} ({2})",
innerSpace, sensor.Name, sensor.Identifier);
foreach (IParameter parameter in sensor.Parameters) {
string innerInnerSpace = innerSpace + "| ";
w.WriteLine("{0}+- {1} : {2}",
innerInnerSpace, parameter.Name,
string.Format(CultureInfo.InvariantCulture, "{0} : {1}",
parameter.DefaultValue, parameter.Value));
}
}
}
foreach (IHardware subHardware in hardware.SubHardware)
ReportHardwareParameterTree(subHardware, w, "| ");
}
19
View Source File : TextReportWriter.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : AlexGyver
public void WriteHeader(Header h)
{
if (h.Text == null)
{
return;
}
WriteLine(h);
if (h.Level == 1)
{
this.WriteLine("=".Repeat(h.Text.Length));
}
this.WriteLine();
}
19
View Source File : WikiReportWriter.cs
License : MIT License
Project Creator : AlexGyver
License : MIT License
Project Creator : AlexGyver
public void WriteHeader(Header h)
{
if (h.Text == null)
{
return;
}
string prefix = string.Empty;
for (int i = 0; i < h.Level; i++)
{
prefix += "!";
}
this.WriteLine(prefix + " " + h.Text);
}
19
View Source File : AlertToChart.cs
License : Apache License 2.0
Project Creator : AlexWan
License : Apache License 2.0
Project Creator : AlexWan
public void Save()
{
try
{
using (StreamWriter writer = new StreamWriter(@"Engine\" + Name + @"Alert.txt", false))
{
writer.WriteLine(Type);
string saveLineString = "";
for (int i = 0; i < Lines.Length; i++)
{
saveLineString += Lines[i].GetStringToSave() + "%";
}
writer.WriteLine(saveLineString);
writer.WriteLine(Label);
writer.WriteLine(Message);
writer.WriteLine(BorderWidth);
writer.WriteLine(IsOn);
writer.WriteLine(IsMusicOn);
writer.WriteLine(IsMessageOn);
writer.WriteLine(ColorLine.ToArgb());
writer.WriteLine(ColorLabel.ToArgb());
writer.WriteLine(Music);
writer.WriteLine(SignalType);
writer.WriteLine(VolumeReaction);
writer.WriteLine(Slippage);
writer.WriteLine(NumberClosePosition);
writer.WriteLine(OrderPriceType);
writer.Close();
}
}
catch (Exception)
{
// ignore
}
}
19
View Source File : AlertToPrice.cs
License : Apache License 2.0
Project Creator : AlexWan
License : Apache License 2.0
Project Creator : AlexWan
public void Save()
{
try
{
using (StreamWriter writer = new StreamWriter(@"Engine\" + Name + @"Alert.txt", false))
{
writer.WriteLine(Message);
writer.WriteLine(IsOn);
writer.WriteLine(MessageIsOn);
writer.WriteLine(MusicType);
writer.WriteLine(SignalType);
writer.WriteLine(VolumeReaction);
writer.WriteLine(Slippage);
writer.WriteLine(NumberClosePosition);
writer.WriteLine(OrderPriceType);
writer.WriteLine(TypeActivation);
writer.WriteLine(PriceActivation);
writer.Close();
}
}
catch (Exception)
{
// ignore
}
}
See More Examples