예제 #1
0
        void DisplayParentBool(string label, List <PlatformBoolSetting> settings, FMODPlatform platform)
        {
            TriStateBool current = Settings.GetSetting(settings, platform, TriStateBool.Disabled);
            int          next    = EditorGUILayout.Popup(label, (int)current, ToggleParent);

            Settings.SetSetting(settings, platform, (TriStateBool)next);
        }
예제 #2
0
 public bool Compare(XmlReader sourceReader, XmlReader changedReader, XmlWriter diffgramWriter)
 {
     if (sourceReader == null)
     {
         throw new ArgumentNullException(nameof(sourceReader));
     }
     if (changedReader == null)
     {
         throw new ArgumentNullException(nameof(changedReader));
     }
     try
     {
         var xmlHash = new XmlHash(this);
         this._xmlDiffPerf.Clean();
         var tickCount = Environment.TickCount;
         this._sourceDoc = new XmlDiffDocument(this);
         this._sourceDoc.Load(sourceReader, xmlHash);
         this._targetDoc = new XmlDiffDocument(this);
         this._targetDoc.Load(changedReader, xmlHash);
         if (this._fragments == TriStateBool.DontKnown)
         {
             this._fragments = this._sourceDoc.IsFragment || this._targetDoc.IsFragment ? TriStateBool.Yes : TriStateBool.No;
         }
         this._xmlDiffPerf._loadTime = Environment.TickCount - tickCount;
         return(this.Diff(diffgramWriter));
     }
     finally
     {
         this._sourceDoc = null;
         this._targetDoc = null;
     }
 }
예제 #3
0
 public bool Compare(XmlNode sourceNode, XmlNode changedNode, XmlWriter diffgramWriter)
 {
     if (sourceNode == null)
     {
         throw new ArgumentNullException(nameof(sourceNode));
     }
     if (changedNode == null)
     {
         throw new ArgumentNullException(nameof(changedNode));
     }
     try
     {
         var xmlHash = new XmlHash(this);
         this._xmlDiffPerf.Clean();
         var tickCount = Environment.TickCount;
         this._sourceDoc = new XmlDiffDocument(this);
         this._sourceDoc.Load(sourceNode, xmlHash);
         this._targetDoc = new XmlDiffDocument(this);
         this._targetDoc.Load(changedNode, xmlHash);
         this._fragments             = sourceNode.NodeType != XmlNodeType.Document || changedNode.NodeType != XmlNodeType.Document ? TriStateBool.Yes : TriStateBool.No;
         this._xmlDiffPerf._loadTime = Environment.TickCount - tickCount;
         return(this.Diff(diffgramWriter));
     }
     finally
     {
         this._sourceDoc = null;
         this._targetDoc = null;
     }
 }
예제 #4
0
        void DisplayTriStateBool(string label, Platform platform, Platform.PropertyAccessor <TriStateBool> property)
        {
            TriStateBool current = property.Get(platform);

            if (platform.Parent != null)
            {
                bool         overriden = property.HasValue(platform);
                TriStateBool parent    = property.Get(platform.Parent);

                string[] toggleChild = new string[ToggleParent.Length + 1];
                Array.Copy(ToggleParent, 0, toggleChild, 1, ToggleParent.Length);
                toggleChild[0] = string.Format("Inherit ({0})", ToggleParent[(int)parent]);

                int next = EditorGUILayout.Popup(label, overriden ? (int)current + 1 : 0, toggleChild);

                if (next == 0)
                {
                    property.Clear(platform);
                }
                else
                {
                    property.Set(platform, (TriStateBool)(next - 1));
                }
            }
            else if (platform is PlatformPlayInEditor)
            {
                int next = EditorGUILayout.Popup(label, (current != TriStateBool.Disabled) ? 0 : 1, ToggleEditor);
                property.Set(platform, next == 0 ? TriStateBool.Enabled : TriStateBool.Disabled);
            }
            else
            {
                int next = EditorGUILayout.Popup(label, (int)current, ToggleParent);
                property.Set(platform, (TriStateBool)next);
            }
        }
