public LoginDetails(string username, string password, string secretAnswer, Platform platform, AppVersion appVersion)
 {
     username.ThrowIfInvalidArgument();
     password.ThrowIfInvalidArgument();
     secretAnswer.ThrowIfInvalidArgument();
     Username = username;
     Password = password;
     SecretAnswer = secretAnswer;
     Platform = platform;
     AppVersion = appVersion;
 }
示例#2
0
        private async Task <string> UpdatePreview()
        {
            // generate release notes

            bool showAllChanges = false;

            UpdateMessage.Text = _update.Message.Body;

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("**Release Notes**\n");

            sb.AppendLine($"{_update.Message.ReleaseNotesURL}\n");

            if (_update.Message.ReleaseNotes != null)
            {
                foreach (var note in _update.Message.ReleaseNotes)
                {
                    if (showAllChanges || _update.InstalledVersion == null || AppVersion.IsOtherVersionNewer(_update.InstalledVersion, AppVersion.FromString(note.Version)))
                    {
                        sb.AppendLine($"{note.Version}: {note.ReleaseDate}");
                        sb.AppendLine($"{note.Body}\n");
                        sb.AppendLine($"-------------------------\n");
                    }
                }
            }

            var result = Markdig.Markdown.ToHtml(sb.ToString(), _markdownPipeline);

            result = "<html><head><meta http-equiv='Content-Type' content='text/html;charset=UTF-8'><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />" +
                     "<style>" + _css + "</style></head><body>" + result + "</body></html>";

            return(await Task.FromResult(result));
        }
示例#3
0
        /// <summary>
        /// This program calculates the MD5 hashes for the given input files
        /// </summary>
        /// <param name="args"></param>
        private void Run(string[] args)
        {
            Console.OutputEncoding = Encoding.GetEncoding(Encoding.Default.CodePage);
            Args = new InputArgs("touch", string.Format(resource.IDS_TITLE, AppVersion.Get()) + "\r\n" + resource.IDS_COPYRIGHT);

            Args.Add(InputArgType.Parameter, "date", "", Presence.Optional, resource.IDS_CMD_date_doc);
            Args.Add(InputArgType.Parameter, "time", "", Presence.Optional, resource.IDS_CMD_time_doc);
            Args.Add(InputArgType.Flag, "recursive", false, Presence.Optional, resource.IDS_CMD_recursive_doc);
            Args.Add(InputArgType.RemainingParameters, "DIR {DIR}", null, Presence.Optional, resource.IDS_CMD_dir_doc);

            if (Args.Process(args))
            {
                DateTime dateSpec = DateTime.Now;
                DateTime timeSpec = DateTime.Now;
                string   date     = Args.GetString("DATE");
                if (!string.IsNullOrEmpty(date))
                {
                    try
                    {
                        dateSpec = DateTime.Parse(date);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        Console.WriteLine(e.StackTrace);
                        Console.WriteLine(resource.IDS_ERR_unable_to_decode_date, date);
                        return;
                    }
                }
                string time = Args.GetString("TIME");
                if (!string.IsNullOrEmpty(time))
                {
                    try
                    {
                        timeSpec = DateTime.Parse(time);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        Console.WriteLine(e.StackTrace);
                        Console.WriteLine(resource.IDS_ERR_unable_to_decode_time, time);
                        return;
                    }
                }
                TimeStamp = new DateTime(dateSpec.Year, dateSpec.Month, dateSpec.Day, timeSpec.Hour, timeSpec.Minute, timeSpec.Second);

                Recursive = Args.GetFlag("recursive");

                List <string> directories = Args.GetStringList("DIR {DIR}");
                if (directories == null)
                {
                    Read(Directory.GetCurrentDirectory());
                }
                else
                {
                    foreach (string directory in directories)
                    {
                        Read(SanitizeInput(directory));
                    }
                }
            }
        }
 internal static Member NewUpMember(string host, int port = 252525, AppVersion version = null) => LeastShardAllocationStrategySpec.NewUpMember(host, port, version);
 /// <summary>
 /// 对比版本是否相同(不对比d 资源版本号)
 /// </summary>
 /// <param name="v1"></param>
 /// <param name="v2"></param>
 /// <returns></returns>
 public static bool Equals(AppVersion v1, AppVersion v2)
 {
     return(v1.ToABC() == v2.ToABC());
 }
示例#6
0
 public static Member Create(Address address, MemberStatus status, ImmutableHashSet <string> roles, int uid = 0, int upNumber = 0, AppVersion appVersion = null)
 {
     return(Member.Create(new UniqueAddress(address, uid), upNumber, status, roles, appVersion ?? AppVersion.Zero));
 }
        public void Can_serialize_Join()
        {
            var address       = new Address("akka.tcp", "system", "some.host.org", 4711);
            var uniqueAddress = new UniqueAddress(address, 17);
            var message       = new InternalClusterAction.Join(uniqueAddress, ImmutableHashSet.Create("foo", "bar"), AppVersion.Zero);

            AssertEqual(message);

            message = new InternalClusterAction.Join(uniqueAddress, ImmutableHashSet.Create("foo", "bar"), AppVersion.Create("1.2.3"));
            AssertEqual(message);
        }
示例#8
0
        public App()
        {
            InitializeComponent();
            DependencyService.Register <PlayerDataStore>();
            DependencyService.Register <ProfileDataStore>();
            DependencyService.Register <GolfclubDataStore>();
            DependencyService.Register <EventDataStore>();
            DependencyService.Register <TournamentDataStore>();
            DependencyService.Register <CourseDataStore>();
            DependencyService.Register <CourseHandicapTableDataStore>();
            DependencyService.Register <CourseHandicapDataStore>();
            DependencyService.Register <FlightDataStore>();
            DependencyService.Register <Flight2PlayerDataStore>();
            DependencyService.Register <TeeDataStore>();
            DependencyService.Register <ResultDataStore>();
            DependencyService.Register <TeeInfoDataStore>();
            DependencyService.Register <AppVersionDataStore>();

            DependencyService.Register <ILocationUpdateService>();

            Device.SetFlags(new string[] { "Expander_Experimental" });

            // check appversion table - if no entries, create first entry
            IDataStore <AppVersion> AppVersions = DependencyService.Get <IDataStore <AppVersion> >();

            var        appVersionsTask = AppVersions.GetItemsAsync();
            AppVersion v = appVersionsTask.Result.FirstOrDefault();

            if (v == null)
            {
                // create first version
                AppVersion newVersion = new AppVersion()
                {
                    Version   = 200,
                    DBVersion = "2"
                };
                AppVersions.AddItemAsync(newVersion);
            }

            // sync events
            SyncWebData();

            MainPage = new MainPage();

            ILocationUpdateService LocationUpdateService = DependencyService.Get <ILocationUpdateService>();

            LocationUpdateService.LocationChanged += LocationUpdateService_LocationChanged;

            //try
            //{
            //    //var location = await Geolocation.GetLastKnownLocationAsync();
            //    var request = new GeolocationRequest(GeolocationAccuracy.Medium, new TimeSpan(0, 0, 10));
            //    var tasklocation = Geolocation.GetLocationAsync(request);
            //    var location = tasklocation.Result;

            //    if (location != null)
            //    {
            //        // save location in profile
            //    }
            //}
            //catch (Exception exp)
            //{
            //    // manage exception
            //}
        }
