private void ListChangesInVersions(IList<ProjectVersion> versions) {
            if (versions == null) {
                Changelog = string.Empty;
                return;
            }

            ChangelogModel.ChangelogModel changelogModel = new ChangelogModel.ChangelogModel();

            foreach (ProjectVersion version in versions) {
                List<Issue> issuesInVersion =
                        _jira.GetIssuesFromJql("project = " + _project.Key + " AND fixVersion = '" + version.Name + "'").ToList();
                VersionModel versionModel = new VersionModel();
                versionModel.Version = version.Name;
                foreach (Issue issue in issuesInVersion) {
                    if (!issue.Type.IsSubTask) {
                        IssueTypeModel typeModelForIssue = versionModel.IssueTypes.FirstOrDefault(x => x.IssueType.Id == issue.Type.Id);
                        if (typeModelForIssue == null) {
                            IssueTypeModel typeModel = new IssueTypeModel();
                            typeModel.IssueType = issue.Type;
                            versionModel.IssueTypes.Add(typeModel);
                            typeModelForIssue = typeModel;
                        }

                        typeModelForIssue.Issues.Add(new IssueModel() { Issue = issue });
                    } else {
                    }
                }
                changelogModel.Versions.Add(versionModel);
            }

            Changelog = changelogModel.ToString();
        }
Esempio n. 2
0
        public Shell(IEventAggregator eventAggregator, IModuleManager moduleManager)
        {
            InitializeComponent();

            this.receive_Aggregator = eventAggregator;
            this.send_Aggregator    = eventAggregator;

            this.moduleManager = moduleManager;

            //定义消息结构
            receiveMsgOrder = new ReceiveMsgOrder();
            //获取服务器端参数
            configModel = ConfigAccess.GetConfig();
            //获取客户端版本信息
            versionModel = VersionAccess.GetConfig();
            //获取连接信息类的单例
            connectParam = ConnectParam.GetInstance();
            //获取日志记录实例
            this.ilogger = ILogger.GetInstance();

            //订阅接收信息事件
            RequestEvent();

            //定义接收消息线程
            connectParam.ListenerMsgThread = new Thread(ListenerMsgThreadMethod);
            connectParam.ListenerMsgThread.IsBackground = true;

            //先建立连接及SSL通道,再发送
            ConnectToServer(MessageTypes.UPD + versionModel.AppVs + MessageTypes.NSP + versionModel.UpdateTime, //确认更新
                            configModel.LoginIP, int.Parse(configModel.LoginPort));
        }
Esempio n. 3
0
        /// <summary>
        /// 联网获取插件的最新版本
        /// </summary>
        /// <param name="pm"></param>
        /// <returns></returns>
        public static VersionModel GetPluginNewVersion(PluginModel pm)
        {
            VersionModel rs = HttpTool.Get <VersionModel>(R.Settings.Url.WebService + string.Format("getPluginsConfig?name={0}&version={1}", pm.Name, pm.Version));

            //VersionModel rs = JsonTool.ToObjFromFile<VersionModel>(@"D:\CoCo\GitHub\Fork\Fork.Net\Oreo.VersionBuilder\bin\Debug\VersionFile\0602104746.version");
            return(rs);
        }
Esempio n. 4
0
        /// <summary>
        /// 写入更新配置文件
        /// </summary>
        /// <param name="vm"></param>
        public static void UpdatePluginConfig(VersionModel vm)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(vm.PluginName) && !string.IsNullOrWhiteSpace(vm.PluginEntry))
                {
                    XElement xe     = XElement.Load(R.Files.Plugins);
                    XElement record = xe.Elements("Item").FirstOrDefault(x => x.Attribute("Name").Value == vm.PluginName);
                    if (record != null)
                    {
                        //如果xml包含改插件,则更新
                        string entryFile = DirTool.IsDriver(vm.PluginEntry) ? vm.PluginEntry : DirTool.Combine(R.Paths.ProjectRoot, vm.PluginEntry);

                        record.Attribute("Entry").Value   = entryFile;
                        record.Attribute("Version").Value = vm.VersionNumber;
                    }
                    else
                    {
                        //如果xml不包含插件,则添加插件
                        string entryFile = DirTool.IsDriver(vm.PluginEntry) ? vm.PluginEntry : DirTool.Combine(R.Paths.ProjectRoot, vm.PluginEntry);

                        XElement insertRec = new XElement("Item", new XAttribute("Name", vm.PluginName), new XAttribute("Entry", entryFile), new XAttribute("Version", vm.VersionNumber));
                        xe.Add(insertRec);
                    }
                    xe.Save(R.Files.Plugins);
                }
            }
            catch (Exception e)
            {
                R.Log.e("修改插件配置信息出错:" + e.Message);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 写入 Whatsnew
 /// </summary>
 /// <param name="vm"></param>
 public static void UpdateWhatsnew(VersionModel vm)
 {
     TxtTool.Append(R.Files.Whatsnew, string.Format("{0} {1} {2}",
                                                    vm.CodeName, vm.VersionNumber, (vm.PluginName == "" ? "" : "For:" + vm.PluginName)));
     TxtTool.Append(R.Files.Whatsnew, vm.VersionDesc);
     TxtTool.Append(R.Files.Whatsnew, new string('=', 50));
 }
Esempio n. 6
0
        protected async override Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            ClientVersion = new VersionModel(typeof(VersionInfo).Assembly.GetName().Version);
            ApiVersion    = await Api.GetVersionAsync();
        }
