public IMForm(CoreUI ui) : base(ui.Core) { InitializeComponent(); UI = ui; Core = ui.Core; GuiUtils.SetupToolstrip(TopStrip, new OpusColorTable()); GuiUtils.FixMonoDropDownOpening(OptionsButton, OptionsButton_DropDownOpening); UI.ShowView += ShowExternal; Text = "IM - " + Core.GetName(Core.UserID); BuddyList.Init(UI, Core.Buddies, SelectionInfo, true); IM = UI.GetService(ServiceIDs.IM) as IMUI; SelectionInfo.Init(UI); SelectionInfo.ShowNetwork(); if (GuiUtils.IsRunningOnMono()) { AddButton.Text = "Add"; SharedButton.Text = "Files"; } Rectangle screen = Screen.GetWorkingArea(this); Location = new Point(screen.Width - Width, screen.Height / 2 - Height / 2); ShowExternal(new Info.InfoView(Core, false, true)); }
public NewProjectForm(OpCore core) : base(core) { InitializeComponent(); Core = core; }
public IM_View(CoreUI ui, IMService im, ulong key) { InitializeComponent(); UI = ui; Core = ui.Core; IM = im; Locations = IM.Core.Locations; UserID = key; IM.ActiveUsers.Add(UserID); UpdateName(); // do here so window can be found and multiples not created for the same user IM.MessageUpdate += new IM_MessageHandler(IM_MessageUpdate); IM.StatusUpdate += new IM_StatusHandler(IM_StatusUpdate); Core.KeepDataGui += new KeepDataHandler(Core_KeepData); MessageTextBox.Core = Core; MessageTextBox.ContextMenuStrip.Items.Insert(0, new ToolStripSeparator()); TimestampMenu = new ToolStripMenuItem("Timestamps", ViewRes.timestamp, new EventHandler(Menu_Timestamps)); MessageTextBox.ContextMenuStrip.Items.Insert(0, TimestampMenu); }
public LocalSync(OpCore core) { Core = core; Network = core.Network; Store = Network.Store; Core.Sync = this; GlobalIM = Core.User.Settings.GlobalIM; Network.CoreStatusChange += new StatusChange(Network_StatusChange); Core.Locations.GetTag[ServiceID, DataTypeSync] += new GetLocationTagHandler(Locations_GetTag); Core.Locations.TagReceived[ServiceID, DataTypeSync] += new LocationTagReceivedHandler(Locations_TagReceived); Store.ReplicateEvent[ServiceID, DataTypeSync] += new ReplicateHandler(Store_Replicate); Cache = new VersionedCache(Network, ServiceID, DataTypeSync, true); Cache.FileAquired += new FileAquiredHandler(Cache_FileAquired); Cache.FileRemoved += new FileRemovedHandler(Cache_FileRemoved); Cache.Load(); // if sync file for ourselves does not exist create if (!Cache.FileMap.SafeContainsKey(Core.UserID)) UpdateLocal(); }
public EditBlock(BlockViewMode mode, ScheduleView view, PlanBlock block) { InitializeComponent(); Mode = mode; View = view; Core = view.Core; Plans = view.Plans; Block = block; StartTime.Value = new DateTime(Core.TimeNow.Year, Core.TimeNow.Month, Core.TimeNow.Day); EndTime.Value = StartTime.Value.AddDays(1); if (block == null) return; TitleBox.Text = block.Title; StartTime.Value = block.StartTime.ToLocalTime(); EndTime.Value = block.EndTime.ToLocalTime(); DescriptionInput.InputBox.Text = block.Description; SetScopeLink(block.Scope); if (mode != BlockViewMode.Show) return; TitleBox.ReadOnly = true; StartTime.Enabled = false; EndTime.Enabled = false; DescriptionInput.ReadOnly = true; ScopeLink.Enabled = false; }
public void Search(ulong target, object hostArg, Action<byte[], object> hostFoundEvent, OpCore core) { DhtSearch search = Network.Searches.Start(target, "Temp Search", ServiceID, DataType, null, Search_FoundTemp); if (search != null) search.Carry = new object[] { hostArg, hostFoundEvent, core }; }
public AddUsersDialog(CoreUI ui, uint project) : base(ui.Core) { InitializeComponent(); UI = ui; Core = ui.Core; ProjectID = project; // load up trust if(Core.Trust != null) LoadTrustTree(); // load up buddies - last option BuddyList.FirstLineBlank = false; BuddyList.Init(ui, Core.Buddies, null, false); ProjectCombo.Items.Add(new AddProjectItem("Buddies")); if (Core.Trust != null) { foreach (AddProjectItem item in ProjectCombo.Items) if (item.ID == ProjectID) { ProjectCombo.SelectedItem = item; break; // break before buddies is selected } } else ProjectCombo.SelectedIndex = 0; // buddy list }
// main operation icon public GetTextDialog(OpCore core, string title, string direction, string defaultText) : base(core) { InitializeComponent(); SetupBox(title, direction, defaultText); }
public BoardService(OpCore core ) { Core = core; Network = Core.Network; Protocol = Network.Protocol; Store = Network.Store; Trust = Core.Trust; Core.SecondTimerEvent += Core_SecondTimer; Core.MinuteTimerEvent += Core_MinuteTimer; Network.CoreStatusChange += new StatusChange(Network_StatusChange); Store.StoreEvent[ServiceID, 0] += new StoreHandler(Store_Local); Store.ReplicateEvent[ServiceID, 0] += new ReplicateHandler(Store_Replicate); Store.PatchEvent[ServiceID, 0] += new PatchHandler(Store_Patch); Network.Searches.SearchEvent[ServiceID, 0] += new SearchRequestHandler(Search_Local); Core.Transfers.FileSearch[ServiceID, 0] += new FileSearchHandler(Transfers_FileSearch); Core.Transfers.FileRequest[ServiceID, 0] += new FileRequestHandler(Transfers_FileRequest); if (Core.Sim != null) PruneSize = 16; LocalFileKey = Core.User.Settings.FileKey; BoardPath = Core.User.RootPath + Path.DirectorySeparatorChar + "Data" + Path.DirectorySeparatorChar + ServiceID.ToString(); if (!Directory.Exists(BoardPath)) Directory.CreateDirectory(BoardPath); // get available board header targets string[] directories = Directory.GetDirectories(BoardPath); SortedDictionary<ulong, ulong> targets = new SortedDictionary<ulong, ulong>(); // key distance to self, value target foreach (string path in directories) { string dir = Path.GetFileName(path); // gets dir name ulong id = BitConverter.ToUInt64(Utilities.FromBase64String(dir), 0); targets[Core.UserID ^ id] = id; } // load closest targets int loaded = 0; foreach (ulong id in targets.Values) { LoadHeader(id); loaded++; if (loaded == PruneSize) break; } Loading = false; }
public StorageUI(CoreUI ui, OpService service) { UI = ui; Core = ui.Core; Storage = service as StorageService; Storage.Disposing += Storage_Disposing; }
public ChatUI(CoreUI ui, OpService service) { UI = ui; Core = ui.Core; Chat = service as ChatService; Chat.NewInvite += Chat_NewInvite; }
public User(OpCore core) : base(core) { InitializeComponent(); Profile = core.User; NameBox.Text = Profile.Settings.UserName; }
public InviteForm(OpCore core) : base(core) { InitializeComponent(); Core = core; HelpLabel.Text = HelpLabel.Text.Replace("<op>", Core.User.Settings.Operation); }
public RemoveLinks(OpCore core, List<ulong> ids) : base(core) { InitializeComponent(); PersonIDs = ids; foreach (ulong id in PersonIDs) PeopleList.Items.Add(new RemoveItem(id, core.GetName(id))); }
public PostMessage(BoardService board, ulong id, uint project) { InitializeComponent(); Core = board.Core; Board = board; UserID = id; ProjectID = project; }
public InternalsForm(CoreUI ui) { // // Required for Windows Form Designer support // InitializeComponent(); UI = ui; Core = ui.Core; Boards = Core.GetService(ServiceIDs.Board) as BoardService; Mail = Core.GetService(ServiceIDs.Mail) as MailService; Profiles = Core.GetService(ServiceIDs.Profile) as ProfileService; Text = "Internals (" + Core.Network.GetLabel() + ")"; treeStructure.Nodes.Add( new StructureNode("", new ShowDelegate(ShowNone), null)); // core // identity // networks (global/operation) // cache // logs // routing // search // store // tcp // Components // Link // Location // ... // rudp // sessions[] // core StructureNode coreNode = new StructureNode("Core", new ShowDelegate(ShowCore), null); // identity coreNode.Nodes.Add( new StructureNode(".Identity", new ShowDelegate(ShowIdentity), null)); // networks if(Core.Context.Lookup != null) LoadNetwork(coreNode.Nodes, "Lookup", Core.Context.Lookup.Network); LoadNetwork(coreNode.Nodes, "Organization", Core.Network); // components StructureNode componentsNode = new StructureNode("Components", new ShowDelegate(ShowNone), null); LoadComponents(componentsNode); coreNode.Nodes.Add(componentsNode); treeStructure.Nodes.Add(coreNode); coreNode.Expand(); }
public ProfileView(ProfileService profile, ulong id, uint project) { InitializeComponent(); Profiles = profile; Core = profile.Core; Trust = Core.Trust; UserID = id; ProjectID = project; }
public IdentityForm(OpCore core, ulong user) { InitializeComponent(); string name = core.GetName(user); HeaderLabel.Text = HeaderLabel.Text.Replace("<name>", name); HelpLabel.Text = HelpLabel.Text.Replace("<name>", name); LinkBox.Text = core.GetIdentity(user); }
public LookupService(OpCore core) { Core = core; Network = core.Network; LookupCache = new TempCache(Network, ServiceID, DataTypeCache); // specify time out // specify how many results to send back // send back newest results? // put ttl }
public EditProfile(ProfileService control, ProfileView view) { InitializeComponent(); Core = control.Core; Links = Core.Trust; Profiles = control; MainView = view; TextFields = new Dictionary<string, string>(view.TextFields); FileFields = new Dictionary<string, string>(view.FileFields); }
public MainForm(CoreUI ui, bool sideMode) : base(ui.Core) { InitializeComponent(); UI = ui; Core = ui.Core; Trust = Core.Trust; UI.ShowView += ShowView; Core.NewsUpdate += new NewsUpdateHandler(Core_NewsUpdate); Core.KeepDataGui += new KeepDataHandler(Core_KeepData); Trust.GuiUpdate += new LinkGuiUpdateHandler(Trust_Update); CommandTree.SelectedLink = Core.UserID; CommandTree.SearchOnline = true; GuiUtils.SetupToolstrip(TopToolStrip, new OpusColorTable()); GuiUtils.SetupToolstrip(NavStrip, new NavColorTable()); GuiUtils.SetupToolstrip(SideToolStrip, new OpusColorTable()); GuiUtils.SetupToolstrip(SideNavStrip, new NavColorTable()); GuiUtils.FixMonoDropDownOpening(SideViewsButton, SideViewsButton_DropDownOpening); GuiUtils.FixMonoDropDownOpening(SideNewsButton, SideNewsButton_DropDownOpening); GuiUtils.FixMonoDropDownOpening(NewsButton, NewsButton_DropDownOpening); GuiUtils.FixMonoDropDownOpening(ProjectsButton, ProjectsButton_DropDownOpening); if (GuiUtils.IsRunningOnMono()) { foreach (ToolStripItem item in SideToolStrip.Items) { //item.DisplayStyle = ToolStripItemDisplayStyle.Text; //item.TextDirection = ToolStripTextDirection.Horizontal; //item.Alignment = ToolStripItemAlignment.Left; } NetworkButton.Text = "Network"; SideButton.Text = "Sidebar"; LockButton.Text = "Lockdown"; NewsButton.ForeColor = Color.White; PopoutButton.ForeColor = Color.White; SideViewsButton.ForeColor = Color.White; SideNewsButton.ForeColor = Color.White; SideHelpButton.ForeColor = Color.White; } SideNavStrip.Visible = sideMode; SideMode = sideMode; }
public static string CryptFilename(OpCore core, string name) { // hash, base64 name with ~ instead of /, use for link as well byte[] salt = Utilities.ExtractBytes(core.User.Settings.FileKey, 0, 4); byte[] final = Utilities.CombineArrays(salt, UTF8Encoding.UTF8.GetBytes(name)); SHA1Managed sha1 = new SHA1Managed(); byte[] hash = new SHA1Managed().ComputeHash(final); return Utilities.ToBase64String(hash); }
public VersionedCache(DhtNetwork network, uint service, uint type, bool localSync) { Core = network.Core; Network = network; Store = network.Store; Service = service; DataType = type; LocalSync = localSync; GlobalIM = Core.User.Settings.GlobalIM; CachePath = Core.User.RootPath + Path.DirectorySeparatorChar + "Data" + Path.DirectorySeparatorChar + Service.ToString() + Path.DirectorySeparatorChar + DataType.ToString(); HeaderPath = CachePath + Path.DirectorySeparatorChar + Utilities.CryptFilename(Core, "VersionedFileHeaders"); Directory.CreateDirectory(CachePath); LocalKey = Core.User.Settings.FileKey; Core.SecondTimerEvent += Core_SecondTimer; Core.MinuteTimerEvent += Core_MinuteTimer; Network.CoreStatusChange += new StatusChange(Network_StatusChange); Store.StoreEvent[Service, DataType] += new StoreHandler(Store_Local); // if local sync used then it will handle all replication if (LocalSync && !GlobalIM) { Store.ReplicateEvent[Service, DataType] += new ReplicateHandler(Store_Replicate); Store.PatchEvent[Service, DataType] += new PatchHandler(Store_Patch); } Network.Searches.SearchEvent[Service, DataType] += new SearchRequestHandler(Search_Local); Core.Transfers.FileSearch[Service, DataType] += new FileSearchHandler(Transfers_FileSearch); Core.Transfers.FileRequest[Service, DataType] += new FileRequestHandler(Transfers_FileRequest); if (!LocalSync) { Core.Sync.GetTag[Service, DataType] += new GetLocalSyncTagHandler(LocalSync_GetTag); Core.Sync.TagReceived[Service, DataType] += new LocalSyncTagReceivedHandler(LocalSync_TagReceived); } if (Core.Sim != null) PruneSize = 16; }
public EditLink(OpCore core, uint id) : base(core) { InitializeComponent(); Core = core; Trust = core.Trust; ProjectID = id; AwayCheckBox.Checked = Core.Locations.LocalAway; AwayMessage.Enabled = Core.Locations.LocalAway; AwayMessage.Text = Core.User.Settings.AwayMessage; }
public CustomIconForm(OpCore core) { Profile = core.User; // window icon Profile_IconUpdate(); // dialog background color if (Application.RenderWithVisualStyles && !GuiUtils.IsRunningOnMono()) BackColor = System.Drawing.Color.WhiteSmoke; // signup for icon updates core.User.GuiIconUpdate += Profile_IconUpdate; }
public CacheSetup(OpCore core, WebCache cache) : base(core) { InitializeComponent(); Core = core; Profile = Core.User; Cache = cache; AddressBox.Text = cache.Address; KeyBox.Text = (cache.AccessKey != null) ? Convert.ToBase64String(cache.AccessKey) : ""; OpBox.Text = core.Network.OpID.ToString(); }
public static string CryptFilename(OpCore core, ulong id, byte[] hash) { // we salt so there are no common file names between users byte[] salt = Utilities.ExtractBytes(core.User.Settings.FileKey, 0, 4); byte[] buffer = new byte[4 + 8 + hash.Length]; salt.CopyTo(buffer, 0); BitConverter.GetBytes(id).CopyTo(buffer, 4); hash.CopyTo(buffer, 12); SHA1Managed sha1 = new SHA1Managed(); byte[] totalHash = new SHA1Managed().ComputeHash(hash); return Utilities.ToBase64String(totalHash); }
public InviteForm(CoreUI ui, ChatService chat, ulong user, ChatRoom room) { InitializeComponent(); UI = ui; Core = ui.Core; Chat = chat; Room = room; IntroLabel.Text = IntroLabel.Text.Replace("<name>", Core.GetName(user)); NameLabel.Text = room.Title; TypeLabel.Text = room.Kind.ToString(); }
public ComposeMail(CoreUI ui, MailService mail, ulong id) { InitializeComponent(); UI = ui; Mail = mail; Core = mail.Core; DefaultID = id; if (id != 0) { ToTextBox.Text = Core.GetName(id); ToIDs.Add(id); } }
public IgnoreForm(CoreUI ui) { InitializeComponent(); UI = ui; Core = ui.Core; Core.Buddies.IgnoreList.LockReading(() => { foreach (OpBuddy ignore in Core.Buddies.IgnoreList.Values) { IgnoreList.Items.Add(new IgnoreItem(Core, ignore.ID)); InList.Add(ignore.ID); } }); }
public OpCache(DhtNetwork network) { Core = network.Core; Network = network; Core.MinuteTimerEvent += Core_MinuteTimerEvent; Retry = new RetryIntervals(Core); LookupearchInterval = new RetryIntervals(Core); NextSave = Core.TimeNow.AddMinutes(1); NextPublishAny = Core.TimeNow.AddMinutes(30); /*if (Network.IsLookup || * (Core.User != null && Core.User.Settings.GlobalIM)) * { * WebCache cache = new WebCache(); * cache.Address = "http://www.c0re.net/deops/cache/update.php"; * cache.AccessKey = Convert.FromBase64String("O+6IRs7GY1r/JIk+DFY/VK+i8pFTWhsDfNH9R3j3f9Q="); * AddWebCache(cache); * }*/ }
public RetryIntervals(OpCore core) { Core = core; Reset(); }