示例#9
0
    IEnumerator Start()
    {
        //save version at first start up
        if (!PlayerPrefs.HasKey("Version String"))
        {
            Debug.Log("Version String: " + AppVersion.GetCurrentVersionString());
            PlayerPrefs.SetString("Version String", AppVersion.GetCurrentVersionString());
        }

        if (!PlayerPrefs.HasKey("Building String"))
        {
            Debug.Log("Building String: " + AppVersion.GetCurrentBuildString());
            PlayerPrefs.SetString("Building String", AppVersion.GetCurrentBuildString());
        }

/*
 *      Logging.GetLogger("App.Boot").SetLevel(Logging.DEBUG);
 *              Logging.GetLogger("App.FCDownloadManager").SetLevel(Logging.DEBUG);
 *      Logging.GetLogger("Package.DynamicContentPipeline").SetLevel(Logging.DEBUG);
 *      Logging.GetLogger("Package.ForcedUpdate").SetLevel(Logging.DEBUG);
 *      Logging.GetLogger("Package.ABTesting").SetLevel(Logging.DEBUG);
 *      Logging.GetLogger("Package.AssetBundles").SetLevel(Logging.DEBUG);
 *      Logging.GetLogger("Package.LiveOpsManager").SetLevel(Logging.DEBUG);
 */

//        DynamicContent.OnForcedBinariesUpdate = delegate
//        {
//            Debug.Log("ForcedUpdate is required");
//            Application.OpenURL(ForcedUpdate.GetUpdateURL()); // opens page on AppStore
//        };
//		DynamicContent.OnNoNeedBinariesUpdate = delegate
//		{
//			Debug.Log("No Forced update");
//			FCDownloadManager.Instance.UpdateAllIndexDownloaded();
//		};
//		FCDownloadManager.Instance.OnDownloadSuccess = null;
        FCDownloadManager.Instance.OnDownloadSuccess = delegate(FCDownloadManager.FCIndexDownloadInfo indexInfo)
        {
            Debug.Log(indexInfo.IndexDownloadName + " is load success!");
        };
        FCDownloadManager.Instance.OnStartNewDownload = null;

        FCDownloadManager.Instance.OnAllDownloadFinished = delegate
        {
            Debug.Log("Loaded successfully");

            Assertion.Check(Application.CanStreamedLevelBeLoaded(LEVEL_TO_LOAD));
#if DEVELOPMENT_BUILD || UNITY_EDITOR
            if (!CheatManager.needCheckSplashText)
            {
                AppLoading.Instance.LoadingStep = APP_LOADING_STEP.SCENE_GAMELUNCH;
                //FCDownloadManager.Instance.IsBackgroundMode = true;
                Application.LoadLevel(LEVEL_TO_LOAD);
            }
#endif
        };

        FCDownloadManager.Instance.OnDownloadFailed = delegate(FCDownloadManager.FCIndexDownloadInfo indexInfo)
        {
            FCDownloadManager.Instance.RemoveAllDownloads(FCDownloadManager.DownloadType.DT_Foreground);
        };

        FCDownloadManager.Instance.OnForceUpdate = delegate(string URL)
        {
        };

        FCDownloadManager.Instance.OnServerCheckFailed = delegate
        {
            Debug.LogError("FCDownloadManager.Instance.OnServerCheckFailed");
        };

        FCDownloadManager.Instance.OnServerMaintaining = delegate(string maintainMessage)
        {
        };

        FCDownloadManager.Instance.OnServerAvailable = delegate
        {
            Debug.Log("FCDownloadManager.Instance.OnServerAvailable");
            AppLoading.Instance.LoadingStep = APP_LOADING_STEP.BUNDLE_CHECK;
            FCDownloadManager.Instance.Init();
            FCDownloadManager.Instance.CheckDynamicContentInfo();
            FCDownloadManager.Instance.UpdateAllIndexDownloaded();
        };

        if (Started != null)
        {
            Started();
        }

        yield return(null);

        if (NetworkManager.isOfflinePlay)
        {
            AppLoading.Instance.LoadingStep = APP_LOADING_STEP.SCENE_GAMELUNCH;
            Application.LoadLevel("GameLaunch");
        }
        else
        {
            FCDownloadManager.Instance.CheckServerPost();
        }
    }
示例#10
0
        public MainForm()
        {
            InitializeComponent();
            Text += " " + Version;
            DateTime from = DateTime.UtcNow;

            fromDate.Value         = new DateTime(from.Year, from.Month, from.Day);
            toDate.Value           = fromDate.Value.AddDays(1);
            fromDate.ValueChanged += (o, e) =>
            {
                if (toDate.Value < fromDate.Value)
                {
                    toDate.Value = fromDate.Value.AddDays(1);
                }
            };
            llPresets.Click += (o, e) =>
            {
                ctxPresets.Show(llPresets, llPresets.PointToClient(Control.MousePosition));
            };
            dataGridView1.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithAutoHeaderText;
            dataGridView1.MultiSelect       = true;
            dataGridView1.CellDoubleClick  += HandleCellDoubleClick;
            typeof(DataGridView).InvokeMember(
                "DoubleBuffered",
                BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
                null,
                dataGridView1,
                new object[] { true });
            UpdateAccountSelection();

            // OrderBy vullen
            foreach (var enumname in Enum.GetNames(typeof(OrderBy)))
            {
                orderByCombo.Items.Add(enumname);
            }
            orderByCombo.SelectedIndex = 0;

            // Filter textbox
            filterTextBox.GotFocus  += HandleFilterGotFocus;
            filterTextBox.LostFocus += HandleFilterLostFocus;
            filterTextBox.KeyUp     += HandleFilterKeyup;
            HandleFilterLostFocus(this, EventArgs.Empty);

            // Extra opties
            useOptimizedQueriesForWADTablesToolStripMenuItem.Checked = Configuration.Instance.UseWADPerformanceOptimization;
            useOptimizedQueriesForWADTablesToolStripMenuItem.Click  += (src, evt) =>
            {
                Configuration.Instance.UseWADPerformanceOptimization     = !Configuration.Instance.UseWADPerformanceOptimization;
                useOptimizedQueriesForWADTablesToolStripMenuItem.Checked = Configuration.Instance.UseWADPerformanceOptimization;
                Configuration.Instance.Save();
            };
            convertEventTickCountColumnToReadableFormatToolStripMenuItem.Checked = Configuration.Instance.ConvertEventTickCount;
            convertEventTickCountColumnToReadableFormatToolStripMenuItem.Click  += (src, evt) =>
            {
                Configuration.Instance.ConvertEventTickCount = !Configuration.Instance.ConvertEventTickCount;
                convertEventTickCountColumnToReadableFormatToolStripMenuItem.Checked = Configuration.Instance.ConvertEventTickCount;
                Configuration.Instance.Save();
            };
            showPerfCountersAsChartMenuItem.Checked = Configuration.Instance.ShowPerformanceCountersAsChart;
            showPerfCountersAsChartMenuItem.Click  += (src, evt) =>
            {
                Configuration.Instance.ShowPerformanceCountersAsChart = !Configuration.Instance.ShowPerformanceCountersAsChart;
                showPerfCountersAsChartMenuItem.Checked = Configuration.Instance.ShowPerformanceCountersAsChart;
                Configuration.Instance.Save();
            };
            useKarellPartitionKey.Checked = Configuration.Instance.UseKarellPartitionKey;
            useKarellRowKey.Checked       = Configuration.Instance.UseKarellRowKey;

            delayedFilterTextChangedTimer          = new Timer();
            delayedFilterTextChangedTimer.Interval = 500;
            delayedFilterTextChangedTimer.Tick    += DelayedFilterTextChangedTimerTick;

            // New version check
            AppVersion.CheckForUpdateAsync();
        }
 private void UpdateService_UpdateIsAvailable(AppVersion appVersion)
 {
 }
