Beispiel #1
0
        /// <summary>
        /// Updates the Version in the AppDef.xml / Also Updates the ServerCore Extension Object's Assembly Path if needed.
        /// </summary>
        /// <param name="logger">Logger</param>
        /// <param name="appdef">Deserialized AppDef</param>
        /// <param name="appdefpath">Path to AppDef</param>
        public static void UpdateAppDef(Logger.Logger logger, application appdef, string appdefpath)
        {
            using (logger.CaptionBlock("Updating AppDef Version"))
            {
                IncrementVersion(appdef, logger);

                // IDisposable StreamWriter, for saving the AppDef.xml
                using (StreamWriter sw = new StreamWriter(appdefpath))
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(application));

                    serializer.Serialize(sw, appdef);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Updates the Version in the AppDef.xml / Also Updates the ServerCore Extension Object's Assembly Path if needed.
        /// </summary>
        /// <param name="logger">Logger</param>
        /// <param name="appdef">Deserialized AppDef</param>
        /// <param name="appdefpath">Path to AppDef</param>
        public static void UpdateAppDef(Logger.Logger logger, application appdef, string appdefpath)
        {
            using( logger.CaptionBlock("Updating AppDef Version") )
            {
                IncrementVersion(appdef, logger);

                // IDisposable StreamWriter, for saving the AppDef.xml
                using (StreamWriter sw = new StreamWriter(appdefpath))
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(application));

                    serializer.Serialize(sw, appdef);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Reset Version all Version Grouping Version to Zero.
        /// </summary>
        public static void ResetVersions( Logger.Logger logger, application appdef )
        {
            logger.NewLine();
            int groups = appdef.version.Split('.').Length;
            logger.Log( string.Format( "- Reseting All {0} Version Groups", groups ) );

            using( new Indentation( logger ) )
            {
                logger.NewLine();
                appdef.version = "0";
                for( var g = 0; g < groups - 1; g++ )
                    appdef.version += ".0";

                logger.Log("- Version = " + appdef.version);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Reset Version all Version Grouping Version to Zero.
        /// </summary>
        public static void ResetVersions(Logger.Logger logger, application appdef)
        {
            logger.NewLine();
            int groups = appdef.version.Split('.').Length;

            logger.Log(string.Format("- Reseting All {0} Version Groups", groups));

            using (new Indentation(logger))
            {
                logger.NewLine();
                appdef.version = "0";
                for (var g = 0; g < groups - 1; g++)
                {
                    appdef.version += ".0";
                }

                logger.Log("- Version = " + appdef.version);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Increments a Version Group.
        /// </summary>
        /// <param name="appdef">Deserialized appdef</param>
        /// <param name="logger"> Engine Object </param>
        /// <param name="groupIndex"> Specify Version Group to Increment... Defaults to the Last Group </param>
        public static void IncrementVersion( application appdef, Logger.Logger logger, int groupIndex = -1 )
        {
            logger.NewLine();
            logger.Log( "- Incrementing Version..." );

            string [] versionGroups = appdef.version.Split('.');

            using( new Indentation( logger ) )
            {
                if( groupIndex == -1 )
                    groupIndex = versionGroups.Length -1;

                logger.Log("- From: " + appdef.version);
                versionGroups[groupIndex] = (int.Parse(versionGroups[groupIndex]) + 1).ToString();

                appdef.version = string.Join(".", versionGroups);
                logger.Log("- To: " + appdef.version);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Console Application Entry Point
        /// </summary>
        /// <param name="args">Drag the Settings file onto the executable in order to use it as a parameter</param>
        private static void Main(string [] args)
        {
            // Initialize the logger.
            Logger = new Logger.Logger();

            // Create a Caption Block to print the settings
            using (Logger.CaptionBlock("Reading Settings"))
            {
                // populate the Settings object.
                Settings = new UXDevSettings(args, Logger);
            }

            // increment the appdef version.
            VersionHelper.UpdateAppDef(Logger, Settings.AppDef, Settings.AppDefPath);

            // Package the UX-App Directory.
            string packedApp = UXPack(Settings.DirectoryToZip, Settings.Outputname);

            // Install the application to the vault.
            InstallApp(packedApp, Settings);
        }
Beispiel #7
0
        /// <summary>
        /// Increments a Version Group.
        /// </summary>
        /// <param name="appdef">Deserialized appdef</param>
        /// <param name="logger"> Engine Object </param>
        /// <param name="groupIndex"> Specify Version Group to Increment... Defaults to the Last Group </param>
        public static void IncrementVersion(application appdef, Logger.Logger logger, int groupIndex = -1)
        {
            logger.NewLine();
            logger.Log("- Incrementing Version...");

            string [] versionGroups = appdef.version.Split('.');

            using (new Indentation(logger))
            {
                if (groupIndex == -1)
                {
                    groupIndex = versionGroups.Length - 1;
                }

                logger.Log("- From: " + appdef.version);
                versionGroups[groupIndex] = (int.Parse(versionGroups[groupIndex]) + 1).ToString();

                appdef.version = string.Join(".", versionGroups);
                logger.Log("- To: " + appdef.version);
            }
        }
Beispiel #8
0
        /// <summary>
        /// Self Populating Constructor
        /// </summary>
        /// <param name="args">args From the Program.cs</param>
        /// <param name="logger">Logger to Log things.</param>
        /// <param name="printComments">Should the comments from the settings.ini be printed?</param>
        public UXDevSettings(string[] args, Logger.Logger logger, bool printComments = false)
        {
            // read all the settings
            string[] settingsFile =
                File.ReadAllLines(args.Length != 0
                                        ? args[0]
                                  // ReSharper disable once AssignNullToNotNullAttribute
                                        : Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().FullName), "settings.ini"));

            // local dictionary
            Dictionary <string, string> settings = new Dictionary <string, string>();

            // print out the settings file
            foreach (string line in settingsFile)
            {
                if (!string.IsNullOrWhiteSpace(line))
                {
                    if (!line.StartsWith("#"))
                    {
                        string[] vals = line.Split('=');

                        logger.WriteLine(string.Format("\t- {0} => {1}", vals[0], vals[1]));
                        settings.Add(vals[0].ToLower(), vals[1]);
                    }
                    else
                    {
                        if (printComments)
                        {
                            logger.WriteLine(line);
                        }
                    }
                }
            }

            // create additional spacing
            logger.NewLine();

            // Populate properties from the settings.ini
            AuthType               = (MFAuthType)Enum.Parse(typeof(MFAuthType), settings.TryGetValueEx("AuthType"));
            AutoExitApp            = bool.Parse(settings.TryGetValueEx("AutoExitApp"));
            DirectoryToZip         = settings.TryGetValueEx("DirectoryToZip");
            Domain                 = settings.TryGetValueEx("Domain");
            GenerateAutoInstallReg = bool.Parse(settings.TryGetValueEx("GenerateAutoInstallReg"));
            KillExplorerWindows    = bool.Parse(settings.TryGetValueEx("KillExplorerWindows"));
            LocalComputerName      = settings.TryGetValueEx("LocalComputerName");
            LocalVaultPath         = settings.TryGetValueEx("LocalVaultPath");
            OpenVault              = bool.Parse(settings.TryGetValueEx("OpenVault"));
            Outputname             = settings.TryGetValueEx("Outputname");
            Password               = settings.TryGetValueEx("Password");
            Port             = settings.TryGetValueEx("Port");
            ProtocolSequence = settings.TryGetValueEx("ProtocolSequence");
            RestartVault     = bool.Parse(settings.TryGetValueEx("RestartVault"));
            ServerAddress    = settings.TryGetValueEx("ServerAddress");
            Username         = settings.TryGetValueEx("Username");
            VaultGuid        = settings.TryGetValueEx("VaultGuid");

            // Get the path to the appdef.xml
            AppDefPath = Directory.GetFiles(DirectoryToZip, "appdef.xml", SearchOption.AllDirectories).FirstOrDefault();
            // Deserialize the AppDef
            DeserializeAppDef(AppDefPath);
        }