This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void TestFifo(Stream cStream) | |
{ | |
int readbytes; | |
int crbytes; | |
var buf = new byte[10 * 1024 * 1024]; | |
var cBuf = new byte[255 * 1024]; | |
var sInfo = new FileInfo(@"D:\Work\Video Editing\Raw\Overwatch\Overwatch 10.17.2017 - 23.59.39.01.mp4"); | |
var dInfo = new FileInfo(@"D:\Work\Video Editing\Raw\dst.mp4"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FifoStream2 : Stream | |
{ | |
private static readonly ConcurrentQueue<CByte> _ringBuffer = new ConcurrentQueue<CByte>(); | |
static FifoStream2() | |
{ | |
for (int i = 0; i < 1000; i++) | |
_ringBuffer.Enqueue(new CByte()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static byte[] Decrypt(byte[] Data, int Offset) | |
{ | |
MemoryStream memoryStream = new MemoryStream(); | |
int num = 0; | |
byte b = 0; | |
for (;;) | |
{ | |
byte b2 = Data[num + Offset]; | |
if (b2 == 0) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FifoStream : Stream | |
{ | |
private readonly Queue<byte[]> _localBuffer = new Queue<byte[]>(); | |
private int _currentStreamOffset = 0; | |
private long _length; | |
public override void Flush() | |
{ | |
throw new NotImplementedException(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Sample Usage for mahapps: | |
//WpfDictionaries.AddDirectories("MahApps.Metro", "component/Styles", new string[] { "Controls", "Fonts", "Colors", "Accents/Blue", "Accents/BaseLight" }, "xaml"); | |
internal class WpfDictionaries | |
{ | |
public static void AddDirectories(string domain, string prefix, IEnumerable<string> fileNames, string suffix) | |
{ | |
fileNames.ForEach(x => | |
{ | |
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
using System.Text; | |
public static class Usage | |
{ | |
public static void Use() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class BwHelper | |
{ | |
public object SessObj { get; set; } | |
public Func<object, bool> CheckingAlg { get; set; } | |
public Action<bool, object> StatusChange { get; set; } | |
public bool doCallbackOn { get; set; } | |
public bool lastResult { get; set; } | |
public double NextCheck { get; set; } | |
public double Interval { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Byte | |
{ | |
/// <summary> | |
/// Gets the starting pointers in array of the given element | |
/// </summary> | |
/// <param name="array">Bigger element where is searched in</param> | |
/// <param name="element">Tiny pattern which has to be matched in <see cref="array"/></param> | |
/// <returns></returns> | |
public static List<int> GetOccurancePtrs(byte[] array, byte[] element) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void PatchHosts() | |
{ | |
string HostFileLocation = @"C:\Windows\System32\drivers\etc\hosts"; | |
Regex rgxHosts = new Regex(@"\b((\d{1,3}\.){3}\d{1,3})\b[ ]+([a-zA-Z0-9.]+)", RegexOptions.ECMAScript | RegexOptions.Compiled); | |
List<String> HostsFile = new List<string>(File.ReadAllLines(HostFileLocation)); | |
//Parse Entities into an easy <domain,ip> list | |
var myDict = HostsFile | |
.Select(m => m.Split("#")[0]).Where(m => m != "") | |
.Select(m => rgxHosts.Match(m)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Linq; | |
using System.Threading; | |
namespace JFunctions.Async | |
{ | |
public class ThreadQueue | |
{ | |
private ConcurrentQueue<Action> processQueue = new ConcurrentQueue<Action>(); |