示例#12
0
 void OnAppVersionFinished(AppVersion app)
 {
     Debug.Log("StartScene OnAppVersionFinished");
     RunApp();
 }
示例#13
0
        public static byte[] GetMemorySize(AppVersion ver, Memory mem)
        {
            List <byte> data;

            if (mem.IsAutoSize)
            {
                data = new List <byte>();
            }
            else
            {
                data = new List <byte>(new byte[mem.Size]);
            }

            foreach (Models.Parameter para in ver.Parameters.Where(p => p.Memory == mem.Name))
            {
                if (para.ParameterTypeObject.SizeInBit > 7)
                {
                    if (mem.IsAutoSize || para.IsOffsetAuto)
                    {
                        para.Offset    = -1;
                        para.OffsetBit = 0;
                    }
                    for (int i = 0; i < (para.ParameterTypeObject.SizeInBit / 8); i++)
                    {
                        if (mem.IsAutoSize)
                        {
                            if (para.Offset == -1)
                            {
                                para.Offset    = data.Count;
                                para.OffsetBit = 0;
                            }
                            data.Add(8);
                        }
                        else
                        {
                            data[para.Offset + i] += 8;
                        }
                    }
                }
                else
                {
                    if (mem.IsAutoSize || para.IsOffsetAuto)
                    {
                        bool flag = false;
                        for (int i = 0; i < data.Count; i++)
                        {
                            if (8 - data[i] >= para.ParameterTypeObject.SizeInBit)
                            {
                                para.Offset    = i;
                                para.OffsetBit = data[i];
                                data[i]        = Convert.ToByte(data[i] + para.ParameterTypeObject.SizeInBit);
                                flag           = true;
                                break;
                            }
                        }
                        if (!flag)
                        {
                            para.Offset    = data.Count;
                            para.OffsetBit = 0;
                            data.Add(Convert.ToByte(para.ParameterTypeObject.SizeInBit));
                        }
                    }
                    else
                    {
                        data[para.Offset] += Convert.ToByte(para.ParameterTypeObject.SizeInBit);
                    }
                }
            }

            if (mem.IsAutoSize)
            {
                mem.Size = data.Count;
            }


            return(data.ToArray());
        }
        public Resources(AppVersion appVersion)
        {
            switch (appVersion)
            {
                case AppVersion.WebApp:

                    Validate = "https://www.easports.com/iframe/fut17/p/ut/game/fifa17/phishing/validate";

                    Auth = "https://www.easports.com/iframe/fut17/p/ut/auth";

                    Home = "https://www.easports.com/fifa/ultimate-team/web-app";

                    NucleusId = "https://www.easports.com/iframe/fut17/?locale=en_US&baseShowoffUrl=https%3A%2F%2Fwww.easports.com%2Ffifa%2Fultimate-team%2Fweb-app%2Fshow-off&guest_app_uri=http%3A%2F%2Fwww.easports.com%2Ffifa%2Fultimate-team%2Fweb-app";

                    Shards = "https://www.easports.com/iframe/fut17/p/ut/shards/v2?_={0}";

                    AccountInfo = "https://www.easports.com/iframe/fut17/p/ut/game/fifa17/user/accountinfo?sku=FUT17WEB&_={0}";

                    Item = "https://fifa17.content.easports.com/fifa/fltOnlineAssets/CC8267B6-0817-4842-BB6A-A20F88B05418/2017/fut/items/web/{0}.json";

                    PlayerImage = "http://fifa17.content.easports.com/fifa/fltOnlineAssets/CC8267B6-0817-4842-BB6A-A20F88B05418/2017/fut/items/images/players/web/{0}.png";

                    FlagsImage = "http://fifa17.content.easports.com/fifa/fltOnlineAssets/CC8267B6-0817-4842-BB6A-A20F88B05418/2017/fut/items/images/cardflagssmall/web/{0}.png";

                    ClubImage = "http://fifa17.content.easports.com/fifa/fltOnlineAssets/CC8267B6-0817-4842-BB6A-A20F88B05418/2017/fut/items/images/clubbadges/web/dark/s{0}.png";

                    break;

                case AppVersion.CompanionApp:

                    Validate = "https://utas.s2.fut.ea.com/ut/game/fifa17/phishing/validate";

                    Auth = "https://utas.s2.fut.ea.com/ut/auth?timestamp={0}";

                    Home = "https://accounts.ea.com/connect/auth?client_id=FIFA-17-MOBILE-COMPANION&response_type=code&display=web2/login&scope=basic.identity+offline+signin&locale=en_GB&prompt=login&machineProfileKey={0}";

                    NucleusId = "https://pas.mob.v3.easfc.ea.com:8095/pow/user/self/tiergp/NucleusId/tiertp/{0}?offset=0&count=50&_={1}";

                    Shards = "https://utas.mob.v3.fut.ea.com/ut/shards/v2?_={0}";

                    AccountInfo = "https://utas.s2.fut.ea.com/ut/game/fifa17/user/accountinfo?sku=FUT17AND&_={0}";

                    Item = "https://fifa17.content.easports.com/fifa/fltOnlineAssets/CC8267B6-0817-4842-BB6A-A20F88B05418/2017/fut/items/web/{0}.json";

                    PlayerImage = "http://fifa17.content.easports.com/fifa/fltOnlineAssets/CC8267B6-0817-4842-BB6A-A20F88B05418/2017/fut/items/images/players/web/{0}.png";

                    FlagsImage = "http://fifa17.content.easports.com/fifa/fltOnlineAssets/CC8267B6-0817-4842-BB6A-A20F88B05418/2017/fut/items/images/cardflagssmall/web/{0}.png";

                    ClubImage = "http://fifa17.content.easports.com/fifa/fltOnlineAssets/CC8267B6-0817-4842-BB6A-A20F88B05418/2017/fut/items/images/clubbadges/web/dark/s{0}.png";

                    break;
                default:
                    throw new ArgumentOutOfRangeException(nameof(appVersion), appVersion, null);
            }
        }
