Beispiel #1
0
 protected virtual void SaveGame(StreamWriter writer)
 {
     Debug.Assert(writer.BaseStream.Position == 0, "You need to call base.SaveGame() at the top of your override as it writes the header information.");
     writer.WriteLine(FileKey);
     writer.WriteLine(CurrentVersion.ToString());
     writer.WriteLine(stateValues.Count);
     foreach (var pair in stateValues)
     {
         writer.Write(pair.Key);
         if (pair.Value is bool)
         {
             writer.Write(";BOOL;");
             writer.WriteLine((bool)pair.Value);
         }
         else if (pair.Value is int)
         {
             writer.Write(";INT;");
             writer.WriteLine((int)pair.Value);
         }
         else if (pair.Value is string)
         {
             writer.Write(";STRING;");
             writer.WriteLine((pair.Value as string) ?? string.Empty);
         }
     }
 }
Beispiel #2
0
        private void DoInit(bool isWork, Action callback)
        {
            GpuProfileSet.Instance.Register(this);
            this.ServerAppSettingSet = new ServerAppSettingSet(this);
            this.CalcConfigSet       = new CalcConfigSet(this);

            ServerContextInit(isWork);

            this.WorkerEventSet   = new WorkerEventSet(this);
            this.UserSet          = new UserSet();
            this.KernelProfileSet = new KernelProfileSet(this);
            this.GpusSpeed        = new GpusSpeed(this);
            this.CoinShareSet     = new CoinShareSet(this);
            this.MineWorkSet      = new MineWorkSet(this);
            this.MinerGroupSet    = new MinerGroupSet(this);
            this.OverClockDataSet = new OverClockDataSet(this);
            this.ColumnsShowSet   = new ColumnsShowSet(this);
            MineWorkData mineWorkData = null;

            if (isWork)
            {
                mineWorkData = LocalJson.MineWork;
            }
            this._minerProfile = new MinerProfile(this, mineWorkData);

            // 这几个注册表内部区分挖矿端和群控客户端
            NTMinerRegistry.SetLocation(VirtualRoot.AppFileFullName);
            NTMinerRegistry.SetArguments(string.Join(" ", CommandLineArgs.Args));
            NTMinerRegistry.SetCurrentVersion(CurrentVersion.ToString());
            NTMinerRegistry.SetCurrentVersionTag(CurrentVersionTag);

            callback?.Invoke();
        }
Beispiel #3
0
 public virtual void SetLanguage(string language)
 {
     if (CurrentVersion.IsAtLeast(SitecoreVersion.V71))
     {
         SetLanguageInternal(language);
     }
 }
        public MainViewModel(IWorkFlowProviderFactory workFlowProviderFactory, IMessageProvider messageProvider,
                             [DeploymentFlow.Annotations.NotNull] ICurrentVersionProvider currentVersionProvider)
        {
            if (currentVersionProvider == null)
            {
                throw new ArgumentNullException(nameof(currentVersionProvider));
            }
            _workFlowProviderFactory = workFlowProviderFactory;
            _messageProvider         = messageProvider;
            _currentVersionProvider  = currentVersionProvider;
            StartCommand             = new RelayCommand(async o => { await StartWorkflow(o); });
            var version = new CurrentVersion
            {
                Mayor = 1,
                Minor = 1,
                Build = 100
            };

            try
            {
                version = _currentVersionProvider.GetVersion();
            }
            catch (Exception)
            {
                messageProvider.ShowMessage("The version could not be read from $DatabaseProject\\Updates\\DBCurrentVersion.txt.\n Taking arbitrary default values.");
            }
            RequiredVersion     = version.Mayor + "." + version.Minor + "." + version.Build + ".0";
            InitialMayorVersion = version.Mayor.ToString();
            InitialMinorVersion = version.Minor.ToString();
            InitialBuildVersion = (version.Build + 1).ToString();
        }
