public BandwidthForm(List <OpCore> cores) { InitializeComponent(); Cores = cores; BandwidthGraph.GraphPane.Title.Text = "Bandwidth"; BandwidthGraph.GraphPane.XAxis.Title.IsVisible = false; BandwidthGraph.GraphPane.YAxis.Title.IsVisible = false; BandwidthGraph.GraphPane.XAxis.Title.Text = "Seconds"; BandwidthGraph.GraphPane.YAxis.Title.Text = "Bytes"; BandwidthGraph.GraphPane.Legend.IsVisible = false; if (Cores.Count > 0) { DeOpsContext sample = Cores[0].Context; RecordSeconds = Cores[0].RecordBandwidthSeconds; foreach (uint id in sample.KnownServices.Keys) { ServiceItem item = new ServiceItem(id, sample.KnownServices[id]); ServiceList.Items.Add(item); ServiceItemMap[id] = item; } } RecordLink.Text = "Recording " + RecordSeconds + " s"; AverageLink.Text = "Average over " + AverageSeconds + " s"; RefreshCoreList(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // UI init SetContentView(Resource.Layout.Main); StatusLabel = FindViewById <TextView>(Resource.Id.StatusTextView); LogView = FindViewById <TextView>(Resource.Id.LogTextView); var createUserButton = FindViewById <Button>(Resource.Id.CreateUserButton); var loginButton = FindViewById <Button>(Resource.Id.LoginButton); var logoffButton = FindViewById <Button>(Resource.Id.LogoffButton); createUserButton.Click += new EventHandler(CreateUserButton_Click); loginButton.Click += new EventHandler(LoginButton_Click); logoffButton.Click += new EventHandler(LogoffButton_Click); // context init Context = new DeOpsContext(CacheDir.Path, null); OpName = "Global IM"; Username = "******"; Password = "******"; UserFile = OpName + " - " + Username; UserPath = CacheDir.Path + Path.DirectorySeparatorChar + UserFile + Path.DirectorySeparatorChar + UserFile + ".dop"; }
public static void Show(DeOpsContext context) { List<OpCore> cores = new List<OpCore>(); if(context.Lookup != null) cores.Add(context.Lookup); context.Cores.LockReading(delegate() { cores.AddRange(context.Cores); }); new BandwidthForm(cores).Show(); }
public CreateUser(AppContext app, string opName, AccessType opAccess) { InitializeComponent(); App = app; Context = app.Context; OpName = opName.Replace("deops://", ""); OpAccess = opAccess; OpNameLabel.Text = OpName; BrowseLink.Text = (Context.Sim == null) ? Application.StartupPath : Context.Sim.Internet.LoadedPath; }
public static void Show(DeOpsContext context) { List <OpCore> cores = new List <OpCore>(); if (context.Lookup != null) { cores.Add(context.Lookup); } context.Cores.LockReading(delegate() { cores.AddRange(context.Cores); }); new BandwidthForm(cores).Show(); }
public LoginForm(AppContext app, string arg) { App = app; Context = app.Context; Arg = arg; InitializeComponent(); Text = "DeOps Alpha v" + DeOpsContext.CoreVersion; //+ app.Context.LocalSeqVersion.ToString(); //SplashBox.Image = InterfaceRes.splash; if (Context.Sim != null) // prevent sim recursion EnterSimLink.Visible = false; LastBrowse = Application.StartupPath; LastOpened = (arg != "") ? arg : App.Settings.LastOpened; // each profile (.rop) is in its own directory // /root/profiledirs[]/profile.rop if (App.Context.Sim == null) { LoadProfiles(Application.StartupPath); // if started with file argument, load profiles around the same location if (File.Exists(arg)) LoadProfiles(Path.GetDirectoryName(Path.GetDirectoryName(arg))); } else LoadProfiles(App.Context.Sim.Internet.LoadedPath); OpComboItem select = null; if(LastOpened != null) foreach (OpComboItem item in OpCombo.Items) if (item.Fullpath == LastOpened) select = item; if (select != null) OpCombo.SelectedItem = select; else if (OpCombo.Items.Count > 0) OpCombo.SelectedIndex = 0; OpCombo.Items.Add("Browse..."); if (OpCombo.SelectedItem != null) TextPassword.Select(); }
public CreateUser(AppContext app, InvitePackage invite) { InitializeComponent(); App = app; Context = app.Context; Invite = invite; OpName = invite.Info.OpName; OpAccess = invite.Info.OpAccess; OpNameLabel.Text = OpName; TextName.Text = invite.Info.UserName; BrowseLink.Text = (Context.Sim == null) ? Application.StartupPath : Context.Sim.Internet.LoadedPath; }
public SelectServices(SimForm sim, string title, RunServiceMethod method) { InitializeComponent(); Sim = sim; Text = title; Method = method; foreach (ListInstanceItem item in Sim.ListInstances.Items) { if (item.Core != null) { DeOpsContext sample = item.Core.Context; foreach (uint id in sample.KnownServices.Keys) { ServiceList.Items.Add(new ServiceItem(id, sample.KnownServices[id])); } break; } } }
// initializing lookup network (from the settings of a loaded operation) public OpCore(DeOpsContext context) { Context = context; Sim = context.Sim; StartTime = TimeNow; GuiProtocol = new G2Protocol(); Network = new DhtNetwork(this, true); // for each core, re-load the lookup cache items Context.Cores.LockReading(() => { foreach (OpCore core in Context.Cores) { core.User.Load(LoadModeType.LookupCache); } }); ServiceBandwidth[DhtServiceID] = new BandwidthLog(RecordBandwidthSeconds); // get cache from all loaded cores AddService(new LookupService(this)); if (Sim != null) { Sim.Internet.RegisterAddress(this); } CoreThread = new Thread(RunCore); CoreThread.Name = "Lookup Thread"; if (Sim == null || Sim.Internet.TestCoreThread) { CoreThread.Start(); } }
// initializing lookup network (from the settings of a loaded operation) public OpCore(DeOpsContext context) { Context = context; Sim = context.Sim; StartTime = TimeNow; GuiProtocol = new G2Protocol(); Network = new DhtNetwork(this, true); // for each core, re-load the lookup cache items Context.Cores.LockReading(() => { foreach (OpCore core in Context.Cores) core.User.Load(LoadModeType.LookupCache); }); ServiceBandwidth[DhtServiceID] = new BandwidthLog(RecordBandwidthSeconds); // get cache from all loaded cores AddService(new LookupService(this)); if (Sim != null) Sim.Internet.RegisterAddress(this); CoreThread = new Thread(RunCore); CoreThread.Name = "Lookup Thread"; if (Sim == null || Sim.Internet.TestCoreThread) CoreThread.Start(); }
// initializing operation network public OpCore(DeOpsContext context, string userPath, string pass) { Context = context; Sim = context.Sim; StartTime = TimeNow; GuiProtocol = new G2Protocol(); User = new OpUser(userPath, pass, this); User.Load(LoadModeType.Settings); Network = new DhtNetwork(this, false); TunnelID = (ushort)RndGen.Next(1, ushort.MaxValue); Test test = new Test(); // should be empty unless running a test User.Load(LoadModeType.AllCaches); // delete data dirs if frsh start indicated if (Sim != null && Sim.Internet.FreshStart) for (int service = 1; service < 20; service++ ) // 0 is temp folder, cleared on startup { string dirpath = User.RootPath + Path.DirectorySeparatorChar + "Data" + Path.DirectorySeparatorChar + service.ToString(); if (Directory.Exists(dirpath)) Directory.Delete(dirpath, true); } if (Sim != null) KeyMax = 32; Context.KnownServices[DhtServiceID] = "Dht"; ServiceBandwidth[DhtServiceID] = new BandwidthLog(RecordBandwidthSeconds); // permanent - order is important here AddService(new TransferService(this)); AddService(new LocationService(this)); AddService(new LocalSync(this)); AddService(new BuddyService(this)); AddService(new UpdateService(this)); if (!User.Settings.GlobalIM) AddService(new TrustService(this)); // optional AddService(new IMService(this)); AddService(new ChatService(this)); AddService(new ShareService(this)); if (Type.GetType("Mono.Runtime") == null) AddService(new VoiceService(this)); if (!User.Settings.GlobalIM) { AddService(new ProfileService(this)); AddService(new MailService(this)); AddService(new BoardService(this)); AddService(new PlanService(this)); AddService(new StorageService(this)); } if (Sim != null) Sim.Internet.RegisterAddress(this); CoreThread = new Thread(RunCore); CoreThread.Name = User.Settings.Operation + " Thread"; if (Sim == null || Sim.Internet.TestCoreThread) CoreThread.Start(); #if DEBUG DebugWindowsActive = true; #endif }
public LoginForm(AppContext app, string arg) { App = app; Context = app.Context; Arg = arg; InitializeComponent(); Text = "DeOps Alpha v" + DeOpsContext.CoreVersion; //+ app.Context.LocalSeqVersion.ToString(); //SplashBox.Image = InterfaceRes.splash; if (Context.Sim != null) // prevent sim recursion { EnterSimLink.Visible = false; } LastBrowse = Application.StartupPath; LastOpened = (arg != "") ? arg : App.Settings.LastOpened; // each profile (.rop) is in its own directory // /root/profiledirs[]/profile.rop if (App.Context.Sim == null) { LoadProfiles(Application.StartupPath); // if started with file argument, load profiles around the same location if (File.Exists(arg)) { LoadProfiles(Path.GetDirectoryName(Path.GetDirectoryName(arg))); } } else { LoadProfiles(App.Context.Sim.Internet.LoadedPath); } OpComboItem select = null; if (LastOpened != null) { foreach (OpComboItem item in OpCombo.Items) { if (item.Fullpath == LastOpened) { select = item; } } } if (select != null) { OpCombo.SelectedItem = select; } else if (OpCombo.Items.Count > 0) { OpCombo.SelectedIndex = 0; } OpCombo.Items.Add("Browse..."); if (OpCombo.SelectedItem != null) { TextPassword.Select(); } }
// initializing operation network public OpCore(DeOpsContext context, string userPath, string pass) { Context = context; Sim = context.Sim; StartTime = TimeNow; GuiProtocol = new G2Protocol(); User = new OpUser(userPath, pass, this); User.Load(LoadModeType.Settings); Network = new DhtNetwork(this, false); TunnelID = (ushort)RndGen.Next(1, ushort.MaxValue); Test test = new Test(); // should be empty unless running a test User.Load(LoadModeType.AllCaches); // delete data dirs if frsh start indicated if (Sim != null && Sim.Internet.FreshStart) { for (int service = 1; service < 20; service++) // 0 is temp folder, cleared on startup { string dirpath = User.RootPath + Path.DirectorySeparatorChar + "Data" + Path.DirectorySeparatorChar + service.ToString(); if (Directory.Exists(dirpath)) { Directory.Delete(dirpath, true); } } } if (Sim != null) { KeyMax = 32; } Context.KnownServices[DhtServiceID] = "Dht"; ServiceBandwidth[DhtServiceID] = new BandwidthLog(RecordBandwidthSeconds); // permanent - order is important here AddService(new TransferService(this)); AddService(new LocationService(this)); AddService(new LocalSync(this)); AddService(new BuddyService(this)); AddService(new UpdateService(this)); if (!User.Settings.GlobalIM) { AddService(new TrustService(this)); } // optional AddService(new IMService(this)); AddService(new ChatService(this)); AddService(new ShareService(this)); if (Type.GetType("Mono.Runtime") == null) { AddService(new VoiceService(this)); } if (!User.Settings.GlobalIM) { AddService(new ProfileService(this)); AddService(new MailService(this)); AddService(new BoardService(this)); AddService(new PlanService(this)); AddService(new StorageService(this)); } if (Sim != null) { Sim.Internet.RegisterAddress(this); } CoreThread = new Thread(RunCore); CoreThread.Name = User.Settings.Operation + " Thread"; if (Sim == null || Sim.Internet.TestCoreThread) { CoreThread.Start(); } #if DEBUG DebugWindowsActive = true; #endif }
public void Run() { StartupPath = AppDomain.CurrentDomain.BaseDirectory; try { LogFile = new StreamWriter(new FileStream("log.txt", FileMode.Create, FileAccess.Write, FileShare.Read)); } catch (Exception ex) { Console.WriteLine("Error creating output file: " + ex.Message); return; } Context = new DeOpsContext(StartupPath, null); WriteOut("DeOps Alpha v" + DeOpsContext.CoreVersion.ToString()); if (File.Exists("init.txt")) { using (var init = new StreamReader(File.OpenRead("init.txt"))) { string line = null; do { line = init.ReadLine(); if (line == null) { break; } if (line.StartsWith("#")) { continue; } Console.WriteLine("> " + line); if (!ProcessInput(line)) { return; } } while (line != null); } } while (true) { Console.Write("> "); string input = Console.ReadLine(); // input is null if daemon so just loopity loop if (input == null) { Thread.Sleep(5000); continue; } if (!ProcessInput(input)) { return; } } }