Exemple #1
0
        /// <summary>
        ///     Initialize with given buffer
        /// </summary>
        /// <param name="buffer"></param>
        public ECB(Span <byte> buffer)
        {
            Header = MemoryMarshal.Read <ECBHeader>(buffer);
            for (var i = 0; i < Header.EntryCount; ++i)
            {
                Entries.Add(buffer.Slice(SizeHelper.SizeOf <ECBHeader>().Align(0x10) + i * Header.Stride, Header.Stride).ToArray());
            }

            DynamicData = buffer.Slice(Header.DynamicDataPointer, Header.TotalSize - Header.DynamicDataPointer).ToArray();
        }
Exemple #2
0
 void RefreshEntries()
 {
     if (Entries.Count == 0 && _registry.Count > 0)
     {
         foreach (var item in _registry)
         {
             Entries.Add(item.Value);
         }
     }
 }
Exemple #3
0
        public async Task AddNewEntry()
        {
            var entry    = new Models.Entry();
            int affected = await EntriesStore.SaveItemAsync(entry);

            if (affected > 0)
            {
                Entries.Add(entry);
            }
        }
Exemple #4
0
 public FTDEditorVM(PersonaEditorLib.FileStructure.Text.FTD ftd)
 {
     EncodingList        = Static.EncodingManager.EncodingList;
     selectEncodingIndex = Static.EncodingManager.GetPersonaEncodingIndex(Settings.AppSetting.Default.FTDEncoding);
     this.ftd            = ftd;
     foreach (var a in ftd.Entries)
     {
         Entries.Add(new FTDEntryVM(a));
     }
 }
Exemple #5
0
        /// <inheritdoc />
        public IMenuEntryBuilder HasEntry(int priority)
        {
            var entry = new ConcreteMenuEntryBuilder(Contributor)
            {
                Priority = priority
            };

            Entries.Add(entry);
            return(entry);
        }
        protected override void AddFixedEntries()
        {
            base.AddFixedEntries();
            int boxSize = (int)Math.Sqrt(GridSize.Width);

            foreach (int i in Enumerable.Range(0, (boxSize - 1) * (boxSize - 1)))
            {
                Entries.Add(new PuzzleEntry(new Rectangle(1 + (i % (boxSize - 1) * (boxSize + 1)), 1 + (i / (boxSize - 1) * (boxSize + 1)), boxSize, boxSize), seq => true, CluePartialUnique));
            }
        }
 void fillAppointments(IList <ScheduleEntryBaseDTO> items)
 {
     Entries.Clear();
     SelectedAppointment = null;
     foreach (var item in items)
     {
         ScheduleEntryBaseViewModel app = createAppointment(item);
         Entries.Add(app);
     }
 }
Exemple #8
0
 public SpellCheckingContextMenuDefinition(string word, SpellingManager manager)
 {
     _currentWord     = word;
     _spellingManager = manager;
     Entries.AddRange(GetSpellingSuggestions());
     Entries.Add(CommandId.IgnoreOnce, true, false);
     Entries.Add(CommandId.IgnoreAll, false, false);
     Entries.Add(CommandId.AddToDictionary, false, false);
     Entries.Add(CommandId.OpenSpellingForm, false, false);
 }
 public CheckpointGroup(CKPH.CKPHEntry path, CKPT data)
 {
     Previous = path.Previous;
     Next     = path.Next;
     Unknown  = path.Unknown;
     for (int i = path.Start; i < path.Start + path.Length; i++)
     {
         Entries.Add(new CheckpointEntry(data.Entries[i]));
     }
 }
Exemple #10
0
        private void AddCommand()
        {
            var newEntry = new Entry()
            {
                Value1 = counter,
                Value2 = counter + 1
            };

            Entries.Add(newEntry);
        }
Exemple #11
0
        public LogVM()
        {
            HighLevelLog.EntryAdded += HighLevelLog_EntryAdded;
            Clear = new ActionCommand((Action)Entries.Clear);

            void HighLevelLog_EntryAdded(object sender, ValueEventArgs <LogEntry> e)
            {
                Entries.Add(e);
            }
        }
Exemple #12
0
        public PreferencesEntry Find(Mobile mob)
        {
            if (m_Table.TryGetValue(mob, out PreferencesEntry entry))
            {
                m_Table[mob] = entry = new PreferencesEntry(mob);
                Entries.Add(entry);
            }

            return(entry);
        }
Exemple #13
0
 void GenerateEntries()
 {
     Entries.Clear();
     for (var i = 0; i < DesiredCount; i++)
     {
         Entries.Add(new EntryViewModel {
             Name = "Entry " + i + " of " + DesiredCount
         });
     }
 }
