Esempio n. 1
0
		public BaseObject(int memoryAddress, ArraySegment<byte> originalBytes, IVersion version)
		{
			MemoryAddress = memoryAddress;
			OriginalBytes = originalBytes;
			DatabaseMode = DatabaseModeEnum.Cached;
			Version = version;
		}
Esempio n. 2
0
 public SourceDump(SourceDumperOptions options, UsageDefinition definition, IEnvironment environment,
     IDebugger debugger, IConsole console, IVersion versionGetter,
     IWriterFactory factory)
     : base(options, definition, environment, debugger, console, versionGetter)
 {
     _factory = factory;
 }
Esempio n. 3
0
 public static int CompareTo(
     IVersion version1,
     IVersion version2
     )
 {
     int comparison = 0;
       {
     IList<int> version1Numbers = version1.Numbers;
     IList<int> version2Numbers = version2.Numbers;
     for(
       int index = 0,
     length = Math.Min(version1Numbers.Count, version2Numbers.Count);
       index < length;
       index++
       )
     {
       comparison = version1Numbers[index] - version2Numbers[index];
       if(comparison != 0)
     break;
     }
     if(comparison == 0)
     {comparison = version1Numbers.Count - version2Numbers.Count;}
       }
       return Math.Sign(comparison);
 }
Esempio n. 4
0
 public void JoinArchive(string name, IArchive archive, IVersion version = null)
 {
     if (version != null)
         throw new GitHubException("Method JoinArchive with version NotImplemented", new NotImplementedException());
     var path = FullPath(name);
     version = LastVersion(path).AddVersion(1);
     archive.SaveTo(Path.Combine(path, version+".zip"));
 }
 public PocoAdapter(object poco, IOid oid) {
     if (poco is INakedObject) {
         throw new AdapterException("Adapter can't be used to adapt an adapter: " + poco);
     }
     this.poco = poco;
     this.oid = oid;
     ResolveState = new ResolveStateMachine(this);
     version = new NullVersion();
 }
Esempio n. 6
0
 protected ProgramDefinition(Options options, UsageDefinition definition, IEnvironment environment,
     IDebugger debugger, IConsole console, IVersion versionGetter)
 {
     _options = options;
     _definition = definition;
     _environment = environment;
     _debugger = debugger;
     _console = console;
     _versionGetter = versionGetter;
 }
Esempio n. 7
0
		// Finds the process and loads it in memory
		public bool findFMProcess ()
		{
			FMProcess fmProcess = new FMProcess ();
			Process[] fmProcesses = Process.GetProcessesByName ("fm");
			uint pid = fmProcesses.Length > 1 ? (uint)fmProcesses[0].Id : (uint)fmProcesses[0].Id;

			if (fmProcesses.Length > 0) {
				uint buffer;
				uint bufferend;
				uint heap;
				uint endaddress;
				if (ProcessMemoryAPI.GetBaseAddress (pid, out buffer, out bufferend, out heap, out endaddress)) {
					fmProcess.Process = fmProcesses [0];
					fmProcess.BaseAddress = (int)buffer;
					fmProcess.HeapAddress = (int)heap;
					fmProcess.EndPoint = (int)endaddress;
					ProcessManager.fmProcess = fmProcess;

					// Search for the current version
					foreach (var versionType in Assembly.GetCallingAssembly().GetTypes().Where(t => typeof(IIVersion).IsAssignableFrom(t))) {
						if (versionType.IsInterface)
							continue;
						var instance = (IIVersion)Activator.CreateInstance (versionType);

						if (instance.SupportsProcess (fmProcess, null)) {
							Version = instance;
							break;
						}
					}
				}
				fmLoaded = (Version != null);
			}

			if (!fmLoaded) {
				// Try to find info about the version
				// Lookup the objects in the memory
				for (int i = fmProcess.BaseAddress; i < fmProcess.EndPoint - 4; i += 4) {
					try {
						int continents = TryGetPointerObjects(i, 0x1c, fmProcess);
						if (continents == 7)
						{
							Debug.WriteLine ("Found a candidate @ 0x{0:X}", i);
							Debug.WriteLine ("Persons: {0}", TryGetPointerObjects(i, 0x3c, fmProcess));
						}
					}
					catch {
					}
				}
			}

			return fmLoaded;
		}