示例#15
0
 public void LessThanOperator_Test_NotLessThan(string lhs, string rhs)
 {
     Assert.IsFalse(AppVersion.Parse(lhs) < AppVersion.Parse(rhs));
 }
 /// <summary>
 /// Checks the app version concurrency.
 /// </summary>
 /// <returns></returns>
 public bool CheckAppVersionConcurrency()
 {
     return(AppVersion.ToString().CompareTo(AppSettings.RequiredAppVersion) == 0);
 }
示例#17
0
        private AppProject AddNewApp(TencentAppStoreModel.AppListItem app, AppProject appProject, AppInfo appInfo)
        {
            try
            {
                #region Set up Applist
                appProject = new AppProject();
                var appProjectId = RedisService.Add <AppProject>(appProject);
                App ap           = new App();
                var appId        = RedisService.Add <App>(ap);
                AppSettingsForAppList appSetting = new AppSettingsForAppList()
                {
                    Id             = appId,
                    CreateDateTime = DateTime.Now
                };
                CustomProperty prop = new CustomProperty()
                {
                    Id    = AppConfigKey.OS_ATTR_ID,
                    Value = AppConfigKey.OS_ATTR_VALUE
                };
                RedisService.AddCustomPropertyFor <App, CustomProperty>(ap.Id, prop);


                var lcdDetails = AppStoreUIService.GetElementDetailList(AppConfigKey.LCD_ATTR_ID);
                foreach (var lcd in lcdDetails)
                {
                    SetLCD(ap.Id, lcd.Value.ToString());
                }

                AppStoreUIService.SetAppForAppList <AppProject>(appProjectId, appSetting);
                #endregion

                #region Set up app project
                var originalAppProject = CloneHelper.DeepClone <AppProject>(appProject);
                appProject.AppNo       = "tencent_" + app.appid;
                appProject.Creator     = app.cpname;
                appProject.LogoFile    = GetFileNameFromUri(appInfo.logo);
                appProject.Name        = appInfo.name;
                appProject.PackageName = appInfo.packageName;
                appProject.Rate        = appInfo.star.ToFloat();
                RedisService.UpdateWithRebuildIndex <AppProject>(originalAppProject, appProject);
                #endregion

                #region Set up App
                var originalApp  = CloneHelper.DeepClone <App>(ap);
                var originalApp2 = RedisService.Get <App>(ap.Id);

                ap.AppNo             = appProject.AppNo;
                ap.AppProjectId      = appProject.Id;
                ap.UseGreaterVersion = true;
                ClientImageInfo lg = new ClientImageInfo
                {
                    BelongsToAppId = ap.Id,
                    FileUrl        = Path.Combine(LogoDirRoot, GetFileNameFromUri(appInfo.logo)),
                    TypeId         = "1"
                };
                RedisService.Add <ClientImageInfo>(lg);
                ap.ClientLogos = new List <ClientImageInfo>
                {
                    lg
                };

                ImageInfo lg2 = new ImageInfo
                {
                    BelongsToAppId = ap.Id,
                    FileUrl        = Path.Combine(LogoDirRoot, GetFileNameFromUri(appInfo.logo))
                };
                RedisService.Add <ImageInfo>(lg2);
                ap.Logo = lg2;

                ap.Name          = appInfo.name;
                ap.OrderNumber   = appInfo.downnum;
                ap.DownloadTimes = appInfo.downnum;
                ap.Status        = 1;
                foreach (var s in appInfo.images)
                {
                    ImageInfo ss = new ImageInfo
                    {
                        BelongsToAppId = ap.Id,
                        FileUrl        = Path.Combine(ScreenshotDirRoot, GetFileNameFromUri(s))
                    };
                    RedisService.Add <ImageInfo>(ss);
                    ap.ScreenShot.Add(ss);
                }
                ap.PlatformType = AppConfigKey.PLATFORM_TYPE_ID.ConfigValue().ToInt32();
                ap.Summary      = appInfo.detail.Replace("<br/>", string.Empty).Replace("<br>", string.Empty);
                RedisService.UpdateWithRebuildIndex <App>(originalApp2, ap);
                #endregion

                #region Set up App Version
                if (!string.IsNullOrEmpty(appInfo.apkurl))
                {
                    FileInfo fi = new FileInfo(Path.Combine(APK_Folder_Base, GetFileNameFromUri(appInfo.apkurl)));

                    if (fi != null && fi.Exists)
                    {
                        AppVersion ver = new AppVersion
                        {
                            FileSize        = (int)fi.Length,
                            FileUrl         = GetFileNameFromUri(appInfo.apkurl),
                            PublishDateTime = appInfo.updatetime,
                            Status          = 1,
                            VersionName     = appInfo.apkver,
                            Id = appInfo.versionCode.ToString()
                        };
                        RedisService.SetSubModel <App, AppVersion>(ap.Id, ver);
                        AppStoreUIService.SetAppCurrentTestVersion(appId, ver.Id);
                        AppStoreUIService.PublishAppVersion(appId);

                        AndroidPackageView apkInfo = FileService.GetAndroidPackageInfomation(fi.FullName);
                        apkInfo.Id = ver.Id;
                        RedisService.SetSubModel <App, AndroidPackageView>(ap.Id, apkInfo);
                    }
                }
                #endregion

                #region Set up tags
                if (appInfo.type.StartsWith("soft", StringComparison.OrdinalIgnoreCase))
                {
                    AppStoreUIService.AddTagForAppProject(AppConfigKey.TAG_SOFTWARE, appProject.Id);
                    AppStoreUIService.AddTagForAppProject(AppConfigKey.TAG_TOT_10_SOFTWARE, appProject.Id);
                }
                else
                {
                    AppStoreUIService.AddTagForAppProject(AppConfigKey.TAG_GAME, appProject.Id);
                    AppStoreUIService.AddTagForAppProject(AppConfigKey.TAG_TOT_10_GAMES, appProject.Id);
                }
                AppStoreUIService.AddTagForAppProject(AppConfigKey.TAG_LATEST, appProject.Id);
                AppStoreUIService.AddTagForAppProject(appInfo.category, appProject.Id);
                AddMarketTag(appInfo.category, ap.Id);
                AppStoreUIService.AddTagForApp("Live", ap.Id);
                AppStoreUIService.AddTagForApp("Valid", ap.Id);
                AppStoreUIService.AddTagForAppProject("From_tencent", appProject.Id);
                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.Message + ex.StackTrace);
                LogHelper.WriteInfo(string.Format("This AppProject {0} will delete, appProjectId is {1}", appProject.Name, appProject.Id));
                AppProjectDelete(appProject.Id);
            }
            return(appProject);
        }
        public SdTabInterfaceBuilder(IThreadNotifier mainWindowUiUiNotifier, ICmdListener <IList <BytesPair> > cmdListenerKsmParams, IParameterLogger parameterLogger, IParameterSetter parameterSetter, AppVersion version)
        {
            _uiNotifier           = mainWindowUiUiNotifier;
            _cmdListenerKsmParams = cmdListenerKsmParams;

            _parameterLogger = parameterLogger;
            _parameterSetter = parameterSetter;
            _version         = version;
        }
