public ZipEntry(ZipEntry entry) { this.externalFileAttributes = -1; this.method = ICSharpCode.SharpZipLib.Zip.CompressionMethod.Deflated; this.zipFileIndex = -1L; if (entry == null) { throw new ArgumentNullException("entry"); } this.known = entry.known; this.name = entry.name; this.size = entry.size; this.compressedSize = entry.compressedSize; this.crc = entry.crc; this.dosTime = entry.dosTime; this.method = entry.method; this.comment = entry.comment; this.versionToExtract = entry.versionToExtract; this.versionMadeBy = entry.versionMadeBy; this.externalFileAttributes = entry.externalFileAttributes; this.flags = entry.flags; this.zipFileIndex = entry.zipFileIndex; this.offset = entry.offset; this.forceZip64_ = entry.forceZip64_; if (entry.extra != null) { this.extra = new byte[entry.extra.Length]; Array.Copy(entry.extra, 0, this.extra, 0, entry.extra.Length); } }
public ZipEntry(ZipEntry entry) { externalFileAttributes = -1; method = CompressionMethod.Deflated; zipFileIndex = -1L; if (entry == null) { throw new ArgumentNullException("entry"); } known = entry.known; name = entry.name; size = entry.size; compressedSize = entry.compressedSize; crc = entry.crc; dosTime = entry.dosTime; method = entry.method; comment = entry.comment; versionToExtract = entry.versionToExtract; versionMadeBy = entry.versionMadeBy; externalFileAttributes = entry.externalFileAttributes; flags = entry.flags; zipFileIndex = entry.zipFileIndex; offset = entry.offset; forceZip64_ = entry.forceZip64_; if (entry.extra != null) { extra = new byte[entry.extra.Length]; Array.Copy(entry.extra, 0, extra, 0, entry.extra.Length); } }
public ZipEntry(ZipEntry entry) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (entry == null) { throw new ArgumentNullException("entry"); } known = entry.known; name = entry.name; size = entry.size; compressedSize = entry.compressedSize; crc = entry.crc; dosTime = entry.dosTime; method = entry.method; comment = entry.comment; versionToExtract = entry.versionToExtract; versionMadeBy = entry.versionMadeBy; externalFileAttributes = entry.externalFileAttributes; flags = entry.flags; zipFileIndex = entry.zipFileIndex; offset = entry.offset; forceZip64_ = entry.forceZip64_; if (entry.extra != null) { extra = new byte[entry.extra.Length]; global::System.Array.Copy((global::System.Array)entry.extra, 0, (global::System.Array)extra, 0, entry.extra.Length); } }
public ZipEntry(ZipEntry entry) { if (entry == null) { throw new ArgumentNullException("entry"); } known = entry.known; name = entry.name; size = entry.size; compressedSize = entry.compressedSize; crc = entry.crc; dosTime = entry.dosTime; method = entry.method; comment = entry.comment; versionToExtract = entry.versionToExtract; versionMadeBy = entry.versionMadeBy; externalFileAttributes = entry.externalFileAttributes; flags = entry.flags; zipFileIndex = entry.zipFileIndex; offset = entry.offset; forceZip64_ = entry.forceZip64_; if (entry.extra != null) { extra = new byte[entry.extra.Length]; Array.Copy(entry.extra, 0, extra, 0, entry.extra.Length); } }
public ZipEntry(ZipEntry entry) { _externalFileAttributes = -1; _method = CompressionMethod.Deflated; ZipFileIndex = -1L; if (entry == null) { throw new ArgumentNullException(nameof(entry)); } _known = entry._known; Name = entry.Name; _size = entry._size; _compressedSize = entry._compressedSize; _crc = entry._crc; _dosTime = entry._dosTime; _method = entry._method; _comment = entry._comment; _versionToExtract = entry._versionToExtract; _versionMadeBy = entry._versionMadeBy; _externalFileAttributes = entry._externalFileAttributes; Flags = entry.Flags; ZipFileIndex = entry.ZipFileIndex; Offset = entry.Offset; _forceZip64 = entry._forceZip64; if (entry._extra != null) { _extra = new byte[entry._extra.Length]; Array.Copy(entry._extra, 0, _extra, 0, entry._extra.Length); } }
public void AddNewFacts(IEnumerable <Fact> facts) { foreach (Fact fact in facts) { Known.Add(fact); } }
public Villes(string _name, int _fortif, int _gold, Soldat _unite, int _capture, int _perception, float _productivity, Soldat _knights, Soldat _trebuchet, int _pos) { is_event = false; is_knights = false; is_king = false; is_trebuchet = false; current_event = 0; nameVilles = _name; fortification = _fortif; gold = _gold; gold_known = new Known(); garnison = _unite; garni_known = new Known(); capture = _capture; perception = _perception; productivity = _productivity; fear = 1.05f; knights = _knights; trebuchet = _trebuchet; pos = _pos; raided = 43; special = new Special(); }
/// <summary> /// Called after the deck has ben deserialized. /// </summary> public virtual void Rehydrated() { Known.AddRange(DrawPile); Known.AddRange(DiscardPile); Known.AddRange(Table); Known.AddRange(Tableau); Hands.Apply(h => Known.AddRange(h)); }
} // //////////////////////////////////////////////////////////////////////////// public override string ToString() { return(N + " " + Count.ToString() + " " + Word + " " + Known.ToString() + Unknown.ToString()); } // ///////////////////////////////////////////////////////////////////////////
/// <summary> /// Adds a card to a specific location in the deck. /// </summary> /// <param name="element">The element to add.</param> /// <param name="side">What side of the deck the item goes to.</param> /// <param name="location">The location to add it to.</param> /// <returns>This same deck (for FLUID interface reasons).</returns> public IDeck <TElement> Add(TElement element, DeckSide side, Location location = Location.DrawPile) { Contract.Requires(Enum.IsDefined(typeof(DeckSide), side)); Contract.Requires(Enum.IsDefined(typeof(Location), location)); CheckAllowAdd(); switch (location) { case Location.DrawPile: ((Internal.IDrawPileInternal <TElement>)_drawPile).Add(element, side); break; case Location.DiscardPile: ((Internal.IDiscardPileInternal <TElement>)_discards).Add(element, side); break; case Location.Table: if (side != DeckSide.Default) { throw new InvalidOperationException("Cannot add to the table on a specific side."); } else { ((Internal.ITableInternal <TElement>)_table).Add(element); } break; case Location.Tableau: if (side != DeckSide.Default) { throw new InvalidOperationException("Cannot add to the tableau on a specific side."); } else { ((Internal.ITableauInternal <TElement>)_tableau).Add(element); } break; case Location.Hand: throw new InvalidOperationException("Cannot add directly to a hand."); default: throw new NotImplementedException($"Don't know about the {location} location."); } Known.Add(element); Events.Added(element, side, location); return(this); }
public static SandPile OfDimension(int _width, int _height) { var zerosOfDim = Known. Where(s => s.Width == _width && s.Height == _height). ToList(); if (zerosOfDim.Count() == 1) { return(zerosOfDim[0]); } if (zerosOfDim.Count() == 0) { return(null); } throw new Exception($"More than one zero match dimensions {_width}, {_height}"); }
public override Vendr Get(string id) { Known.TryGetValue(id, out var returned); if (returned == null) { var result = new GetVendorRequest(id).Execute(Api.Client); if (result.Status == 200) { returned = new Vendr(); returned.UpdateFromRequest(Utils.DictionaryOfJsonFields(result.Data.Vendor)); Known.Add(returned.Id, returned); } } return(returned); }
public HfsEntry(HfsEntry entry) { if (entry == null) { throw new ArgumentNullException("entry"); } known = entry.known; name = entry.name; size = entry.size; compressedSize = entry.compressedSize; crc = entry.crc; dosTime = entry.dosTime; method = entry.method; comment = entry.comment; versionToExtract = entry.versionToExtract; versionMadeBy = entry.versionMadeBy; externalFileAttributes = entry.externalFileAttributes; flags = entry.flags; HfsFileIndex = entry.HfsFileIndex; offset = entry.offset; if (entry.extra != null) { extra = new byte[entry.extra.Length]; Array.Copy(entry.extra, 0, extra, 0, entry.extra.Length); } }
public bool CompleteInfer(List <Fact> inputs, List <Request> outputs) { // TODO: replace this global variable InferenceRule Rule = null; foreach (Fact input in inputs) { Known.Add(input); } bool completeFlag = false; // duyet het luat chua List <int> usedIndexes = new List <int>(); // luu lai danh sach cac luat da di qua va duoc ap dung de tranh lap lai while (!completeFlag) // neu chuat duyet het luat { bool usableFlag = false; // luat co ap dung dung khong int index = 0; // vi tri cua luat hien tai // duyet tung gia thiet trong tap luat foreach (InferenceRule rule in RuleBase.InferenceRules) { IEnumerable <Fact> hypotheses = rule.Hypotheses; // Tim cach luu lai nhung luat ma da duyet co trong Know nhung chua co result usableFlag = CheckHypothesesInKnown(hypotheses, Known); // Kiem tra luat co ap dung duoc khong if (usableFlag) { // Kiem tra xem luat nay da ap dung chua va dua su kien vao Known chua de tranh lap lai if (!usedIndexes.Contains(index)) { // Neu chua ap dung IEnumerable <Fact> conclusions = rule.Conclusions; if (CheckRequestsInConclusions(outputs, conclusions)) // Kiem tra xem su kien ket luan co phai la ket qua khong { foreach (CrispFact fact in hypotheses) { Console.Write(fact.ToString() + "\t"); } Console.Write(" -> "); foreach (CrispFact fact in conclusions) { Console.Write(fact.ToString() + "\t"); } Console.WriteLine(); } else // Su kien ket luan khong la ket qua { foreach (Fact conclusion in conclusions) { // Them tat ca su kien ket luan vao Known Known.Add(conclusion); } } usedIndexes.Add(index); // luat o vi tri index da duyet va cap nhat vao Known break; } } index++; } // Neu duyet het luat ma chua tim duoc ket luan if (index == RuleBase.InferenceRules.Count) { completeFlag = true; } foreach (RelationRule rule in RuleBase.RelationRules) { for (int i = 0; i < Known.Count; ++i) { Fact fact = Known[i]; IndividualCrispFact individualFact = fact as IndividualCrispFact; if (individualFact == null) { continue; } if (individualFact.Class == rule.Domain) { Tuple <IEnumerable <string>, IEnumerable <string> > result = _knowledgeManager.RunQuery(rule.Query, "autogen0:" + individualFact.Individual, rule.QueryRange); foreach (string rangeIndividual in result.Item2) { string individual = rangeIndividual.Replace("autogen0:", ""); Console.WriteLine(individual); // workar5ound Fact rangeFact = new IndividualCrispFact { Class = rule.Range, Individual = individual }; if (!Known.Contains(rangeFact)) { Known.Add(rangeFact); } } } else if (individualFact.Class == rule.Range) { Tuple <IEnumerable <string>, IEnumerable <string> > result = _knowledgeManager.RunQuery(rule.Query, rule.QueryDomain, "autogen0:" + individualFact.Individual); foreach (string domainIndividual in result.Item1) { string individual = domainIndividual.Replace("autogen0:", ""); Console.WriteLine(individual); Fact domainFact = new IndividualCrispFact { Class = rule.Range, Individual = individual }; if (!Known.Contains(domainFact)) { Known.Add(domainFact); } } } } } } // TODO: return(false); }