Beispiel #5
0
        private void DoInit(bool isWork, Action callback)
        {
            this.ServerAppSettingSet = new ServerAppSettingSet(this);
            this.CalcConfigSet       = new CalcConfigSet(this);

            ServerContextInit(isWork);

            this.GpuProfileSet    = new GpuProfileSet(this);
            this.WorkerEventSet   = new WorkerEventSet(this);
            this.UserSet          = new UserSet();
            this.KernelProfileSet = new KernelProfileSet(this);
            this.GpusSpeed        = new GpusSpeed(this);
            this.CoinShareSet     = new CoinShareSet(this);
            this.MineWorkSet      = new MineWorkSet(this);
            this.MinerGroupSet    = new MinerGroupSet(this);
            this.OverClockDataSet = new OverClockDataSet(this);
            this.ColumnsShowSet   = new ColumnsShowSet(this);
            IsJsonLocal           = isWork;
            this._minerProfile    = new MinerProfile(this);

            // 这几个注册表内部区分挖矿端和群控客户端
            NTMinerRegistry.SetLocation(VirtualRoot.AppFileFullName);
            NTMinerRegistry.SetArguments(string.Join(" ", CommandLineArgs.Args));
            NTMinerRegistry.SetCurrentVersion(CurrentVersion.ToString());
            NTMinerRegistry.SetCurrentVersionTag(CurrentVersionTag);

            if (VirtualRoot.IsMinerClient)
            {
                OfficialServer.GetTimeAsync((remoteTime) => {
                    if (Math.Abs((DateTime.Now - remoteTime).TotalSeconds) < Timestamp.DesyncSeconds)
                    {
                        Logger.OkDebugLine("时间同步");
                    }
                    else
                    {
                        Write.UserWarn($"本机时间和服务器时间不同步,请调整,本地:{DateTime.Now},服务器:{remoteTime}");
                    }
                });

                Report.Init(this);
                Link();
                // 当显卡温度变更时守卫温度防线
                TempGruarder.Instance.Init(this);
                // 因为这里耗时500毫秒左右
                Task.Factory.StartNew(() => {
                    Windows.Error.DisableWindowsErrorUI();
                    if (NTMinerRegistry.GetIsAutoDisableWindowsFirewall())
                    {
                        Windows.Firewall.DisableFirewall();
                    }
                    Windows.UAC.DisableUAC();
                    Windows.WAU.DisableWAUAsync();
                    Windows.Defender.DisableAntiSpyware();
                    Windows.Power.PowerCfgOff();
                    Windows.BcdEdit.IgnoreAllFailures();
                });
            }

            callback?.Invoke();
        }
Beispiel #6
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (ProcessKey == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "ProcessKey");
     }
     if (ProcessVersion == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "ProcessVersion");
     }
     if (Name == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Name");
     }
     if (Environment != null)
     {
         Environment.Validate();
     }
     if (CurrentVersion != null)
     {
         CurrentVersion.Validate();
     }
     if (ReleaseVersions != null)
     {
         foreach (var element in ReleaseVersions)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
 }