示例#19
0
        private int AddNewVersionForApp(int newVersionCount, TencentAppStoreModel.AppListItem app, App a)
        {
            newVersionCount++;

            #region Checked TYD App
            var tags = AppStoreUIService.GetTagsByApp(a.Id);
            // if the app has "TYD手动维护" tag, skip it.
            if (tags.FindIndex(x => (x.Name == AppConfigKey.TAG_TYD_SKIP) || (x.Id == AppConfigKey.TAG_TYD_SKIP_ID)) != -1)
            {
                LogHelper.WriteInfo(string.Format("TYD手动维护 -- {0}, skipped", app.name), ConsoleColor.Yellow);

                return(newVersionCount);
            }

            LogHelper.WriteInfo(string.Format("Has new version for app, name {0}, downloading...", app.name), ConsoleColor.Yellow);
            #endregion

            #region Set up App Version
            AppInfo appInfo = DowloadAppInfoAndResources(app.appid.ToString());

            if (!string.IsNullOrEmpty(appInfo.apkurl))
            {
                FileInfo fi = new FileInfo(Path.Combine(APK_Folder_Base, GetFileNameFromUri(appInfo.apkurl)));

                if (fi != null && fi.Exists)
                {
                    AppVersion ver = new AppVersion
                    {
                        FileSize        = (int)fi.Length,
                        FileUrl         = GetFileNameFromUri(appInfo.apkurl),
                        PublishDateTime = appInfo.updatetime,
                        Status          = 1,
                        VersionName     = appInfo.apkver,
                        Id = appInfo.versionCode.ToString()
                    };
                    var originalApp            = RedisService.Get <App>(a.Id);
                    AndroidPackageView apkInfo = FileService.GetAndroidPackageInfomation(fi.FullName);
                    apkInfo.Id = ver.Id;
                    if (a.Status == 0)
                    {
                        RedisService.UpdateWithRebuildIndex <App>(originalApp, a);
                        LogHelper.WriteInfo(string.Format("This App {0} status is invaild", a.Name), ConsoleColor.Gray);
                    }

                    RedisService.SetSubModel <App, AppVersion>(a.Id, ver);
                    RedisService.SetSubModel <App, AndroidPackageView>(a.Id, apkInfo);
                    AppStoreUIService.SetAppCurrentTestVersion(a.Id, ver.Id);
                    AppStoreUIService.PublishAppVersion(a.Id);
                }
            }

            #endregion

            #region Set up tags
            if (a.Status != 0)
            {
                AppStoreUIService.AddTagForApp("Valid", a.Id);
            }
            AppStoreUIService.AddTagForApp(appInfo.category, a.Id);
            AddMarketTag(appInfo.category, a.Id);
            AppStoreUIService.AddTagForApp("From_tencent", a.Id);
            AppStoreUIService.AddTagForApp("Live", a.Id);
            #endregion

            return(newVersionCount);
        }
示例#20
0
 public static Member Create(Address address, MemberStatus status, int uid = 0, AppVersion appVersion = null)
 {
     return(Create(address, status, ImmutableHashSet.Create <string>(), uid, appVersion: appVersion));
 }
        public async Task ExecuteCommand(string command)
        {
            TextBoxEnabled = false;
            ConsoleMessages.Clear();
            ConsoleMessages.Add(">" + command);

            if (ProjectRootDirectory == null || !File.Exists(Path.Combine(ProjectRootDirectory, "mission.sqm")))
            {
                ConsoleMessages.Add("Project must be saved at least once, and the project file (.tproj) must be in the same directory as 'mission.sqm' in order to use the CPack Console.");
                ConsoleMessages.Add(">");
                TextBoxEnabled = true;
                return;
            }

            IProgress <string> progress      = new Progress <string>(OnCommandProgress);
            AppVersion         targetVersion = null;
            bool updateDependencies          = false;
            bool removeDependencies          = false;
            bool overwrite = false;
            bool beta      = false;

            string[] commandItems = command.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < commandItems.Length; i++)
            {
                if (commandItems[i].ToLower() == "-version")
                {
                    if (i < commandItems.GetUpperBound(0))
                    {
                        AppVersion.TryParse(commandItems[i + 1], out targetVersion);
                        i++;
                    }
                }
                else if (commandItems[i].ToLower() == "-updatedep")
                {
                    updateDependencies = true;
                }
                else if (commandItems[i].ToLower() == "-removedep")
                {
                    removeDependencies = true;
                }
                else if (commandItems[i].ToLower() == "-overwrite")
                {
                    overwrite = true;
                }
                else if (commandItems[i].ToLower() == "-beta")
                {
                    beta = true;
                }
            }

            if (commandItems[0].ToLower() == "install")
            {
                if (commandItems.Length < 2)
                {
                    ConsoleMessages.Add("Command Install missing package name");
                    return;
                }

                string packageName = commandItems[1];
                var    result      = await Service.InstallPackageAsync(packageName, ProjectRootDirectory, targetVersion, updateDependencies, overwrite, beta, progress);

                TextBoxEnabled = true;
                OnPackageInstalled(packageName);
                //result.ContinueWith((arg) => {});
            }
            else if (commandItems[0].ToLower() == "update")
            {
                if (commandItems.Length < 2)
                {
                    ConsoleMessages.Add("Command Update missing package name");
                    return;
                }

                string packageName = commandItems[1];
                var    result      = await Service.UpdatePackageAsync(packageName, ProjectRootDirectory, targetVersion, updateDependencies, overwrite, beta, progress);

                TextBoxEnabled = true;
                OnPackageInstalled(packageName);
                //result.ContinueWith((arg) => { TextBoxEnabled = true; });
            }
            else if (commandItems[0].ToLower() == "remove")
            {
                if (commandItems.Length < 2)
                {
                    ConsoleMessages.Add("Command Update missing package name");
                    return;
                }

                string packageName = commandItems[1];
                var    result      = await Service.RemovePackageAsync(packageName, ProjectRootDirectory, removeDependencies, overwrite, progress);

                TextBoxEnabled = true;
                OnPackageInstalled(packageName);
                //result.ContinueWith((arg) => {  });
            }
            else if (commandItems[0].ToLower() == "list")
            {
                var result = await Service.ListPackagesAsync(ProjectRootDirectory, beta, progress);

                TextBoxEnabled = true;
                //result.ContinueWith((arg) => {  });
            }
            else if (commandItems[0].ToLower() == "clear")
            {
                ConsoleMessages.Add(">");
            }
            else if (commandItems[0].ToLower() == "exit")
            {
                OnExit();
            }
            else
            {
                ConsoleMessages.Add("Unknown command: '" + commandItems[0] + "'");
                ConsoleMessages.Add(">");
                TextBoxEnabled = true;
            }
        }
 /// <summary>
 /// 对比版本是否v1是否比v2大(不对比d 资源版本号)
 /// </summary>
 /// <param name="v1"></param>
 /// <param name="v2"></param>
 /// <returns></returns>
 public static bool Bigger(AppVersion v1, AppVersion v2)
 {
     return(v1.ToABC() > v2.ToABC());
 }
 public WhatsNewDialog(Context context, AppPrefs prefs, AppVersion oldVersion, AppVersion currentVersion)
 {
     this.context        = context;
     this.prefs          = prefs;
     this.oldVersion     = oldVersion;
     this.currentVersion = currentVersion;
     this.handler        = new Handler(Looper.MainLooper);
 }
