public void feedRemoteListHtml() { //comments are for debugging //FileStream filestream; ////StreamWriter s = File.CreateText("txt.txt"); String[] splithtml = MobiController.Properties.Resources.remotelist.Split(REMOTE_TABLE_DELIMETER); DirectoryInfo controllerDir; if (Directory.Exists(App.CONTROLLER_DIR)) { controllerDir = new DirectoryInfo(App.CONTROLLER_DIR); } else { controllerDir = Directory.CreateDirectory(App.CONTROLLER_DIR); } //FileStream rs = File.Create(Environment.ExpandEnvironmentVariables("%LOCALAPPDATA%\\MobiController") + "\\asdf.rmt"); //rs.WriteByte(2); //rs.Write(Encoding.UTF8.GetBytes("This is a test string"), 0, Encoding.UTF8.GetByteCount("This is a test string")); //rs.WriteByte(3); //rs.Close(); ////s.WriteLine(splithtml[0].Length.ToString("X")); ////s.WriteLine(splithtml[0]); SocketWriteLine(splithtml[0].Length.ToString("X")); SocketWriteLine(splithtml[0]); String tableEntry; foreach (ControllerInfo controller in ControllerInfo.getInstalledControllers(App.CONTROLLER_DIR)) { string[] meta = Controller.getControllerMeta(controller.Path); //rel="external" so that jquery will reload the header of the remote and re-init the DOM for multipage browsing!!!! tableEntry = "<li ><a rel=\"external\" href=\"/controllers/" + controller.Path.Name + "\"> <h3>" + meta[0] + "</h3><p>" + meta[1] + "</p></a></li>"; SocketWriteLine(tableEntry.Length.ToString("X")); SocketWriteLine(tableEntry); } tableEntry = "<li ><a rel=\"external\" href=\"http://mobicontroller.com/controllers/\"> <h3>Get More Controllers</h3></a></li>"; SocketWriteLine(tableEntry.Length.ToString("X")); SocketWriteLine(tableEntry); SocketWriteLine(splithtml[1].Length.ToString("X")); ////s.WriteLine(splithtml[1].Length.ToString("X")); ////s.WriteLine(splithtml[1]); SocketWriteLine(splithtml[1]); SocketWriteLine("0\r\n"); stream.Flush(); //s.Close(); }
public List <ControllerInfo> needsUpdate() { List <ControllerInfo> lstNeedsUpdate = new List <ControllerInfo>(); if (state == ASYNC_STATE.REFRESHED) { try { foreach (ControllerInfo info in ControllerInfo.getInstalledControllers(App.CONTROLLER_DIR)) { if (App.Config.updateTimeStamps.ContainsKey(info.FileName)) { ControllerInfo officialController = findController(info.FileName); // this way the controller info is synced with mobicontroller.com if (App.Config.updateTimeStamps[info.FileName] <= DateTime.Parse(officialController.Lastupdated)) { lstNeedsUpdate.Add(officialController); } } else { findController(info.FileName); lstNeedsUpdate.Add(info); } } } catch (ControllerInfoException ex) { frmSettings.NotifyBadController(ex); } catch (ArgumentException)// if controller is in the all controller list than add to list. { } } else { RefreshCompleted += recallUpdateControllers; refreshControllers(null, null); } return(lstNeedsUpdate); }
private void tabSettings_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (tabSettings.SelectedItem == tabiControllers) { try { ControllerList = new ObservableCollection <ControllerInfo>(ControllerInfo.getInstalledControllers(App.CONTROLLER_DIR)); lstControllers.ItemsSource = ControllerList; } catch (ControllerInfoException ex) { NotifyBadController(ex); } } }