Exemplo n.º 1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            ExceptionlessClient.Default.Configuration.DefaultData.Add("Locale",
                                                                      Thread.CurrentThread.CurrentUICulture.Name);
            ExceptionlessClient.Default.Startup(Settings.Default.ExceptionlessKey);

            Parser.Default.ParseArguments <CommandLineOptions>(e.Args).WithParsed(o => CurrentOptions = o);

            if (string.IsNullOrEmpty(CurrentOptions.Path))
            {
                CurrentOptions.Path = Environment.CurrentDirectory;
            }

            UpdaterSettings = UpdaterSettings.Load(CurrentOptions.Path ?? Environment.CurrentDirectory);
            Exit           += (s, ea) =>
                              UpdaterSettings.Save(UpdaterSettings, CurrentOptions.Path ?? Environment.CurrentDirectory);

            if (CurrentOptions.CurrentVersion != null)
            {
                return;
            }

            string dllPath = IOPath.Combine(CurrentOptions.Path, "ClassicAssist.dll");

            try
            {
                CurrentOptions.CurrentVersion = VersionHelpers.GetProductVersion(dllPath).ToString();
            }
            catch (Exception)
            {
                CurrentOptions.Force = true;
            }
        }
 public static string GetDropBoxFolder()
 {
     if (string.IsNullOrEmpty(_folder))
     {
         var dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Dropbox\\host.db");
         if (VersionHelpers.IsWindows10OrGreater())
         {
             dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Dropbox\\host.db");
         }
         try
         {
             var dbBase64Text = Convert.FromBase64String(File.ReadAllText(dbPath));
             var lastIndex    = 0;
             for (int i = 0; i < dbBase64Text.Length; i++)
             {
                 if (dbBase64Text[i] == 52)
                 {
                     lastIndex = i;
                 }
             }
             var path = dbBase64Text.Skip(lastIndex + 1).ToArray();
             _folder = Encoding.UTF8.GetString(path);
         }
         catch (Exception e)
         {
             _log.Error(e);
             return(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
         }
     }
     return(_folder);
 }
Exemplo n.º 3
0
        public void When_Windows_Insider_Version_ToLong()
        {
            var version     = new Version("10.0.22523.1000");
            var longVersion = VersionHelpers.ToLong(version);

            Assert.AreEqual(2814751243174888L, longVersion);
        }
Exemplo n.º 4
0
        public static CrashReport Generate(Exception exception)
        {
            StringBuilder builder     = new();
            DateTime      currentTime = DateTime.Now;

            builder
            .AppendLine($"PixiEditor {VersionHelpers.GetCurrentAssemblyVersionString()} crashed on {currentTime:yyyy.MM.dd} at {currentTime:HH:mm:ss}\n")
            .AppendLine("-----System Information----")
            .AppendLine("General:")
            .AppendLine($"  OS: {Environment.OSVersion.VersionString}")
            .AppendLine();

            CrashHelper helper = new();

            try
            {
                helper.GetCPUInformation(builder);
            }
            catch (Exception cpuE)
            {
                builder.AppendLine($"Error ({cpuE.GetType().FullName}: {cpuE.Message}) while gathering CPU information, skipping...");
            }

            try
            {
                helper.GetGPUInformation(builder);
            }
            catch (Exception gpuE)
            {
                builder.AppendLine($"Error ({gpuE.GetType().FullName}: {gpuE.Message}) while gathering GPU information, skipping...");
            }

            try
            {
                helper.GetMemoryInformation(builder);
            }
            catch (Exception memE)
            {
                builder.AppendLine($"Error ({memE.GetType().FullName}: {memE.Message}) while gathering memory information, skipping...");
            }

            CrashHelper.AddExceptionMessage(builder, exception);

            string filename = $"crash-{currentTime:yyyy-MM-dd_HH-mm-ss_fff}.zip";
            string path     = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                "PixiEditor",
                "crash_logs");

            Directory.CreateDirectory(path);

            CrashReport report = new();

            report.FilePath   = Path.Combine(path, filename);
            report.ReportText = builder.ToString();

            return(report);
        }
Exemplo n.º 5
0
    partial void Initialize()
    {
        DeviceFamily = $"{OsName}.{AnalyticsInfo.DeviceForm}";

        if (Version.TryParse(UIDevice.CurrentDevice.SystemVersion, out var version))
        {
            DeviceFamilyVersion = VersionHelpers.ToLong(version).ToString();
        }
    }
Exemplo n.º 6
0
    partial void Initialize()
    {
        DeviceFamily = $"{OsName}.{AnalyticsInfo.DeviceForm}";

        if (Version.TryParse(NSProcessInfo.ProcessInfo.OperatingSystemVersionString, out var version))
        {
            DeviceFamilyVersion = VersionHelpers.ToLong(version).ToString();
        }
    }