Esempio n. 7
0
        private int parseMapFiles()
        {
            UpdateLog.DEBUG_LOG("解析map文件+++");
            int num = 1;

            RepairList.Clear();
            this.BackDownloadList.Clear();
            _backDownloadDict.Clear();
            this._parsedMapDataList.Clear();
            string resourceUrl = "";

            for (int i = 0; i < this._currentData.VersionModelBaseList.Count; i++)
            {
                VersionModel model   = this._currentData.VersionModelBaseList[i];
                string       str2    = model.Map_url.Replace(@"\", "/");
                string       str3    = str2.Substring(str2.LastIndexOf("/") + 1);
                string       mapFile = Path.Combine(BaseFlow._storeDir, str3);
                resourceUrl = model.ResourceUrl;
                MapFileManage manage = new MapFileManage();
                num = manage.parseMapFile(mapFile, model.ResourceUrl, BaseFlow._storeDir);
                if (num <= -1)
                {
                    return(num);
                }
                this._parsedMapDataList.AddRange(manage.GetMapFileDataList());
            }
            UpdateLog.DEBUG_LOG("解析map文件---");
            return(num);
        }
Esempio n. 8
0
    public override void Open()
    {
        base.Open();
        ExpireSet();
        ForAudio();
        offAudioBtn.SetValue(off == 1);
        readBtn.SetValue(read == 1);
        chatBtn.SetValue(chat == 1);
        shockBtn.SetValue(shock == 1);
        fuDongBtn.SetValue(fudong == 1);
        soundSlider.value = AudioManager.Instance.SoundValue;
        muiceSlider.value = AudioManager.Instance.MusicValue;
        OffAudio();
        release.text = "当前版本号:" + Application.version;
        StartCoroutine(VersionManager.Instance.BigVersion(model =>
        {
            this.model = model;
#if UNITY_ANDROID
            refreshGameBtn.gameObject.SetActive(VersionManager.Instance.CompareVersion(model.android_severVersion));
#elif UNITY_IPHONE
            refreshGameBtn.gameObject.SetActive(VersionManager.Instance.CompareVersion(model.ios_severVersion));
#elif UNITY_EDITOR
            refreshGameBtn.gameObject.SetActive(false);
#endif
        }));
    }
Esempio n. 9
0
 public IHttpActionResult Put(VersionModel model, int id)
 {
     if (model == null)
     {
         return(BadRequest("Model is null"));
     }
     if (id <= 0)
     {
         return(BadRequest("ID not valid"));
     }
     try
     {
         var version = Repository.Get(id);
         if (version == null)
         {
             return(NotFound());
         }
         Repository.Update(Parser.Create(model, Repository.HomeContext()), id);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Esempio n. 10
0
        private VersionModel GatherModel()
        {
            VersionModel rs = new VersionModel()
            {
                CodeName                 = TbCodeName.Text.Trim(),
                VersionNumber            = TbVersionNumber.Text.Trim(),
                VersionDesc              = TbVersionDesc.Text.Trim(),
                ServerPath               = TbServerPath.Text.Trim(),
                PluginName               = TbPluginName.Text.Trim(),
                PluginEntry              = TbPluginEntry.Text.Trim(),
                BeforeUpdateStartProcess = TbBeforeUpdateStartProcess.Text.Trim().Split(','),
                BeforeUpdateKillProcess  = TbBeforeUpdateKillProcess.Text.Trim().Split(','),
                AfterUpdateStartProcess  = TbAfterUpdateStartProcess.Text.Trim().Split(','),
                AfterUpdateKillProcess   = TbAfterUpdateKillProcess.Text.Trim().Split(','),
            };

            if (DgFileList.Rows.Count > 0)
            {
                rs.FileList = new List <VersionFile>();
                foreach (DataGridViewRow row in DgFileList.Rows)
                {
                    rs.FileList.Add(new VersionFile()
                    {
                        ServerFile = row.Cells["ClFileListServer"].Value.ToString(),
                        LocalFile  = row.Cells["ClFileListLocal"].Value.ToString(),
                        FileMD5    = row.Cells["ClFileListMD5"].Value.ToString(),
                        IsClean    = (bool)row.Cells["ClFileListClean"].Value,
                    });
                }
            }
            return(rs);
        }
        public async Task <IHttpActionResult> Get(string type, string applicationName, string clientSdkVersion)
        {
            Debug("Get", $"Type: {type}, ApplicationName: {applicationName}, clientSdkVersion:{clientSdkVersion}");

            var    model = new VersionModel();
            string path, url, extension;

            if (string.IsNullOrEmpty(type))
            {
                return(NotFound());
            }
            if (type.ToLower() == "android")
            {
                model.ApplicationType = "Android";
                path      = _androidFolder;
                extension = "apk";
                url       = $"{_androidDownloadPath}{applicationName}/";
                path     += applicationName;
                SetAndroidModel(ref model, url, path, extension, clientSdkVersion.ToInt() ?? 0);
            }
            else
            {
                model.ApplicationType = "iOS";
                path      = _iOSFolder;
                extension = "ipa";
                url       = $"{_iOSDownloadPath}{applicationName}/";
                path     += applicationName;
                model     = await SetiOsModel(model, url, path, extension);

                //model.Url = @"itms-services://?action=download-manifest&url=https://your.company.domain/path/to/Mobile.Apps Website/Restroom/manifest.plist";
                //model.Url = @"itms-services://?action=download-manifest&url=https://testapi.actransit.org/Restroom-finder/api/version/GetiOSManifest/restroom";
            }

            return(Ok(model));
        }
        private Task <VersionModel> SetiOsModel(VersionModel model, string url, string path, string extension)
        {
            return(Task.Run(() => {
                try
                {
                    string[] files = Directory.GetFiles(path, $"*.{extension}");
                    files = files.OrderByDescending(f => f).ToArray();
                    if (files.Length > 0)
                    {
                        foreach (var file in files)
                        {
                            var parts = file.Split('-');
                            if (parts.Length != 3)
                            {
                                continue;
                            }
                            var fileInfo = new FileInfo(file);

                            model.Version = GetVersion(parts[2]);
                            model.Date = fileInfo.LastAccessTime;
                            model.Url = $"itms-services://?action=download-manifest&url={url}manifest.plist";
                            model.FileName = fileInfo.Name;
                            break;
                        }
                    }

                    return model;
                }
                catch (Exception ex)
                {
                    Error("SetiOSModel", ex.Message, ex);
                    throw;
                }
            }));
        }
Esempio n. 13
0
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <returns></returns>
        static VersionModel LoadFromFile()
        {
            if (!File.Exists(_config_path))
            {
                NewFile();
            }

            var param = from config in XElement.Load(_config_path).Descendants("Version")
                        select VersionModel.CreateModel(
                config.Element("UpdateTime").Value,
                config.Element("AppVs").Value
                );

            try
            {
                foreach (var p in param)
                {
                    return(p);
                }
            }
            catch
            {
                return(null);
            }

            return(null);
        }
        public async Task <VersionModel> GetVersionAsync(int versionId, bool isSeller)
        {
            string sql = "SELECT v.*, b.Id, b.Name, p.Id, p.Name, p.Price FROM dbo.Versions v JOIN dbo.Branches b ON v.BranchId = b.Id " +
                         "JOIN dbo.Products p ON p.Id = b.ProductId WHERE v.Id = @versionId ";

            if (!isSeller)
            {
                sql += " AND v.IsEnabled = 1 AND b.IsEnabled = 1;";
            }

            VersionModel version = null;
            await connection.QueryAsync <VersionModel, BranchModel, ProductModel, VersionModel>(sql, (v, b, p) =>
            {
                if (version == null)
                {
                    version                = v;
                    version.Branch         = b;
                    version.Branch.Product = p;
                }

                return(null);
            }, new { versionId });

            return(version);
        }
Esempio n. 15
0
 private void BtBuild_Click(object sender, EventArgs e)
 {
     Task.Factory.StartNew(() =>
     {
         this.Invoke(new Action(() => { LbResult.Text = "开始检索并生成目录文件,请稍候……"; }));
         beginTime            = DateTime.Now;
         string path          = TbPath.Text;
         string parentPath    = DirTool.Parent(path);
         FileCodeHelper fcode = new FileCodeHelper();
         if (Directory.Exists(path) && Directory.Exists(parentPath))
         {
             List <string> fileList = FileTool.GetAllFile(path);
             if (!ListTool.IsNullOrEmpty(fileList))
             {
                 VersionModel version = new VersionModel()
                 {
                     Number = DateTime.Now.Second, Path = path, FileList = new List <VersionFile>(),
                 };
                 foreach (var item in fileList)
                 {
                     version.FileList.Add(new VersionFile()
                     {
                         File = item.Replace(path, ""),
                         MD5  = fcode.GetMD5(item),
                     });
                 }
                 string file = string.Format(@"{0}\version.txt", parentPath);
                 string json = JsonTool.ToStr(version);
                 TxtTool.Create(file, json);
             }
         }
         endTime = DateTime.Now;
         this.Invoke(new Action(() => { LbResult.Text = string.Format("生成完成,用时:{0}秒。", (endTime - beginTime).TotalSeconds); }));
     });
 }
Esempio n. 16
0
        public async Task <IActionResult> Get()
        {
            try
            {
                // CoefAPI test for slack logging
                // TODO: remove API test
                string coefStatus = "CoefficientCalculator is OK";
                try { var result = await _coefficientCalculator.RequestAsync("123456", "EURCHF"); }
                catch (Exception ex01) { coefStatus = $"Coefficient calculator status failed: {ex01.Message}"; }

                var coefCalc = _settings.CoefficientCalculator.Instruments.Select(x => x.Name).ToList();
                coefCalc.Insert(0, coefStatus);

                var answer = new VersionModel
                {
                    Version = Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.ApplicationVersion,
                    CoefficientCalculatorInstruments = coefCalc.ToArray(),
                    DaysHistory = _settings.HistoryHolder.NumberOfDaysInCache
                };
                return(Ok(answer));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            };
        }
Esempio n. 17
0
 public void SetVersion(VersionModel version)
 {
     try
     {
         var client = new HttpClient(new HttpClientHandler {
             CookieContainer = new CookieContainer()
         });
         client.BaseAddress = new Uri(WebConfigurationManager.AppSettings["DataServiceUrl"]);
         client.DefaultRequestHeaders.Accept.Clear();
         client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
         var content = new StringContent(JsonConvert.SerializeObject(version), Encoding.UTF8, "application/json");
         HttpResponseMessage response = client.PostAsync("api/Version/Save", content).Result;
         if (!response.IsSuccessStatusCode)
         {
             InternalServerError(new Exception(response.ReasonPhrase));
         }
     }
     catch (HttpRequestException hre)
     {
         var msg = $"Set OpenPharma Version => {hre.Message}";
         InternalServerError(new Exception(msg, hre));
     }
     catch (Exception e)
     {
         var msg = $"Set OpenPharma Version => {e.Message}";
         InternalServerError(new Exception(msg, e));
     }
 }
Esempio n. 18
0
        public int InsertVersion(VersionModel versionModel)
        {
            int insertedID = 0;
            List <VersionModel> listDocument = new List <VersionModel>();

            try
            {
                using (MySqlConnection con = new MySqlConnection(connectionString))
                {
                    MySqlCommand cmd = new MySqlCommand("sp_InsertVerion", con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    con.Open();
                    cmd.Parameters.Add("@version_name", MySqlDbType.VarChar).Value        = versionModel.VersionName;
                    cmd.Parameters.Add("@version_description", MySqlDbType.VarChar).Value = versionModel.VersionDescription;
                    cmd.Parameters.Add("@created_by", MySqlDbType.VarChar).Value          = versionModel.CreatedBy;
                    cmd.Parameters.Add("@updated_by", MySqlDbType.VarChar).Value          = versionModel.UpdatedBy;
                    insertedID = int.Parse(cmd.ExecuteScalar().ToString());
                    con.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                var json = JsonConvert.SerializeObject(versionModel);
                ExceptionLogging.SendExcepToDB(json, "insert", versionModel.CreatedBy);
            }

            return(insertedID);
        }
Esempio n. 19
0
        public List <VersionModel> GetAllVersion()
        {
            List <VersionModel> listDocument = new List <VersionModel>();

            using (MySqlConnection con = new MySqlConnection(connectionString))
            {
                MySqlCommand cmd = new MySqlCommand("select * from version;", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                MySqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    VersionModel document = new VersionModel();
                    document.VersionID          = Convert.ToInt32(rdr["version_ID"]);
                    document.VersionName        = String.IsNullOrEmpty(rdr["version_name"].ToString()) ? "" : rdr["version_name"].ToString();
                    document.VersionDescription = String.IsNullOrEmpty(rdr["version_description"].ToString()) ? "" : rdr["version_description"].ToString();
                    document.CreatedBy          = String.IsNullOrEmpty(rdr["created_by"].ToString()) ? "0" : rdr["created_by"].ToString();
                    document.UpdatedBy          = String.IsNullOrEmpty(rdr["updated_by"].ToString()) ? "0" : rdr["updated_by"].ToString();
                    document.CreatedAt          = String.IsNullOrEmpty(rdr["created_at"].ToString()) ? "" : rdr["created_at"].ToString();
                    document.UpdatedAt          = String.IsNullOrEmpty(rdr["updated_at"].ToString()) ? "" : rdr["updated_at"].ToString();

                    listDocument.Add(document);
                }
                con.Close();
            }
            return(listDocument);
        }
Esempio n. 20
0
 public ExcutedResult <VersionModel> GetCurrentVersion(int clientType)
 {
     try
     {
         if (!Enum.IsDefined(typeof(EnumClientType), clientType))
         {
             return(ExcutedResult <VersionModel> .FailedResult(BusinessResultCode.ArgumentError, "参数错误或无效"));
         }
         var version = _versionLogic.GetCurrentVersion(clientType);
         if (version == null)
         {
             return(ExcutedResult <VersionModel> .SuccessResult());
         }
         var anUrl  = _configDataLogic.GetByKeyAndLang(ConfigDataKey.AndroidDownUrl);
         var iosUrl = _configDataLogic.GetByKeyAndLang(ConfigDataKey.IosDownUrl);
         var data   = new VersionModel
         {
             Name      = version.Name,
             Version   = version.Number.Value,
             Introduce = version.Desc,
             IsForce   = version.IsMustUpdate,
             DownUrl   = (clientType == (int)EnumClientType.Android) ? anUrl : ((clientType == (int)EnumClientType.Ios) ? iosUrl : "")
         };
         return(ExcutedResult <VersionModel> .SuccessResult(data));
     }
     catch (BusinessException businessException)
     {
         return(ExcutedResult <VersionModel> .FailedResult(businessException.ErrorCode, businessException.Message));
     }
 }
Esempio n. 21
0
        public async Task SetCurrentVersion(VersionModel dataContent)
        {
            try
            {
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                var content = new StringContent(JsonConvert.SerializeObject(dataContent), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await client.PostAsync("api/Data/SetVersion", content);

                if (response.IsSuccessStatusCode)
                {
                    Program.LogInfo("Software Version Sent !");
                }
                else
                {
                    throw new Exception(response.ReasonPhrase);
                }
            }
            catch (HttpRequestException hre)
            {
                var msg = $"Set Current Version => {hre.Message}";
                Program.LogError(msg, hre);
                throw new Exception(msg, hre);
            }
            catch (Exception e)
            {
                var msg = $"Set CurrentVersion => {e.Message}";
                Program.LogError(msg, e);
                throw new Exception(msg, e);
            }
        }
Esempio n. 22
0
 /// <summary>
 /// Sets the following properties: Additional Properties (Version, AssemblyVersion, FileVersion)
 /// </summary>
 public static DotNetCoreMSBuildSettings Default(VersionModel versionModel)
 {
     return(new DotNetCoreMSBuildSettings()
            .WithProperty("Version", versionModel.Version)
            .WithProperty("AssemblyVersion", versionModel.AssemblyVersion.ToString())
            .WithProperty("FileVersion", versionModel.FileVersion.ToString()));
 }
Esempio n. 23
0
        private void DeleteVersion_Click(object sender, RoutedEventArgs e)
        {
            if (foundSingleVersionFile == null)
            {
                MessageBox.Show("软件错误,请联系管理员");
                return;
            }
            VersionModel father = null;

            for (int i = 0; i < treeVersionMap.Count; i++)
            {
                if (treeVersionMap[i].Value.FileName.Equals(
                        foundSingleVersionFile.FatherName))
                {
                    father = treeVersionMap[i].Value;
                    break;
                }
            }
            if (father == null)
            {
                MessageBox.Show("软件错误,请联系管理员");
                return;
            }
            if (MainFolder.AskDeleteAllRef(father.FileName, foundSingleVersionFile.VersionName,
                                           "") == false)
            {
                return;
            }
            MainFolder.CommitDeleteRef(father.FileName, foundSingleVersionFile.VersionName);
            father.versionList.Remove(foundSingleVersionFile);
            refManager.DeleteVersion(father.FileName, foundSingleVersionFile.VersionName);
            ShowFolderTree();
            ShowVersionTree();
        }
Esempio n. 24
0
        public ActionResult Version()
        {
            // Site
            var site = ConfigurationManager.AppSettings["ApplicationVersion"];

            // Database
            using (var versionManager = new VersionManager())
            {
                var database = versionManager.GetLatestVersion().Value;

                // Workspace
                string    filePath  = Path.Combine(AppConfiguration.WorkspaceGeneralRoot, "General.Settings.xml");
                XDocument settings  = XDocument.Load(filePath);
                XElement  entry     = XmlUtility.GetXElementByAttribute("entry", "key", "version", settings);
                var       workspace = entry.Attribute("value")?.Value;


                var model = new VersionModel()
                {
                    Site      = site,
                    Database  = database,
                    Workspace = workspace
                };

                ViewBag.Title = PresentationModel.GetViewTitleForTenant("Session Timeout", this.Session.GetTenant());

                return(View(model));
            }
        }
        public VersionModel GetVersion(string ticket = "")
        {
            var model = new VersionModel {
                version = UsersHelper.GetVersion()
            };

            return(model);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            VersionModel versionModel = db.VersionModel.Find(id);

            db.VersionModel.Remove(versionModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 27
0
 public void UpdateTo(VersionModel version)
 {
     _logger.Info($"Updating {ModuleName} to {version.Version}...");
     _downloader.Download(
         _newestVersionExtractor.GetNewestVersion().Url,
         CurrentDirectory.CreateFullFilePath(_destinationFilePath));
     _logger.Info($"{ModuleName} updated to {version.Version}.");
 }
Esempio n. 28
0
 public static bool Insert(VersionModel model)
 {
     if (model == null)
     {
         return(false);
     }
     DataAccessCenter.DbContext.Version.Add(model);
     return(DataAccessCenter.DbContext.SaveChanges() != 0);
 }
Esempio n. 29
0
        public virtual void Process(MigrateItemPipelineArgs args)
        {
            if (args.Source == null ||
                args.Item == null)
            {
                return;
            }

            // Sort decending by version and Group by language
            var languages = args.Source.Versions
                            .OrderBy(x => x.Language)
                            .ThenByDescending(x => x.Version)
                            .GroupBy(x => x.Language);

            var versionModels = new List <VersionModel>();

            foreach (var language in languages)
            {
                VersionModel latestVersion  = null;
                VersionModel latestApproved = null;

                // Find latest version that is publishable and is approved
                foreach (var version in language)
                {
                    if (latestVersion == null)
                    {
                        latestVersion = version;
                    }

                    if (version.HasWorkflow && version.WorkflowState == WorkflowState.NonFinal)
                    {
                        continue;
                    }

                    latestApproved = version;

                    break;
                }

                // Take the latest approved version.  If there is no approved version take the latest version.
                if (latestApproved != null)
                {
                    versionModels.Add(latestApproved);
                }
                else if (latestVersion != null)
                {
                    versionModels.Add(latestVersion);
                    Sitecore.Diagnostics.Log.Info(string.Format("[FieldMigrator] Approved version not found: {0}, {1}, {2}", args.Source.Id, latestVersion.Language, args.Source.FullPath(x => x.Parent, x => x.Name)), this);
                }
            }

            // Update each version
            foreach (var versionModel in versionModels)
            {
                _migrateVersionPipeline.Run(versionModel, args.Item);
            }
        }
Esempio n. 30
0
 public int UpdateVersion(VersionModel version)
 {
     using (Version <VersionModel> v = new Version <VersionModel>(_file))
     {
         var result = v.UpdateVersion(version);
         //v.Commit();
         return(result);
     }
 }