/// Refresh Folder Viewer and Folder Store public void Refresh() { // Directory's Path if (currentDirectory == null || baseDirectory == null) { return; } // Clear The Store store.Clear(); if (this.userInfo == MyInfo.GetInstance()) { // MyFolder this.store.Fill(currentDirectory.FullName); } else { // Peer Folder if (FolderRefresh != null) { FolderRefresh(this, currentDirectory.FullName); } } }
// ============================================ // PROTECTED (Methods) Event Handlers // ============================================ protected void OnDragDataReceived(object sender, DragDataReceivedArgs args) { // Get Drop Paths object[] filesPath = Dnd.GetDragReceivedPaths(args); if (this.userInfo == MyInfo.GetInstance()) { // Copy Selected Files Into Directory foreach (string filePath in filesPath) { FileUtils.CopyAll(filePath, currentDirectory.FullName); } // Refresh Icon View Refresh(); } else { // Send Files foreach (string filePath in filesPath) { PeerSocket peer = (PeerSocket)P2PManager.KnownPeers[userInfo]; bool fisDir = FileUtils.IsDirectory(filePath); Debug.Log("Send To '{0}' URI: '{1}'", userInfo.Name, filePath); if (FileSend != null) { FileSend(peer, filePath, fisDir); } } } Drag.Finish(args.Context, true, false, args.Time); }
/// Check Login, Return null if Login failed public UserInfo CheckLogin() { MyInfo.Initialize(Username, SecureAuthentication); if (SecureAuthentication == false) { return(MyInfo.GetInstance()); } // Login Progress Dialog LoginProgressDialog dialog = new LoginProgressDialog(Password); ResponseType response = (ResponseType)dialog.Run(); string responseMsg = dialog.ResponseMessage; dialog.Destroy(); // Login OK if (response == ResponseType.Ok) { return(MyInfo.GetInstance()); } WindowUtils.Shake(this, 2); if (responseMsg != null) { Glue.Dialogs.MessageError("Login Error", responseMsg); } return(null); }
private async Task handleGetInfo(HttpProcessor p) { var info = await MyInfo.Fetch(api.getConsole()); p.writeSuccess(); await p.outputStream.WriteLineAsync(info.Json.ToString()); }
public static async Task <Person> Login(string login, string pass) { JObject servObj = JObject.Parse(await GetUrlToString(Server.servUrl + "GET/login.php?login="******"&pass="******"status"]) { string otv = (string)servObj["prepod_info"]; myInfo = JsonConvert.DeserializeObject <MyInfo>(otv); Properties.Settings.Default.loginOk = true; Properties.Settings.Default.Save(); //загрузка параметров await GetInfo(); return(myInfo); } else { Properties.Settings.Default.loginSave = false; Properties.Settings.Default.login = ""; Properties.Settings.Default.pass = ""; Properties.Settings.Default.Save(); MessageBox.Show("Неверный логин или пароль!"); return(null); }; }
static void Main() { try { Console.WriteLine(MyInfo.Office); Console.WriteLine(MyInfo.OS); Console.WriteLine(MyInfo.Model); Console.WriteLine(MyInfo.HostIP); Console.WriteLine(MyInfo.HostName); Console.WriteLine(MyInfo.UserName); Console.WriteLine(MyInfo.CPUCores); MyInfo.DoMyThing(); } catch (Exception e) { //Console.WriteLine(String.Format("Exception {0} Trace {1}", e.Message, e.StackTrace)); } //Console.WriteLine("Press Enter to exit"); //Console.Read(); //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Form1()); }
protected void OnItemActivated(object sender, ItemActivatedArgs args) { // Get File Path & IsDirectory Flag bool isDir = store.GetIsDirectory(args.Path); string path = store.GetFilePath(args.Path); if (isDir == true) { // Replace Parent With Path and ReFill The Model currentDirectory = new DirectoryInfo(path); // Refresh FileStore Gtk.Application.Invoke(delegate { Refresh(); }); // Sensitize the up button if (DirChanged != null) { DirChanged(this, true); } } else if (userInfo == MyInfo.GetInstance()) { try { // Try To Open This File System.Diagnostics.Process.Start(path); } catch (Exception e) { Debug.Log("Failed Process.Start() {0}: {1}", path, e.Message); } } }
public MainWindow() { InitializeComponent(); _myInfo = new MyInfo(); _myInfo.Name = "My name"; this.DataContext = _myInfo; }
private Status CurrentStatus(MyInfo info, JObject tasks) { // if no money or no boost => idle //if (info.Boost == 0 || info.Netcoins < 1000) //if (info.Netcoins < 1000) // return Status.Idle; var tasksData = (JArray)tasks["data"]; if (tasksData == null || tasksData.Count < info.RAM) // slots are available to add task => upgrade { if (info.Money > 5000) // TODO: can upgrade? should calculate if money > what needs to upgrade { CurStatus = Status.Upgrade; } else { CurStatus = Status.Idle; } } else { CurStatus = Status.EndTasks; } return(CurStatus); }
protected Tasks chooseTask(MyInfo info) { var hwTask = chooseTaskHw(info); if (hwTask != null) { return(hwTask); } var total = info.Firewall + info.Antivirus + info.SDK + info.IPSpoofing + info.Spam + info.Scan + info.Spyware; var ratios = new Ratios { { Tasks.Firewall, (double)info.Firewall / total }, { Tasks.Antivirus, (double)info.Antivirus / total }, { Tasks.Sdk, (double)info.SDK / total }, { Tasks.IPSpoofing, (double)info.IPSpoofing / total }, { Tasks.Spam, (double)info.Spam / total }, { Tasks.Scan, (double)info.Scan / total }, { Tasks.Spyware, (double)info.Spyware / total }, }; Tasks t = Tasks.Sdk; foreach (var key in ratios.Keys.ToList()) { ratios[key] = percents[key] - ratios[key]; } var asdf = ratios.OrderByDescending(r => r.Value).ToList(); var c = asdf.First(); return(c.Key); }
/// Check Login, Return null if Login failed public UserInfo CheckLogin() { MyInfo.Initialize(Username, SecureAuthentication); if (SecureAuthentication == false) { return(MyInfo.GetInstance()); } // Login Progress Dialog LoginDialog.ProgressDialog dialog = new LoginDialog.ProgressDialog(Password); ResponseType response = (ResponseType)dialog.Run(); string responseMsg = dialog.ResponseMessage; dialog.Destroy(); // Login OK if (response == ResponseType.Ok) { return(MyInfo.GetInstance()); } string title = "Login Error"; if (responseMsg == null) { responseMsg = "Unknown Error..."; } ShowErrorMessage(title, responseMsg); return(null); }
protected Tasks chooseTaskHw(MyInfo info) { var ratios = new Ratios(); if (info.CPU < Tasks.CPU.Max) { ratios[Tasks.CPU] = info.CPU; } if (info.HDD < Tasks.HDD.Max) { ratios[Tasks.HDD] = info.HDD; } if (info.Internet < Tasks.Internet.Max) { ratios[Tasks.Internet] = info.Internet; } if (info.RAM < Tasks.RAM.Max) { ratios[Tasks.RAM] = info.RAM; } if (ratios.Count == 0) { return(null); // all HW stats are fully upgraded } var ordered = ratios.OrderBy(r => r.Value); var task = ordered.First(); return(task.Key); }
/// <summary> /// Rebuild stats percentages based on actual informations from the other users /// </summary> /// <param name="info"></param> /// <param name="cfg"></param> public void RebuildPercentages(MyInfo info, IConfig cfg) { var ips = from ip in cfg.persistanceMgr.GetIps() where ip.Firewall > 0 && ip.Antivirus > 0 && ip.SDK > 0 && ip.IPSpoofing > 0 && ip.Spam > 0 && ip.Spyware > 0 select ip; if (ips.Count() < 10) // bad statistic { return; } double avgFw = ips.Average(ip => ip.Firewall); double avgAv = ips.Average(ip => ip.Antivirus); double avgsdk = ips.Average(ip => ip.SDK); double avgIpsp = ips.Average(ip => ip.IPSpoofing); double avgSpam = ips.Average(ip => ip.Spam); double avgAdw = ips.Average(ip => ip.Spyware); double avgScan = 0; // don't know other players scan double total = avgFw + avgAv + avgsdk + avgIpsp + avgSpam + avgAdw + avgScan; percents[Tasks.Firewall] = avgFw / total; percents[Tasks.Antivirus] = avgAv / total; percents[Tasks.Sdk] = avgsdk / total; percents[Tasks.IPSpoofing] = avgIpsp / total; percents[Tasks.Spam] = avgSpam / total; percents[Tasks.Spyware] = avgAdw / total; percents[Tasks.Scan] = avgScan / total; }
public override Tasks NextTaskToUpgrade() { var info = MyInfo.Fetch(console).Result; RebuildPercentages(info, cfg); return(chooseTask(info)); }
public MyInfo dyn() { var obj = new MyInfo { ID = 2, Name = "Rajesh" }; return(obj); }
/// Update Shared Files Num public void UpdateSharedFilesNum() { try { UserInfo userInfo = MyInfo.GetInstance(); string sharedFolder = Paths.UserSharedDirectory(userInfo.Name); int numFiles = CountDirectoryFiles(sharedFolder); this.labelTFiles.Text = numFiles.ToString() + " Shared Files"; } catch {} }
private void SelectDependencies(MyInfo info) { foreach (var parent in info.Dependencies.Where(p => !p.Checked)) { parent.Checked = true; SelectDependencies(parent); } }
private void DisconnectFromWebServer() { try { // Disconnect From NyFolder Web Server MyInfo.DisconnectFromWebServer(); } catch (Exception e) { Base.Dialogs.MessageError("Disconnection From Web Server", e.Message); } }
public MyInfo getMyDetails() { MyInfo info = new MyInfo(); info.Name = "Rishabh Jain"; info.age = 23; info.aboutme = "Software Developer"; return(info); }
MyInfo IAboutMeRepository.showAboutMe() { MyInfo info = new MyInfo(); info.Name = "Rishabah Jain"; info.Age = 24; info.Description = "Test Text"; return(info); }
static void Main(string[] args) { MyInfo info1 = new MyInfo("JJ", 24); info1.Display(); Send(info1); info1.Display(); Console.ReadLine(); }
private static void Main(string[] args) { MyInfo myID = new MyInfo(); myID.StudentInfo(); GradesUI grades = new GradesUI(); grades.MainMethod(); }
public async Task saveprofileInfo(MyInfo info) { var user = await UserManager.GetUserByIdAsync(AbpSession.GetUserId()); var myinfo = await _TenantProfile.FirstOrDefaultAsync(p => p.TenantId == user.TenantId); myinfo.FullName = info.FullName; myinfo.CellNumber = info.CellNumber; await _TenantProfile.UpdateAsync(myinfo); }
private static void Main(string[] args) { MyInfo myID = new MyInfo(); Controller cTroller = new Controller(); myID.StudentInfo(); cTroller.DisplayWelcome(); cTroller.Play(); }
private void ConnectMyPeer() { try { // P2P Start Listening this.p2pManager.StartListening(); } catch (Exception e) { Glue.Dialogs.MessageError("P2P Starting Error", e.Message); // ReTrow Exception throw(e); } try { // Initialize Download & Upload Manager DownloadManager.Initialize(); UploadManager.Initialize(); } catch (Exception e) { Glue.Dialogs.MessageError("Download/Upload Manager Init", e.Message); // P2P Stop Listening this.p2pManager.StopListening(); // ReTrow Exception throw(e); } try { // Initialize Command Manager & Add Commands Handler this.cmdManager.AddPeerEventsHandler(); this.AddProtocolEvents(); // Add Custom Command Handler if (AddProtocolEvent != null) { AddProtocolEvent(p2pManager, cmdManager); } } catch (Exception e) { Glue.Dialogs.MessageError("Add Protocol Events", e.Message); // P2P Stop Listening this.p2pManager.StopListening(); // ReTrow Exception throw(e); } try { // Connect To NyFolder Web Server MyInfo.ConnectToWebServer(this.p2pManager.CurrentPort); } catch (Exception e) { Glue.Dialogs.MessageError("Connect To Web Server", e.Message); // P2P Stop Listening this.p2pManager.StopListening(); // ReTrow Exception throw(e); } }
public void FindSingleStuckItem() { var testScheduler = new TestScheduler(); var xs = testScheduler.CreateColdObservable( OnNext(TimeSpan.FromMinutes(5).Ticks, MyInfo.Started("1"))); var results = testScheduler.CreateObserver <MyInfo>(); xs.StuckInfos(testScheduler).Subscribe(results); testScheduler.Start(); results.Messages.AssertEqual( OnNext(TimeSpan.FromMinutes(35).Ticks, MyInfo.Started("1"))); }
// ============================================ // PRIVATE Methods // ============================================ private void UserConnect(UserInfo userInfo) { try { // Connect & Send Login P2PManager.AddPeer(userInfo, userInfo.Ip, userInfo.Port); PeerSocket peer = (PeerSocket)P2PManager.KnownPeers[userInfo]; CmdManager.Login(peer, MyInfo.GetInstance()); OnPeerLogin(peer, userInfo); } catch (Exception e) { Glue.Dialogs.MessageError("Connenting To " + userInfo.Name + " Failed", e.Message); } }
public MyInfo GetMyInfo() { var entity = new MyInfo { Name = "liucx", Age = 22, Phone = "13011112222", Remark = "测试跨域请求" }; return(entity); }
private static void OnTalkFrameRemoved(object o, object page) { if (talkFrames.ContainsValue(page) == true) { TalkFrame talkFrame = page as TalkFrame; talkFrame.Message -= new StringEventHandler(OnSendMessage); PeerSocket peer = (PeerSocket)P2PManager.KnownPeers[talkFrame.UserInfo]; SendStatus(peer, MyInfo.GetInstance().Name + " has closed the conversation Window..."); talkFrames.Remove(talkFrame.UserInfo); } }
private void UserConnect(UserInfo userInfo) { try { // Connect & Send Login P2PManager.AddPeer(userInfo, userInfo.Ip, userInfo.Port); PeerSocket peer = (PeerSocket)P2PManager.KnownPeers[userInfo]; Cmd.Login(peer, MyInfo.GetInstance()); OnPeerLogin(peer, userInfo); } catch (Exception e) { string title = "Connection To <b>" + userInfo.Name + "</b> Failed"; Base.Dialogs.MessageError(title, e.Message); } }
public static MyInfo GetTypeInfo2(this SemanticModel model, ExpressionSyntax expression) { var typeInfo = ModelExtensions.GetTypeInfo(model, expression); if (typeInfo.ConvertedType == null) Debug.Write(""); var g = new MyInfo { Conversion1 = typeInfo.ConvertedType != null ? (Conversion?)model.ClassifyConversion(expression, typeInfo.ConvertedType) : null, Conversion2 = model.GetConversion(expression), TypeInfo = typeInfo }; return g; }
public void MyFunction() { MonthOfYear month = MonthOfYear.Novermber; MyInfo my = new MyInfo(); MyInfo.myName = "zc"; my.myAge = 18; }