Exemple #14
0
 public AnchorContextMenuDefinition(bool supportsAddToGlossary)
 {
     Entries.Add(CommandId.OpenLink, false, false);
     Entries.Add(CommandId.EditLink, false, false);
     Entries.Add(CommandId.RemoveLink, false, false);
     if (supportsAddToGlossary)
     {
         Entries.Add(CommandId.AddToGlossary, true, false);
     }
 }
 private void Add()
 {
     Entries.Add(new Entry {
         Value = double.Parse(InputValue), DateTime = DateTime.Now
     });
     InputValue = null;
     NotifyPropertyChanged(nameof(InputValue));
     NotifyPropertyChanged(nameof(Total));
     AddCommand.RaiseCanExecuteChanged();
 }
Exemple #16
0
        private async void Add_Clicked(object sender, EventArgs e)
        {
            Changed = true;
            Names          t  = new Names();
            NamesViewModel vm = new NamesViewModel(t);

            Desc.Names.Add(t);
            Entries.Add(vm);
            await Navigation.PushAsync(new NamesEditPage(vm));
        }
        public GmdViewModel(FileInfo fileInfo)
        {
            Info = fileInfo;
            gmd  = new GMD(fileInfo.FullName);

            for (int i = 0; i < gmd.Entries.Count; i++)
            {
                Entries.Add(new GmdEntryViewModel(i, gmd.Entries[i]));
            }
        }
Exemple #18
0
        //private List<ItemListArrEntry> _something;

        #endregion

        /// <summary>
        /// Read an NAM file into memory.
        /// </summary>
        /// <param name="input">A readable stream of an NAM file.</param>
        public NAM(Stream input, Stream inputARR, string filename)
        {
            _hasArr = inputARR != null;

            switch (filename)
            {
            case "ITEMLIST.NAM":
                NamFile = NamFile.ItemList;
                break;
            }

            var arrOffsets = new List <short>();

            if (_hasArr)
            {
                using (var br = new BinaryReaderX(inputARR))
                {
                    switch (NamFile)
                    {
                    case NamFile.ItemList:
                        _itemListArrEntries = br.ReadMultiple <ItemListArrEntry>((int)br.BaseStream.Length / (int)NamFile);
                        arrOffsets.AddRange(_itemListArrEntries.Select(e => e.Offset));
                        break;
                    }
                }

                using (var br = new BinaryReaderX(input))
                {
                    for (var i = 0; i < arrOffsets.Count; i++)
                    {
                        br.BaseStream.Position = arrOffsets[i];

                        short b     = 0;
                        var   chars = new List <byte>();
                        do
                        {
                            b = br.ReadInt16();
                            chars.AddRange(BitConverter.GetBytes(b));
                        }while (b != 0);

                        var str = Encoding.Unicode.GetString(chars.ToArray());

                        Entries.Add(new TextEntry {
                            Name = i.ToString(), EditedText = str.TrimEnd('\0')
                        });
                    }
                }
            }
            else
            {
                Entries.Add(new TextEntry {
                    Name = "Unsupported", EditedText = "This NAM file is not yet supported."
                });
            }
        }
Exemple #19
0
        public static async Task <List <string> > LoadFiles(IEnumerable <string> filenames)
        {
            List <string>  _errors = new List <string>();
            Queue <string> files   = new Queue <string>(filenames.OrderByDescending(x => Path.GetExtension(x)));

            filenames = filenames.Distinct(); //Prevent loading multiple times

            var batchBlock = new BatchBlock <string>(100, new GroupingDataflowBlockOptions {
                BoundedCapacity = 100
            });
            var actionBlock = new ActionBlock <string[]>(t =>
            {
                for (int i = 0; i < t.Length; i++)
                {
                    string file = files.Dequeue();
                    try
                    {
                        DBReader reader = new DBReader();
                        DBEntry entry   = reader.Read(file);
                        if (entry != null)
                        {
                            var current = Entries.FirstOrDefault(x => x.FileName == entry.FileName && x.Build == entry.Build);
                            if (current != null)
                            {
                                Entries.Remove(current);
                            }

                            Entries.Add(entry);

                            if (!string.IsNullOrWhiteSpace(reader.ErrorMessage))
                            {
                                _errors.Add(FormatError(file, ErrorType.Warning, reader.ErrorMessage));
                            }
                        }
                    }
                    catch (ConstraintException ex) { _errors.Add(FormatError(file, ErrorType.Error, "Id column contains duplicates.")); }
                    catch (Exception ex) { _errors.Add(FormatError(file, ErrorType.Error, ex.Message)); }
                }

                ForceGC();
            });

            batchBlock.LinkTo(actionBlock, new DataflowLinkOptions {
                PropagateCompletion = true
            });

            foreach (string i in filenames)
            {
                await batchBlock.SendAsync(i); // wait synchronously for the block to accept.
            }
            batchBlock.Complete();
            await actionBlock.Completion;

            return(_errors);
        }
        public void Add(ProfitabilityAnlysisEntry entry)
        {
            Entries.Add(entry);

            Entries.Sort((p1, p2) => { return(p2.ProfitData.Profit - p1.ProfitData.Profit); });

            for (int i = 0; i < Entries.Count; i++)
            {
                Entries[i].Rank = i + 1;
            }
        }
