예제 #1
0
        public ApplicationHost(
            IServerApplicationPaths applicationPaths,
            ILoggerFactory loggerFactory,
            IStartupOptions options,
            IConfiguration startupConfig,
            IFileSystem fileSystem,
            IServiceCollection serviceCollection)
        {
            ApplicationPaths   = applicationPaths;
            LoggerFactory      = loggerFactory;
            _startupOptions    = options;
            _startupConfig     = startupConfig;
            _fileSystemManager = fileSystem;
            ServiceCollection  = serviceCollection;

            Logger = LoggerFactory.CreateLogger <ApplicationHost>();
            fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));

            ApplicationVersion       = typeof(ApplicationHost).Assembly.GetName().Version;
            ApplicationVersionString = ApplicationVersion.ToString(3);
            ApplicationUserAgent     = Name.Replace(' ', '-') + "/" + ApplicationVersionString;

            _xmlSerializer       = new MyXmlSerializer();
            ConfigurationManager = new ServerConfigurationManager(ApplicationPaths, LoggerFactory, _xmlSerializer, _fileSystemManager);
            _pluginManager       = new PluginManager(
                LoggerFactory.CreateLogger <PluginManager>(),
                this,
                ConfigurationManager.Configuration,
                ApplicationPaths.PluginsPath,
                ApplicationVersion);
        }
        public async Task <bool> DeletePackage(ApplicationVersion version)
        {
            var fileName = BuildPackageFilename(version);
            var response = await client.Delete(fileName);

            return(response.IsSuccessful);
        }
        private string BuildPackageFilename(ApplicationVersion version)
        {
            // Build channel/build definition of filename
            string def = string.Empty;

            switch (version.Channel)
            {
            case Channels.Alpha:
                def = PKG_FILENAME_ALPHADEFINITION + version.Build;
                break;

            case Channels.Stable:
                if (version.Build != 1)
                {
                    def = PKG_FILENAME_RELEASEDEFINITION + version.Build;
                }
                break;

            case Channels.PreRelease:
                def = PKG_FILENAME_RCDEFINITION + version.Build;
                break;

            case Channels.Beta:
                def = PKG_FILENAME_BETADEFINITION + version.Build;
                break;
            }

            // Build filename
            var fileName = string.Format(PKG_FILENAME_TEMPLATE, version.Version, def);

            return(fileName);
        }
        public void Constructor()
        {
            ApplicationVersion applicationVersion;

            applicationVersion = new ApplicationVersion(GetUserContext());
            Assert.IsNotNull(applicationVersion);
        }
        public ApplicationVersion Import(string applicatonTypeName, string versionName, string versionNumber, List <string> headers, List <string> rows, string importedBy)
        {
            var applicationSectionManager = this.container.GetInstance <ApplicationSectionManager>();
            var applicationTypeManager    = this.container.GetInstance <ApplicationTypeManager>();
            var scopeTypeManager          = this.container.GetInstance <ScopeTypeManager>();
            var versionManager            = this.container.GetInstance <ApplicationVersionManager>();

            var applicationType = applicationTypeManager.GetByName(applicatonTypeName);
            var scopeTypes      = scopeTypeManager.GetAllActive();

            var version = new ApplicationVersion
            {
                Id = Guid.NewGuid(),
                ApplicationTypeId = applicationType.Id,
                Title             = versionName,
                IsActive          = false,
                VersionNumber     = versionNumber,
                CreatedDate       = DateTime.Now,
                CreatedBy         = importedBy
            };

            version = applicationSectionManager.Import(scopeTypes, version, applicationType, headers, rows, importedBy);

            versionManager.Add(version);

            return(version);
        }
        public async Task <IActionResult> PutApplicationVersion([FromRoute] int id, [FromBody] ApplicationVersion applicationVersion)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != applicationVersion.Id)
            {
                return(BadRequest());
            }

            applicationVersion.UpdatedAt             = DateTimeOffset.Now;
            _context.Entry(applicationVersion).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ApplicationVersionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Ok(_context.ApplicationVersions.Find(id)));
        }