예제 #5
0
		internal AccessControl()
		{
			Role = "*";
			ResourceType = "*";
			Folder = "/";

			FolderView = TriStateBool.Undefined;
			FolderCreate = TriStateBool.Undefined;
			FolderRename = TriStateBool.Undefined;
			FolderDelete = TriStateBool.Undefined;

			FileView = TriStateBool.Undefined;
			FileUpload = TriStateBool.Undefined;
			FileRename = TriStateBool.Undefined;
			FileDelete = TriStateBool.Undefined;
		}
        internal AccessControl()
        {
            Role         = "*";
            ResourceType = "*";
            Folder       = "/";

            FolderView   = TriStateBool.Undefined;
            FolderCreate = TriStateBool.Undefined;
            FolderRename = TriStateBool.Undefined;
            FolderDelete = TriStateBool.Undefined;

            FileView   = TriStateBool.Undefined;
            FileUpload = TriStateBool.Undefined;
            FileRename = TriStateBool.Undefined;
            FileDelete = TriStateBool.Undefined;
        }
예제 #7
0
        void DisplayChildBool(string label, List <PlatformBoolSetting> settings, FMODPlatform platform)
        {
            bool         overriden = Settings.HasSetting(settings, platform);
            TriStateBool parent    = Settings.GetSetting(settings, Settings.GetParent(platform), TriStateBool.Disabled);
            TriStateBool current   = Settings.GetSetting(settings, platform, TriStateBool.Disabled);

            string[] toggleChild = new string[ToggleParent.Length + 1];
            Array.Copy(ToggleParent, 0, toggleChild, 1, ToggleParent.Length);
            toggleChild[0] = string.Format("Inherit ({0})", ToggleParent[(int)parent]);

            int next = EditorGUILayout.Popup(label, overriden ? (int)current + 1: 0, toggleChild);

            if (next == 0)
            {
                if (overriden)
                {
                    Settings.RemoveSetting(settings, platform);
                }
            }
            else
            {
                Settings.SetSetting(settings, platform, (TriStateBool)(next - 1));
            }
        }
예제 #8
0
        public bool Compare(
            string sourceFile,
            string changedFile,
            bool bFragments,
            XmlWriter diffgramWriter)
        {
            if (sourceFile == null)
            {
                throw new ArgumentNullException(nameof(sourceFile));
            }
            if (changedFile == null)
            {
                throw new ArgumentNullException(nameof(changedFile));
            }
            var sourceReader  = (XmlReader)null;
            var changedReader = (XmlReader)null;

            try
            {
                this._fragments = bFragments ? TriStateBool.Yes : TriStateBool.No;
                if (bFragments)
                {
                    this.OpenFragments(sourceFile, changedFile, ref sourceReader, ref changedReader);
                }
                else
                {
                    this.OpenDocuments(sourceFile, changedFile, ref sourceReader, ref changedReader);
                }
                return(this.Compare(sourceReader, changedReader, diffgramWriter));
            }
            finally
            {
                sourceReader?.Close();
                changedReader?.Close();
            }
        }
예제 #9
0
 public static bool?AsNullableBool(this TriStateBool val)
 {
     return(val == TriStateBool.Unspecified ? null : val == TriStateBool.True ? (bool?)true : (bool?)false);
 }