Exemple #21
0
        public void Read(Stream inputStream)
        {
            BinaryReader reader      = new BinaryReader(inputStream, Encoding.ASCII, true);
            string       signature   = reader.ReadString(4); // BHF4
            int          unknown1    = reader.ReadInt32();   // Always 00 00 00 00?
            int          unknown2    = reader.ReadInt32();   // Always 00 00 01 00?
            int          numberFiles = reader.ReadInt32();
            int          unknown3    = reader.ReadInt32();   // Always 64?
            int          unknown4    = reader.ReadInt32();

            Version = reader.ReadString(8);
            int directoryEntrySize = reader.ReadInt32(); // Always 36?
            int unknown5           = reader.ReadInt32();
            int unknown6           = reader.ReadInt32();
            int unknown7           = reader.ReadInt32();

            byte encoding  = reader.ReadByte();
            byte unknown8  = reader.ReadByte();
            byte unknown9  = reader.ReadByte();
            byte unknown10 = reader.ReadByte();

            int unknown11 = reader.ReadInt32();
            int unknown12 = reader.ReadInt32();
            int unknown13 = reader.ReadInt32();

            for (int i = 0; i < numberFiles; i++)
            {
                Entries.Add(Bhf4Entry.ReadBhf4Entry(inputStream));
            }

            long endPosition = inputStream.Position;

            switch (encoding)
            {
            case 0:
                break;

            case 1:
                reader = new BinaryReader(inputStream, Encoding.Unicode, true);
                break;

            default:
                Debug.WriteLine("Unknown encoding " + encoding);
                break;
            }

            foreach (var entry in Entries)
            {
                inputStream.Position = entry.FileNameOffset;
                entry.FileName       = reader.ReadNullTerminatedString();
            }

            inputStream.Position = endPosition;
        }
Exemple #22
0
        /// <summary>
        /// Logs the Entry to the Report and DebugReport... As well as Prints the Message .. All Without Indentation
        /// </summary>
        /// <param name="message"> </param>
        public void WriteLine(string message = "")
        {
            message = message.Trim();
            if (Verbose)
            {
                Console.WriteLine(message);
            }

            DebugEntries.Add(message);
            Entries.Add(message);
        }
Exemple #23
0
 public GliderGroup(GLPH.GLPHEntry path, GLPT data)
 {
     Previous      = path.Previous;
     Next          = path.Next;
     RouteSettings = path.Unknown1;
     Unknown2      = path.Unknown2;
     for (int i = path.Start; i < path.Start + path.Length; i++)
     {
         Entries.Add(new GliderEntry(data.Entries[i]));
     }
 }
Exemple #24
0
        private void AddEntry()
        {
            Entries.Add(DataSalvator.NewEntry());
            HighlightedEntry = Entries[Entries.Count - 1];

            RaisePropertyChanged("Entries");
            RaisePropertyChanged("HighlightedEntry");
            DecreaseBookCountCommand.RaiseCanExecuteChanged();
            DeleteEntryCommand.RaiseCanExecuteChanged();
            ProvideFeedback("An entry added");
        }
Exemple #25
0
            public void AddPackageDetails(string version)
            {
                var parsedVersion     = NuGetVersion.Parse(version);
                var catalogCommitItem = GetCatalogCommitItem(parsedVersion, Schema.DataTypes.PackageDetails);

                Entries.Add(catalogCommitItem);
                EntryToCatalogLeaf[catalogCommitItem] = new PackageDetailsCatalogLeaf
                {
                    PackageVersion = version,
                };
            }
Exemple #26
0
        private async Task CreateMessageAsync(CommandContext context, ActiveMultiRoleCreation creation)
        {
            IUserMessage message = await context.Channel.SendMessageAsync(creation.Message);

            Entries.Add(new MultiRoleEntry(context, message.Id, creation.EmoteStringRolePairs));
            Save();
            foreach (KeyValuePair <IEmote, ulong> pair in creation.EmoteRolePairs)
            {
                await message.AddReactionAsync(pair.Key);
            }
        }