예제 #7
0
        private List <ApplicationVersion> ParseFromUpdateTextFile(StreamReader stream)
        {
            var    versions    = new List <ApplicationVersion>();
            string downloadUrl = "";

            while (!stream.EndOfStream)
            {
                string line = stream.ReadLine();
                if (line != null && _downloadUrlRegex.IsMatch(line))
                {
                    var matches = _downloadUrlRegex.Match(line).Groups;
                    if (matches.Count > 0)
                    {
                        downloadUrl = matches[matches.Count - 1].Value;
                    }
                }
                else if (line != null && _versionRegex.IsMatch(line))
                {
                    var matches = _versionRegex.Match(line).Groups;
                    if (matches.Count > 0)
                    {
                        versions.Add(ApplicationVersion.Parse(matches[matches.Count - 1].Value, downloadUrl));
                    }
                }
            }

            return(versions);
        }
예제 #8
0
        public static bool TryParse(string versionAsString, out ApplicationVersion version)
        {
            version = default;

            var array = versionAsString.Split('.');

            if (array.Length != 3 && array.Length != 4)
            {
                return(false);
            }

            var applicationVersionType = ApplicationVersion.ApplicationVersionTypeFromString(array[0][0].ToString());

            if (!int.TryParse(array[0].Substring(1), out var major))
            {
                return(false);
            }
            if (!int.TryParse(array[1], out var minor))
            {
                return(false);
            }
            if (!int.TryParse(array[2], out var revision))
            {
                return(false);
            }

            version = Create(applicationVersionType, major, minor, revision);
            return(true);
        }
예제 #9
0
        public bool IsNew(string incomingVersion)
        {
            var currentVersion = new Version(ApplicationVersion.GetCurrentVersion());
            var newVersion     = new Version(incomingVersion);

            return(newVersion > currentVersion);
        }
예제 #10
0
        /// <summary>
        /// Checks for update.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <param name="progress">The progress.</param>
        /// <returns>Task{CheckForUpdateResult}.</returns>
        public override async Task <CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress <double> progress)
        {
            var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);

            var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, _remotePackageName, null, ApplicationVersion, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);

            var versionObject = version == null || string.IsNullOrWhiteSpace(version.versionStr) ? null : new Version(version.versionStr);

            var isUpdateAvailable = versionObject != null && versionObject > ApplicationVersion;

            var result = versionObject != null ?
                         new CheckForUpdateResult {
                AvailableVersion = versionObject.ToString(), IsUpdateAvailable = isUpdateAvailable, Package = version
            } :
            new CheckForUpdateResult {
                AvailableVersion = ApplicationVersion.ToString(), IsUpdateAvailable = false
            };

            HasUpdateAvailable = result.IsUpdateAvailable;

            if (result.IsUpdateAvailable)
            {
                Logger.Info("New application version is available: {0}", result.AvailableVersion);
            }

            return(result);
        }
예제 #11
0
 /// <summary>
 /// Gets the system status.
 /// </summary>
 /// <returns>SystemInfo.</returns>
 public virtual SystemInfo GetSystemInfo()
 {
     return(new SystemInfo
     {
         HasPendingRestart = HasPendingRestart,
         Version = ApplicationVersion.ToString(),
         IsNetworkDeployed = CanSelfUpdate,
         WebSocketPortNumber = HttpServerPort,
         SupportsNativeWebSocket = true,
         FailedPluginAssemblies = FailedAssemblies.ToList(),
         InProgressInstallations = InstallationManager.CurrentInstallations.Select(i => i.Item1).ToList(),
         CompletedInstallations = InstallationManager.CompletedInstallations.ToList(),
         Id = SystemId,
         ProgramDataPath = ApplicationPaths.ProgramDataPath,
         LogPath = ApplicationPaths.LogDirectoryPath,
         ItemsByNamePath = ApplicationPaths.ItemsByNamePath,
         InternalMetadataPath = ApplicationPaths.InternalMetadataPath,
         CachePath = ApplicationPaths.CachePath,
         MacAddress = GetMacAddress(),
         HttpServerPortNumber = HttpServerPort,
         OperatingSystem = Environment.OSVersion.ToString(),
         CanSelfRestart = CanSelfRestart,
         CanSelfUpdate = CanSelfUpdate,
         WanAddress = ConnectManager.WanApiAddress,
         HasUpdateAvailable = HasUpdateAvailable,
         SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
         TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
         IsRunningAsService = IsRunningAsService,
         SupportsRunningAsService = SupportsRunningAsService,
         ServerName = FriendlyName,
         LocalAddress = GetLocalIpAddress()
     });
 }
