示例#1
0
            /// <summary>
            /// Populates the version settings
            /// </summary>
            private void getSettings()
            {
                versionInfo version;

                versions = new List <versionInfo>();

                switch (m_DataType)
                {
                case (EDIDataTypes.TMD):
                    typeName          = "Totalized Meter Data";
                    folderName        = "MMP-TMD";
                    fileNameStructure = "CNF-!~ACCOUNTNAME~!_MMP-TMD_!~DATE:YYYYMMDD~!";

                    version = new versionInfo(1, "V1", "_v1", -2, 0, "06:00:00");
                    versions.Add(version);
                    version = new versionInfo(2, "V2", "_v2", -1, -8, "06:00:00");
                    versions.Add(version);
                    version = new versionInfo(3, "V3", "_v3", -1, -18, "06:00:00");
                    versions.Add(version);
                    version = new versionInfo(4, "V4", "_v1", -1, -5, "06:00:00");
                    versions.Add(version);
                    break;

                case (EDIDataTypes.TMD_WL):
                    typeName          = "Totalized Meter Data With Losses";
                    folderName        = "MMP-TMD-WL";
                    fileNameStructure = "CNF-!~ACCOUNTNAME~!_MMP-TMD-WL_!~DATE:YYYYMMDD~!";

                    version = new versionInfo(1, "V1", "_v1", -2, 0, "06:00:00");
                    versions.Add(version);
                    version = new versionInfo(2, "V2", "_v2", -1, -8, "06:00:00");
                    versions.Add(version);
                    version = new versionInfo(3, "V3", "_v3", -1, -18, "06:00:00");
                    versions.Add(version);
                    version = new versionInfo(4, "V4", "_v1", -1, -5, "06:00:00");
                    versions.Add(version);
                    break;

                case (EDIDataTypes.VMD):
                    typeName          = "Verified Meter Data";
                    folderName        = "MMP-VMD";
                    fileNameStructure = "CNF-!~ACCOUNTNAME~!_MMP-VMD_!~DATE:YYYYMMDD~!";

                    version = new versionInfo(1, "V1", "_v1", -1, 0, "08:00:00");
                    versions.Add(version);
                    version = new versionInfo(2, "V2", "_v2", -1, -8, "08:00:00");
                    versions.Add(version);
                    version = new versionInfo(3, "V3", "_v3", -1, -18, "08:00:00");
                    versions.Add(version);
                    version = new versionInfo(4, "V4", "_v1", -1, -5, "06:00:00");
                    versions.Add(version);
                    break;
                }
            }