示例#24
0
        public int CompareTo(Metrics other)
        {
            if (!(OS == null && other.OS == null))
            {
                if (OS == null)
                {
                    return(-1);
                }
                if (other.OS == null)
                {
                    return(1);
                }
                if (!OS.Equals(other.OS))
                {
                    return(OS.CompareTo(other.OS));
                }
            }

            if (!(OSVersion == null && other.OSVersion == null))
            {
                if (OSVersion == null)
                {
                    return(-1);
                }
                if (other.OSVersion == null)
                {
                    return(1);
                }
                if (!OSVersion.Equals(other.OSVersion))
                {
                    return(OSVersion.CompareTo(other.OSVersion));
                }
            }

            if (!(Device == null && other.Device == null))
            {
                if (Device == null)
                {
                    return(-1);
                }
                if (other.Device == null)
                {
                    return(1);
                }
                if (!Device.Equals(other.Device))
                {
                    return(Device.CompareTo(other.Device));
                }
            }

            if (!(Resolution == null && other.Resolution == null))
            {
                if (Resolution == null)
                {
                    return(-1);
                }
                if (other.Resolution == null)
                {
                    return(1);
                }
                if (!Resolution.Equals(other.Resolution))
                {
                    return(Resolution.CompareTo(other.Resolution));
                }
            }

            if (!(Carrier == null && other.Carrier == null))
            {
                if (Carrier == null)
                {
                    return(-1);
                }
                if (other.Carrier == null)
                {
                    return(1);
                }
                if (!Carrier.Equals(other.Carrier))
                {
                    return(Carrier.CompareTo(other.Carrier));
                }
            }

            if (!(AppVersion == null && other.AppVersion == null))
            {
                if (AppVersion == null)
                {
                    return(-1);
                }
                if (other.AppVersion == null)
                {
                    return(1);
                }
                if (!AppVersion.Equals(other.AppVersion))
                {
                    return(AppVersion.CompareTo(other.AppVersion));
                }
            }

            return(0);
        }
示例#25
0
 private void HandleChangelogClicked(object sender, EventArgs e)
 {
     AppVersion.DisplayChanges();
 }
示例#26
0
 public void A_cluster_must_initially_become_singleton_cluster_when_joining_itself_and_reach_convergence()
 {
     ClusterView.Members.Count.Should().Be(0);
     _cluster.Join(_selfAddress);
     LeaderActions(); // Joining -> Up
     AwaitCondition(() => ClusterView.IsSingletonCluster);
     ClusterView.Self.Address.Should().Be(_selfAddress);
     ClusterView.Members.Select(m => m.Address).ToImmutableHashSet()
     .Should().BeEquivalentTo(ImmutableHashSet.Create(_selfAddress));
     AwaitAssert(() => ClusterView.Status.Should().Be(MemberStatus.Up));
     ClusterView.Self.AppVersion.Should().Be(AppVersion.Create("1.2.3"));
     ClusterView.Members.FirstOrDefault(i => i.Address == _selfAddress).AppVersion.Should().Be(AppVersion.Create("1.2.3"));
     ClusterView.State.HasMoreThanOneAppVersion.Should().BeFalse();
 }
示例#27
0
 private void HandleAbout(object sender, EventArgs e)
 {
     AppVersion.DisplayAbout();
 }
示例#28
0
 public void Version_should_not_support_more_than_3_digits_version()
 {
     XAssert.Throws <ArgumentOutOfRangeException>(() => AppVersion.Create("1.2.3.1"));
 }
示例#29
0
 /// <summary>
 /// Form Load Event Handler - Initialized form after it has been loaded
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void AboutForm_Load(object sender, EventArgs e)
 {
     thisVersionLabel.Text = AppVersion.ToString();
 }