예제 #12
0
 public static bool IsSameOverride(this ApplicationVersion @this, ApplicationVersion other)
 {
     return(@this.ApplicationVersionType == other.ApplicationVersionType &&
            @this.Major == other.Major &&
            @this.Minor == other.Minor &&
            @this.Revision == other.Revision);
 }
        public void Ctor_String_String_String_DateTime_IEnumerable_IEnumerable_String()
        {
            string versionId = "1.1.0.1";

            string shortDescription = "ShortDescription";
            string longDescription = "LongDescription";

            DateTime date = DateTime.Now;

            var notes = new Collection<VersionNote>
            {
                new VersionNote("Test", "Hi")
            };

            var urls = new Collection<VersionUrl>
            {
                new VersionUrl("Google", "http://google.com")
            };

            string copyright = "(C) Hugh Bellamy 2015";

            var version = new ApplicationVersion(versionId,  shortDescription, longDescription, date, notes, urls, copyright);
            Assert.Equal(versionId, version.Id);

            Assert.Equal(shortDescription, version.ShortDescription);
            Assert.Equal(longDescription, version.LongDescription);

            Assert.Equal(date, version.Date);

            Assert.Equal(notes, version.Notes);
            Assert.Equal(urls, version.Urls);

            Assert.Equal(copyright, version.Copyright);
        }
예제 #14
0
        public bool IsEqual(string version)
        {
            var currentVersion = new Version(ApplicationVersion.GetCurrentVersion());
            var versionToCheck = new Version(version);

            return(versionToCheck == currentVersion);
        }
예제 #15
0
        public async void OnNext(EventPattern <WhenClipboardContainsTextEventArgs> value)
        {
            await Task.Run(async() =>
            {
                var currentString = value.EventArgs.CurrentString;

                if (previousString == currentString)
                {
                    return;
                }

                previousString = currentString;

                var fromLanguageExtension = await languageDetector.DetectLanguage(currentString);

                var results = await cache.GetAsync(currentString,
                                                   async() => await Task.WhenAll(meanFinderFactory.GetFinders().Select(t => t.Find(new TranslateRequest(currentString, fromLanguageExtension)))))
                              .ConfigureAwait(false);

                var findedMeans = await resultOrganizer.OrganizeResult(results, currentString).ConfigureAwait(false);

                await notifier.AddNotificationAsync(currentString, ImageUrls.NotificationUrl, findedMeans.DefaultIfEmpty(string.Empty).First()).ConfigureAwait(false);

                await googleAnalytics.TrackEventAsync("DynamicTranslator", "Translate", currentString, null).ConfigureAwait(false);

                await googleAnalytics.TrackAppScreenAsync("DynamicTranslator",
                                                          ApplicationVersion.GetCurrentVersion(),
                                                          "dynamictranslator",
                                                          "dynamictranslator",
                                                          "notification").ConfigureAwait(false);
            });
        }
예제 #16
0
 internal DefaultHtm(string fullFileNamePath, string appTitle, Tables selectedTables, Language language, bool isOrganizeGeneratedWebForms, OrganizeWebForm organizeWebForm, IsCheckedWebForm isCheckedWebForm, DatabaseObjectToGenerateFrom generateFrom, DataTable referencedTables, ApplicationVersion appVersion, ApplicationType appType, bool isUseFriendlyUrls = false)
 {
     this._fullFileNamePath            = fullFileNamePath;
     this._appTitle                    = appTitle;
     this._selectedTables              = selectedTables;
     this._referencedTables            = referencedTables;
     this._language                    = language;
     this._isOrganizeGeneratedWebForms = isOrganizeGeneratedWebForms;
     this._organizeWebForm             = organizeWebForm;
     this._isCheckedWebForm            = isCheckedWebForm;
     this._generateFrom                = generateFrom;
     this._referencingTable            = (Table)null;
     this._appVersion                  = appVersion;
     this._appType           = appType;
     this._isUseFriendlyUrls = isUseFriendlyUrls;
     if (this._appType == ApplicationType.ASPNET45)
     {
         this._categoryTitleBackgroundColor = "#6D00D9";
         this._alternateBackgroundColor     = "#F2E6FF";
     }
     else
     {
         this._categoryTitleBackgroundColor = "#507CD1";
         this._alternateBackgroundColor     = "#F5F5F5";
     }
     this.Generate();
 }
