public Controller(Model.Model Model, GameForm GameForm, BlockingCollection<ApplicationEvent> ViewEvents) { this.GameModel = Model; this.GameForm = GameForm; this.ViewEvents = ViewEvents; this.Strategies = new Dictionary<System.Type, Strategy>(); }
public void ShouldCheckIfNullableType() { var properties = new Model.Model().GetProperties().ToArray(); properties[1].IsNullableType().Should().BeFalse(); properties[2].IsNullableType().Should().BeTrue(); }
public MainViewModel(Model.Model model) { _model = model; _connectionQuery = new ConnectionQuery(); _getFileNamesQuery = new GetFileNamesQuery(); _downloadFileQuery = new DownloadFileQuery(); _downloads = new ObservableCollection<string>(); _processingInfos = new ObservableCollection<ProcessingInfo>(); }
public MasterController(GraphicsDeviceManager a_manager, ContentManager a_contentManager) { m_model = new Model.Model(); m_view = new View.View(a_manager, a_contentManager); m_menu = new View.Menu(a_manager, a_contentManager); m_pause = new View.Menu(a_manager, a_contentManager); m_death = new View.Menu(a_manager, a_contentManager); }
public Controller(Canvas canvas) { _roomView = new RoomView(canvas); _eventView = new EventView(); _model = Model.Model.GetModel(_roomView, _eventView); _roomView.Draw(); var w = new OpenWindow(); w.ShowDialog(); }
public GameController(View.View a_view, View.Camera a_camera, View.Menu a_menu, GraphicsDeviceManager a_manager, ContentManager a_contentManager) { m_enemyBolt = new Model.EnemyBolt(); m_view = a_view; m_menu = a_menu; m_camera = a_camera; m_manager = a_manager; m_model = new Model.Model(m_player, m_statehandler, m_levels, m_enemy, m_enemyBolt); // m_sound = new Model.SoundManager(a_contentManager); m_save = new Model.Save(m_player, m_statehandler, m_levels, m_model); }
//Laddar in värden om man har tryckt loadgame, så som, vilken bam vilken svårighetsgrad osv. internal void LoadGame() { m_levels.SetLevel(m_save.GetSavedLevel()); m_model = new Model.Model(m_player, m_statehandler, m_levels, m_enemy, m_enemyBolt); m_player.SetPosition(m_save.GetSavedPosition().X, m_save.GetSavedPosition().Y); m_levels.GenerateLevel(); m_statehandler.SetDifficulty(m_save.GetSavedDifficulty()); m_model.SetDifficulty(m_save.GetSavedDifficulty()); m_player.SetLife(m_save.GetSavedHealth()); m_view.SetLevel(m_levels.GetLevel()); }
public TileSelectionViewModel() { _model = Model.Model.Instance; TilePanel = new WrapPanel(); DecorationPanel = new WrapPanel(); LevelEditorDatabaseDataContext db = new LevelEditorDatabaseDataContext(); IOrderedQueryable<ImagePath> imagePaths = (from a in db.ImagePaths orderby a.Id select a); db.Connection.Close(); foreach (ImagePath ip in imagePaths) { if (ip.Path.Contains("/Terrain/")) { if (ip.Description.Contains("Mid") || (ip.Description.Contains("Hill Left") &! ip.Description.Contains("Corner"))) { TileButton tileButton = new TileButton((ushort) (ip.Id - 1), ip.Description) { Background = Brushes.Transparent, BorderThickness = new Thickness(0) }; tileButton.AddHandler(UIElement.MouseDownEvent, (RoutedEventHandler) SelectTile); tileButton.Click += SelectTile; TilePanel.Children.Add(tileButton); } } else if (ip.Description.Contains("Object")) { TileButton tileButton = new TileButton((ushort) (ip.Id - 1), ip.Description) { Background = Brushes.Transparent, BorderThickness = new Thickness(0) }; tileButton.AddHandler(UIElement.MouseDownEvent, (RoutedEventHandler)SelectTile); tileButton.Click += SelectTile; DecorationPanel.Children.Add(tileButton); } } }
static void Main(string[] args) { var parser = new Parser(); var model = new Model.Model(); foreach(var file in args) { var text = File.ReadAllText(file); parser.UpdateModel(model, text); } model.Normalise(); JsonConvert.DefaultSettings = () => new JsonSerializerSettings { Formatting = Formatting.Indented, ContractResolver = new CamelCasePropertyNamesContractResolver() }; var json = JsonConvert.SerializeObject(model); Console.WriteLine(json); }
public long Update(Model.Model model) { var attributes = model.GetAttributes(); var oldAttributes = model.OriginAttributes; var changedAttributes = new Dictionary <string, object>(); foreach (var(columnName, value) in attributes) { if (!value.Equals(oldAttributes[columnName])) { changedAttributes.Add(columnName, value); } } var primaryColumnName = model.GetPrimaryColumnName(); var cmd = new MySqlCommand { Connection = _getConnection() }; var sql = "UPDATE " + model.TableName() + " SET"; cmd.CommandText = changedAttributes.Keys.Aggregate(sql, (current, attributesKey) => current + " " + attributesKey + "=@" + attributesKey); cmd.CommandText += " where " + primaryColumnName + "=@_primaryValue"; foreach (var(key, value) in changedAttributes) { cmd.Parameters.AddWithValue("@" + key, value); } cmd.Parameters.AddWithValue("_primaryValue", oldAttributes[primaryColumnName]); cmd.ExecuteNonQuery(); return(cmd.LastInsertedId); }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <param name="game"></param> internal static void SetCemuVersion(Model.Model model, GameInformation game) { if (model != null) { if (game != null) { if (game.GameSetting.PreferedVersion != "Latest") { runningVersion = model.Settings.InstalledVersions.FirstOrDefault(v => v.Name == game.GameSetting.PreferedVersion); PopulateFromVersion(ref cemu, ref logfile, runningVersion); } else { runningVersion = model.Settings.InstalledVersions.FirstOrDefault(v => v.IsLatest); PopulateFromVersion(ref cemu, ref logfile, runningVersion); } } else { runningVersion = model.Settings.InstalledVersions.FirstOrDefault(v => v.IsLatest); PopulateFromVersion(ref cemu, ref logfile, runningVersion); } } }
/// <summary> /// Parse a text line of GWA format data and use it to populate a Nucleus model /// </summary> /// <param name="gwa"></param> /// <param name="model"></param> /// <param name="context"></param> public void ParseGWALine(string gwa, Model.Model model, GSAConversionContext context) { gwa = gwa.Trim(); if (gwa.StartsWith("NODE", StringComparison.CurrentCultureIgnoreCase)) { ReadNode(gwa, model, context); } else if (gwa.StartsWith("EL", StringComparison.CurrentCultureIgnoreCase)) { ReadElement(gwa, model, context); } else if (gwa.StartsWith("PROP_2D", StringComparison.CurrentCultureIgnoreCase)) { ReadBuildUp(gwa, model, context); } else if (gwa.StartsWith("PROP_SEC", StringComparison.CurrentCultureIgnoreCase)) { ReadSection(gwa, model, context); } else if (gwa.StartsWith("LIST", StringComparison.CurrentCultureIgnoreCase)) { ReadList(gwa, model, context); } }
void test_Mtch_2() { Log.set(" test_Mtch_2: Rule 15 и Group < B12,5 , 1900x1600 > "); rule = new Rule.Rule(15); ElmAttSet.ElmAttSet elB = new ElmAttSet.ElmAttSet( "ID56A7442F-0000-0D7B-3134-353338303236", "B12,5", "Concrete", "1900x1600", 0, 0, 0, 1000); Dictionary <string, ElmAttSet.ElmAttSet> els = new Dictionary <string, ElmAttSet.ElmAttSet>(); els.Add(elB.guid, elB); List <string> guids = new List <string>(); guids.Add(elB.guid); var model = new Model.Model(); model.setElements(els); model.getGroups(); var gr = model.elmGroups[0]; //6/4/17 TST.Eq(gr.guids.Count, 1); var match = new Mtch(gr, rule); //6/4/17 TST.Eq(match.ok == OK.Match, true); var cmp = match.component; //31/3 TST.Eq(cmp.fps[SType.Material].pars[0].par.ToString(), "b12,5"); Log.exit(); }
public Window(Model.Model model) { InitializeComponent(); _model = model; dataGridView1.RowTemplate = new DataGridViewNumberedRow(); var lst = new List <TimetableRow>(); int tableHeight = _model.DayLength(_model.LongestDay()); for (int i = 0; i < tableHeight; ++i) { lst.Add(new TimetableRow()); foreach (var day in DISPLAYED_DAYS) { lst[i][day] = _model[day, i]; } } dataGridView1.AutoGenerateColumns = true; dataGridView1.DataSource = null; dataGridView1.DataSource = lst; }
/// <summary> /// /// </summary> internal static void CopyLatestControllerProfiles(Model.Model model, InstalledVersion installedVersion) { int latestVersionWithProfiles = -1; InstalledVersion versionWithControllerProfiles = null; foreach (var v in model.Settings.InstalledVersions) { if (v.HasControllerProfiles) { if (v.VersionNumber > latestVersionWithProfiles) { latestVersionWithProfiles = v.VersionNumber; versionWithControllerProfiles = v; } } } if (versionWithControllerProfiles != null) { FileManager.CopyFilesRecursively( new DirectoryInfo(Path.Combine(versionWithControllerProfiles.Folder, "controllerProfiles")), new DirectoryInfo(Path.Combine(installedVersion.Folder, "controllerProfiles"))); } }
/// <summary> /// Write a Nucleus model to an ETABS file /// </summary> /// <param name="filePath"></param> /// <param name="model"></param> /// <param name="idMap"></param> /// <param name="options"></param> /// <returns></returns> public bool WriteModelToEtabs(FilePath filePath, Model.Model model, ref ETABSIDMappingTable idMap, ETABSConversionOptions options = null) { if (New()) { if (idMap == null) { idMap = new ETABSIDMappingTable(); } if (options == null) { options = new ETABSConversionOptions(); } var context = new ETABSConversionContext(idMap, options); if (!WriteToETABS(model, context)) { return(false); } return(Save(filePath)); } else { return(false); } }
/// <summary> /// /// </summary> /// <param name="model"></param> internal static void CheckGames(Model.Model model) { foreach (var game in model.GameData) { game.Value.Exists = File.Exists(game.Value.LaunchFile); if (!game.Value.Exists) { string currentRomFolder = game.Value.LaunchFile; for (int i = 0; i < 3; ++i) { currentRomFolder = currentRomFolder.Substring(0, currentRomFolder.LastIndexOf(Path.DirectorySeparatorChar)); } foreach (var version in model.Settings.RomFolders) { string attempt = game.Value.LaunchFile.Replace(currentRomFolder, version); if (File.Exists(attempt)) { game.Value.LaunchFile = attempt; } } } } }
private static void CopyFolderToCemu(Model.Model model, string[] data) { string destinationFolder = Path.Combine(SpecialFolders.BudfordDir(model), data[1]); if (!Directory.Exists(destinationFolder)) { Directory.CreateDirectory(destinationFolder); } foreach (var v in model.Settings.InstalledVersions) { string sourceFolder = Path.Combine(v.Folder, data[2]); if (Directory.Exists(sourceFolder)) { foreach (var file in Directory.EnumerateFiles(sourceFolder)) { string destinationFile = Path.Combine(destinationFolder, Path.GetFileName(file)); if (!File.Exists(destinationFile)) { File.Copy(file, destinationFile); } } } } }
private static void CopySingleFileToBudford(Model.Model model, string[] data, int minVersion) { string sourceFile = Path.Combine(SpecialFolders.BudfordDir(model), data[1], data[0]); if (File.Exists(sourceFile)) { foreach (var v in model.Settings.InstalledVersions) { if (v.VersionNumber >= minVersion) { string destinationFile = Path.Combine(v.Folder, data[2], data[0]); string destinationFolder = Path.Combine(v.Folder, data[2]); if (!Directory.Exists(destinationFolder)) { Directory.CreateDirectory(destinationFolder); } if (!File.Exists(destinationFile)) { File.Copy(sourceFile, destinationFile); } } } } }
/// <summary> /// /// </summary> /// <param name="form"></param> /// <param name="model"></param> internal static void RepairInstalledVersions(Form form, Model.Model model) { Unpacker unpacker = new Unpacker(form); PopulateBudfordDataBase(model); PopulateBudfordVersions(model); foreach (var v in model.Settings.InstalledVersions) { RepairPatch(model, v); RepairFonts(unpacker, v); InstallCemuHook(unpacker, v); RepairControllers(model, v); RepairOnlineFiles(model, v); RepairUpdateFolder(model, v); } UpdateFeaturesForInstalledVersions(model); }
public MainWindow() { // TODO: Fix sequential coupling here. this.DataContext = this; this.InitializeComponent(); this.model = new Model.Model(); this.palette.SetModel(this.model); var controller = new Controller.Controller(this.model); this.Closed += this.CloseChildrenWindows; this.scene.ElementUsed += (sender, args) => this.palette.ClearSelection(); this.scene.ElementAdded += (sender, args) => this.modelExplorer.NewElement(args.Element); this.scene.NodeSelected += (sender, args) => this.attributesView.DataContext = args.Node; this.scene.EdgeSelected += (sender, args) => this.attributesView.DataContext = args.Edge; this.scene.Init(this.model, controller, new PaletteAdapter(this.palette)); this.modelSelector.Init(this.model); this.InitAndLaunchPlugins(); }
internal void Reset() { m_model = new Model.Model(); }
public void SavePolicy(Model.Model model) { var policy = ConvertToPolicy(model); SavePolicyFile(string.Join("\n", policy)); }
public ControlNovaDespesa() { context = new Model.Model(); }
internal void ContinueGame() { m_model = new Model.Model(); }
public TipView(Model.Model model) : base(model) { _pairList = null; _boarderPen = new Pen(Color.FromArgb(255, 200, 0), MainView.BOARDER_STROKE_SIZE); }
private string FetchStructure() { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; string result = lastSelected; ImportButton.Enabled = false; ListView.SelectedListViewItemCollection selected = Results.SelectedItems; if (selected.Count > 0) { ListViewItem item = selected[0]; string pubchemId = item.Text; PubChemId = pubchemId; if (!pubchemId.Equals(lastSelected)) { Cursor = Cursors.WaitCursor; // https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/241/record/SDF var securityProtocol = ServicePointManager.SecurityProtocol; ServicePointManager.SecurityProtocol = securityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; try { var request = (HttpWebRequest)WebRequest.Create( string.Format(CultureInfo.InvariantCulture, "{0}rest/pug/compound/cid/{1}/record/SDF", UserOptions.PubChemRestApiUri, pubchemId)); request.Timeout = 30000; request.UserAgent = "Chem4Word"; HttpWebResponse response; response = (HttpWebResponse)request.GetResponse(); if (HttpStatusCode.OK.Equals(response.StatusCode)) { // we will read data via the response stream using (var resStream = response.GetResponseStream()) { lastMolfile = new StreamReader(resStream).ReadToEnd(); SdFileConverter sdFileConverter = new SdFileConverter(); Model.Model model = sdFileConverter.Import(lastMolfile); if (model.MeanBondLength < Core.Helpers.Constants.MinimumBondLength - Core.Helpers.Constants.BondLengthTolerance || model.MeanBondLength > Core.Helpers.Constants.MaximumBondLength + Core.Helpers.Constants.BondLengthTolerance) { model.ScaleToAverageBondLength(Core.Helpers.Constants.StandardBondLength); } this.display1.Chemistry = model; if (model.AllWarnings.Count > 0 || model.AllErrors.Count > 0) { Telemetry.Write(module, "Exception(Data)", lastMolfile); List <string> lines = new List <string>(); if (model.AllErrors.Count > 0) { Telemetry.Write(module, "Exception(Data)", string.Join(Environment.NewLine, model.AllErrors)); lines.Add("Errors(s)"); lines.AddRange(model.AllErrors); } if (model.AllWarnings.Count > 0) { Telemetry.Write(module, "Exception(Data)", string.Join(Environment.NewLine, model.AllWarnings)); lines.Add("Warnings(s)"); lines.AddRange(model.AllWarnings); } ErrorsAndWarnings.Text = string.Join(Environment.NewLine, lines); } else { CMLConverter cmlConverter = new CMLConverter(); Cml = cmlConverter.Export(model); ImportButton.Enabled = true; } } result = pubchemId; } else { result = string.Empty; lastMolfile = string.Empty; StringBuilder sb = new StringBuilder(); sb.AppendLine($"Bad request. Status code: {response.StatusCode}"); UserInteractions.AlertUser(sb.ToString()); } } catch (Exception ex) { if (ex.Message.Equals("The operation has timed out")) { ErrorsAndWarnings.Text = "Please try again later - the service has timed out"; } else { ErrorsAndWarnings.Text = ex.Message; Telemetry.Write(module, "Exception", ex.Message); Telemetry.Write(module, "Exception", ex.StackTrace); } } finally { ServicePointManager.SecurityProtocol = securityProtocol; Cursor = Cursors.Default; } } } return(result); }
public Model.Model CreateModel(string script) { var model = new Model.Model(); UpdateModel(model, script); return model; }
public void Map(Model.Model model, params IMapperOption[] options) { this.model = model; foreach (Model.Entity e in model) GetEntityMapping(e, options); }
public void ShouldGetProperties() { var props = new Model.Model().GetProperties(); props.Count().Should().BeGreaterOrEqualTo(2); }
public PersistenceProviderAsyncImplementation() { Model = new Model.Model(); //TypeResolver = new TypeResolver.TypeResolverImpl(); }
//Resettar spelet, vid eventuell död. internal void ResetGame() { m_model = new Model.Model(m_player, m_statehandler, m_levels, m_enemy, m_enemyBolt); }
public void PIMtoOWL() { //Presumtions // - Class, Association and Attribute names are "nice" - can be URI SaveFileDialog D = new SaveFileDialog(); D.Filter = "OWL File|*.owl"; D.Title = "Save OWL file as..."; D.CheckPathExists = true; if (D.ShowDialog() != true) { return; } Model.Model M = controller.ModelController.Model; #region Class processing foreach (PIMClass C in M.Classes) { XElement ClassElement = new XElement(nsowl + "Class", new XAttribute(nsrdf + "about", GetName(C)), new XElement(nsrdfs + "label", C.Name)); foreach (Generalization G in C.Generalizations) { ClassElement.Add(new XElement(nsrdfs + "subClassOf", new XAttribute(nsrdf + "resource", GetName(G.General)))); } foreach (Property P in C.Attributes) { if (P.Type == null) { rdfElement.Add(new XElement(nsowl + "DatatypeProperty", new XAttribute(nsrdf + "about", GetName(P)), new XElement(nsrdfs + "domain", new XAttribute(nsrdf + "resource", GetName(C))))); } else { rdfElement.Add(new XElement(nsowl + "DatatypeProperty", new XAttribute(nsrdf + "about", GetName(P)), new XElement(nsrdfs + "domain", new XAttribute(nsrdf + "resource", GetName(C))), new XElement(nsrdfs + "range", new XAttribute(nsrdf + "resource", nsxs.NamespaceName + P.Type.Name)))); } } rdfElement.Add(ClassElement); } #endregion #region Association Processing foreach (Association A in M.Associations) { rdfElement.Add(new XElement(nsowl + "ObjectProperty", new XAttribute(nsrdf + "about", GetName(A) + "_1"), new XElement(nsrdfs + "domain", new XAttribute(nsrdf + "resource", GetName(A.Ends[0].Class))), new XElement(nsrdfs + "range", new XAttribute(nsrdf + "resource", GetName(A.Ends[1].Class))))); rdfElement.Add(new XElement(nsowl + "ObjectProperty", new XAttribute(nsrdf + "about", GetName(A) + "_2"), new XElement(nsrdfs + "range", new XAttribute(nsrdf + "resource", GetName(A.Ends[0].Class))), new XElement(nsrdfs + "domain", new XAttribute(nsrdf + "resource", GetName(A.Ends[1].Class))))); } #endregion foreach (KeyValuePair <XNamespace, string> P in Namespaces) { rdfElement.Add(new XAttribute(XNamespace.Xmlns + P.Value, P.Key.NamespaceName)); } rdfElement.Add(new XAttribute("xmlns", nsproject.NamespaceName)); doc.Save(D.FileName); }
public TypeFinderVisitor(Model.Model model, Mapping.Mapping mapping) { this.model = model; this.mapping = mapping; }
public bool Init() { this.Model = new Model.Model(); return(true); }
internal void GameCompleteted() { m_model = new Model.Model(); }
public static void DoUpgrade(Word.Document doc) { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; int sel = doc.Application.Selection.Range.Start; Globals.Chem4WordV3.DisableDocumentEvents(doc); try { string extension = doc.FullName.Split('.').Last(); string guid = Guid.NewGuid().ToString("N"); string timestamp = DateTime.Now.ToString("yyyyMMdd-HHmmss", CultureInfo.InvariantCulture); string destination = Path.Combine(Globals.Chem4WordV3.AddInInfo.ProductAppDataPath, "Backups", $"Chem4Word-{timestamp}-{guid}.{extension}"); File.Copy(doc.FullName, destination); } catch (Exception ex) { // Nothing much we can do here :-( Debug.WriteLine(ex.Message); } Dictionary <string, CustomXMLPart> customXmlParts = new Dictionary <string, CustomXMLPart>(); List <UpgradeTarget> targets = CollectData(doc); int upgradedCCs = 0; int upgradedXml = 0; foreach (var target in targets) { if (target.ContentControls.Count > 0) { upgradedXml++; upgradedCCs += target.ContentControls.Count; } foreach (var cci in target.ContentControls) { foreach (Word.ContentControl cc in doc.ContentControls) { if (cc.ID.Equals(cci.Id)) { int start; bool isFormula; string source; string text; switch (cci.Type) { case "2D": cc.LockContents = false; cc.Title = Constants.ContentControlTitle; cc.Tag = target.Model.CustomXmlPartGuid; cc.LockContents = true; // ToDo: Regenerate converted 2D structures break; case "new": cc.LockContents = false; cc.Range.Delete(); start = cc.Range.Start; cc.Delete(); doc.Application.Selection.SetRange(start - 1, start - 1); var model = new Model.Model(); var molecule = new Molecule(); molecule.ChemicalNames.Add(new ChemicalName { Id = "m1.n1", Name = cci.Text, DictRef = Constants.Chem4WordUserSynonym }); model.Molecules.Add(molecule); model.CustomXmlPartGuid = Guid.NewGuid().ToString("N"); var cmlConvertor = new CMLConverter(); doc.CustomXMLParts.Add(cmlConvertor.Export(model)); Word.ContentControl ccn = doc.ContentControls.Add(Word.WdContentControlType.wdContentControlRichText, ref _missing); ChemistryHelper.Insert1D(ccn, cci.Text, false, $"m1.n1:{model.CustomXmlPartGuid}"); ccn.LockContents = true; break; default: cc.LockContents = false; cc.Range.Delete(); start = cc.Range.Start; cc.Delete(); doc.Application.Selection.SetRange(start - 1, start - 1); isFormula = false; text = ChemistryHelper.GetInlineText(target.Model, cci.Type, ref isFormula, out source); Word.ContentControl ccr = doc.ContentControls.Add(Word.WdContentControlType.wdContentControlRichText, ref _missing); ChemistryHelper.Insert1D(ccr, text, isFormula, $"{cci.Type}:{target.Model.CustomXmlPartGuid}"); ccr.LockContents = true; break; } } } } CMLConverter converter = new CMLConverter(); CustomXMLPart cxml = doc.CustomXMLParts.SelectByID(target.CxmlPartId); if (customXmlParts.ContainsKey(cxml.Id)) { customXmlParts.Add(cxml.Id, cxml); } doc.CustomXMLParts.Add(converter.Export(target.Model)); } EraseChemistryZones(doc); foreach (var kvp in customXmlParts.ToList()) { kvp.Value.Delete(); } Globals.Chem4WordV3.EnableDocumentEvents(doc); doc.Application.Selection.SetRange(sel, sel); if (upgradedCCs + upgradedXml > 0) { Globals.Chem4WordV3.Telemetry.Write(module, "Information", $"Upgraded {upgradedCCs} Chemistry Objects for {upgradedXml} Structures"); UserInteractions.AlertUser($"Upgrade Completed{Environment.NewLine}{Environment.NewLine}Upgraded {upgradedCCs} Chemistry Objects for {upgradedXml} Structures"); } }
public MessageFactory(Model.SqlCon con) { this.con = con; this.model = ModelFac.Models.First(p => p.ClassName == "Soway.Event.Message"); }
public Task LoadPolicyAsync(Model.Model model) { throw new NotImplementedException(); }
/// <summary> /// /// </summary> /// <param name="parent"></param> /// <param name="model"></param> /// <param name="fileName"></param> internal static void ImportShaderCache(Form parent, Model.Model model, string fileName) { string id = Path.GetFileNameWithoutExtension(fileName); if (id != null) { id = id.Replace("(1)", "").Replace("(2)", "").Replace("(3)", "").Replace("(4)", "").Replace(" - Copy", ""); string budfordFolder = Path.Combine(model.Settings.SavesFolder, "Budford", id); if (!Directory.Exists(budfordFolder)) { using (FormSelectGameForShaderImport selectGame = new FormSelectGameForShaderImport(model)) { if (selectGame.ShowDialog(parent) == DialogResult.OK) { budfordFolder = Path.Combine(model.Settings.SavesFolder, "Budford", selectGame.Id); } } } if (Directory.Exists(budfordFolder)) { bool copy = false; string destination = Path.Combine(budfordFolder, "post_180.bin"); if (!File.Exists(destination)) { copy = true; } else { FileInfo srcInfo = new FileInfo(fileName); FileInfo destInfo = new FileInfo(destination); if (srcInfo.Length > destInfo.Length) { copy = true; } else { if (MessageBox.Show(Resources.FileManager_ImportShaderCache_The_shader_cache_file_is_smaller_than_the_current_file__are_you_sure_want_to_over_ride_it_, Resources.FileManager_ImportShaderCache_Are_you_sure, MessageBoxButtons.YesNo) == DialogResult.Yes) { copy = true; } } } if (copy) { string message = "Shader cache import succesfull"; if (File.Exists(destination)) { FileCache srcCache = FileCache.fileCache_openExisting(fileName, 1); if (srcCache == null) { MessageBox.Show(Resources.FileManager_ImportShaderCache_, Resources.FileManager_ImportShaderCache_Invalid_Shader_Cache); return; } FileCache destCache = FileCache.fileCache_openExisting(destination, 1); message = message + "\r\n\r\nExisting cache: " + destCache.FileTableEntryCount + " shaders.\r\nNew Cache: " + srcCache.FileTableEntryCount + " shaders."; } File.Copy(fileName, destination, true); MessageBox.Show(message, Resources.FileManager_ImportShaderCache_Imported_OK); } } } }
public async Task SavePolicyAsync(Model.Model model) { var policy = ConvertToPolicy(model); await SavePolicyFileAsync(string.Join("\n", policy)); }
public void InitLifeStyles() { model = new Model.Model(); lifeStyles = model.GetLifeStyles(); }
/// <summary> /// Write a Nucleus model to the currently open ETABS model /// </summary> /// <param name="model"></param> /// <param name="context"></param> /// <returns></returns> private bool WriteToETABS(Model.Model model, ETABSConversionContext context) { RaiseMessage("Writing data to ETABS..."); SapModel.File.NewBlank(); //TODO: check if updating //SapModel.File.NewSteelDeck(0, 12, 12, 0, 0, 24, 24); if (context.Options.Levels) { LevelCollection levels = model.Levels; // Seemingly can only write whole table at once - updating individuals may not be wise... if (levels.Count > 0) { RaiseMessage("Writing levels..."); WriteStoreys(levels, context); } } if (context.Options.Nodes) { NodeCollection nodes = model.Nodes; if (context.Options.Update) { nodes = nodes.Modified(context.Options.UpdateSince); } if (nodes.Count > 0) { RaiseMessage("Writing nodes..."); } WriteNodes(nodes, context); } if (context.Options.Families) { FamilyCollection families = model.Families; if (context.Options.Update) { families = families.Modified(context.Options.UpdateSince); } if (families.Count > 0) { RaiseMessage("Writing properties..."); } WriteFamilies(families, context); } if (context.Options.LinearElements) { LinearElementCollection linearElements = model.Elements.LinearElements; if (context.Options.Update) { linearElements = linearElements.Modified(context.Options.UpdateSince); } if (linearElements.Count > 0) { RaiseMessage("Writing linear elements..."); } WriteLinearElements(linearElements, context); } if (context.Options.PanelElements) { PanelElementCollection panelElements = model.Elements.PanelElements; if (context.Options.Update) { panelElements = panelElements.Modified(context.Options.UpdateSince); } if (panelElements.Count > 0) { RaiseMessage("Writing Panels..."); } WritePanelElements(panelElements, context); } if (context.Options.Sets) { ModelObjectSetCollection sets = model.Sets; //if (context.Options.Update) sets = //TODO? if (sets.Count > 0) { RaiseMessage("Writing Groups..."); } WriteSets(sets, context); } if (context.Options.Loading) { var cases = model.LoadCases; if (cases.Count > 0) { RaiseMessage("Writing Load Cases..."); } WriteLoadCases(cases, context); var loads = model.Loads; if (loads.Count > 0) { RaiseMessage("Writing Loads..."); } WriteLoads(loads, context); } return(true); }
/// <summary> /// Sets a model from which palette will be populated. /// </summary> /// <param name="model">A model with repository from which palette will take elements.</param> public void SetModel(Model.Model model) => this.paletteViewModel.SetModel(model);
internal void ContinueGame() { m_model = new Model.Model(m_player, m_statehandler, m_levels, m_enemy, m_enemyBolt); m_view.SetLevel(m_levels.GetLevel()); }
public XPathTransformer(Model.Model model) { this.model = model; isFirstFrom = true; identifiers = new Dictionary<string, NLinq.Expressions.BinaryExpression>(); }
//Resettar värden om man väljer att köra new game. internal void NewGame() { //m_levels.UnloadEnemyPositions(); m_levels.ResetLevel(); m_model = new Model.Model(m_player, m_statehandler, m_levels, m_enemy, m_enemyBolt); m_player.SetToStartPosition(m_levels.GetLevel()); m_player.SetSpeed(0, 0); m_levels.GenerateLevel(); m_view.SetLevel(m_levels.GetLevel()); }
public void UpdateModel(Model.Model m) { dal.UpdateModel(m); }
/// <summary> /// Finds elements hidden in a PIM diagram. /// </summary> /// <param name="presentElements">elements that are present in the diagram</param> /// <param name="model">The model where to search.</param> /// <returns>elements that are hidden in the diagram</returns> public static List <Element> FindHiddenElements(IEnumerable <Element> presentElements, Model.Model model) { List <Element> result = new List <Element>(); foreach (Element element in presentElements) { Class c = element as Class; if (c != null) { foreach (Association association in c.Assocations) { if (!presentElements.Contains(association) && !result.Contains(association) && association.Ends.All(end => presentElements.Contains(end.Class))) { result.Add(association); } } foreach (Generalization specification in c.Specifications) { if (!presentElements.Contains(specification) && !result.Contains(specification) && presentElements.Contains(specification.Specific)) { result.Add(specification); } } foreach (Generalization generalization in c.Generalizations) { if (!presentElements.Contains(generalization) && !result.Contains(generalization) && presentElements.Contains(generalization.General)) { result.Add(generalization); } } } foreach (Comment comment in element.Comments) { if (!presentElements.Contains(comment) && !result.Contains(comment)) { result.Add(comment); } } } foreach (Comment comment in model.Comments) { if (!presentElements.Contains(comment) && !result.Contains(comment)) { result.Add(comment); } } return(result); }
public List <Model.Model> GetSpecifiedModels(Model.Model m) { return(dal.GetSpecifiedModels(m)); }
/// <summary> /// /// </summary> public FormMultiFileDownload(Model.Model modelIn) { InitializeComponent(); model = modelIn; unpacker = new Unpacker(this); }
protected void GuardarRegistros(Model.Model context, List <Columna> colProceso) { Model.Dato dato; foreach (Columna col in colProceso) { if (col.EsNivel) { if (col.Nivel == 1 && col.Principal) { //Crear FormularioCampana context.FormularioCampana.Add(new Model.FormularioCampana() { FormularioId = FormularioId, Visible = col.EsVisible.ToByte(), Obligatorio = col.EsObligatorio.ToByte(), TipoDato = col.TipoDato, TablaId = TablaId, Campo = $"dv{col.Nombre.Replace(" ", "")}", Nombre = col.Etiqueta, PropiedadAlmacena = "IdNivel1", Longitud = 0, ClienteId = ClienteId, Orden = col.Nivel }); } // Crear un registro en DATO para cada NODO foreach (Nodo nodo in col.Nodos) { dato = new Model.Dato() { TablaId = TablaId, Codigo = col.Etiqueta, Nombre = nodo.Valor, Valor = col.Nivel.ToString(), Activo = 1, FechaRegistro = DateTime.Now, UsuarioId = 1, PadreId = (col.Nivel > 1) ? nodo.Padre.Dato.Id : (long?)null, Herencia = nodo.Herencia }; context.Dato.Add(dato); nodo.Dato = dato; } context.SaveChanges(); // Validar si hay columnas HIJAS if (columnas.Any(x => x.ColumnaPadre == col.Nombre)) { GuardarRegistros(context, columnas.Where(x => x.ColumnaPadre == col.Nombre).ToList()); } } else { // Comodines if (col.Nivel == 1) { // Crear FormularioCampana } } } }