示例#30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="package"></param>
        /// <param name="isPreviewMode"></param>
        /// <returns></returns>
        public async Task <List <ActionStep> > PerformImport(ImportExportPackage package, ImportSettings settings, bool isPreviewMode)
        {
            // apply import
            var steps = new List <ActionStep>();

            // import managed certs, certificate files, stored credentials, CAs
            var currentAppVersion = Certify.Management.Util.GetAppVersion();

            if (currentAppVersion != package.SystemVersion)
            {
                if (package.SystemVersion == null || AppVersion.IsOtherVersionNewer(AppVersion.FromVersion(package.SystemVersion), AppVersion.FromVersion(currentAppVersion)))
                {
                    steps.Add(new ActionStep {
                        Title = "Version Check", Category = "Import", Key = "Version", HasWarning = true, Description = "Migration to an older app version is not supported. Results may be unreliable."
                    });
                }
            }
            else
            {
                steps.Add(new ActionStep {
                    Title = "Version Check", Category = "Import", Key = "Version", Description = "Source is from the same version or a supported app version."
                });
            }

            // check encryption
            var decryptionFailed = false;

            try
            {
                var decryptionCheckBytes  = DecryptBytes(package.EncryptionValidation.Content, settings.EncryptionSecret, package.EncryptionSalt);
                var decryptionCheckString = Encoding.ASCII.GetString(decryptionCheckBytes).Trim('\0');
                if (decryptionCheckString != "Secret")
                {
                    // failed decryption
                    decryptionFailed = true;
                }
            }
            catch (Exception)
            {
                decryptionFailed = true;
            }

            if (decryptionFailed)
            {
                steps.Add(new ActionStep {
                    HasError = true, Title = "Decryption Check", Category = "Import", Key = "Decrypt", Description = "Secrets cannot be decrypted using the provided password."
                });
                return(steps);
            }
            else
            {
                steps.Add(new ActionStep {
                    Title = "Decryption Check", Category = "Import", Key = "Decrypt", Description = "Secrets can be decrypted OK using the provided password."
                });
            }


            // stored credentials
            var credentialImportSteps = new List <ActionStep>();

            foreach (var c in package.Content.StoredCredentials)
            {
                var decodedBytes   = Convert.FromBase64String(c.Secret);
                var decryptedBytes = DecryptBytes(decodedBytes, settings.EncryptionSecret, package.EncryptionSalt);

                // convert decrypted bytes to UTF8 string and trim NUL
                c.Secret = UTF8Encoding.UTF8.GetString(decryptedBytes).Trim('\0');

                var existing = await _credentialsManager.GetCredential(c.StorageKey);

                if (existing == null)
                {
                    if (!isPreviewMode)
                    {
                        // perform import
                        var result = await _credentialsManager.Update(c);

                        if (result != null)
                        {
                            credentialImportSteps.Add(new ActionStep {
                                Title = c.Title, Key = c.StorageKey
                            });
                        }
                        else
                        {
                            credentialImportSteps.Add(new ActionStep {
                                Title = c.Title, Key = c.StorageKey, HasWarning = true, Description = $"Failed to store this credential. Items which depend on it may not function."
                            });
                        }
                    }
                    else
                    {
                        // preview only
                        credentialImportSteps.Add(new ActionStep {
                            Title = c.Title, Key = c.StorageKey
                        });
                    }
                }
                else
                {
                    // credential already exists
                    credentialImportSteps.Add(new ActionStep {
                        Title = c.Title, Key = c.StorageKey, HasWarning = true, Description = $"Credential already exists, it will not be re-imported."
                    });
                }
            }

            steps.Add(new ActionStep {
                Title = "Import Stored Credentials", Category = "Import", Substeps = credentialImportSteps, Key = "StoredCredentials"
            });


            var targetSiteBindings = new List <BindingInfo>();

            if (await _targetServer?.IsAvailable() == true)
            {
                targetSiteBindings = await _targetServer.GetSiteBindingList(false);
            }

            // managed certs
            var managedCertImportSteps = new List <ActionStep>();

            foreach (var c in package.Content.ManagedCertificates)
            {
                var existing = await _itemManager.GetById(c.Id);

                if (existing == null)
                {
                    // check if item is auto deployment or single site, if single site warn if we don't have an exact match (convert to Auto)
                    DeploymentOption deploymentMode      = c.RequestConfig.DeploymentSiteOption;
                    bool             hasUnmatchedTargets = false;
                    bool             siteIdChanged       = false;

                    var warningMsg = "";
                    if (deploymentMode == DeploymentOption.SingleSite)
                    {
                        var targets = targetSiteBindings.Where(t => t.SiteId == c.ServerSiteId);

                        if (targets.Any())
                        {
                            //exact match on site id, check domains

                            var unmatchedDomains = new List <string>();
                            foreach (var d in c.GetCertificateDomains())
                            {
                                var t = targets.FirstOrDefault(ta => ta.Host == d);

                                if (t == null)
                                {
                                    unmatchedDomains.Add(d);
                                    hasUnmatchedTargets = true;
                                    warningMsg         += " " + d;
                                }
                            }
                        }
                        else
                        {
                            // no exact site id match, check if a different site is an exact match, if so migrate site id

                            // if no exact match, change to auto
                        }
                    }
                    else
                    {
                        // auto deploy, site id only used for IIS site selection in UI
                    }

                    if (!isPreviewMode)
                    {
                        // perform actual import
                        try
                        {
                            // TODO : re-map certificate pfx path, could be a different location on this instance
                            // warn if deployment task script paths don't match an existing file?

                            // TODO : warn if Certificate Authority ID does not match one we have (cert renewal will fail)

                            var result = await _itemManager.Update(c);

                            if (result != null)
                            {
                                managedCertImportSteps.Add(new ActionStep {
                                    Title = c.Name, Key = c.Id, HasWarning = (hasUnmatchedTargets || siteIdChanged)
                                });
                            }
                            else
                            {
                                managedCertImportSteps.Add(new ActionStep {
                                    Title = c.Name, Key = c.Id, HasError = true, Description = $"Failed to import item."
                                });
                            }
                        }
                        catch (Exception exp)
                        {
                            managedCertImportSteps.Add(new ActionStep {
                                Title = c.Name, Key = c.Id, HasError = true, Description = $"Failed to import item: {exp.Message}"
                            });
                        }
                    }
                    else
                    {
                        // preview only
                        managedCertImportSteps.Add(new ActionStep {
                            Title = c.Name, Key = c.Id
                        });
                    }
                }
                else
                {
                    managedCertImportSteps.Add(new ActionStep {
                        Title = c.Name, Key = c.Id, HasWarning = true, Description = "Item already exists, it will not be re-imported."
                    });
                }
            }

            steps.Add(new ActionStep {
                Title = "Import Managed Certificates", Category = "Import", Substeps = managedCertImportSteps, Key = "ManagedCerts"
            });

            // certificate files
            var certFileImportSteps = new List <ActionStep>();

            foreach (var c in package.Content.CertificateFiles)
            {
                var pfxBytes = DecryptBytes(c.Content, settings.EncryptionSecret, package.EncryptionSalt);

                X509Certificate2 cert = null;

                try
                {
                    cert = new X509Certificate2(pfxBytes);
                }
                catch (Exception)
                {
                    // maybe we need a password
                    var managedCert = package.Content.ManagedCertificates.FirstOrDefault(m => m.CertificatePath == c.Filename && m.CertificatePasswordCredentialId != null);
                    if (managedCert != null)
                    {
                        //get stored cred
                        var cred = await _credentialsManager.GetUnlockedCredentialsDictionary(managedCert.CertificatePasswordCredentialId);

                        if (cred != null)
                        {
                            var pfxPwd = cred["password"];
                            cert = new X509Certificate2(pfxBytes, pfxPwd);
                        }
                    }
                }

                if (cert != null)
                {
                    bool isVerified = cert.Verify();

                    if (!System.IO.File.Exists(c.Filename))
                    {
                        if (!isPreviewMode)
                        {
                            // perform actual import, TODO: re-map cert PFX storage location
                            try
                            {
                                System.IO.File.WriteAllBytes(c.Filename, c.Content);
                                certFileImportSteps.Add(new ActionStep {
                                    Title = $"Importing PFX {cert.Subject}, expiring {cert.NotAfter}", Key = c.Filename, HasWarning = !isVerified, Description = isVerified ? null : "Certificate did not pass verify check."
                                });
                            }
                            catch (Exception exp)
                            {
                                certFileImportSteps.Add(new ActionStep {
                                    Title = $"Importing PFX {cert.Subject}, expiring {cert.NotAfter}", Key = c.Filename, HasError = true, Description = $"Failed to write certificate to destination: {c.Filename} [{exp.Message}]"
                                });
                            }
                        }
                        else
                        {
                            // preview only
                            certFileImportSteps.Add(new ActionStep {
                                Title = $"Importing PFX {cert.Subject}, expiring {cert.NotAfter}", Key = c.Filename, HasWarning = !isVerified, Description = isVerified ? "Would import to " + c.Filename : "Certificate did not pass verify check."
                            });
                        }
                    }
                    else
                    {
                        certFileImportSteps.Add(new ActionStep {
                            Title = $"Importing PFX {cert.Subject}, expiring {cert.NotAfter}", Key = c.Filename, HasWarning = true, Description = "Output file already exists, it will not be re-imported"
                        });
                    }
                }
                else
                {
                    certFileImportSteps.Add(new ActionStep {
                        Title = $"Importing PFX Failed", Key = c.Filename, HasWarning = true, Description = "Could not create PFX from bytes. Password may be incorrect."
                    });
                }
            }

            steps.Add(new ActionStep {
                Title = "Import Certificate Files", Category = "Import", Substeps = certFileImportSteps, Key = "CertFiles"
            });


            return(steps);
        }