예제 #10
0
    /// <include file='doc\XmlDiff.uex' path='docs/doc[@for="XmlDiff.Compare6"]/*' />
    /// <summary>
    ///    Compares two XML nodes.
    ///    If the diffgramWriter parameter is not null it will contain the list of changes 
    ///    between the two XML documents/fragments (diffgram).
    /// </summary>
    /// <param name="sourceNode">Original XML node</param>
    /// <param name="changedNode">Changed XML node</param>
    /// <param name="diffgramWriter">XmlWriter object for returning the list of changes (diffgram).</param>
    /// <returns>True, if the documents/fragments are identical.</returns>
    public bool Compare( XmlNode sourceNode, XmlNode changedNode, XmlWriter diffgramWriter )
    {
        if ( sourceNode == null )
            throw new ArgumentNullException( "sourceNode" );
        if ( changedNode == null )
            throw new ArgumentNullException( "changedNode" );

        try
        {
            XmlHash xmlHash = new XmlHash( this );

#if MEASURE_PERF
            _xmlDiffPerf.Clean();
            int startTickCount = Environment.TickCount;
#endif
            // load source document
            _sourceDoc = new XmlDiffDocument( this );
            _sourceDoc.Load( sourceNode, xmlHash );

#if DEBUG
            Trace.WriteLineIf( T_Phases.Enabled, "* Source document loaded: " + _sourceDoc.NodesCount + " nodes." );
#endif
        
            // load target document
            _targetDoc = new XmlDiffDocument( this );
            _targetDoc.Load( changedNode, xmlHash );

            _fragments = ( sourceNode.NodeType != XmlNodeType.Document || 
                           changedNode.NodeType != XmlNodeType.Document ) ? TriStateBool.Yes : TriStateBool.No;

#if DEBUG
            Trace.WriteLineIf( T_Phases.Enabled, "* Target document loaded: " + _targetDoc.NodesCount + " nodes." );
#endif
#if MEASURE_PERF
            _xmlDiffPerf._loadTime = Environment.TickCount - startTickCount;
#endif

            // compare
            return Diff( diffgramWriter );
        }
        finally
        {
            _sourceDoc = null;
            _targetDoc = null;
        }
    }
예제 #11
0
    /// <include file='doc\XmlDiff.uex' path='docs/doc[@for="XmlDiff.Compare2"]/*' />
    /// <summary>
    ///    Compares two XML documents or fragments. 
    ///    If the diffgramWriter parameter is not null it will contain the list of changes 
    ///    between the two XML documents/fragments (diffgram).
    /// </summary>
    /// <param name="sourceFile">The original xml document or fragment filename</param>
    /// <param name="changedFile">The changed xml document or fragment filename.</param>
    /// <param name="bFragments">If true, the passed files contain xml fragments; otherwise the files must contain xml documents.</param>
    /// <param name="diffgramWriter">XmlWriter object for returning the list of changes (diffgram).</param>
    /// <returns>True, if the documents/fragments are identical.</returns>
    public bool Compare( string sourceFile, string changedFile, bool bFragments, XmlWriter diffgramWriter ) 
    {
        if ( sourceFile == null )
            throw new ArgumentNullException( "sourceFile" );
        if ( changedFile == null )
            throw new ArgumentNullException( "changedFile" );

        XmlReader sourceReader = null;
        XmlReader targetReader = null;

        try
        {
            _fragments = bFragments ? TriStateBool.Yes : TriStateBool.No;

            if ( bFragments )
                OpenFragments( sourceFile, changedFile, ref sourceReader, ref targetReader );
            else
                OpenDocuments( sourceFile, changedFile, ref sourceReader, ref targetReader );

            return Compare( sourceReader, targetReader, diffgramWriter );
        }
        finally
        {
            if ( sourceReader != null ) {
                sourceReader.Close();
                sourceReader = null;
            }
            if ( targetReader != null ) {
                targetReader.Close();
                targetReader = null;
            }
        }
    }
예제 #12
0
        /// <summary>
        /// Generates Application manifest
        /// </summary>
        /// <param name="filesToIgnore">List of files to ignore</param>
        /// <param name="nameArgument">Product name</param>
        /// <param name="appName">Application name</param>
        /// <param name="version">Version</param>
        /// <param name="processor">Processor type</param>
        /// <param name="trustLevel">Trust level</param>
        /// <param name="fromDirectory">Directory from which to harvest files.</param>
        /// <param name="iconFile">Icon file</param>
        /// <param name="useApplicationManifestForTrustInfo">Specifies if Application manifest is used for trust info</param>
        /// <param name="publisherName">Publisher name</param>
        /// <param name="supportUrl">Support URL</param>
        /// <param name="targetFrameworkVersion">Target Framework version</param>
        /// <returns>ApplicationManifest object</returns>
        public static ApplicationManifest GenerateApplicationManifest(List <string> filesToIgnore, string nameArgument, string appName, Version version,
                                                                      Processors processor, Command.TrustLevels trustLevel, string fromDirectory,
                                                                      string iconFile, TriStateBool useApplicationManifestForTrustInfo, string publisherName, string supportUrl, string targetFrameworkVersion)
        {
            ApplicationManifest manifest = new ApplicationManifest();

            // Default to full trust for manifest generation
            if (trustLevel == Command.TrustLevels.None)
            {
                trustLevel = Command.TrustLevels.FullTrust;
            }

            // Use a default name for generated manifests
            if (appName == null)
            {
                appName = Application.Resources.GetString("DefaultAppName");
            }

            // Use a default version for generated manifests
            if (version == null)
            {
                version = defaultVersion;
            }

            // Use a default processor for generated manifests
            if (processor == Processors.Undefined)
            {
                processor = Processors.msil;
            }

            UpdateApplicationManifest(filesToIgnore, manifest, nameArgument, appName, version,
                                      processor, trustLevel, fromDirectory, iconFile, useApplicationManifestForTrustInfo,
                                      publisherName, supportUrl, targetFrameworkVersion);

            return(manifest);
        }