Esempio n. 8
0
 public static string ToString(
     IVersion version
     )
 {
     StringBuilder versionStringBuilder = new StringBuilder();
       foreach(int number in version.Numbers)
       {
     if(versionStringBuilder.Length > 0)
     {versionStringBuilder.Append('.');}
     versionStringBuilder.Append(number);
       }
       return versionStringBuilder.ToString();
 }
        public IRevisionCollection CreateRevisionSet(IVersion version)
        {
            IEnumerable<ILogItem> logItems = this.GetLogItems(version);
            ICollection<IRevision> revisions = new List<IRevision>();
            foreach (ILogItem logItem in logItems)
            {
                IssueCollection issues = this.GetIssues(logItem.Tickets);
                IRevisionOverride overrride = GetOverride(version, logItem.Revision);
                revisions.Add(CreateRevision(logItem, issues, overrride));
            }

            var revisionCollection = new RevisionCollection(revisions);
            return revisionCollection;
        }
 public INakedObjectAdapter CreateAdapter(object domainObject, IOid oid, IVersion version) {
     if (domainObject == null) {
         return null;
     }
     if (oid == null) {
         ITypeSpec objectSpec = metamodel.GetSpecification(domainObject.GetType());
         if (objectSpec.ContainsFacet(typeof (IComplexTypeFacet))) {
             return GetAdapterFor(domainObject);
         }
         if (objectSpec.HasNoIdentity) {
             return AdapterForNoIdentityObject(domainObject);
         }
         return AdapterForExistingObject(domainObject, objectSpec);
     }
     return AdapterForExistingObject(domainObject, oid);
 }
Esempio n. 11
0
 public ReferenceManager(IUnityContainer container, ReferenceOptions options, UsageDefinition definition,
     IEnvironment environment, IDebugger debugger, IConsole console, IVersion versionGetter)
     : base(options, definition, environment, debugger, console, versionGetter)
 {
     _container = container;
 }
Esempio n. 12
0
 /// <summary>
 ///     Finds the <see cref="IFeatureClass" /> with the specified <paramref name="tableName" /> in the
 ///     specified <paramref name="source" /> workspace.
 /// </summary>
 /// <param name="source">The workspace</param>
 /// <param name="tableName">Name of the table.</param>
 /// <returns>
 ///     Returns a <see cref="IFeatureClass" /> representing the feature class that has the name,
 ///     otherwise <c>null</c>.
 /// </returns>
 /// <exception cref="System.ArgumentNullException">tableName</exception>
 public static IFeatureClass GetFeatureClass(this IVersion source, string tableName)
 {
     return(((IWorkspace)source).GetFeatureClass(tableName));
 }
Esempio n. 13
0
 public Club(int memoryAddress, IVersion version)
     : base(memoryAddress, version)
 {
     this.ClubOffsets = new ClubOffsets(Version);
 }
Esempio n. 14
0
 /// <summary>
 ///     Encapsulates the <paramref name="operation" /> by the necessary start and stop edit constructs using the specified
 ///     <paramref name="withUndoRedo" /> and
 ///     <paramref name="multiuserEditSessionMode" /> parameters.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="withUndoRedo">if set to <c>true</c> when the changes are reverted when the edits are aborted.</param>
 /// <param name="multiuserEditSessionMode">
 ///     The edit session mode that can be used to indicate non-versioned or versioned
 ///     editing for workspaces that support multiuser editing.
 /// </param>
 /// <param name="operation">
 ///     The edit operation delegate that handles making the necessary edits. When the delegate returns
 ///     <c>true</c> the edits will be saved; otherwise they will not be saved.
 /// </param>
 /// <returns>
 ///     Returns a <see cref="bool" /> representing the state of the operation.
 /// </returns>
 /// <exception cref="System.ArgumentNullException">action</exception>
 /// <exception cref="System.ArgumentException">
 ///     The workspace does not support the edit session
 ///     mode.;multiuserEditSessionMode
 /// </exception>
 public static bool PerformOperation(this IVersion source, bool withUndoRedo, esriMultiuserEditSessionMode multiuserEditSessionMode, Func <bool> operation)
 {
     return(((IWorkspace)source).PerformOperation(withUndoRedo, multiuserEditSessionMode, operation, error => false));
 }
