public static void Save(AppSettings MooAppSettings) { //serialize the object to save try { using (FileStream fs = new FileStream(@"Configuration/mooconf.mco", FileMode.Open, FileAccess.Write)) { BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, MooAppSettings); } } catch (Exception e) { Exceptioner.Log(e); } }
public static AppSettings Load() { //deserialize the object to load AppSettings ASObject = new AppSettings(); try { using (FileStream fs = new FileStream(@"Configuration/mooconf.mco", FileMode.Open, FileAccess.Read)) { BinaryFormatter bf = new BinaryFormatter(); ASObject = (AppSettings)bf.Deserialize(fs); } } catch (Exception e) { Exceptioner.Log(e); } return(ASObject); }
public static bool SendLog(string usercomment, bool islogattached) { try { string mailcontent = usercomment; if (islogattached) { mailcontent += Environment.NewLine + Exceptioner.GetLog(); //clear the log file Exceptioner.ClearLog(); } MiscHelper.SendMail("Bug Report", mailcontent); return(true); } catch { } return(false); }
public static Project Open(string Profile) { Project PObject = new Project(); try { using (FileStream fs = new FileStream(Profile, FileMode.Open, FileAccess.Read)) { BinaryFormatter bf = new BinaryFormatter(); PObject = (Project)bf.Deserialize(fs); } } catch (Exception e) { Exceptioner.Log(e); } return(PObject); }
public static bool IsInternet() { Ping PingObject = new Ping(); try { PingReply result = PingObject.Send(OnlineInfo.hosturl, 3000); if (result.Status == IPStatus.Success) { return(true); } } catch (Exception e) { Exceptioner.Log(e); } return(false); }
public static Project Create(string Profolder, string Proname, PType Protype, bool Inctemplate) { Project PObject; string Profile = Profolder + @"\" + Proname + @"\" + Proname + ".mpr"; Profolder = Profolder + @"\" + Proname; switch (Protype) { case PType.Csharp: PObject = new Csharp(Profile); break; case PType.Databse: PObject = new Database(Profile); break; case PType.Hydro: PObject = new Hydro(Profile); break; case PType.Ilasm: PObject = new Ilasm(Profile); break; case PType.Java: PObject = new Java(Profile); break; case PType.Unmanaged: PObject = new Unmanaged(Profile); break; case PType.Vbasic: PObject = new Vbasic(Profile); break; case PType.Website: PObject = new Website(Profile); break; case PType.Yalamof: PObject = new Yalamof(Profile); break; default: PObject = new Unmanaged(); break; } try { Directory.CreateDirectory(Profolder); if (Inctemplate == true) { PObject.CopyTemplate(); } PObject.Save(); } catch (Exception e) { Exceptioner.Log(e); } return(PObject); }
private void ParseInfo() { try { XmlTextReader reader = new XmlTextReader(OnlineInfo.configfileurl); while (reader.Read()) { switch (reader.Name) { case "configuration": XmlReader configurationreader = reader.ReadSubtree(); while (configurationreader.Read()) { switch (configurationreader.Name) { case "modulename": this.config.ModuleName = configurationreader.ReadString(); break; case "codename": this.config.CodeName = configurationreader.ReadString(); break; case "version": this.config.Version = configurationreader.ReadString(); break; case "author": this.config.Author = configurationreader.ReadString(); break; case "adminmail": this.config.AdminMail = configurationreader.ReadString(); break; case "helppage": this.config.HelpPage = configurationreader.ReadString(); break; case "message": this.config.Message = configurationreader.ReadString(); break; } } break; case "updates": XmlReader updatereader = reader.ReadSubtree(); while (updatereader.Read()) { if (updatereader.Name == "update") { XmlReader updatesubreader = updatereader.ReadSubtree(); Update updateItem = new Update(); while (updatesubreader.Read()) { switch (updatesubreader.Name) { case "name": updateItem.Name = updatesubreader.ReadString(); break; case "link": updateItem.Link = updatesubreader.ReadString(); break; case "targetlocation": updateItem.TargetLocation = updatesubreader.ReadString(); break; } } if (updateItem.Name != null) { this.Updates.Add(updateItem); } } } break; case "plugins": XmlReader pluginreader = reader.ReadSubtree(); while (pluginreader.Read()) { if (pluginreader.Name == "plugin") { XmlReader pluginsubreader = pluginreader.ReadSubtree(); Plugin pluginItem = new Plugin(); while (pluginsubreader.Read()) { switch (pluginsubreader.Name) { case "name": pluginItem.Name = pluginsubreader.ReadString(); break; case "link": pluginItem.Link = pluginsubreader.ReadString(); break; case "description": pluginItem.Description = pluginsubreader.ReadString(); break; } } if (pluginItem.Name != null) { this.Plugins.Add(pluginItem); } } } break; } } } catch (Exception e) { Exceptioner.Log(e); } }