예제 #13
0
        /// <summary>
        /// Updates Deployment manifest
        /// </summary>
        /// <param name="manifest">DeploymentManifest object</param>
        /// <param name="deploymentManifestPath">Path of generated deployment manifest</param>
        /// <param name="appName">Application name</param>
        /// <param name="version">Version</param>
        /// <param name="processor">Processor type</param>
        /// <param name="applicationManifest">Application manifest from which to extract deployment details</param>
        /// <param name="applicationManifestPath">Path to application manifest</param>
        /// <param name="appCodeBase">Application codebase</param>
        /// <param name="appProviderUrl">Application provider URL</param>
        /// <param name="minVersion">Minimum version</param>
        /// <param name="install">Install state</param>
        /// <param name="includeDeploymentProviderUrl"></param>
        /// <param name="publisherName">Publisher name</param>
        /// <param name="supportUrl">Support URL</param>
        /// <param name="targetFrameworkVersion">Target Framework version</param>
        public static void UpdateDeploymentManifest(DeployManifest manifest, string deploymentManifestPath,
                                                    string appName, Version version, Processors processor,
                                                    ApplicationManifest applicationManifest, string applicationManifestPath,
                                                    string appCodeBase, string appProviderUrl, string minVersion,
                                                    TriStateBool install,
                                                    TriStateBool includeDeploymentProviderUrl,
                                                    string publisherName, string supportUrl, string targetFrameworkVersion)
        {
            if (install != TriStateBool.Undefined)
            {
                if (install == TriStateBool.False)
                {
                    manifest.Install = false;
                    manifest.DisallowUrlActivation = false;
                }
                else
                {
                    manifest.Install       = true;
                    manifest.UpdateEnabled = true;
                    manifest.UpdateMode    = UpdateMode.Background;

                    // We need to activate the set method on these fields since the XML
                    // representation might not be in sync with the propery value.
                    manifest.UpdateInterval = manifest.UpdateInterval;
                    manifest.UpdateUnit     = manifest.UpdateUnit;
                }
            }

            if (appName != null)
            {
                manifest.AssemblyIdentity.Name = appName;
                if (appName.EndsWith(".app") && appName.Length > 4)
                {
                    manifest.Product = appName.Substring(0, appName.Length - 4);
                }
                else
                {
                    manifest.Product = appName;
                }
            }

            if (!string.IsNullOrEmpty(publisherName))
            {
                manifest.Publisher = publisherName;
            }
            else
            {
                // Get the default publisher name
                manifest.Publisher = Utilities.Misc.GetRegisteredOrganization();
            }

            // Ensure Publisher is not empty (otherwise ClickOnce runtime will refuse to load the manifest)
            if (string.IsNullOrEmpty(manifest.Publisher))
            {
                manifest.Publisher = manifest.Product;
            }

            if (!string.IsNullOrEmpty(supportUrl))
            {
                manifest.SupportUrl = supportUrl;
            }

            if (version != null)
            {
                manifest.AssemblyIdentity.Version = version.ToString();
            }

            if (processor != Processors.Undefined)
            {
                manifest.AssemblyIdentity.ProcessorArchitecture = processor.ToString();
            }

            // Culture is not supported by command-line arguments, but it gets defaulted if not already present in the manifest
            if ((manifest.AssemblyIdentity.Culture == null) || (manifest.AssemblyIdentity.Culture.Length == 0))
            {
                manifest.AssemblyIdentity.Culture = defaultCulture;
            }
            if (includeDeploymentProviderUrl == TriStateBool.False)
            {
                manifest.DeploymentUrl = null;
            }
            else if (appProviderUrl != null)
            {
                manifest.DeploymentUrl = appProviderUrl;
            }

            if (minVersion != null)
            {
                if (minVersion != string.Empty)
                {
                    manifest.Install = true;
                    manifest.MinimumRequiredVersion = minVersion;
                }
                else
                {
                    manifest.MinimumRequiredVersion = null;
                }
            }

            if (applicationManifest != null)
            {
                SetApplicationManifestReference(manifest, deploymentManifestPath, applicationManifest, applicationManifestPath, targetFrameworkVersion);
            }

            if (appCodeBase != null)
            {
                SetApplicationCodeBase(manifest, appCodeBase);
            }
        }