Beispiel #7
0
 public Main()
 {
     try
     {
         InitializeComponent();
         initVariables();
         ////Region = System.Drawing.Region.FromHrgn(Utilities.CreateRoundRectRgn(0, 0, 1150, 635, 20, 20));
         this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
         ////this.FormBorderStyle = FormBorderStyle.Fixed3D;
         adjustForScreenResolution();
         //addButton("BtnAccount", 0, "AccountGroup");
         //addButton("BtnFinance", 1, "FinanceGroup");
         //addButton("BtnReports", 2, "ReportGroup");
         createMainHeaderButtons();
         //createMainOptionButtons();
         pnlMainOptionButtons.AutoScroll = true;
         lblVersion.Text            = CurrentVersion;
         txtVersionUpdate.ForeColor = Color.Red;
         string   VerLoc = UpdateTable.getLatestVersionOfERP();
         string[] verStr = VerLoc.Split(Main.delimiter1);
         if (!CurrentVersion.Trim().Equals(verStr[0].Trim()))
         {
             txtVersionUpdate.Text = "Latest ERP version is " + verStr[0].Trim() + ". Please update to latest version";
         }
         else
         {
             txtVersionUpdate.Text = "";
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Main() : Error 1");
     }
 }
 // Override of the ToString Method
 public string ToString()
 {
     // Serializing Object as CSV
     return(String.Join(",",
                        ("\"" + Url + "\""),
                        ("\"" + ReferenceDate.ToString("yyyy-MM-dd").Replace(",", "") + "\""),
                        ("\"" + Name.Replace(",", "") + "\" "),
                        ("\"" + Developer.Replace(",", "") + "\""),
                        ("\"" + IsTopDeveloper + "\""),
                        ("\"" + DeveloperURL.Replace(",", "") + "\""),
                        ("\"" + PublicationDate.ToString("yyyy-MM-dd").Replace(",", "") + "\""),
                        ("\"" + Category.Replace(",", "") + "\""),
                        ("\"" + IsFree + "\""),
                        ("\"" + Price + "\""),
                        ("\"" + Reviewers + "\""),
                        ("\"" + Score.Total + "\""),
                        ("\"" + Score.Count + "\""),
                        ("\"" + Score.FiveStars + "\""),
                        ("\"" + Score.FourStars + "\""),
                        ("\"" + Score.ThreeStars + "\""),
                        ("\"" + Score.TwoStars + "\""),
                        ("\"" + Score.OneStars + "\""),
                        ("\"" + LastUpdateDate.ToString("yyyy-MM-dd") + "\""),
                        //("\"" + AppSize                + "\""),
                        ("\"" + Instalations.Replace(",", ".") + "\""),
                        ("\"" + CurrentVersion.Replace(",", "") + "\""),
                        ("\"" + MinimumOSVersion.Replace(",", "") + "\""),
                        ("\"" + ContentRating.Replace(",", "") + "\""),
                        ("\"" + HaveInAppPurchases + "\""),
                        ("\"" + DeveloperEmail.Replace(",", "") + "\""),
                        ("\"" + DeveloperWebsite.Replace(",", "") + "\""),
                        ("\"" + DeveloperPrivacyPolicy.Replace(",", "") + "\""),
                        ("\"" + Description.Replace(",", "") + "\"")));
 }
Beispiel #9
0
        private int VersionUpToDate()
        {
            try
            {
                var currentParts   = CurrentVersion.Split(' ');
                var availableParts = AvailableVersion.Split(' ');
                //Version ID's are EXACTLY the same (eg. 0.8 vs 0.8)
                if (CurrentVersion == AvailableVersion)
                {
                    return(0);
                }
                var availableNum = Convert.ToDouble(availableParts[0], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
                var currentNum   = Convert.ToDouble(currentParts[0], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);

                //Cases where the a pre-release version is used (eg. 0.85 pre vs 0.8)
                if (availableNum < currentNum)
                {
                    return(1);
                }

                //Cases where version number is the same, but suffix is different (eg. 2.0 a1 vs 2.0 a2)
                if (availableNum == currentNum && currentParts.Length > 1 && availableParts.Length > 1)
                {
                    return(String.CompareOrdinal(currentParts[1], availableParts[1]));
                }
                //Cases where either an old release is used (eg 0.7 vs 0.8)
                //Or Version numbers don't quite match, (like 0.8 beta 1 vs 0.8)
                return(-1);
            }
            // Show the new version available if anything goes wrong, just to be safe.
            catch (Exception)
            {
                return(-1);
            }
        }
Beispiel #10
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (CurrentVersion.Length != 0)
            {
                hash ^= CurrentVersion.GetHashCode();
            }
            if (NewRevisionAvailable != false)
            {
                hash ^= NewRevisionAvailable.GetHashCode();
            }
            if (NewRevisionSummary.Length != 0)
            {
                hash ^= NewRevisionSummary.GetHashCode();
            }
            if (VersionDeprecated != false)
            {
                hash ^= VersionDeprecated.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #11
0
        public void OnPackageLoad(IdeIntegration ideIntegration)
        {
            IdeIntegration = ideIntegration;

            if (IsDevBuild)
            {
                tracer.Trace("Running on 'dev' version on {0}", this, ideIntegration);
            }

            var today  = DateTime.Today;
            var status = GetInstallStatus();

            if (!status.IsInstalled)
            {
                // new user
                if (ShowNotification(GuidanceNotification.AfterInstall))
                {
                    status.InstallDate      = today;
                    status.InstalledVersion = CurrentVersion;
                    status.LastUsedDate     = today;

                    UpdateStatus(status);
                    CheckFileAssociation();
                }
            }
            else if (status.InstalledVersion < CurrentVersion)
            {
                //upgrading user
                CheckFileAssociation();
            }

            _analyticsTransmitter.TransmitExtensionLoadedEvent(CurrentVersion.ToString());
        }
Beispiel #12
0
        public void SetVersion()
        {
            var content = System.IO.File.ReadAllText(FileProjectPath);

            var matches = System.Text.RegularExpressions.Regex.Matches(content, @"<Version>([^""]*)</Version>");

            if (matches.Any())
            {
                CurrentVersion = matches[0].Groups[1].Value;
                var versionSplit = CurrentVersion.Split('.');

                var major  = 1;
                var middle = 0;
                var minor  = 0;

                if (versionSplit.Length == 3)
                {
                    int.TryParse(versionSplit[0], out major);
                    int.TryParse(versionSplit[1], out middle);
                    int.TryParse(versionSplit[2], out minor);

                    minor++;
                }

                NewVersion = $"{major}.{middle}.{minor}";

                var newContentCsProj = content.Replace($"<Version>{CurrentVersion}</Version>", $"<Version>{NewVersion}</Version>");

                File.WriteAllText(FileProjectPath, newContentCsProj);
            }
        }
Beispiel #13
0
 /// <summary>
 /// Сохраняет изменения, сделанные в модели.
 /// </summary>
 public void Save(XmlDocument document)
 {
     WriteProperty(document, VERSION_PROPERTY, CurrentVersion.ToString(CultureInfo.InvariantCulture));
     if (!string.IsNullOrWhiteSpace(Environment))
     {
         WriteProperty(document, ENV_PROPERTY, Environment);
     }
 }
Beispiel #14
0
        protected virtual void UpdateSettings(ClientPipelineArgs args)
        {
            var settings        = ApplicationSettings.GetInstance(ApplicationNames.ISE);
            var backgroundColor = OutputLine.ProcessHtmlColor(settings.BackgroundColor);
            var bottomPadding   = CurrentVersion.IsAtLeast(SitecoreVersion.V80) ? 0 : 10;

            SheerResponse.Eval(
                $"spe.changeSettings('{settings.FontFamilyStyle}', {settings.FontSize}, '{backgroundColor}', {bottomPadding}, {settings.LiveAutocompletion.ToString().ToLower()});");
        }
Beispiel #15
0
 protected virtual void SetupVersionSkipping()
 {
     using (var updateKey = Registry.CurrentUser.CreateSubKey(RegistryLocation))
         if (updateKey != null)
         {
             updateKey.SetValue("version", CurrentVersion.ToString());
             updateKey.SetValue("skip", 1);
         }
 }
Beispiel #16
0
 /// <summary>
 /// Constructor with dependencies
 /// </summary>
 /// <param name="coreConfiguration">ICoreConfiguration</param>
 /// <param name="greenshotLanguage">IGreenshotLanguage</param>
 public UpdateService(
     ICoreConfiguration coreConfiguration,
     IGreenshotLanguage greenshotLanguage)
 {
     _coreConfiguration = coreConfiguration;
     _greenshotLanguage = greenshotLanguage;
     LatestVersion      = CurrentVersion = GetType().Assembly.GetName().Version;
     _coreConfiguration.LastSaveWithVersion = CurrentVersion.ToString();
 }
        public void CheckIn()
        {
            AssertValidAction(StateAction.CheckIn);

            if (!HasApproving)
            {
                // Approving OFF
                switch (VersioningMode)
                {
                case VersioningMode.None:
                    DeleteVersionsAndApprove();
                    break;

                case VersioningMode.Major:
                    // remove all working versions, except current
                    DeletableVersionIds.AddRange(GetLastWorkingVersions().Select(x => x.VersionId));
                    DeletableVersionIds.Remove(CurrentVersionId);

                    var lastApproved = GetLastApprovedVersion();
                    ExpectedVersion = lastApproved != null?
                                      GetNextPublicVersion(lastApproved.VersionNumber, VersionStatus.Approved) :
                                          ComputeNewVersion();

                    ExpectedVersionId = CurrentVersionId;
                    break;

                case VersioningMode.Full:
                    ExpectedVersion   = CurrentVersion.ChangeStatus(VersionStatus.Draft);
                    ExpectedVersionId = CurrentVersionId;
                    break;
                }
            }
            else
            {
                // Approving ON
                switch (VersioningMode)
                {
                case VersioningMode.None:
                    DeleteVersionsAndPreserveLastWorking();
                    break;

                case VersioningMode.Major:
                    ExpectedVersion   = CurrentVersion.ChangeStatus(VersionStatus.Pending);
                    ExpectedVersionId = CurrentVersionId;
                    break;

                case VersioningMode.Full:
                    ExpectedVersion   = CurrentVersion.ChangeStatus(VersionStatus.Draft);
                    ExpectedVersionId = CurrentVersionId;
                    break;
                }
            }

            // Unlock
            this.LockerUserId = 0;
        }
 private void UpdateNotes_OnLoaded(object sender, RoutedEventArgs e)
 {
     _fullReleaseNotes = new List <GithubRelease>
     {
         new GithubRelease {
             Name = "Loading...", Body = "Loading...", TagName = CurrentVersion.ToString(true)
         }
     };
     OnPropertyChanged(nameof(ReleaseNotes));
 }
Beispiel #19
0
        /// <summary>
        /// Checks for update
        ///
        /// Sets UpdateAvailable to true if an update was found and
        /// Sets UpdateAvailable to false if an update was not found
        /// </summary>
        public void CheckForUpdate()
        {
            if (!ReadUpdateXML())
            {
                Log.Error("Couldn't read update information.");
                return;
            }

            UpdateAvailable = CurrentVersion.CompareTo(NewVersion) < 0;
        }
Beispiel #20
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = StringComparer.OrdinalIgnoreCase.GetHashCode(TableName);
         hashCode = (hashCode * 397) ^ CurrentVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ MinValidVersion.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #21
0
        /// <summary>
        /// Checks for update
        ///
        /// Sets UpdateAvailable to true if an update was found and
        /// Sets UpdateAvailable to false if an update was not found
        /// </summary>
        public void CheckForUpdate()
        {
            if (!ReadUpdateXML())
            {
                Log.Error(Language.Resource.COULDNT_READ_UPDATE_INFORMATION);
                return;
            }

            UpdateAvailable = CurrentVersion.CompareTo(NewVersion) < 0;
        }
        public static string GetIcon(this Language language)
        {
            var db   = Factory.GetDatabase(ApplicationSettings.ScriptLibraryDb);
            var icon = db != null?language.GetIcon(db) : string.Empty;

            return(!string.IsNullOrEmpty(icon)
                ? icon
                : CurrentVersion.IsAtLeast(SitecoreVersion.V80)
                    ? "Office/32x32/flag_generic.png"
                    : "Flags/32x32/flag_generic.png");
        }
Beispiel #23
0
        public ListViewItem GetPluginsStoreItem()
        {
            var packageVersion = new Version(Package.Version.Version.Major,
                                             Package.Version.Version.Minor,
                                             Package.Version.Version.Build,
                                             Package.Version.Version.Revision);

            var item = new ListViewItem(string.Empty);

            item.Tag = this;
            item.SubItems.Add(this.ToString());
            item.SubItems.Add(packageVersion.ToString());
            item.SubItems.Add(CurrentVersion?.ToString());
            item.SubItems.Add(Package.Description);
            item.SubItems.Add(string.Join(", ", Package.Authors));
            var actionItem = item.SubItems.Add("None");

            item.SubItems.Add(Package.DownloadCount.ToString());

            if (currentVersionDownloadsCount.ContainsKey(Package.Id.ToLower()))
            {
                item.SubItems.Add(currentVersionDownloadsCount[Package.Id.ToLowerInvariant()].ToString());
            }
            else
            {
                item.SubItems.Add("N/A");
            }

            switch (Action)
            {
            case PackageInstallAction.Unavailable:
                actionItem.Text = "Incompatible";
                item.ForeColor  = Color.Red;
                break;

            case PackageInstallAction.Update:
                actionItem.Text = "Update";
                item.ForeColor  = Color.Blue;
                break;

            case PackageInstallAction.Install:
                actionItem.Text = "Install";
                item.ForeColor  = Color.Black;
                break;

            case PackageInstallAction.None:
            default:
                actionItem.Text = "N/A";
                item.ForeColor  = Color.Gray;
                break;
            }

            return(item);
        }
Beispiel #24
0
        public object done()
        {
            Action startJob_ = () =>
            {
                log.exceuteInContext = _done;
                log.show();
            };

            Action askFirm_ = () =>
            {
                string firms_ = CurrentVersion.ENV.getFirms();

                if (firms_ == string.Empty)
                {
                    startJob_.Invoke();
                }
                else
                {
                    List <string> lNr   = new List <string>();
                    List <string> lDesc = new List <string>();
                    string[]      arr_  = ToolString.explodeList(firms_);
                    //
                    for (int i = 0; i < arr_.Length; i += 2)
                    {
                        lNr.Add(arr_[i]);
                        lDesc.Add(arr_[i + 1]);
                    }
                    //

                    ToolMsg.askList(null, lDesc.ToArray(), (s, e) =>
                    {
                        int nr_ = XmlFormating.helper.parseInt(lNr[e.Which]);

                        int port_ = CurrentVersion.getPortByFirmNr(nr_);

                        CurrentVersion.ENV.setEnv(CurrentVersion.ENV.PORT, XmlFormating.helper.format(port_));

                        startJob_.Invoke();
                    }

                                    );
                }
            };

            ToolMsg.confirm(null, string.Format("{0} - {1}", MessageCollection.T_MSG_COMMIT_BEGIN, MessageCollection.T_MSG_DATA_RECEIVING), () =>
            {
                askFirm_();
                //log.exceuteInContext = _done;
                //log.show();
            }, null);


            return(null);
        }
        /// <summary>
        /// Gets the mod info that is currently in the install log, indexed by mod key.
        /// </summary>
        /// <returns>The mod info that is currently in the install log, indexed by mod key.</returns>
        private IDictionary <string, IMod> GetInstallLogModInfo()
        {
            var loggedModInfo = new Dictionary <string, IMod>();
            var log           = XDocument.Load(LogPath);

            var logVersion = log.Element("installLog")?.Attribute("fileVersion")?.Value;

            if (!CurrentVersion.ToString().Equals(logVersion))
            {
                throw new Exception($"Invalid Install Log version: \"{logVersion}\", expected \"{CurrentVersion}\".");
            }

            var modList = log.Descendants("modList").FirstOrDefault();

            if (modList != null)
            {
                foreach (var mod in modList.Elements("mod"))
                {
                    var modPath = mod.Attribute("path")?.Value;

                    if (!OriginalValueMod.Filename.Equals(modPath) && !ModManagerValueMod.Filename.Equals(modPath))
                    {
                        if (string.IsNullOrEmpty(modPath))
                        {
                            throw new Exception($"Could not determine path to mod \"{mod}\"");
                        }

                        modPath = Path.Combine(ModInstallDirectory, modPath);
                        var version = mod.Element("version");
                        var humanReadableVersion = version?.Attribute("machineVersion")?.Value;
                        var machineVersion       = string.IsNullOrEmpty(humanReadableVersion) ? null : new Version(humanReadableVersion);
                        humanReadableVersion = version?.Value;
                        var modName     = mod.Element("name")?.Value;
                        var installDate = "<No Data>";

                        if (mod.Element("installDate") != null)
                        {
                            installDate = mod.Element("installDate")?.Value;
                        }

                        IMod dummyMod = new DummyMod(modName, modPath, machineVersion, humanReadableVersion, "", installDate);

                        var loggedModInfoKey = mod.Attribute("key")?.Value;

                        if (loggedModInfoKey != null)
                        {
                            loggedModInfo[loggedModInfoKey] = dummyMod;
                        }
                    }
                }
            }

            return(loggedModInfo);
        }
Beispiel #26
0
        private static void ParseVersionString(string versionString)
        {
            try
            {
                string[] data = string.IsNullOrEmpty(versionString)
                                    ? null
                                    : versionString.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                string version = CurrentVersion.ToString();

                // parse received data for version info:
                if (data != null)
                {
                    foreach (string s in data)
                    {
                        if (s.StartsWith(ParamVersionName, StringComparison.CurrentCultureIgnoreCase))
                        {
                            version = s.Substring(s.IndexOfAny(ParamValueSeparators) + 1).Trim();
                            break;
                        }
                    }
                }

                // remember the server version:
                lock (syncObject)
                {
                    try
                    {
                        serverVersion = new Version(version);
                    }
                    catch (Exception ex)
                    {
                        Trace.WriteLine(string.Format("Invalid version info retrieved from the server: '{0}'", version));
                        Trace.WriteLine(ex.Message);
                        serverVersion = InvalidVersion;
                    }
                }

                // both version should be known here, so fire the proper notifications:
                lock (syncList)
                {
                    foreach (VersionCheckHandler c in listeners)
                    {
                        c(currentVersion, serverVersion, ReleaseURL);
                    }

                    // and never call them again...
                    listeners.Clear();
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
Beispiel #27
0
 public override void Encode()
 {
     encodeBuf.Clear();
     encodeBuf.AddRange(AddString(CollectTime, 14));
     encodeBuf.AddRange(AddString(StationId, 4));
     encodeBuf.AddRange(AddString(DeviceId, 8));
     encodeBuf.AddRange(AddString(StatusDescription, 4));
     encodeBuf.AddRange(AddString(SoftType, 2));
     encodeBuf.AddRange(AddString(CurrentVersion.PadLeft(12, '0'), 12));
     encodeBuf.AddRange(AddString(FutureVersion.PadLeft(12, '0'), 12));
     encodeBuf.AddRange(AddString(Spare, 8));
 }
        public void Reject()
        {
            AssertValidAction(StateAction.Reject);

            if (!HasApproving)
            {
                return;
            }

            ExpectedVersion   = CurrentVersion.ChangeStatus(VersionStatus.Rejected);
            ExpectedVersionId = CurrentVersionId;
        }
Beispiel #29
0
        // Создает новую версию как копию текущего состояния
        public void MakeVersion()
        {
            IsChanged = true;

            Version newVersion = CurrentVersion.Clone();

            _versions.AddLast(newVersion);

            Save();

            Logger.LogWithBinding("Status_MakeVersion");
        }
Beispiel #30
0
        static string getDalyTempDir()
        {
            string d_ = CurrentVersion.getName().ToUpper() + "_SYS_TMP_" + DateTime.Now.ToString("yyyy_MM_dd");

            d_ = Path.Combine(tmpLocationDir(), d_);

            if (!Directory.Exists(d_))
            {
                Directory.CreateDirectory(d_);
            }

            return(d_);
        }