public InformationSchemaObjectBase(DataRow dr, ICatalog cat) { Catalog = cat; ObjectName = dr[IsObjectName].ToString(); ObjectSchema = dr[IsObjectSchema].ToString(); ObjectCatalog = dr.IsNull(IsObjectCatalog) ? string.Empty : dr[IsObjectCatalog].ToString(); }
public void ExecuteCommand(ICatalog catalog, ICommand cmd, StringBuilder sb) { switch (cmd.Type) { case CommandType.AddBook: catalog.Add(new ContentItem(ContentItemType.Book, cmd.Parameters)); sb.AppendLine("Book added"); break; case CommandType.AddMovie: catalog.Add(new ContentItem(ContentItemType.Movie, cmd.Parameters)); sb.AppendLine("Movie added"); break; case CommandType.AddSong: catalog.Add(new ContentItem(ContentItemType.Song, cmd.Parameters)); sb.AppendLine("Song added"); break; case CommandType.AddApplication: catalog.Add(new ContentItem(ContentItemType.Application, cmd.Parameters)); sb.AppendLine("Application added"); break; case CommandType.Update: if (cmd.Parameters.Length != 2) { throw new FormatException("Format exception"); } var updatedItems = catalog.UpdateContent(cmd.Parameters[0], cmd.Parameters[1]); sb.AppendLine(String.Format("{0} items updated", updatedItems)); break; case CommandType.Find: { if (cmd.Parameters.Length != 2) { Console.WriteLine("Invalid params!"); throw new Exception("Invalid number of parameters!"); } int numberOfElementsToList = int.Parse(cmd.Parameters[1]); IEnumerable<IContent> foundContent = catalog.GetListContent(cmd.Parameters[0], numberOfElementsToList); if (foundContent.Count() == 0) { sb.AppendLine("No items found"); } else { foreach (IContent content in foundContent) { sb.AppendLine(content.TextRepresentation); } } } break; default: { throw new InvalidCastException("Unknown command!"); } } }
ICatalog ToUpdatable(ICatalog catalog) { if (null == catalog) { catalog = new Catalog(); } var row = 1; return(new UpdatedCatalog { Id = catalog.FileId, PluralCount = catalog.PluralCount, Items = catalog.Entries.Values.Select(t => new UpdatedTranslation(row++) { UniqueKey = t.Key, Context = t.Context, Singular = t.Singular, Plural = t.Plural, Translations = t.Translations, ExtractedComments = t.ExtractedComments, Flags = t.Flags, References = t.References, TranslatorComments = t.TranslatorComments, }).ToArray(), }); }
void oprBar_Click(object sender, EventArgs e) { ICatalog c = _catalogs[(sender as ToolStripButton).Tag.ToString()]; SubProductCatalogDef catalogDef = c.Definition as SubProductCatalogDef; string filter = catalogDef.Filter; using (OpenFileDialog dlg = new OpenFileDialog()) { dlg.Filter = filter; dlg.Multiselect = true; dlg.InitialDirectory = MifEnvironment.GetWorkspaceDir(); if (dlg.ShowDialog() == DialogResult.OK) { string[] fnames = dlg.FileNames; if (fnames == null || fnames.Length == 0) { return; } foreach (string f in fnames) { c.AddItem(new CatalogItem(f, catalogDef, null)); } } } }
public TableDataBaseObject(string objectCatalog, string objectName, string objectSchema, ICatalog catalog) { ObjectCatalog = objectCatalog; ObjectName = objectName; ObjectSchema = objectSchema; Catalog = catalog; }
public void ExecuteCommand(ICatalog catalog, ICommand command, StringBuilder consoleOutput) { switch (command.Type) { case CommandType.AddBook: this.AddBook(catalog, command, consoleOutput); break; case CommandType.AddMovie: this.AddMovie(catalog, command, consoleOutput); break; case CommandType.AddSong: this.AddSong(catalog, command, consoleOutput); break; case CommandType.AddApplication: this.AddAplication(catalog, command, consoleOutput); break; case CommandType.Update: this.Update(catalog, command, consoleOutput); break; case CommandType.Find: this.Find(catalog, command, consoleOutput); break; default: { throw new InvalidCastException("Unknown command!"); } } }
public override string FormatLink(string type, object dataItem, ICatalog catalog, GuayaquilTemplate renderer) { string link; if (type.Equals("vehicle")) { link = String.Format("Vehicle.aspx?c={0}&vid={1}&ssd={2}", catalog.Code, catalog.VehicleId, catalog.Ssd); } else { t_row row = dataItem as t_row; if (row == null) { throw new ArgumentException(String.Format("Expected type 't_row'. Actual type is '{0}'.", dataItem.GetType())); } link = String.Format("QuickDetails.aspx?c={0}&gid={1}&vid={2}&ssd={3}", catalog.Code, row.quickgroupid, catalog.VehicleId, catalog.Ssd); } if (ItemId > 0) { link += string.Format("&ItemId={0}", ItemId); } return link; }
public void ExecuteCommand(ICatalog catalog, ICommand command, StringBuilder output) { switch (command.Type) { case CommandType.AddBook: ExecuteAddBookCommand(catalog, command, output); break; case CommandType.AddMovie: ExecuteAddMovieCommand(catalog, command, output); break; case CommandType.AddSong: ExecuteAddSongCommand(catalog, command, output); break; case CommandType.AddApplication: ExecuteAddApplicationCommand(catalog, command, output); break; case CommandType.Update: ExecuteUpdateCommand(catalog, command, output); break; case CommandType.Find: ExecuteFindCommand(catalog, command, output); break; default: { throw new InvalidOperationException("Unknown command!"); } } }
public Library(IBookDao dao) { this.catalog = new CatalogBasicImpl(dao); this.processState = new LibraryState(dao); this.users = new UsersBasicImpl(); this.events = new EventsBasicImpl(); }
private static void ProcessFindCommand(ICatalog contentCatalog, ICommand command, StringBuilder output) { if (command.Parameters.Length != 2) { throw new ArgumentException("Invalid number of parameters!"); } int numberOfElementsToList = Int32.Parse(command.Parameters[1]); IEnumerable<IContent> foundContent = contentCatalog.GetListContent(command.Parameters[0], numberOfElementsToList); if (foundContent.Count() == 0) { output.AppendLine("No items found"); } else { foreach (IContent content in foundContent) { output.AppendLine(content.TextRepresentation); } } }
public void ExecuteCommand(ICatalog catalog, ICommand command, StringBuilder output) { switch (command.Type) { case CommandTypes.AddBook: AddBookCommand(catalog, command, output); break; case CommandTypes.AddMovie: AddMovieCommand(catalog, command, output); break; case CommandTypes.AddSong: AddSongCommand(catalog, command, output); break; case CommandTypes.AddApplication: AddApplicationCommand(catalog, command, output); break; case CommandTypes.Update: IsValidParameters(command); UpdateCommand(catalog, command, output); break; case CommandTypes.Find: IsValidParameters(command); FindCommand(catalog, command, output); break; default: throw new ArgumentException("Unknown command: " + command.Type.ToString()); } }
public static string Comment(ICatalog t, string indent = "") { var sb = new StringBuilder(); sb.Append(indent); sb.Append(commentBegSummary); sb.AppendLine(); sb.Append(indent); sb.Append(comment); sb.Append("UI name: "); sb.Append(t.NameUi); sb.AppendLine(); if (!string.IsNullOrWhiteSpace(t.Description)) { sb.Append(indent); sb.Append(comment); //sb.Append("Description: "); sb.Append(t.Description); sb.AppendLine(); } sb.Append(indent); sb.Append(commentEndSummary); return(sb.ToString()); }
public bool SetFileArg(ISmartSession session, IArgumentProvider iArgumentProvider, string argName) { IWorkspace wks = (session.MonitoringSession as IMonitoringSession).Workspace; if (wks == null) { return(false); } ICatalog catalog = wks.ActiveCatalog; if (catalog == null) { return(false); } string[] fnames = catalog.GetSelectedFiles(); if (fnames == null || fnames.Length == 0) { return(false); } string selectFileName = Path.GetFileName(fnames[0]); if (selectFileName.Contains("BPCD")) { iArgumentProvider.SetArg(argName, fnames[0]); return(true); } string bpcdName = Path.GetDirectoryName(fnames[0]) + "\\" + selectFileName.Replace("DBLV", "BPCD"); if (File.Exists(bpcdName)) { iArgumentProvider.SetArg(argName, bpcdName); } return(true); }
public static void TrySaveFileToWorkspace(IMonitoringSubProduct subProduct, IMonitoringSession mession, string fname, IExtractResult restult) { if (string.IsNullOrEmpty(fname)) { return; } IWorkspace wks = mession.GetWorkspace(); RasterIdentify rst = new RasterIdentify(fname); ICatalog c = wks.GetCatalog("CurrentExtracting"); if (c != null) { c.AddItem(new CatalogItem(fname, c.Definition as SubProductCatalogDef)); } if (_contextEnvironment != null && subProduct != null) { rst.SubProductIdentify = subProduct.Identify; IExtractResultBase erb = restult as IExtractResultBase; if (erb != null && !string.IsNullOrEmpty(erb.OutIdentify)) { rst.SubProductIdentify = erb.OutIdentify; } GetOutFileIdentify(ref rst, subProduct); if (!string.IsNullOrEmpty(restult.Name) && restult.Name != rst.SubProductIdentify) { rst.SubProductIdentify = restult.Name; } _contextEnvironment.PutContextVar(rst.SubProductIdentify, fname); } }
/// <summary> /// make a copy of catalog /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btCopy_Click(object sender, RoutedEventArgs e) { //get the selected item if (lbCatalogs.SelectedItem == null) { return; } ICatalog copy = lbCatalogs.SelectedItem as ICatalog; //copy fields var cat = new Catalog.Catalog(ComputeNode); BermudaConfigUtil.CopyCatalog(copy, cat); //open the window CatalogConfig window = new CatalogConfig(cat, ""); var ret = window.ShowDialog(); if (!ret.HasValue || ret == false) { return; } //add to list Catalogs.Add(cat); ComputeNode.Catalogs.Add(cat.CatalogName, cat); }
public void ExecuteCommand(ICatalog catalog, ICommand command, StringBuilder output) { switch (command.Type) { case CommandType.AddBook: ProcessAddCommand(catalog, ContentType.Book, command.Parameters, output); break; case CommandType.AddMovie: ProcessAddCommand(catalog, ContentType.Movie, command.Parameters, output); break; case CommandType.AddSong: ProcessAddCommand(catalog, ContentType.Song, command.Parameters, output); break; case CommandType.AddApplication: ProcessAddCommand(catalog, ContentType.Application, command.Parameters, output); break; case CommandType.Update: ProcessUpdateCommand(catalog, command, output); break; case CommandType.Find: ProcessFindCommand(catalog, command, output); break; default: throw new InvalidOperationException("Unknown command!"); } }
/// <summary> /// Sets localizable strings /// </summary> /// <param name="catalog"></param> public void setLocale(ICatalog catalog) { // Localizable captions lblKml.Text = catalog.GetString("Select from kml"); lblLat.Text = catalog.GetString("Latitude"); lblLon.Text = catalog.GetString("Longitude"); }
public Catalog(ICatalog catalog) : base(catalog) { if (catalog.Groups != null && catalog.Groups.Any()) { Groups = catalog.Groups.Select(x => new Group(this, x)).ToArray(); } }
public void ExecuteCommand(ICatalog catalog, ICommand command, StringBuilder output) { switch (command.Type) { case CommandType.AddBook: var book = new ContentItem(ContentItemType.Book, command.Parameters); catalog.Add(book); output.AppendLine("Book Added"); break; case CommandType.AddMovie: var movie = new ContentItem(ContentItemType.Movie, command.Parameters); catalog.Add(movie); output.AppendLine("Movie added"); break; case CommandType.AddSong: var song = new ContentItem(ContentItemType.Song, command.Parameters); catalog.Add(song); output.AppendLine("Song added"); break; case CommandType.AddApplication: var application = new ContentItem(ContentItemType.Application, command.Parameters); catalog.Add(application); output.AppendLine("Application added"); break; case CommandType.Update: ProcessUpdateCommand(catalog, command, output); break; case CommandType.Find: ProcessFindCommand(catalog, command, output); break; default: throw new InvalidOperationException("Unknown command!"); } }
public void ExecuteCommand(ICatalog catalog, ICommand command, StringBuilder sb) { switch (command.Type) { case Commands.AddBook: catalog.Add(new CatalogContent(ContentTypes.Book, command.Parameters)); sb.AppendLine("Book added"); break; case Commands.AddMovie: catalog.Add(new CatalogContent(ContentTypes.Movie, command.Parameters)); sb.AppendLine("Movie added"); break; case Commands.AddSong: catalog.Add(new CatalogContent(ContentTypes.Song, command.Parameters)); sb.AppendLine("Song added"); break; case Commands.AddApplication: catalog.Add(new CatalogContent(ContentTypes.Application, command.Parameters)); sb.AppendLine("Application added"); break; case Commands.Update: UpdateCommand(catalog, command, sb); break; case Commands.Find: FindCommand(command, catalog, sb); break; default: throw new InvalidOperationException("Unknown command!"); } }
public static bool CopyCatalog(ICatalog from, ICatalog to) { if (!CopyProperties(from, to)) { return(false); } to.CatalogMetadata = new CatalogMetadata(to); if (!CopyProperties(from.CatalogMetadata, to.CatalogMetadata)) { return(false); } to.CatalogMetadata.Catalog = to; to.CatalogMetadata.Tables = new Dictionary <string, ITableMetadata>(); from.CatalogMetadata.Tables.Values.ToList().ForEach(t => { ITableMetadata table = new TableMetadata(to.CatalogMetadata); CopyTable(t, table); to.CatalogMetadata.Tables.Add(table.TableName, table); }); to.CatalogMetadata.Relationships = new Dictionary <string, IRelationshipMetadata>(); from.CatalogMetadata.Relationships.Values.ToList().ForEach(r => { IRelationshipMetadata rel = new RelationshipMetadata(to.CatalogMetadata); CopyRelationship(r, rel); to.CatalogMetadata.Relationships.Add(rel.RelationshipName, rel); }); return(true); }
//TODO: Documentation public void ExecuteCommand(ICatalog catalog, ICommand command, StringBuilder sb) { switch (command.Type) { case CommandType.AddBook: this.ExecuteCommandAddBook(command, catalog, sb); break; case CommandType.AddMovie: this.ExecuteCommandAddMovie(command, catalog, sb); break; case CommandType.AddSong: this.ExecuteCommandAddSong(command, catalog, sb); break; case CommandType.AddApplication: this.ExecuteCommandAddApplication(command, catalog, sb); break; case CommandType.Update: this.ExecuteCommandUpdate(command, catalog, sb); break; case CommandType.Find: this.ExecuteCommandFind(command, catalog, sb); break; default: throw new InvalidCastException("Unknown command!"); } }
private void ExecuteCommandAddSong(ICommand command, ICatalog catalog, StringBuilder sb) { var song = new Content(ContentType.Song, command.Parameters); catalog.Add(song); sb.AppendLine("Song added"); }
private void ExecuteCommandAddMovie(ICommand command, ICatalog catalog, StringBuilder sb) { var movie = new Content(ContentType.Movie, command.Parameters); catalog.Add(movie); sb.AppendLine("Movie added"); }
/// <summary> /// Initialize a new instance of this scanner. /// </summary> /// <param name="itunes"></param> public EmptyScanner(Controller controller, ICatalog catalog) : base(Resx.I_ScanEmptyDirectories, controller, catalog) { base.description = Resx.ScanEmpty; this.count = 0; }
/// <summary> /// Saves the changes made to the specified catalog on disk. /// </summary> /// <param name="catalog">The catalog to save.</param> /// <param name="backup">Whether to create a backup of the original catalog.</param> /// <param name="wrapReferences">Whether to word-wrap comment references.</param> /// <returns></returns> public static bool SaveChanges(this ICatalog catalog, bool backup = false, bool wrapReferences = false) { try { // save the changes to a temporary file location var tempname = new PoFileWriter(catalog) { WordWrapReferences = wrapReferences }.SaveChanges(); var catalogName = catalog.FileName; if (File.Exists(catalogName)) { if (backup) { File.Move(catalogName, $"{catalogName}.{DateTime.Now.ToString("yyyy-MM-dd-HHmmss")}.bak"); } else { File.Delete(catalogName); } } File.Copy(tempname, catalogName); return(true); } catch //(Exception ex) { //System.Diagnostics.Trace.WriteLine(ex); } return(false); }
public static void LoadLocaleFromFile() { string moFile = currentLocale + ".mo"; if (File.Exists(moFile)) { using (Stream stream = File.OpenRead(moFile)) { catalog = new Catalog(stream, new CultureInfo(currentLocale)); } } else { string resourceName = "WinDynamicDesktop.locale." + moFile; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) { if (stream == null) { return; } catalog = new Catalog(stream, new CultureInfo(currentLocale)); } } }
public RbacProvider(string catalogPath) { logger.Debug("RbacProvider( {0} )", catalogPath); this.Catalog = string.IsNullOrEmpty(catalogPath) ? CatalogFactory.GetFactory().GetCatalog() : CatalogFactory.GetFactory("file").GetCatalog(catalogPath); }
private void AddContent(ContentType type, ICatalog catalog, ICommand command, StringBuilder result) { catalog.Add(new Content(type, command.Parameters)); string updateSring = String.Format("{0} added", type.ToString()); this.UpdateResult(result, updateSring); }
protected override void BeginVisit(ICatalog ct) { if (ct is INodeGenSettings) { _act(ct as INodeGenSettings); } }
public LibraryClass(IBookDao dao) { this.catalog = new Catalog(dao); this.processState = new ProcessState(dao); this.users = new Users(); this.events = new Events(); }
// //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //Use ClassCleanup to run code after all tests in a class have run //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //Use TestInitialize to run code before running each test //[TestInitialize()] //public void MyTestInitialize() //{ //} // //Use TestCleanup to run code after each test has run //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion internal virtual ICatalog CreateICatalog() { // TODO: Instantiate an appropriate concrete class. ICatalog target = null; return(target); }
public SalesController(ICatalog catalog, IDisplay display, IScanner scanner) { this.catalog = catalog; this.display = display; scanner.BarcodeScanned += scanner_BarcodeScanned; }
//======================================================================================== // Constructor //======================================================================================== /// <summary> /// Initialize a new instance of this scaner with the specified iTunes interface. /// </summary> /// <param name="itunes"></param> /// <param name="catalog"></param> public FileWatchScanner(Controller controller, ICatalog catalog, FileWatchAction action) : base(Resx.I_ScanFileWatch, controller, catalog) { base.description = Resx.ScanFileWatch; this.action = action; }
public static void LoadLocaleFromFile() { string moFile = currentLocale + ".mo"; if (File.Exists(moFile)) { using (Stream stream = File.OpenRead(moFile)) { catalog = new Catalog(stream, new CultureInfo(currentLocale)); } } else { byte[] embeddedMo = (byte[])Properties.Resources.ResourceManager.GetObject( "locale_" + currentLocale.Replace('-', '_')); if (embeddedMo == null) { return; } using (Stream stream = new MemoryStream(embeddedMo)) { catalog = new Catalog(stream, new CultureInfo(currentLocale)); } } }
private void ExecuteCommandAddBook(ICommand command, ICatalog catalog, StringBuilder sb) { var book = new Content(ContentType.Book, command.Parameters); catalog.Add(book); sb.AppendLine("Book Added"); }
public Store(ICatalog catalog, IInventory inventory, IHistory history, float capital) { Money = capital; this.catalog = catalog; this.inventory = inventory; this.history = history; }
public void ExecuteCommand(ICatalog contentCatalog, ICommand command, StringBuilder output) { switch (command.Type) { case CommandType.AddBook: this.Add(ContentType.Book, command, contentCatalog, output); break; case CommandType.AddMovie: this.Add(ContentType.Movie, command, contentCatalog, output); break; case CommandType.AddSong: this.Add(ContentType.Song, command, contentCatalog, output); break; case CommandType.AddApplication: this.Add(ContentType.Application, command, contentCatalog, output); break; case CommandType.Update: this.Update(command, contentCatalog, output); break; case CommandType.Find: this.Find(command, contentCatalog, output); break; default: throw new ArgumentException("Unknown command!"); } }
private static void LoadLocaleFromWeb() { var client = new RestClient("https://api.poeditor.com"); ProxyServer.ApplyProxyToClient(client); var request = new RestRequest("/v2/projects/export", Method.POST); request.AddParameter("api_token", JsonConfig.settings.poeditorApiToken); request.AddParameter("id", "293081"); request.AddParameter("language", currentLocale); request.AddParameter("type", "mo"); var response = client.Execute <PoEditorApiData>(request); if (!response.IsSuccessful) { return; } using (WebClient wc = new WebClient()) { ProxyServer.ApplyProxyToClient(client); byte[] moBinary = wc.DownloadData(response.Data.result.url); using (Stream stream = new MemoryStream(moBinary)) { catalog = new Catalog(stream, new CultureInfo(currentLocale)); } } }
public void AddState(ICatalog catalog, int id) { if (GetState(id) == null) { _context.States.Add(new State(catalog, id)); } }
public override string FormatLink(string type, object dataItem, ICatalog catalog, GuayaquilTemplate renderer) { string link; if (type.Equals("quickgroup")) { link = String.Format("QuickGroups.aspx?c={0}&vid={1}&ssd={2}", catalog.Code, catalog.VehicleId, catalog.Ssd); } else { ListCategoriesRow category = dataItem as ListCategoriesRow; if (category == null) { throw new ArgumentException(String.Format("Expected type 'ListCategoriesRow'. Actual type is '{0}'.", renderer.GetType())); } link = String.Format("Vehicle.aspx?c={0}&vid={1}&cid={2}&ssd={3}", catalog.Code, catalog.VehicleId, category.categoryid, catalog.Ssd); } if (ItemId > 0) { link += string.Format("&ItemId={0}", ItemId); } return link; }
public override string FormatLink(string type, object dataItem, ICatalog catalog, GuayaquilTemplate renderer) { ListUnitsRow unit = dataItem as ListUnitsRow; if (unit == null) { throw new ArgumentException(String.Format("Expected type 'ListUnitsRow'. Actual type is '{0}'.", renderer.GetType())); } string link; if (type.Equals("filter")) { link = String.Format("UnitFilter.aspx?c={0}&vid={1}&uid={2}&cid={3}&ssd={4}&path_id={5}&f={6}", catalog.Code, catalog.VehicleId, unit.unitid, catalog.CategoryId, unit.ssd, catalog.PathId, HttpUtility.UrlEncode(unit.filter)); } else { link = String.Format("Unit.aspx?c={0}&vid={1}&uid={2}&cid={3}&ssd={4}&path_id={5}", catalog.Code, catalog.VehicleId, unit.unitid, catalog.CategoryId, unit.ssd, catalog.PathId); } if (ItemId > 0) { link += string.Format("&ItemId={0}", ItemId); } return link; }
private void ExecuteCommandAddApplication(ICommand command, ICatalog catalog, StringBuilder sb) { var application = new Content(ContentType.Application, command.Parameters); catalog.Add(application); sb.AppendLine("Application added"); }
//======================================================================================== // Constructor //======================================================================================== /// <summary> /// Initialize a new instance of this scaner with the specified iTunes interface. /// </summary> /// <param name="itunes"></param> /// <param name="catalog"></param> public MaintenanceScanner( Controller controller, ICatalog catalog, MaintenanceAction action) : base(Resx.I_ScanMaintenance, controller, catalog) { base.description = Resx.ScanMaintenance; this.action = action; }
/// <summary> /// /// </summary> /// <param name="controller"></param> /// <param name="catalog"></param> public ScannerBase(string name, Controller controller, ICatalog catalog) { this.name = name; this.controller = controller; this.catalog = catalog; this.progressPercentage = 0; this.completedAction = null; }
public void ExecuteCommand(ICatalog catalog, ICommand commmand, StringBuilder output) { switch (commmand.Type) { case CommandType.AddBook: { catalog.Add(new Content(ContentType.Book, commmand.Parameters)); output.AppendLine("Book added"); break; } case CommandType.AddMovie: { catalog.Add(new Content(ContentType.Movie, commmand.Parameters)); output.AppendLine("Movie added"); break; } case CommandType.AddSong: { catalog.Add(new Content(ContentType.Song, commmand.Parameters)); output.AppendLine("Song added"); break; } case CommandType.AddApplication: { catalog.Add(new Content(ContentType.Application, commmand.Parameters)); output.AppendLine("Application added"); break; } case CommandType.Update: { if (commmand.Parameters.Length != 2) { throw new FormatException("Invalid parameteres count."); } int itemsUpdated = catalog.UpdateContent(commmand.Parameters[0], commmand.Parameters[1]); string updatedInfo = String.Format("{0} items updated", itemsUpdated); output.AppendLine(updatedInfo); break; } case CommandType.Find: { if (commmand.Parameters.Length != 2) { throw new Exception("Invalid number of parameters!"); } int numberOfElementsToList = int.Parse(commmand.Parameters[1]); FindContent(catalog, commmand, output, numberOfElementsToList); break; } default: { throw new ArgumentException("Unknown command type."); } } }
//======================================================================================== // Constructor //======================================================================================== /// <summary> /// Initialize a new instance of this scanner with the specified iTunes interface. /// </summary> /// <param name="itunes"></param> /// <param name="catalog"></param> public PhantomScanner(Controller controller, ICatalog catalog) : base(Resx.I_ScanPhantoms, controller, catalog) { base.description = Resx.ScanPhantoms; this.albumFilter = null; this.artistFilter = null; this.playlistFilter = PersistentID.Empty; }
private void Update(ICatalog catalog, ICommand command, StringBuilder consoleOutput) { if (command.Parameters.Length != 2) { throw new FormatException("Invalid number of parameters!Mandatory parameters are: Old url and new url. Probably some are missing."); } consoleOutput.AppendLine(String.Format("{0} items updated", catalog.UpdateContent(command.Parameters[0], command.Parameters[1]))); }
private static void ProcessAddCommand( ICatalog catalog, ContentType contentType, string[] parameters, StringBuilder output) { IContent contentItem = new ContentItem(contentType, parameters); catalog.Add(contentItem); output.AppendFormat("{0} added{1}", contentType, Environment.NewLine); }
/// <summary> /// Initializes a new instance of the DbTableConfiguration class. /// </summary> /// <param name="tableName">Table name.</param> /// <param name="catalog">Catalog to which the table/view belongs to.</param> /// <param name="columnConfiguration">Column configuration</param> /// <param name="primaryKeyColumnIndexes">Primary key column indexes in <b>columnConfiguration</b> array.</param> /// <param name="parentEntityProperties">Names of parent entity properties in generated <see cref="IEntity"/> class.</param> /// <param name="extendedProperties">Customized information associated with the table.</param> public DbTableConfiguration(string tableName, ICatalog catalog, DbColumnConfiguration[] columnConfiguration, int[] primaryKeyColumnIndexes, string[] parentEntityProperties, IPropertyCollection extendedProperties) { this.TableName = tableName; this.Catalog = catalog; this.ColumnConfiguration = columnConfiguration; this.PrimaryKeyColumnIndexes = primaryKeyColumnIndexes; this.ParentEntityProperties = parentEntityProperties; this.EmptyDataTable = CreateDataTable(); this.ExtendedProperties = extendedProperties; }
private void _TestLoadedTranslation(ICatalog t) { Assert.AreEqual("тест", t.GetString("test")); Assert.AreEqual("тест2", t.GetString("test2")); Assert.AreEqual("1 минута", t.GetPluralString("{0} minute", "{0} minutes", 1, 1)); Assert.AreEqual("5 минут", t.GetPluralString("{0} minute", "{0} minutes", 5, 5)); Assert.AreEqual("тест3контекст1", t.GetParticularString("context1", "test3")); Assert.AreEqual("тест3контекст2", t.GetParticularString("context2", "test3")); }
public override string FormatLink(string type, object dataItem, ICatalog catalog, GuayaquilTemplate renderer) { if (type.Equals("quickgroup")) { return String.Format("QuickGroups.aspx?c={0}&vid={1}&ssd={2}", catalog.Code, catalog.VehicleId, catalog.Ssd); } //'window.alert('.FormatLocalizedString('SelectedDetail', $dataItem->oem).')' return String.Format("window.alert('{0}')", GetLocalizedString("SelectedDetail", renderer));//dataItem->oem - wtf? }
public void ClearCatalogState() { logger.Debug("Clearing all in-memory catalog state"); using (new ShortLock(LoadedCatalogs)) LoadedCatalogs.Clear(); using (new ShortLock(_dflock)) _defaultCatalog = null; }
private static void ProcessUpdateCommand(ICatalog catalog, ICommand cmd, StringBuilder output) { if (cmd.Parameters.Length != 2) { throw new ArgumentException("Invalid number of parameters!"); } output.AppendLine(String.Format("{0} items updated", catalog.UpdateContent(cmd.Parameters[0], cmd.Parameters[1]))); }
private static void UpdateCommand(ICatalog catalog, ICommand command, StringBuilder sb) { if (command.Parameters.Length != 2) { throw new ArgumentException("Invalid number of parameters!"); } int updatedItems = catalog.UpdateContent(command.Parameters[0], command.Parameters[1]); sb.AppendLine(string.Format("{0} items updated", updatedItems)); }
public void ExecuteCommand(ICatalog contentCatalog, ICommand command, StringBuilder output) { switch (command.Type) { case CommandType.AddBook: contentCatalog.Add(new ContentItem(ContentType.Book, command.Parameters)); output.AppendLine("Book Added"); break; case CommandType.AddMovie: contentCatalog.Add(new ContentItem(ContentType.Movie, command.Parameters)); output.AppendLine("Movie added"); break; case CommandType.AddSong: contentCatalog.Add(new ContentItem(ContentType.Song, command.Parameters)); output.AppendLine("Song added"); break; case CommandType.AddApplication: contentCatalog.Add(new ContentItem(ContentType.Application, command.Parameters)); output.AppendLine("Application added"); break; case CommandType.Update: if (command.Parameters.Length != 2) { throw new FormatException("Invalid number of Parameters!"); } string message = string.Format("{0} items updated", contentCatalog.UpdateContent(command.Parameters[0], command.Parameters[1])); output.AppendLine(message); break; case CommandType.Find: if (command.Parameters.Length != 2) { throw new FormatException("Invalid number of parameters!"); } int numberOfElementsToList = int.Parse(command.Parameters[1]); IEnumerable<IContent> foundContent = contentCatalog.GetListContent(command.Parameters[0], numberOfElementsToList); if (foundContent.Count() == 0) { output.AppendLine("No items found"); } else { foreach (IContent content in foundContent) { output.AppendLine(content.TextRepresentation); } } break; default: throw new ArgumentException("Unknown command!"); } }
private void UpdateItem(ICatalog contentCatalog, ICommand command, StringBuilder output) { if (command.Parameters.Length != 2) { throw new ArgumentException("Ivalid number of paramethers!"); } output.AppendLine(string.Format( "{0} items updated", contentCatalog.UpdateContent(command.Parameters[0], command.Parameters[1]))); }
private static void ProcessUpdateCommand(ICatalog catalog, ICommand command, StringBuilder output) { if (command.Parameters.Length == 2) { int itemsUpdated = catalog.UpdateContent(command.Parameters[0], command.Parameters[1]); output.AppendFormat("{0} items updated{1}", itemsUpdated, Environment.NewLine); } else { throw new ArgumentException("Invalid number of parameters for 'Update' command!"); } }
public DetailsList(IGuayaquilExtender extender, ICatalog catalog) : base(extender, catalog) { _defaultColumns = new Dictionary<string, int>(); _defaultColumns.Add("Toggle", 1); _defaultColumns.Add("OEM", 3); _defaultColumns.Add("Name", 3); _defaultColumns.Add("Cart", 1); _defaultColumns.Add("Price", 3); _defaultColumns.Add("Note", 3); _defaultColumns.Add("Tooltip", 1); }