示例#31
0
        /// <summary>
        /// This program finds an executable on the PATH. It can also find other stuff on the path, but
        /// mostly it finds the executable.s
        /// </summary>
        /// <param name="args"></param>
        private void Run(string[] args)
        {
            Console.OutputEncoding = Encoding.GetEncoding(Encoding.Default.CodePage);

            Args = new InputArgs("which", string.Format(resource.IDS_TITLE, AppVersion.Get()) + "\r\n" + resource.IDS_COPYRIGHT);


            Args.Add(InputArgType.StringList, "extension", null, Presence.Optional, resource.IDS_CMD_extension_doc);
            Args.Add(InputArgType.StringList, "dir", null, Presence.Optional, resource.IDS_CMD_dir_doc);
            Args.Add(InputArgType.Flag, "recursive", false, Presence.Optional, resource.IDS_CMD_recursive_doc);
            Args.Add(InputArgType.Flag, "single", false, Presence.Optional, resource.IDS_CMD_single_doc);
            Args.Add(InputArgType.RemainingParameters, "FILE {FILE}", null, Presence.Required, resource.IDS_CMD_file_doc);
            Args.Add(InputArgType.Parameter, "env", "PATH", Presence.Optional, resource.IDS_CMD_env_doc);

            if (Args.Process(args))
            {
                Filenames   = Args.GetStringList("FILE {FILE}");
                Directories = Args.FindOrCreateStringList("dir");

                string EnvironmentVariableName = Args.GetString("env");
                if (!string.IsNullOrEmpty(EnvironmentVariableName))
                {
                    string env = Environment.GetEnvironmentVariable(EnvironmentVariableName, EnvironmentVariableTarget.User);
                    if (string.IsNullOrEmpty(env))
                    {
                        env = Environment.GetEnvironmentVariable(EnvironmentVariableName);
                    }
                    EnvironmentVariablesAlreadyChecked[EnvironmentVariableName] = true;
                    if (string.IsNullOrEmpty(env))
                    {
                        Console.WriteLine(resource.IDS_ERR_invalid_env_var, EnvironmentVariableName);
                    }
                    else
                    {
                        foreach (string token in env.Split(';'))
                        {
                            Directories.Add(token);
                        }
                    }
                }

                if (FilenamesAreIncludes())
                {
                    AddEnvBasedDirectories("INCLUDE");
                }
                else if (FilenamesAreLibs())
                {
                    AddEnvBasedDirectories("LIB");
                }
                else
                {
                    // default: use standard windows lookup
                    Directories.Add(Directory.GetCurrentDirectory());
                    Directories.Add(PathSanitizer.GetWindowsDirectory());
                    Directories.Add(PathSanitizer.Get32BitSystemDirectory());
                    Directories.Add(Environment.SystemDirectory);
                    Directories.Add(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName));
                    Directories.Add(Environment.GetFolderPath(Environment.SpecialFolder.System));
                    Directories.Add(Path.GetDirectoryName(Environment.GetFolderPath(Environment.SpecialFolder.System)));
                    AddEnvBasedDirectories("PATH");
                }

                Directories.MakeUnique(StringComparison.OrdinalIgnoreCase);

                List <string> Extensions = Args.FindOrCreateStringList("extension");
                if (Extensions.Count == 0)
                {
                    foreach (string path in Environment.GetEnvironmentVariable("PATHEXT").Split(';'))
                    {
                        Extensions.Add(path);
                    }
                }

                List <string> FoundItems = new List <string>();
                foreach (string filename in Filenames)
                {
                    bool found = false;
                    foreach (string foundname in Locate(filename))
                    {
                        if (!Contains(FoundItems, foundname))
                        {
                            FileInfo fi = new FileInfo(foundname);

                            Console.WriteLine(resource.IDS_RESULT_PATTERN,
                                              foundname, fi.LastWriteTime, fi.Length);
                            FoundItems.Add(foundname);
                            if (Args.GetFlag("single"))
                            {
                                break;
                            }

                            found = true;
                        }
                    }
                    if (!found)
                    {
                        Console.WriteLine(resource.IDS_ERR_not_found, filename);
                    }
                }
            }
        }
示例#32
0
 public void LessThanOrEqualToOperator_Test_True(string lhs, string rhs)
 {
     Assert.IsTrue(AppVersion.Parse(lhs) <= AppVersion.Parse(rhs));
 }
示例#33
0
 // Use this for initialization
 void Start()
 {
     getAppVersion = appVersion;
 }