예제 #14
0
        /// <summary>
        /// Updates Application manifest
        /// </summary>
        /// <param name="filesToIgnore">List of files to ignore</param>
        /// <param name="manifest">ApplicationManifest object</param>
        /// <param name="nameArgument">Product name</param>
        /// <param name="appName">Application name</param>
        /// <param name="version">Version</param>
        /// <param name="processor">Processor type</param>
        /// <param name="trustLevel">Trust level</param>
        /// <param name="fromDirectory">Directory from where to harvest the files.</param>
        /// <param name="iconFile">Icon file</param>
        /// <param name="useApplicationManifestForTrustInfo">Specifies if ApplicationManifest should be used for trust info</param>
        /// <param name="publisherName">Publisher name</param>
        /// <param name="supportUrl">Support URL</param>
        /// <param name="targetFrameworkVersion">Target Framework version</param>
        public static void UpdateApplicationManifest(List <string> filesToIgnore, ApplicationManifest manifest, string nameArgument, string appName, Version version, Processors processor, Command.TrustLevels trustLevel, string fromDirectory,
                                                     string iconFile, TriStateBool useApplicationManifestForTrustInfo, string publisherName, string supportUrl, string targetFrameworkVersion)
        {
            if (appName != null)
            {
                manifest.AssemblyIdentity.Name = appName;
            }
            else if (!string.IsNullOrEmpty(manifest.AssemblyIdentity.Name))
            {
                appName = manifest.AssemblyIdentity.Name;
            }

            if (version != null)
            {
                manifest.AssemblyIdentity.Version = version.ToString();
            }

            if (processor != Processors.Undefined)
            {
                manifest.AssemblyIdentity.ProcessorArchitecture = processor.ToString();
            }

            // Culture is not supported by command-line arguments, but it gets defaulted if not already present in the manifest
            if ((manifest.AssemblyIdentity.Culture == null) || (manifest.AssemblyIdentity.Culture.Length == 0))
            {
                manifest.AssemblyIdentity.Culture = defaultCulture;
            }

#if RUNTIME_TYPE_NETCORE
            // TrustInfo is always Full-trust on .NET (Core)
            if (manifest.TrustInfo == null)
            {
                // TrustInfo object is initialized as Full-trust for all apps running on .NET (Core)
                manifest.TrustInfo = new Microsoft.Build.Tasks.Deployment.ManifestUtilities.TrustInfo();
            }
#else
            if (trustLevel != Command.TrustLevels.None)
            {
                SetTrustLevel(manifest, trustLevel);
            }
#endif

            if (iconFile != null)
            {
                manifest.IconFile = iconFile;
            }

            if (useApplicationManifestForTrustInfo == TriStateBool.True)
            {
                manifest.UseApplicationTrust = true;
                if (!string.IsNullOrEmpty(nameArgument))
                {
                    manifest.Product = nameArgument;
                }
                else if (appName != null)
                {
                    if (appName.ToLower().EndsWith(".exe"))
                    {
                        // remove the trailing .exe extension
                        manifest.Product = appName.Substring(0, appName.Length - ".exe".Length);
                    }
                    else
                    {
                        manifest.Product = appName;
                    }
                }

                if (!string.IsNullOrEmpty(publisherName))
                {
                    manifest.Publisher = publisherName;
                }
                else
                {
                    // Get the default publisher name
                    manifest.Publisher = Utilities.Misc.GetRegisteredOrganization();
                }

                if (!string.IsNullOrEmpty(supportUrl))
                {
                    manifest.SupportUrl = supportUrl;
                }
            }

            if (fromDirectory != null)
            {
                Utilities.AppMan.AddReferences(manifest, false, fromDirectory, filesToIgnore, new AppMan.LockedFileReporter(LockedFileReporter), null, null, null, new ArrayList());

                // Update file sizes and hashes for the new references.
                // This uses Manifest methods rather than Utilities.AppMan.UpdateReferenceInfo
                // because in this case we want to report any missing files in the manifest.
                manifest.OutputMessages.Clear();
                manifest.ResolveFiles();
                manifest.UpdateFileInfo(targetFrameworkVersion);

                // Set entry point and config files
                Utilities.AppMan.SetSpecialFiles(manifest);
            }
            else
            {
                // -FromDirectory was not specified, but try to update
                // existing references if possible.

                Utilities.AppMan.UpdateReferenceInfo(manifest, "", null, null, targetFrameworkVersion);
            }
        }
