/// <summary> /// Set things in motion so your service can do its work. /// </summary> protected override void OnStart(string[] args) { NameValueCollection appSettings = ConfigurationManager.AppSettings; _port = int.Parse(appSettings["proxyPort"]); _secured = bool.Parse(appSettings["proxySecured"]); _store = new SQLiteStore("mocument"); _server = new Server(_port, _secured, _store); _server.Start(); }
protected void AddButton_Click(object sender, EventArgs e) { var tape = new Tape() { Id = ProxySettings.GetUserId() + "." + NameTextBox.Text, Description = DescTextBox.Text, AllowedIpAddress = IpTextBox.Text, OpenForRecording = LockedCheckBox.Checked }; var store = new SQLiteStore("mocument"); store.Insert(tape); Response.Redirect("~/tapes/mytapes.aspx"); }
// ReSharper disable UnusedParameter.Local private static void Main(string[] args) // ReSharper restore UnusedParameter.Local { NameValueCollection appSettings = ConfigurationManager.AppSettings; _port = int.Parse(appSettings["proxyPort"]); _secured = bool.Parse(appSettings["proxySecured"]); _proxySSLPort = int.Parse(appSettings["proxySSLPort"]); _proxyHostName = appSettings["proxyHostName"]; _store = new SQLiteStore("mocument"); AppDomain.CurrentDomain.ProcessExit += CurrentDomainProcessExit; _server = new Server(_port, _proxySSLPort, _proxyHostName, _secured, _store); Console.CancelKeyPress += ConsoleCancelKeyPress; _server.Start(); Console.WriteLine("Hit CTRL+C to end session."); bool bDone = false; do { Console.WriteLine( "\nEnter a command [G=Collect Garbage; Q=Quit]:"); Console.Write(">"); ConsoleKeyInfo cki = Console.ReadKey(); Console.WriteLine(); switch (cki.KeyChar) { case 'g': Console.WriteLine("Working Set:\t" + Environment.WorkingSet.ToString("n0")); Console.WriteLine("Begin GC..."); GC.Collect(); Console.WriteLine("GC Done.\nWorking Set:\t" + Environment.WorkingSet.ToString("n0")); break; case 'q': bDone = true; _server.Stop(); break; } } while (!bDone); }
public ContextDataSource() { _store = new SQLiteStore("mocument"); }