예제 #17
0
        private int NewDownload(ApplicationVersion version)
        {
            var userIP            = HttpContext.Current.Request.UserHostAddress;
            var thisUserDownloads = context.Downloads
                                    .Where(download => download.IP == userIP);

            var newDownload = new Download
            {
                IP = userIP,
                ApplicationVersionId = version.Id,
                DateTime             = DateTime.UtcNow,
            };

            context.Downloads.Add(newDownload);

            if (thisUserDownloads.Count() == 0)
            {
                version.NewUsersDownloadsCount++;
            }

            version.DownloadsCount++;
            context.SaveChanges();

            return(version.DownloadsCount);
        }
예제 #18
0
        private string generatePkNormal(ApplicationVersion appV, Client client)
        {
            StringBuilder str = new StringBuilder();

            str.Append("LV");
            str.Append(client.Code);
            str.Append(RandomLetterUpper());
            str.Append(appV.Application.Code);
            str.Append(RandomLetterUpper());
            str.Append(VersionToInt(appV.GetVersion()).ToString("000000"));
            str.Append(RandomLetterUpper());
            str.Append(DateTime.UtcNow.ToDateTimeCE().ToString("yMMdd"));
            str.Append(RandomLetterUpper());
            var r = RandomNumber(1, 99);

            foreach (var c in TTLL.Models.ProductKey.CryptoWord)
            {
                var indx    = Array.IndexOf(TTLL.Models.ProductKey.RandomCryptoSequence, c);
                var newIndx = (indx + r) % TTLL.Models.ProductKey.RandomCryptoSequence.Length;
                if (newIndx < TTLL.Models.ProductKey.RandomCryptoSequence.Length)
                {
                    str.Append(TTLL.Models.ProductKey.RandomCryptoSequence[newIndx]);
                }
                else
                {
                    throw new Exception("error pk");
                }
            }
            str.Append(r.ToString("00"));
            return(str.ToString());
        }
        public async Task <ApplicationSectionQuestion> AddAsync(ApplicationVersion version, QuestionType questionType, Question item, string createdBy)
        {
            LogMessage("AddAsync (ApplicationSectionQuestionManager)");

            var row = new ApplicationSectionQuestion
            {
                Id = Guid.NewGuid(),
                ApplicationSectionId = item.SectionId.GetValueOrDefault(),
                Text             = item.Text,
                IsActive         = true,
                Order            = item.Order,
                ComplianceNumber = item.ComplianceNumber,
                Description      = item.Description,
                QuestionTypeId   = questionType.Id,
                CreatedDate      = DateTime.Now,
                CreatedBy        = createdBy,
                ScopeTypes       = item.ScopeTypes.Select(x => new ApplicationSectionQuestionScopeType
                {
                    Id          = Guid.NewGuid(),
                    ScopeTypeId = x.ScopeTypeId,
                    CreatedDate = DateTime.Now,
                    CreatedBy   = createdBy
                })
                                   .ToList()
            };

            if (item.QuestionTypeFlags != null)
            {
                row.QuestionTypesFlag = item.QuestionTypeFlags.AllTypes;
            }

            await base.Repository.AddAsync(row);

            return(row);
        }
예제 #20
0
        public async Task <string> GenerateProdutKey(PKType type, ApplicationVersion appV, Client client, TimeSpan?time = null)
        {
            try
            {
                var prods = await _db.ProductKeys.Select(p => p.Key).ToListAsync();

                while (true)
                {
                    var pk = "";
                    if (type == PKType.Normal)
                    {
                        pk = generatePkNormal(appV, client);
                    }
                    else if (type == PKType.Time)
                    {
                        pk = generatePkTime(appV, client, (TimeSpan)time);
                    }
                    else if (type == PKType.Trial)
                    {
                        pk = generatePkTrial(appV, client, (TimeSpan)time);
                    }
                    if (!prods.Contains(pk))
                    {
                        return(pk);
                    }
                }
            }
            catch (Exception ex) { Console.WriteLine(ex.Message); return(null); }
        }