Exemplo n.º 7
0
 public VersionMetadata(string metadataString)
 {
     string[] parts;
     if (!VersionHelpers.TryParseVersionSuffix(metadataString, out parts))
     {
         throw new ArgumentException($"Invalid metadata. String '{metadataString}', does not match requirements");
     }
     this.metadataString = metadataString;
     Parts = parts;
 }
Exemplo n.º 8
0
 public PreReleaseIdentifier(string identifierString)
 {
     string[] parts;
     if (!VersionHelpers.TryParseVersionSuffix(identifierString, out parts))
     {
         throw new ArgumentException($"Invalid prerelease identifier. String '{identifierString}', does not match requirements");
     }
     this.identifierString = identifierString;
     Parts = parts;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Tries the parse.
 /// </summary>
 /// <param name="s">The s.</param>
 /// <param name="version">The version.</param>
 /// <returns>True if the parse succeeds</returns>
 public static bool TryParse(string s, out DtoVersion version)
 {
     try
     {
         version = VersionHelpers.ParseVersionString(s);
         return(true);
     }
     catch (Exception)
     {
         version = null;
         return(false);
     }
 }
Exemplo n.º 10
0
    partial void Initialize()
    {
        DeviceFamily = $"{OsName}.{AnalyticsInfo.DeviceForm}";
        var versionString = Build.VERSION.Release;

        if (int.TryParse(versionString, out var intVersion))
        {
            versionString = $"{intVersion}.0.0.0";
        }
        if (Version.TryParse(versionString, out var version))
        {
            DeviceFamilyVersion = VersionHelpers.ToLong(version).ToString();
        }
    }
Exemplo n.º 11
0
        public AboutControlViewModel()
        {
            Assembly assembly = Assembly.GetExecutingAssembly();

            Version   = VersionHelpers.GetProductVersion(assembly);
            BuildDate = $"{GetBuildDateTime( assembly ).ToLongDateString()}";

            Engine.ConnectedEvent            += OnConnectedEvent;
            Engine.DisconnectedEvent         += OnDisconnectedEvent;
            Engine.PlayerInitializedEvent    += PlayerInitializedEvent;
            Engine.Items.CollectionChanged   += ItemsOnCollectionChanged;
            Engine.Mobiles.CollectionChanged += MobilesOnCollectionChanged;

            IncomingPacketHandlers.MobileUpdatedEvent += OnMobileUpdatedEvent;
        }
Exemplo n.º 12
0
 public static SwapEffect GetBestSwapEffectForPlatform(Version version = null)
 {
     if (version == null)
     {
         version = VersionHelpers.GetWindowsVersion();
     }
     if (version.Major > 6)
     {
         return(SwapEffect.FlipDiscard);                   // Win 10+
     }
     if ((version.Major > 5) && (version.Minor > 1))
     {
         return(SwapEffect.FlipSequential);                                            // 6.2+ - Win 8+
     }
     return(SwapEffect.Discard);
 }
Exemplo n.º 13
0
        public SemanticVersion(string versionString)
        {
            int major, minor, patch;
            PreReleaseIdentifier?preRelease;
            VersionMetadata?     metadata;

            if (!VersionHelpers.TryParseVersion(versionString,
                                                out major, out minor, out patch,
                                                out preRelease, out metadata))
            {
                throw new ArgumentException($"Cannot parse semantic version '{versionString}'");
            }
            Major      = major;
            Minor      = minor;
            Patch      = patch;
            PreRelease = preRelease;
            Metadata   = metadata;
        }
Exemplo n.º 14
0
 public static int GetVariantForPlatform(Version platformVersion = null)
 {
     if (platformVersion == null)
     {
         platformVersion = VersionHelpers.GetWindowsVersion();
     }
     if (platformVersion.Major > 6)
     {
         return(2);
     }
     if (platformVersion.Major == 6)
     {
         if (platformVersion.Minor > 2)
         {
             return(2);
         }
         if (platformVersion.Minor > 1)
         {
             return(1);
         }
     }
     return(0);
 }
Exemplo n.º 15
0
        static void Main(string[] args)
        {
            Console.WriteLine($"Is Windows Server? {VersionHelpers.IsWindowsServer()}");

            Console.ReadKey();
        }
Exemplo n.º 16
0
 /// <summary>
 /// Parses the specified version.
 /// </summary>
 /// <param name="s">The string version.</param>
 /// <returns>
 /// The <see cref="Version" />
 /// </returns>
 public static DtoVersion Parse(string s)
 {
     return(VersionHelpers.ParseVersionString(s));
 }