예제 #15
0
        /// <summary>
        /// Generates Deployment manifest
        /// </summary>
        /// <param name="deploymentManifestPath">Path of generated deployment manifest</param>
        /// <param name="appName">Application name</param>
        /// <param name="version">Version</param>
        /// <param name="processor">Processor type</param>
        /// <param name="applicationManifest">Application manifest from which to extract deployment details</param>
        /// <param name="applicationManifestPath">Path to application manifest</param>
        /// <param name="appCodeBase">Application codebase</param>
        /// <param name="appProviderUrl">Application provider URL</param>
        /// <param name="minVersion">Minimum version</param>
        /// <param name="install">Install state</param>
        /// <param name="includeDeploymentProviderUrl"></param>
        /// <param name="publisherName">Publisher name</param>
        /// <param name="supportUrl">Support URL</param>
        /// <param name="targetFrameworkVersion">Target Framework version</param>
        /// <returns>DeploymentManifest object</returns>
        public static DeployManifest GenerateDeploymentManifest(string deploymentManifestPath,
                                                                string appName, Version version, Processors processor,
                                                                ApplicationManifest applicationManifest, string applicationManifestPath, string appCodeBase,
                                                                string appProviderUrl, string minVersion, TriStateBool install, TriStateBool includeDeploymentProviderUrl,
                                                                string publisherName, string supportUrl, string targetFrameworkVersion)
        {
            /*
             * Mage running on Core cannot obtain .NET FX version for targeting.
             * Set default minimum version to v4.5, that Launcher targets,
             * which is a good default for .NET FX Mage as well.
             *
             * As always, version can be modified in deployment manifest, if needed.
             */
            Version shortVersion        = new Version(4, 5);
            string  frameworkIdentifier = ".NETFramework";

            DeployManifest manifest = new DeployManifest((new FrameworkName(frameworkIdentifier, shortVersion)).FullName);

            // Set default manifest publish options
            if (install == TriStateBool.True)
            {
                manifest.Install       = true;
                manifest.UpdateEnabled = true;
                manifest.UpdateMode    = UpdateMode.Background;
            }
            else
            {
                manifest.Install = false;
            }

            // Use default application name if none was specified
            if (appName == null)
            {
                appName = Application.Resources.GetString("DefaultAppName");
            }

            // Use default version if none was specified
            if (version == null)
            {
                version = defaultVersion;
            }

            // Use default processor if none was specified
            if (processor == Processors.Undefined)
            {
                processor = Processors.msil;
            }

            // Use default provider URL if none was specified
            if (appProviderUrl == null)
            {
                appProviderUrl = "";
            }

            UpdateDeploymentManifest(manifest, deploymentManifestPath, appName, version, processor,
                                     applicationManifest, applicationManifestPath, appCodeBase,
                                     appProviderUrl, minVersion, install, includeDeploymentProviderUrl, publisherName, supportUrl, targetFrameworkVersion);

            return(manifest);
        }