예제 #21
0
        public static LoadGameResult LoadSaveGameData(
            string saveName,
            string[] loadedModuleNames)
        {
            List <ModuleInfo> modules = MBSaveLoad.GetModules(loadedModuleNames);

            MBSaveLoad.InitializeAutoSaveIndex(saveName);
            string      fileName = saveName + ".sav";
            ISaveDriver driver   = MBSaveLoad._saveDriver;

            driver.SetFileName(fileName);
            ApplicationVersion applicationVersion = driver.LoadMetaData().GetApplicationVersion();

            if (applicationVersion.Major <= 1 && applicationVersion.Minor <= 4 && applicationVersion.Revision < 2)
            {
                driver = (ISaveDriver) new OldFileDriver();
                driver.SetFileName(fileName);
            }
            LoadResult loadResult = SaveManager.Load(driver, true);

            if (loadResult.Successful)
            {
                MBSaveLoad.ActiveSaveSlotName = !MBSaveLoad.IsSaveFileNameReserved(saveName) ? saveName : (string)null;
                return(new LoadGameResult(loadResult, MBSaveLoad.CheckModules(loadResult.MetaData, modules)));
            }
            Debug.Print("Error: Could not load the game!");
            return((LoadGameResult)null);
        }
 public override void SyncData(IDataStore dataStore)
 {
     if (dataStore.IsLoading)
     {
         this.order_map    = new Dictionary <Hero, PartyOrder>();
         this.template_map = new Dictionary <Hero, TroopRoster>();
         ApplicationVersion?nullable = new ApplicationVersion?(Traverse.Create(typeof(TaleWorlds.Core.MetaDataExtensions)).Method("GetModuleVersion", new System.Type[2]
         {
             typeof(MetaData),
             typeof(string)
         }, (object[])null).GetValue <ApplicationVersion>((object)CheckModulesPatch.meta_data, (object)"Party AI Overhaul and Commands"));
         CheckModulesPatch.meta_data  = (MetaData)null;
         this.savegame_module_version = nullable.GetValueOrDefault();
         if (this.savegame_module_version.Major == 1)
         {
             Dictionary <MobileParty, PartyOrder> data = new Dictionary <MobileParty, PartyOrder>();
             dataStore.SyncData <Dictionary <MobileParty, PartyOrder> >("order_list", ref data);
             dataStore.SyncData <Dictionary <Hero, PartyOrder> >("order_map", ref this.order_map);
             if (data.Count > 0 && this.order_map.Count == 0)
             {
                 foreach (KeyValuePair <MobileParty, PartyOrder> keyValuePair in data)
                 {
                     if (keyValuePair.Key?.LeaderHero != null && keyValuePair.Value != null)
                     {
                         this.order_map[keyValuePair.Key.LeaderHero] = keyValuePair.Value;
                     }
                 }
             }
         }
         else if (this.savegame_module_version.Major > 1)
         {
             dataStore.SyncData <Dictionary <Hero, PartyOrder> >("order_map", ref this.order_map);
             dataStore.SyncData <Dictionary <Hero, TroopRoster> >("template_map", ref this.template_map);
         }
         else
         {
             dataStore.SyncData <Dictionary <Hero, PartyOrder> >("order_map", ref this.order_map);
             dataStore.SyncData <Dictionary <Hero, TroopRoster> >("template_map", ref this.template_map);
             int num = (int)MessageBox.Show(string.Format("{0} TEST Party AI Overhaul and Commands: It seems you are loading a savegame where you temporarily disabled this mod. This is not recommended and may lead to unexpected issues. It is recommended to revert to a savegame where you hadn't yet disabled this mod. Continue at your own risk.", (object)this.savegame_module_version));
         }
         if (!CheckModulesPatch.missing_modules)
         {
             return;
         }
         foreach (KeyValuePair <Hero, TroopRoster> template in this.template_map)
         {
             template.Value.RemoveIf((Predicate <TroopRosterElement>)(troop => !troop.Character.IsInitialized));
         }
     }
     else
     {
         if (this.savegame_module_version.Major == 1)
         {
             Dictionary <MobileParty, PartyOrder> data = new Dictionary <MobileParty, PartyOrder>();
             dataStore.SyncData <Dictionary <MobileParty, PartyOrder> >("order_list", ref data);
         }
         dataStore.SyncData <Dictionary <Hero, PartyOrder> >("order_map", ref this.order_map);
         dataStore.SyncData <Dictionary <Hero, TroopRoster> >("template_map", ref this.template_map);
     }
 }
 internal BusinessAndDataObjectsView(Tables selectedTables, string directory, Language language, string webAppName, DatabaseObjectToGenerateFrom generateFrom, ApplicationVersion appVersion, bool isUseStoredProcedure, IsCheckedView isCheckedView, ViewNames viewNames, bool isUseWebApi, bool isFormsGenProduct, int spPrefixSuffixIndex, string storedProcPrefix, string storedProcSuffix, string apiName)
 {
     this._selectedTables               = selectedTables;
     this._directory                    = directory + MyConstants.DirectoryRazorPage + "Home\\";
     this._language                     = language;
     this._webAppName                   = webAppName.Trim();
     this._isUseStoredProcedure         = isUseStoredProcedure;
     this._spPrefixSuffixIndex          = spPrefixSuffixIndex;
     this._storedProcPrefix             = storedProcPrefix;
     this._storedProcSuffix             = storedProcSuffix;
     this._generateFrom                 = generateFrom;
     this._appVersion                   = appVersion;
     this._isCheckedView                = isCheckedView;
     this._viewNames                    = viewNames;
     this._isUseWebApi                  = isUseWebApi;
     this._isFormsGenProduct            = isFormsGenProduct;
     this._categoryTitleBackgroundColor = "#507CD1";
     this._alternateBackgroundColor     = "#F5F5F5";
     this._apiName = apiName;
     if (language == Language.VB)
     {
         this._fileExtension = ".vb";
     }
     this.Generate();
 }