Esempio n. 15
0
 /// <summary>
 ///     Determines whether this instance is locked.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <returns>
 ///     <c>true</c> if the specified source is locked; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsLocked(this IVersion source)
 {
     return(source.GetVersionLocks().Any());
 }
Esempio n. 16
0
 public PlayerStats(int memoryAddress, IVersion version)
     : base(memoryAddress, version)
 {
 }
Esempio n. 17
0
        /// <summary>
        ///     Gets the differences between the <paramref name="source" /> and <paramref name="target" /> versions.
        /// </summary>
        /// <param name="source">The source (or child) version.</param>
        /// <param name="target">The target (or parent) version.</param>
        /// <param name="filter">The predicate to filter the results.</param>
        /// <param name="differenceTypes">The type of differences that will be determined.</param>
        /// <returns>
        ///     Returns a <see cref="Dictionary{String, DifferenceRow}" /> representing the differences for the
        ///     table (or key).
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        ///     target
        ///     or
        ///     differenceTypes
        /// </exception>
        public static Dictionary <string, IEnumerable <DifferenceRow> > GetDifferences(this IVersion source, IVersion target, IQueryFilter filter, params esriDifferenceType[] differenceTypes)
        {
            if (source == null)
            {
                return(null);
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (differenceTypes == null)
            {
                throw new ArgumentNullException("differenceTypes");
            }

            return(source.GetDifferences(target, filter, (s, t) => t != null, differenceTypes));
        }
Esempio n. 18
0
 public PackageIdentity(PackageId packageId, IVersion version, PackagePath path)
 {
     PackageId = packageId ?? throw new ArgumentNullException(nameof(packageId));
     Version   = version ?? throw new ArgumentNullException(nameof(version));
     Path      = path ?? throw new ArgumentNullException(nameof(path));
 }
Esempio n. 19
0
 private static int IsReplacedBall(IVersion enc, PKM pk) => pk switch
 {
Esempio n. 20
0
 public Team(int memoryAddress, IVersion version)
     : base(memoryAddress, version)
 {
 }
Esempio n. 21
0
 static string GetPackageFileName(string packageId, IVersion version)
 {
     return(packageId + "." + version + NuGetFileExtension);
 }
Esempio n. 22
0
 public InstallResult Install(IVersion release, Action <IProgress> callback)
 {
     return(installer.Install(manifest, release.VersionFiles, DownloadRootDirectoryName, AppDomain.CurrentDomain.BaseDirectory, (progress) => { callback(progress); }));
 }
Esempio n. 23
0
 public async Task <DownloadResult> Download(IVersion version, Action <DownloadProgress> callback)
 {
     return(await downloader.Download(manifest, version, DownloadRootDirectoryName, (progress) => { callback(progress); }));
 }
Esempio n. 24
0
 public PlayerStats(int memoryAddress, ArraySegment <byte> originalBytes, IVersion version)
     : base(memoryAddress, originalBytes, version)
 {
 }
Esempio n. 25
0
   public int CompareTo(
 IVersion value
 )
   {
       return VersionUtils.CompareTo(this, value);
   }
Esempio n. 26
0
 public BaseObject(int memoryAddress, IVersion version)
 {
     MemoryAddress = memoryAddress;
     Version       = version;
     DatabaseMode  = DatabaseModeEnum.Realtime;
 }
Esempio n. 27
0
		public Player (int memoryAddress, ArraySegment<byte> originalBytes, IVersion version) 
			: base(memoryAddress, originalBytes, version)
		{
            this.PlayerOffsets = new PlayerOffsets(version);
        }
Esempio n. 28
0
 static string GetFullImageName(string packageId, IVersion version, Uri feedUri)
 {
     return(feedUri.Host.Equals(DockerHubRegistry)
         ? $"{packageId}:{version}"
         : $"{feedUri.Authority}{feedUri.AbsolutePath.TrimEnd('/')}/{packageId}:{version}");
 }
Esempio n. 29
0
 public PlayerStats(int memoryAddress, ArraySegment<byte> originalBytes, IVersion version)
     : base(memoryAddress, originalBytes, version)
 {
 }
Esempio n. 30
0
 public RivalNation(int memoryAddress, IVersion version)
     : base(memoryAddress, version)
 {
     this.RivalNationOffsets = new RivalNationOffsets(version);
 }
Esempio n. 31
0
        /// <summary>
        ///     Reconciles the current source version with the specified target version. The target version must be
        ///     an ancestor of the current version or an error will be returned.
        /// </summary>
        /// <param name="source">The source version that will be reconciled.</param>
        /// <param name="target">The target version must be an ancestor of the current version or an error will be returned.</param>
        /// <param name="acquireLock">
        ///     The default behavior of reconcile is to obtain a shared version lock on the target version. The lock ensures the
        ///     target version cannot be reconciled while the source version can be reconciled. The purpose of the version lock on
        ///     the target version is to ensure the version is available when the intention is to post. If the intention is not to
        ///     post to the target version following a reconcile, the acquireLock method can be set to false.
        /// </param>
        /// <param name="abortIfConflicts">
        ///     It is also possible to abort the reconcile when a conflict is detected. Setting the abortIfConflicts to true will
        ///     abort the reconcile process when conflicts are detected; for example, you could choose to abort when performing the
        ///     reconcile in a batch process when there is no human interaction to resolve the conflicts.
        /// </param>
        /// <param name="childWins">
        ///     If conflicts occur, the conflicts are initially resolved in favor of the target version. Setting this argument to
        ///     true replaces all conflicting features with the source version's representation of the object.
        /// </param>
        /// <param name="columnLevel">
        ///     The reconcile method also provides the ability to define what constitutes a conflict during the reconcile. The
        ///     columnLevel argument is a Boolean argument that, if set to true, will only promote the same modified object in both
        ///     versions as a conflict if the same attribute for the object has changed in both versions. For example, if a feature
        ///     was moved in the target version, the same feature's attribute was updated in the edit version, and column level
        ///     conflict filtering was set to true, the reconcile would not detect this feature as a conflict.
        /// </param>
        /// <returns>Returns a <see cref="bool"/> representing <c>true</c> when conflicts have been detected.</returns>
        public static bool Reconcile(this IVersion source, IVersion target, bool acquireLock, bool abortIfConflicts, bool childWins, bool columnLevel)
        {
            IVersionEdit4 versionEdit = (IVersionEdit4)source;

            return(source.PerformOperation(true, esriMultiuserEditSessionMode.esriMESMVersioned, () => versionEdit.Reconcile4(target.VersionName, acquireLock, abortIfConflicts, childWins, columnLevel)));
        }
Esempio n. 32
0
 public RivalNation(int memoryAddress, ArraySegment <byte> originalBytes, IVersion version)
     : base(memoryAddress, originalBytes, version)
 {
     this.RivalNationOffsets = new RivalNationOffsets(version);
 }
Esempio n. 33
0
 /// <summary>
 ///     Encapsulates the <paramref name="operation" /> by the necessary start and stop edit constructs using the specified
 ///     <paramref name="withUndoRedo" />s
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="withUndoRedo">if set to <c>true</c> when the changes are reverted when the edits are aborted.</param>
 /// <param name="operation">
 ///     The edit operation delegate that handles making the necessary edits. When the delegate returns
 ///     <c>true</c> the edits will be saved; otherwise they will not be saved.
 /// </param>
 /// <returns>
 ///     Returns a <see cref="bool" /> representing the state of the operation.
 /// </returns>
 /// <exception cref="System.ArgumentNullException">action</exception>
 public static bool PerformOperation(this IVersion source, bool withUndoRedo, Func <bool> operation)
 {
     return(((IWorkspaceEdit)source).PerformOperation(withUndoRedo, operation, error => false));
 }
Esempio n. 34
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DeltaRowCollection" /> class.
 /// </summary>
 /// <param name="modifiedClassInfo">The modified class information.</param>
 /// <param name="source">The source (or child) version.</param>
 /// <param name="target">The target (or parent) version.</param>
 public DeltaRowCollection(IModifiedClassInfo modifiedClassInfo, IVersion source, IVersion target)
 {
     this.ModifiedClassInfo     = modifiedClassInfo;
     this.SourceVersion         = source;
     this.TargetVersion         = target;
     this.CommonAncestorVersion = target == null ? null : ((IVersion2)source).GetCommonAncestor(target);
 }
Esempio n. 35
0
 /// <summary>
 ///     Finds the <see cref="ITable" /> with the specified <paramref name="tableName" /> in the
 ///     specified <paramref name="source" /> workspace.
 /// </summary>
 /// <param name="source">The workspace</param>
 /// <param name="tableName">Name of the table.</param>
 /// <returns>
 ///     Returns a <see cref="ITable" /> representing the table that has the name,
 ///     otherwise <c>null</c>.
 /// </returns>
 /// <exception cref="System.ArgumentNullException">tableName</exception>
 public static ITable GetTable(this IVersion source, string tableName)
 {
     return(((IWorkspace)source).GetTable(tableName));
 }
		public ClubFinances (int memoryAddress, ArraySegment<byte> originalBytes, IVersion version) 
			: base(memoryAddress, originalBytes, version)
		{
            this.ClubFinancesOffsets = new ClubFinancesOffsets(version);
        }
Esempio n. 37
0
        /// <summary>
        ///     Gets the differences between the <paramref name="source" /> and <paramref name="target" /> versions.
        /// </summary>
        /// <param name="source">The source (or child) version.</param>
        /// <param name="target">The target (or parent) version.</param>
        /// <param name="filter">The predicate to filter the results.</param>
        /// <param name="predicate">
        ///     The predicate that defines a set of criteria and determines whether the specified differences
        ///     will be loaded.
        /// </param>
        /// <param name="differenceTypes">The type of differences that will be determined.</param>
        /// <returns>
        ///     Returns a <see cref="Dictionary{String, DifferenceRow}" /> representing the differences for the
        ///     table (or key).
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        ///     target
        ///     or
        ///     differenceTypes
        /// </exception>
        public static Dictionary <string, IEnumerable <DifferenceRow> > GetDifferences(this IVersion source, IVersion target, IQueryFilter filter, Func <string, ITable, bool> predicate, params esriDifferenceType[] differenceTypes)
        {
            if (source == null)
            {
                return(null);
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (differenceTypes == null)
            {
                throw new ArgumentNullException("differenceTypes");
            }

            var list = new Dictionary <string, IEnumerable <DifferenceRow> >();

            IVersionDataChangesInit vdci         = new VersionDataChangesClass();
            IWorkspaceName          wsNameSource = (IWorkspaceName)((IDataset)source).FullName;
            IWorkspaceName          wsNameTarget = (IWorkspaceName)((IDataset)target).FullName;

            vdci.Init(wsNameSource, wsNameTarget);

            IDataChanges           dataChanges = (IDataChanges)vdci;
            IEnumModifiedClassInfo enumMci     = dataChanges.GetModifiedClassesInfo();

            enumMci.Reset();
            IModifiedClassInfo mci;

            while ((mci = enumMci.Next()) != null)
            {
                // The table references are not disposed due to the enumerable return which would result in an RCW exception.
                string tableName   = mci.ChildClassName;
                ITable sourceTable = ((IFeatureWorkspace)source).OpenTable(tableName);
                if (predicate(tableName, sourceTable))
                {
                    IVersionedTable versionedTable = sourceTable as IVersionedTable;
                    ITable          table          = ((IFeatureWorkspace)target).OpenTable(tableName);
                    if (versionedTable != null && table != null)
                    {
                        var rows = versionedTable.GetDifferences(table, filter, differenceTypes);
                        list.Add(tableName, rows);
                    }
                }
            }

            return(list);
        }
Esempio n. 38
0
 public Continent(int memoryAddress, IVersion version)
     : base(memoryAddress, version)
 {
 }
Esempio n. 39
0
        public void ReconcileandPost(IVersion editVersion, IVersion targetVersion)
        {
            IMultiuserWorkspaceEdit muWorkspaceEdit = (IMultiuserWorkspaceEdit)editVersion;
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit2)editVersion;
            IVersionEdit4 versionEdit = (IVersionEdit4)workspaceEdit;

            if (muWorkspaceEdit.SupportsMultiuserEditSessionMode(esriMultiuserEditSessionMode.esriMESMVersioned))
            {
                muWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
                //Reconcile with the target version.
                bool conflicts = versionEdit.Reconcile4(targetVersion.VersionName, true, false, false, false);
                if (conflicts) MessageBox.Show(" Conflicts Detected ");
                else MessageBox.Show(" No Conflicts Detected ");
                workspaceEdit.StartEditOperation();
                //Post to the target version.
                if (versionEdit.CanPost()) versionEdit.Post(targetVersion.VersionName);
                workspaceEdit.StopEditOperation();
                workspaceEdit.StopEditing(true);
            }
        }
 public NationOffsets(IVersion version)
 {
     this.Version = version;
 }
 public NationTaxRulesOffsets (IVersion version)
 {
     this.Version = version;
 }
 public RivalNation (int memoryAddress, IVersion version)
     : base(memoryAddress, version) 
 {
         this.RivalNationOffsets = new RivalNationOffsets(version);
 }
Esempio n. 43
0
		public Player (int memoryAddress, IVersion version) 
			: base(memoryAddress, version)
		{
            this.PlayerOffsets = new PlayerOffsets(version);
        }
Esempio n. 44
0
 public void CheckLock(IVersion otherVersion) {
     throw new System.NotImplementedException();
 }
Esempio n. 45
0
 public static bool CanBeReceivedBy(this IVersion ver, GameVersion game) => ver.Version.Contains(game);
Esempio n. 46
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DeltaRowCollection" /> class.
 /// </summary>
 /// <param name="modifiedClassInfo">The modified class information.</param>
 /// <param name="source">The source.</param>
 public DeltaRowCollection(IModifiedClassInfo modifiedClassInfo, IVersion source)
     : this(modifiedClassInfo, source, null)
 {
 }
		public ClubFinances (int memoryAddress, IVersion version) 
			: base(memoryAddress, version)
		{
            this.ClubFinancesOffsets = new ClubFinancesOffsets(version);
        }
Esempio n. 48
0
 public VersionController(IVersion versionService, IValidate validateService)
 {
     _versionService  = versionService;
     _validateService = validateService;
 }
 public ContractClause(int memoryAddress, IVersion version)
     : base(memoryAddress, version)
 {
 }
Esempio n. 50
0
 public int CompareTo(IVersion other)
 {
     return(Version.Compare(this, other));
 }
Esempio n. 51
0
 public Continent(int memoryAddress, ArraySegment<byte> originalBytes, IVersion version)
     : base(memoryAddress, originalBytes, version)
 {
 }
Esempio n. 52
0
 public Injury(int memoryAddress, IVersion version)
     : base(memoryAddress, version)
 {
 }
Esempio n. 53
0
 public Person(int memoryAddress, IVersion version)
     : base(memoryAddress, version)
 {
     this.PersonOffsets = new PersonOffsets(version);
 }
Esempio n. 54
0
 public Injury(int memoryAddress, ArraySegment <byte> originalBytes, IVersion version)
     : base(memoryAddress, originalBytes, version)
 {
 }
 public RivalNation(int memoryAddress, ArraySegment<byte>originalBytes, IVersion version)
     : base(memoryAddress, originalBytes, version)
 {
     this.RivalNationOffsets = new RivalNationOffsets(version);
 }
Esempio n. 56
0
 public Club(int memoryAddress, IVersion version)
     : base(memoryAddress, version)
 {
     this.ClubOffsets = new ClubOffsets(Version);
 }
Esempio n. 57
0
 public PlayerStats(int memoryAddress, IVersion version)
     : base(memoryAddress, version)
 {
 }
Esempio n. 58
0
 public Club(int memoryAddress, ArraySegment <byte> originalBytes, IVersion version)
     : base(memoryAddress, originalBytes, version)
 {
     this.ClubOffsets = new ClubOffsets(Version);
 }
Esempio n. 59
0
 public TeamOffsets(IVersion version)
 {
     this.Version = version;
 }
Esempio n. 60
0
        /// <summary>
        ///     Gets the differences between the <paramref name="source" /> and <paramref name="target" /> versions that need to be
        ///     checked-in or exported.
        /// </summary>
        /// <param name="source">The source (or child) version.</param>
        /// <param name="target">The target (or parent) version.</param>
        /// <param name="predicate">
        ///     The predicate that defines a set of criteria and determines whether the specified differences
        ///     will be loaded.
        /// </param>
        /// <param name="dataChangeTypes">The data change types.</param>
        /// <returns>
        ///     Returns a <see cref="Dictionary{String, DeltaRow}" /> representing the differences for the table (or
        ///     key).
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        ///     target
        ///     or
        ///     predicate
        ///     or
        ///     dataChangeTypes
        /// </exception>
        public static Dictionary <string, DeltaRowCollection> GetDataChanges(this IVersion source, IVersion target, Func <IModifiedClassInfo, bool> predicate, params esriDataChangeType[] dataChangeTypes)
        {
            if (source == null)
            {
                return(null);
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (predicate == null)
            {
                throw new ArgumentNullException("predicate");
            }
            if (dataChangeTypes == null)
            {
                throw new ArgumentNullException("dataChangeTypes");
            }

            var list = new Dictionary <string, DeltaRowCollection>(StringComparer.Create(CultureInfo.InvariantCulture, true));

            IVersionDataChangesInit vdci         = new VersionDataChangesClass();
            IWorkspaceName          wsNameSource = (IWorkspaceName)((IDataset)source).FullName;
            IWorkspaceName          wsNameTarget = (IWorkspaceName)((IDataset)target).FullName;

            vdci.Init(wsNameSource, wsNameTarget);

            IDataChanges     dataChanges = (IDataChanges)vdci;
            IDataChangesInfo dci         = (IDataChangesInfo)vdci;

            var tasks = new List <Action>();

            IEnumModifiedClassInfo enumMci = dataChanges.GetModifiedClassesInfo();

            foreach (var mci in enumMci.AsEnumerable())
            {
                // Validate that the table needs to be loaded.
                if (predicate(mci))
                {
                    string tableName = mci.ChildClassName;
                    tasks.Add(() =>
                    {
                        var rows    = new DeltaRowCollection(mci, source, target);
                        var actions = new List <Action>();

                        // Determines if the table represents a feature class.
                        bool isFeatureClass = mci.DatasetType == esriDatasetType.esriDTFeatureClass;

                        // Iterate through all of the data change types.
                        foreach (var dataChangeType in dataChangeTypes)
                        {
                            actions.Add(() =>
                            {
                                // IRow objects returned from a difference cursor are meant to be a read only. Thus, only the OIDs are being loaded and
                                // the rows are hydrated from the struct.
                                IFIDSet set = dci.ChangedIDs[tableName, dataChangeType];
                                set.Reset();

                                int oid;
                                set.Next(out oid);
                                while (oid != -1)
                                {
                                    var row = new DeltaRow(dataChangeType, oid, tableName, isFeatureClass);
                                    rows.Add(row);

                                    set.Next(out oid);
                                }
                            });
                        }

                        if (actions.Any())
                        {
                            Task.WaitAll(actions);
                        }

                        list.Add(tableName, rows);
                    });
                }
            }

            if (tasks.Any())
            {
                Task.WaitAll(tasks);
            }

            return(list);
        }