Exemple #27
0
        public override void processEntries(List <byte> raw)
        {
            int currentOffset = headerSize;

            // Entries
            for (ulong i = 0; i < EntryCount; i++)
            {
                Entries.Add(new MagcItem(raw.GetRange(currentOffset, MagcItem.entrySize)));
                currentOffset += MagcItem.entrySize;
            }
        }
Exemple #28
0
 public void Add(GumpEntry g)
 {
     if (g.Parent != this)
     {
         g.Parent = this;
     }
     else if (!Entries.Contains(g))
     {
         Entries.Add(g);
     }
 }
Exemple #29
0
        public override bool TryAddEntry(DateTime date, string value)
        {
            var success = int.TryParse(value, out var parsed);

            if (success)
            {
                Entries.Add(new Entry <int>(date, parsed));
            }

            return(success);
        }
Exemple #30
0
        /* Methods */

        public void AddNewEntry()
        {
            short maxHintNumber = Entries.Count <= 0 ?
                                  (short)-1 :
                                  (short)Entries.Max(x => x.HintNumber);

            var newEntry = new ManagedEntry((short)(maxHintNumber + 1), Character.Sonic, "Reloaded II is Cool!", 1337, 0);

            Entries.Add(newEntry);
            CurrentEntry = newEntry;
        }
 private Entries GetSystemValues()
 {
     var machineName = System.Environment.MachineName;
     Entries retval = new Entries();
     retval.Add("MachineName", machineName);
     return retval;
 }
 /// <summary>
 /// Deserializes an XmlReader representing a site.xml file.
 /// </summary>
 /// <param name="reader">
 /// The XmlReader to deserialize.
 /// </param>
 /// <returns>
 /// Entries representing the site.xml file.
 /// </returns>
 public Entries DeserializeXml(XmlReader reader)
 {
     Entries entries = new Entries();
     try
     {
         var doc = new XmlDocument();
         doc.Load(reader);
         var props = doc.SelectNodes("//property");
         if (!ReferenceEquals(props, null))
         {
             foreach (XmlNode prop in props)
             {
                 string name;
                 string value = string.Empty;
                 var nameNode = prop.SelectSingleNode("name");
                 var valueNode = prop.SelectSingleNode("value");
                 if (!ReferenceEquals(nameNode, null))
                 {
                     name = nameNode.InnerText;
                     if (!ReferenceEquals(valueNode, null))
                     {
                         value = valueNode.InnerText;
                     }
                     if (!string.IsNullOrWhiteSpace(name))
                     {
                         entries.Add(name, value);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         if (!(ex is IOException || ex is XmlException))
         {
             throw;
         }
     }
     return entries;
 }
 private Entries ConvertStringToEntries(string encoded)
 {
     Entries retval = new Entries();
     var entriesLines = encoded.Split(new string[] { EntryDelimiter.ToString() }, StringSplitOptions.None);
     foreach (var entriesLine in entriesLines)
     {
         if (!string.IsNullOrWhiteSpace(entriesLine))
         {
             string[] pairs = entriesLine.Split(new string[] { EntryPairDelimiter.ToString() }, StringSplitOptions.None);
             retval.Add(pairs[0], pairs[1]);
         }
     }
     return retval;
 }
        private string GenerateApi(DirectoryList.ItemsData api)
        {
            var tmpl = new Template();
            tmpl.Add("|| *{VERSION}* | [{URL_BINARY} {FILE_BINARY}]  ([{URL_SOURCE} Source]) | [{URL_XML} XmlDoc] ||");
            tmpl.Add("|| [{URL_DOCU} Documentation] | " +
                     "[https://code.google.com/apis/explorer/#_s={NAME}&_v={VERSION} APIs Explorer] ||");
            string formalName = api.Name.ToUpperFirstChar();
            string formalVersion = api.Version;
            string binFileName = string.Format("Google.Apis.{0}.{1}.dll", formalName, formalVersion);

            // Fill in the data.
            const string RELEASE_DIR = "http://contrib.google-api-dotnet-client.googlecode.com/hg/Stable";
            const string BINARY_PATH = RELEASE_DIR + "/Generated/Bin/{0}Service/{1}";
            var data = new Entries();
            data.Add("URL_DOCU", api.DocumentationLink);
            data.Add("URL_BINARY", BINARY_PATH, formalName, binFileName);
            data.Add("URL_XML", BINARY_PATH, formalName, Path.ChangeExtension(binFileName, ".xml"));
            data.Add("FILE_BINARY", binFileName);
            data.Add("URL_SOURCE", RELEASE_DIR + "/Generated/Source/{0}", Path.ChangeExtension(binFileName, ".cs"));
            data.Add("NAME", api.Name);
            data.Add("VERSION", api.Version);
            return tmpl.ToString(data);
        }