예제 #24
0
 /// <summary>
 /// Gets the system status.
 /// </summary>
 /// <returns>SystemInfo.</returns>
 public virtual SystemInfo GetSystemInfo()
 {
     return(new SystemInfo
     {
         HasPendingRestart = HasPendingRestart,
         Version = ApplicationVersion.ToString(),
         IsNetworkDeployed = CanSelfUpdate,
         WebSocketPortNumber = ServerManager.WebSocketPortNumber,
         SupportsNativeWebSocket = ServerManager.SupportsNativeWebSocket,
         FailedPluginAssemblies = FailedAssemblies.ToList(),
         InProgressInstallations = InstallationManager.CurrentInstallations.Select(i => i.Item1).ToList(),
         CompletedInstallations = InstallationManager.CompletedInstallations.ToList(),
         Id = _systemId,
         ProgramDataPath = ApplicationPaths.ProgramDataPath,
         LogPath = ApplicationPaths.LogDirectoryPath,
         ItemsByNamePath = ApplicationPaths.ItemsByNamePath,
         CachePath = ApplicationPaths.CachePath,
         MacAddress = GetMacAddress(),
         HttpServerPortNumber = ServerConfigurationManager.Configuration.HttpServerPortNumber,
         OperatingSystem = Environment.OSVersion.ToString(),
         CanSelfRestart = CanSelfRestart,
         CanSelfUpdate = CanSelfUpdate,
         WanAddress = GetWanAddress(),
         HasUpdateAvailable = _hasUpdateAvailable,
         SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
         TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
         IsRunningAsService = IsRunningAsService,
         ServerName = string.IsNullOrWhiteSpace(ServerConfigurationManager.Configuration.ServerName) ? Environment.MachineName : ServerConfigurationManager.Configuration.ServerName
     });
 }
예제 #25
0
        /// <summary>
        /// Runs the migration routines if necessary.
        /// </summary>
        public void TryMigrate()
        {
            var previousVersion = ConfigurationManager.CommonConfiguration.PreviousVersion;

            switch (ApplicationVersion.CompareTo(previousVersion))
            {
            case 1:
                Logger.LogWarning("Version check shows Jellyfin was updated: previous version={0}, current version={1}", previousVersion, ApplicationVersion);

                Migrations.Run(this, Logger);

                ConfigurationManager.CommonConfiguration.PreviousVersion = ApplicationVersion;
                ConfigurationManager.SaveConfiguration();
                break;

            case 0:
                // nothing to do, versions match
                break;

            case -1:
                Logger.LogWarning("Version check shows Jellyfin was rolled back, use at your own risk: previous version={0}, current version={1}", previousVersion, ApplicationVersion);
                // no "rollback" routines for now
                ConfigurationManager.CommonConfiguration.PreviousVersion = ApplicationVersion;
                ConfigurationManager.SaveConfiguration();
                break;
            }
        }