示例#2
0
        public static void DescribeAssetBundles(List <assetBundleJSON> bundles)
        {
            {
                Dictionary <string, versionInfo> versions = new Dictionary <string, versionInfo>()
                {
                    { "pc", new versionInfo() },
                    { "android", new versionInfo() },
                    { "mac", new versionInfo() },
                };

                string currentString = "current (version " + Common.currentUnityVersion + ")";
                foreach (assetBundleJSON ab in bundles)
                {
                    DateTime created = Common.ParseTimeString(ab.created_at);
                    created = created.ToLocalTime();

                    versionInfo v = null;
                    versions.TryGetValue(ab.platform, out v);
                    if (v != null && ab.game_engine_version > v.version)
                    {
                        versions[ab.platform] = new versionInfo()
                        {
                            version = ab.game_engine_version, created = created
                        }
                    }
                    ;
                }

                Common.DisplayStatus("  PC", "ABSENT", versions["pc"].versionstring, currentString);
                if (versions["pc"].present)
                {
                    Common.DisplayStatus("", "never", versions["pc"].datestring);
                }

                Common.DisplayStatus("  Android", "ABSENT", versions["android"].versionstring, currentString);
                if (versions["android"].present)
                {
                    Common.DisplayStatus("", "never", versions["android"].datestring);
                }

                Common.DisplayStatus("  Mac", "ABSENT", versions["mac"].versionstring, currentString);
                if (versions["mac"].present)
                {
                    Common.DisplayStatus("", "never", versions["mac"].datestring);
                }
            }
        }
        void manifest_DownloadCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                return;
            }

            versionInfo bzip = new versionInfo();
            versionInfo gzip = new versionInfo();
            versionInfo wzip = new versionInfo();

            versionInfo web = new versionInfo();

            versionInfo current = new versionInfo(Assembly.GetExecutingAssembly().GetName().Version.ToString());

            current.hash = Decompressor.MD5Verify.ComputeHash(Assembly.GetExecutingAssembly().Location);
            current.uri  = "";

            string strHelpHashMe = "";
            string strHelpFile   = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Properties.Settings.Default.HelpOfflineFile);

            if (File.Exists(strHelpFile))
            {
                strHelpHashMe = Decompressor.MD5Verify.ComputeHash(strHelpFile);
            }
            else
            {
                // help file does not exist
                if (Properties.Settings.Default.HelpOffline || blnOnlyHelpFile)
                {
                    strHelpHashMe = "*";                     // force new update
                }
                else
                {
                    strHelpHashMe = "";                     // no update
                    this.labelHelpFile.Visible          = false;
                    this.labelHelpversionString.Visible = false;
                }
            }

            StringReader sr = new StringReader(e.Result);

            for (int intI = 0; intI < 255; intI++)
            {
                string strLine = sr.ReadLine();
                if (strLine == null)
                {
                    break;
                }

                int intSplit = strLine.IndexOf("=");
                if (intSplit < 0)
                {
                    continue;
                }

                string strName  = strLine.Substring(0, intSplit);
                string strValue = strLine.Substring(intSplit + 1);

                //All hashes are of the uncompressed file. However, different archives may contain different versions.
                switch (strName)
                {
                case "Version":
                case "BZipVersion":
                    bzip = new versionInfo(strValue);
                    break;

                case "Hash":
                case "BZipHash":
                    bzip.hash = strValue;
                    break;

                case "Url":
                case "BZipUrl":
                    bzip.uri = strValue;
                    break;

                case "GZipVersion":
                    gzip = new versionInfo(strValue);
                    break;

                case "GZipHash":
                    gzip.hash = strValue;
                    break;

                case "GZipUrl":
                    gzip.uri = strValue;
                    break;

                case "ZipVersion":
                    wzip = new versionInfo(strValue);
                    break;

                case "ZipHash":
                    wzip.hash = strValue;
                    break;

                case "ZipUrl":
                    wzip.uri = strValue;
                    break;

                case "HelpHash":
                    strHelpHashWeb = strValue;
                    break;

                case "HelpUrl2":
                    strHelpUrl = strValue;
                    break;

                case "HelpReferer":
                    strHelpReferer = strValue;
                    break;

                default:
                    break;
                }
            }

            web = bzip;

            /*
             * if (!String.IsNullOrEmpty(gzip.uri) && (gzip.compare(web) == 1))
             * {
             *      web = gzip;
             * }
             *
             *
             * if (!String.IsNullOrEmpty(wzip.uri) && (wzip.compare(web) == 1))
             * {
             *      web = wzip;
             * }
             */
            strHashWeb = web.hash;

            this.labelOurVersionString.Text    = current.version.ToString();
            this.labelLatestVersionString.Text = web.version.ToString();

            if (String.IsNullOrEmpty(web.uri) || (web.version.CompareTo(current.version) != 1))
            {
                return;
            }

            if (strHelpHashMe == "")
            {
                strHelpHashMe = strHelpHashWeb;
            }

            if (strHelpHashMe == strHelpHashWeb)
            {
                this.labelHelpversionString.Text = "Up to date";
                this.strHelpUrl = null;
            }
            else
            {
                this.labelHelpversionString.Text = "Out of date";
            }

            if (current.hash == web.hash)
            {
                this.strDownloadUrl = null;
            }
            else
            {
                this.strDownloadUrl = web.uri;
            }

            if (this.blnOnlyHelpFile)
            {
                this.strDownloadUrl                   = null;
                this.labelLatestVersion.Visible       = false;
                this.labelLatestVersionString.Visible = false;
            }

            if (this.strHelpUrl != null || this.strDownloadUrl != null)
            {
                this.buttonUpdate.Enabled = true;

                if (OnUpdateAvailable != null)
                {
                    OnUpdateAvailable(this, null);
                }
            }
        }