예제 #26
0
        public static Years GetYear(this ApplicationVersion version)
        {
            int RuntimeVersion = version.RuntimeMajor;

            if (RuntimeVersion == 13)
            {
                return(Years.Y2016);
            }
            else if (RuntimeVersion == 14)
            {
                return(Years.Y2017);
            }
            else if (RuntimeVersion == 15)
            {
                return(Years.Y2018);
            }
            else if (RuntimeVersion == 16)
            {
                return(Years.Y2019);
            }
            else
            {
                return(Years.None);
            }
        }
예제 #27
0
 public ReplicationReadEnvelope(ReplicationRead payload, string logName, string targetApplicationName, ApplicationVersion targetApplicationVersion)
 {
     Payload = payload;
     LogName = logName;
     TargetApplicationName    = targetApplicationName;
     TargetApplicationVersion = targetApplicationVersion;
 }
예제 #28
0
 internal GeneratedCodeHtm(string fullFileNamePath, string appTitle, Tables selectedTables, DataTable referencedTables, Language language, string path, bool isUseStoredProcedure, int spPrefixSuffixIndex, string storedProcPrefix, string storedProcSuffix, DatabaseObjectToGenerateFrom generateFrom, ApplicationVersion appVersion, bool isFormsGenProduct = true, ApplicationType appType = ApplicationType.ASPNET)
 {
     this._fullFileNamePath     = fullFileNamePath;
     this._appTitle             = appTitle;
     this._selectedTables       = selectedTables;
     this._referencedTables     = referencedTables;
     this._directory            = path;
     this._language             = language;
     this._fileExtension        = this._language != Language.CSharp ? ".vb" : ".cs";
     this._isUseStoredProcedure = isUseStoredProcedure;
     this._spPrefixSuffixIndex  = spPrefixSuffixIndex;
     this._storedProcPrefix     = storedProcPrefix;
     this._storedProcSuffix     = storedProcSuffix;
     this._generateFrom         = generateFrom;
     this._appVersion           = appVersion;
     this._isFormsGenProduct    = isFormsGenProduct;
     this._appType = appType;
     if (this._appType == ApplicationType.ASPNET45)
     {
         this._categoryTitleBackgroundColor = "#6D00D9";
         this._alternateBackgroundColor     = "#F2E6FF";
     }
     else
     {
         this._categoryTitleBackgroundColor = "#507CD1";
         this._alternateBackgroundColor     = "#F5F5F5";
     }
     this.Generate();
 }
예제 #29
0
        public IApplicationVersion RegisterApplicationVersionUsage(IFingerprint applicationVersionFingerprint, Guid applicationId, string version, string supportToolkitNameVersion, DateTime?buildTime, string environment)
        {
            Version tmp;

            if (string.IsNullOrEmpty(version))
            {
                throw new ArgumentException("No version provided for application.");
            }
            if (!Version.TryParse(version, out tmp))
            {
                throw new ArgumentException("Invalid version format.");
            }

            var applicationVersion = RegisterExistingApplicationVersionUsage((Fingerprint)applicationVersionFingerprint, applicationId, environment);

            if (applicationVersion != null)
            {
                return(applicationVersion);
            }

            applicationVersion = new ApplicationVersion((Fingerprint)applicationVersionFingerprint, applicationId, version, new List <IIssueType>(), null, false, false, supportToolkitNameVersion, buildTime, new List <string>()
            {
                environment
            });

            AddApplicationVersion(applicationVersion);

            //TODO:
            //_counterBusiness.UpdateApplicationVersionCounters();

            return(applicationVersion);
        }
        public void Ctor(string versionId, string versionsLocation)
        {
            var currentVersion = new ApplicationVersion(versionId);
            var versionChecker = new ApplicationVersionChecker(versionsLocation, currentVersion);

            Assert.Equal(versionsLocation, versionChecker.VersionsLocation);
            Assert.Equal(currentVersion, versionChecker.CurrentVersion);
        }
예제 #31
0
 GraphicData IOmegaService.GetGraphicData(ApplicationVersion applicationVersion, GraphicType type)
 {
     return(RunSecurity(applicationVersion, user =>
     {
         CheckRightChangeBalance(user);
         return _repository.GetGraphicData(type);
     }));
 }
예제 #32
0
 AccountBillModel IAccountService.CreateAccountBill(ApplicationVersion applicationVersion, String accountNumber, DateTime dateAccountBill, IEnumerable <AccountBillLineRowModel> accountBillLines)
 {
     if (dateAccountBill == null)
     {
         throw new ArgumentNullException("Дата с/фактуры не была получена\r\nНе могу создать счет/фактуру");
     }
     return(RunSecurity(applicationVersion, (user) => _RepositoryAccount.CreateAccountBill(accountNumber, user, dateAccountBill, accountBillLines)));
 }
        public ApplicationVersionChecker(string versionsLocation, ApplicationVersion currentVersion)
        {
            if (versionsLocation == null) { throw new ArgumentNullException(nameof(versionsLocation)); }
            if (versionsLocation.Length == 0) { throw new ArgumentException("The version location is empty", nameof(versionsLocation)); }

            if (currentVersion == null) { throw new ArgumentNullException(nameof(currentVersion)); }
            
            VersionsLocation = versionsLocation;
            CurrentVersion = currentVersion;
        }
예제 #34
0
        private static void CheckVersion(Object[] attributes)
        {
            ApplicationVersion currentVersion = GetCurrentVersion();

            if (attributes.Length <= 0 || attributes.Contains(new Version(currentVersion)))
            {
                TestVersion = currentVersion;
            }
            else
            {
                Assert.Inconclusive("This test is not designed to be executed in the application version '" + currentVersion.ToString());
            }
        }
        public void Ctor_String()
        {
            var version = new ApplicationVersion("1.1.0.1");
            Assert.Equal("1.1.0.1", version.Id);

            Assert.Null(version.ShortDescription);
            Assert.Null(version.LongDescription);

            Assert.Equal(DateTime.MinValue, version.Date);

            Assert.Null(version.Notes);
            Assert.Null(version.Urls);

            Assert.Null(version.Copyright);
        }
예제 #36
0
        private static ApplicationVersion GetCurrentVersion()
        {
            string currentVersion = ConfigurationManager.AppSettings["Version"].ToLower(CultureInfo.CurrentCulture);
            ApplicationVersion MISVersion = new ApplicationVersion();

            try
            {
                MISVersion = (ApplicationVersion) Enum.Parse(typeof (ApplicationVersion), currentVersion, true);
            }
            catch (System.ArgumentException)
            {
                Assert.Fail(" The current version setting in 'Version' in the app.config is invalid.");
            }

            return MISVersion;
        }
예제 #37
0
 public void run(ApplicationVersion information)
 {
     if (information.updates_available)
     {
         ux_update_button.Enabled = true;
         ux_dont_update_button.Enabled = true;
         ux_cancel_button.Enabled = true;
         ux_update_button.Enabled = information.updates_available;
         ux_current_version.Text = "Current: " + information.current;
         ux_new_version.Text = "New: " + information.available_version;
     }
     else
     {
         ux_update_button.Enabled = false;
         ux_dont_update_button.Enabled = true;
         ux_cancel_button.Enabled = false;
         ux_current_version.Text = "Current: " + Assembly.GetExecutingAssembly().GetName().Version;
         ux_new_version.Text = "New: " + Assembly.GetExecutingAssembly().GetName().Version;
     }
 }
        public async Task IsUpToDate_ReturnsExpected(string input, bool expected)
        {
            var currentVersion = new ApplicationVersion(input);
            var versionChecker = new ApplicationVersionChecker(VersionsLocation, currentVersion);

            var upToDate = await versionChecker.IsUpToDate();
            Assert.Equal(upToDate, expected);
        }
예제 #39
0
 public ExecutionVersion(ApplicationVersion numberVersion)
 {
     VersionNumber = numberVersion;
 }
 public void Equals_Null_ReturnsFalse()
 {
     var version = new ApplicationVersion("1.0");
     Assert.False(version.Equals(null));
 }
        public void Equals_ReturnsExpected(string versionId1, string versionId2, bool expected)
        {
            var version1 = new ApplicationVersion(versionId1);
            var version2 = new ApplicationVersion(versionId2);

            Assert.Equal(expected, version1.Equals(version2));
        }