Exemplo n.º 1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (BasePath.Length != 0)
            {
                hash ^= BasePath.GetHashCode();
            }
            if (ModelType != 0)
            {
                hash ^= ModelType.GetHashCode();
            }
            if (ModelPlatform.Length != 0)
            {
                hash ^= ModelPlatform.GetHashCode();
            }
            if (modelVersionPolicy_ != null)
            {
                hash ^= ModelVersionPolicy.GetHashCode();
            }
            hash ^= VersionLabels.GetHashCode();
            if (loggingConfig_ != null)
            {
                hash ^= LoggingConfig.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 2
0
        // Discover new mods.
        public void DiscoverMods()
        {
            NewMods.Clear();
            ModDiscoveryStarted?.Invoke();
            _mods.Clear();
            BasePath.Refresh();

            if (Valid && BasePath.Exists)
            {
                foreach (var modFolder in BasePath.EnumerateDirectories())
                {
                    var mod = LoadMod(modFolder);
                    if (mod == null)
                    {
                        continue;
                    }

                    mod.Index = _mods.Count;
                    _mods.Add(mod);
                }
            }

            ModDiscoveryFinished?.Invoke();
            PluginLog.Information("Rediscovered mods.");
        }
Exemplo n.º 3
0
        protected override void Execute(CodeActivityContext context)
        {
            #region Workflow Arguments

            var switchInvokePowerShell = SwitchInvokePowerShell.Get(context);
            var powerShellScriptPath   = PowerShellScriptPath.Get(context);
            var nuGetExeFilePath       = NuGetExeFilePath.Get(context);
            var nuSpecFilePath         = NuSpecFilePath.Get(context);
            var basePath          = BasePath.Get(context);
            var outputDirectory   = OutputDirectory.Get(context);
            var version           = Version.Get(context);
            var switchInvokePush  = SwitchInvokePush.Get(context);
            var apiKey            = ApiKey.Get(context);
            var pushDestination   = PushDestination.Get(context);
            var additionalOptions = AdditionalOptions.Get(context);

            #endregion

            var resultMessages = SummarizePropertyValues(switchInvokePowerShell, powerShellScriptPath, nuGetExeFilePath,
                                                         nuSpecFilePath, basePath, outputDirectory, version, switchInvokePush, apiKey,
                                                         pushDestination, additionalOptions);

            for (var i = 0; i < resultMessages.Length - 1; i++)
            {
                // Write to the log
                context.WriteBuildMessage(resultMessages[i], BuildMessageImportance.High);
            }
        }
Exemplo n.º 4
0
            private async Task <string> AddEmailToList(IApiClient apiClient, Schema schema,
                                                       Dictionary <string, object> recordMap)
            {
                if (NameToListIdDictionary.TryGetValue((string)recordMap["Name"], out var listId))
                {
                    var postObject = new Dictionary <string, object>();

                    var emailList = new List <string>
                    {
                        (string)recordMap["Email"]
                    };

                    postObject.Add("EmailAddresses", emailList);

                    var json = new StringContent(
                        JsonConvert.SerializeObject(postObject),
                        Encoding.UTF8,
                        "application/json"
                        );

                    var response =
                        await apiClient.PostAsync($"{BasePath.TrimEnd('/')}/{listId}/AddEmails", json);

                    if (!response.IsSuccessStatusCode)
                    {
                        return(await response.Content.ReadAsStringAsync());
                    }

                    return("");
                }

                return("List does not exist in lookup.");
            }
Exemplo n.º 5
0
 public InMemPathData()
 {
     BasePath = new BasePath()
     {
         Path = @"C:\Users\gjatin\Desktop\DirectoryProject\corpus"
     };
 }
Exemplo n.º 6
0
        public IEnumerable <IFSEntry> GetNextEntry(BasePath path, string snapshottedPath)
        {
            // http://www.tummy.com/journals/entries/jafo_20101101_193113
            fsprov = FSEnumeratorProvider.GetFSEnumeratorProvider().GetFSEnumerator(snapshottedPath);

            yield return(prov.GetItemByPath(snapshottedPath));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Searches an XML file with an XPath expression
        /// </summary>
        /// <param name="context"></param>
        protected override void Execute(CodeActivityContext context)
        {
            // get the value of the FilePath
            var packageInfoFilePath = context.GetValue(PackageInfoFilePath);
            var packageIndex        = context.GetValue(PackageIndex);

            var outputDirectoryFromBldDef        = context.GetValue(OutputDirectoryFromBldDef);
            var switchInvokePushFromBldDef       = context.GetValue(SwitchInvokePushFromBldDef);
            var pushDestinationFromBldDef        = context.GetValue(PushDestinationFromBldDef);
            var switchInvokePowerShellFromBldDef = context.GetValue(SwitchInvokePowerShellFromBldDef);
            var versionFromBldDef = context.GetValue(VersionFromBldDef);

            var basePathFromBldDef             = context.GetValue(BasePathFromBldDef);
            var additionalOptionsFromBldDef    = context.GetValue(AdditionalOptionsFromBldDef);
            var powerShellScriptPathFromBldDef = context.GetValue(PowerShellScriptPathFromBldDef);


            var packageData = Execute(packageInfoFilePath, packageIndex, basePathFromBldDef, additionalOptionsFromBldDef,
                                      outputDirectoryFromBldDef, switchInvokePushFromBldDef,
                                      pushDestinationFromBldDef, switchInvokePowerShellFromBldDef, powerShellScriptPathFromBldDef, versionFromBldDef);

            Name.Set(context, packageData.Name);
            AdditionalOptions.Set(context, packageData.AdditionalOptions);
            BasePath.Set(context, packageData.BasePath);
            NuSpecFilePath.Set(context, packageData.NuSpecFilePath);
            PowerShellScriptPath.Set(context, packageData.PowerShellScriptPath);
            Version.Set(context, packageData.Version);

            OutputDirectory.Set(context, packageData.OutputDirectory);
            SwitchInvokePush.Set(context, packageData.SwitchInvokePush);
            PushDestination.Set(context, packageData.PushDestination);
            SwitchInvokePowerShell.Set(context, packageData.SwitchInvokePowerShell);
        }
Exemplo n.º 8
0
        public bool Merge(PathMatcher matcher)
        {
            var merge = false;

            if (isFolder && matcher.isFolder)
            {
                if (BasePath.StartsWith(matcher.BasePath))
                {
                    BasePath = matcher.BasePath;
                    merge    = true;
                }
                else if (matcher.BasePath.StartsWith(BasePath))
                {
                    merge = true;
                }

                if (merge)
                {
                    extensionPatterns = extensionPatterns.Union(matcher.extensionPatterns).Distinct().ToArray();
                    regexes           = matcher.RegexesInternal.Union(RegexesInternal).ToArray();
                }
            }

            return(merge);
        }
Exemplo n.º 9
0
            public override async IAsyncEnumerable <Record> ReadRecordsAsync(IApiClient apiClient,
                                                                             DateTime?lastReadTime = null, TaskCompletionSource <DateTime>?tcs = null, bool isDiscoverRead = false)
            {
                var response = await apiClient.GetAsync(
                    $"{BasePath.TrimEnd('/')}/{AllPath.TrimStart('/')}");

                var recordsList =
                    JsonConvert.DeserializeObject <SuppressionListsResponse>(await response.Content.ReadAsStringAsync());

                if (recordsList.SuppressionLists == null)
                {
                    yield break;
                }

                foreach (var recordMap in recordsList.SuppressionLists)
                {
                    var normalizedRecordMap = new Dictionary <string, object?>();

                    foreach (var kv in recordMap)
                    {
                        if (kv.Key.Equals(EndpointHelper.LinksPropertyId))
                        {
                            continue;
                        }

                        normalizedRecordMap.TryAdd(kv.Key, kv.Value);
                    }

                    yield return(new Record
                    {
                        Action = Record.Types.Action.Upsert,
                        DataJson = JsonConvert.SerializeObject(normalizedRecordMap)
                    });
                }
            }
Exemplo n.º 10
0
        public static List <Image> GetAllImages(BasePath b)
        {
            var l   = new List <Image>();
            var dir = new DirectoryInfo(String.Concat(b.Path, b.Category, "\\", b.Date + "\\"));

            foreach (var fileInfo in dir.GetFiles())
            {
                if (fileInfo.Extension.ToLower() != ".jpg")
                {
                    continue;
                }

                var imageComment = TextFile.ReadFileWithoutEncoding(fileInfo.FullName + ".txt");

                var img = new Image
                {
                    Name    = fileInfo.Name.Replace(".", "_____"),
                    Url     = "/Upload/" + b.Category + "/" + b.Date + "/" + fileInfo.Name,
                    Thumb   = "/Upload/" + b.Category + "/" + b.Date + "/thumbnails/" + fileInfo.Name,
                    Comment = imageComment
                };
                l.Add(img);
            }
            return(l);
        }
Exemplo n.º 11
0
 public FileSystemProject(string path)
 {
     _indexPath = path;
     BasePath   = Path.GetDirectoryName(_indexPath) !;
     _baseUri   = "file:///" + BasePath.Replace("\\", "/");
     Index      = Json.Defrost <TemplateProject>(File.ReadAllText(_indexPath) !) !;
 }
Exemplo n.º 12
0
        // Vanilla:		Path				e.g. "/UserMarkers/ShaderMisses/0.435.3 LCM illum"
        // Displayed: DisplayPath	e.g. "/UserMarkers/ShaderMisses/LCM illum"
        public string[] GetPathLocations(ERDIPathType type)
        {
            string[] baseLocations = BasePath.PathLocations();
            string[] locations     = new string[baseLocations.Length + 1];
            baseLocations.CopyTo(locations, 0);

            switch (type)
            {
            case ERDIPathType.Vanilla:
                if (Name == "")
                {
                    return(baseLocations);
                }
                locations[locations.Length - 1] = Name;
                break;

            case ERDIPathType.Displayed:
                if (DisplayName == "")
                {
                    return(baseLocations);
                }
                locations[locations.Length - 1] = DisplayName;
                break;
            }

            return(locations);
        }
Exemplo n.º 13
0
        public Path Build()
        {
            Path path = BasePath != null ? new Path(BasePath.ToString()) : PathConstants.BasePath;

            if (Action != null)
            {
                path.BasePath += "/" + Action;
            }

            if (InitialDate == DateTime.MinValue && FinalDate == DateTime.MinValue && DocumentType == null)
            {
                return(path);
            }

            if (InitialDate != DateTime.MinValue)
            {
                AddParameter(path, "initialDate", InitialDate);
            }

            if (FinalDate != DateTime.MinValue)
            {
                AddParameter(path, "finalDate", FinalDate);
            }

            if (DocumentType != null)
            {
                AddParameter(path, "documentType", DocumentType);
            }

            return(path);
        }
Exemplo n.º 14
0
        public IEnumerable <PackageCleanResult> Clean(IEnumerable <IPackageInfo> packagesToKeep)
        {
            packagesToKeep = packagesToKeep.ToList();
            var packagesToRemove = Packages.Where(x => !packagesToKeep.Contains(x.Package)).ToList();

            foreach (var packageInfo in packagesToRemove)
            {
                if (!Packages.Contains(packageInfo))
                {
                    throw new ArgumentException("Supplied packageInfo must belong to the FolderRepository.", "packageInfo");
                }

                if (packageInfo.CacheDirectory.TryDelete())
                {
                    Packages.Remove(packageInfo);

                    BasePath.GetFile(packageInfo.Package.FullName + ".wrap").Delete();
                    yield return(new PackageCleanResult(packageInfo.Package, true));
                }
                else
                {
                    yield return(new PackageCleanResult(packageInfo.Package, false));
                }
            }
        }
Exemplo n.º 15
0
 public bool IsViewShowing(string viewId)
 {
     string[] paths = BasePath.Split('/');
     if (paths.Length > 0)
     {
         if (paths[paths.Length - 1] == "Detail")
         {
             if (ActiveView != null && ActiveView.ViewName == viewId)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else if (paths[paths.Length - 1] == "List")
         {
             return(this.IsDockViewShowing(viewId));
         }
         else
         {
             throw new Exception("Error basePath :" + BasePath);
         }
     }
     else
     {
         throw (new Exception("Error basePath :" + BasePath));
     }
 }
Exemplo n.º 16
0
 protected sealed override void OnGeneratePath(ref GraphicsPath path)
 {
     foreach (IDrawObj obj in ObjList)
     {
         BasePath.AddPath(obj.MatrixPath, false);
     }
     SetDirectRect(BasePath.GetBounds());
 }
Exemplo n.º 17
0
 public ActionResult Details(BasePath b)
 {
     if (b.Date != null)
     {
         return(View(DayStory.GetSingleDay(b)));
     }
     return(null);
 }
 public IEnumerable <Element> GetElements()
 {
     foreach (ThemedFileElement element in ReadFileSystem())
     {
         element.Tapped += () => OpenFile(BasePath.Expand(element.Caption, basePathId));
         yield return(element);
     }
 }
Exemplo n.º 19
0
        public ActionResult Day(BasePath b)
        {
            var d = DayStory.GetSingleDay(b) ?? new DayStory {
                Day = b.Date
            };

            return(View("Day", d));
        }
        public override void Selected(NSIndexPath indexPath)
        {
            base.Selected(indexPath);
            ThemedFileElement element    = (ThemedFileElement)fileSection [indexPath.Row];
            string            targetPath = BasePath.Expand(element.Caption, element.PathId);

            OpenFile(targetPath);
        }
Exemplo n.º 21
0
        /// <summary>
        /// Gets the next incremental/diff entry to backup.
        /// </summary>
        /// <returns>
        /// and IFSEntry
        /// </returns>
        /// <param name='path'>
        /// Path.
        /// </param>
        /// <param name='snapshottedPath'>
        /// Snapshotted path.
        /// </param>
        public IEnumerable <IFSEntry> GetNextEntry(BasePath path, string snapshottedPath)
        {
            //To efficiently reuse existing code, we instanciate
            // a "phantom" BackupRootDriveHandler an use its "GetFull()" FS items provider as an items source to check
            // for modifications.
            // Each entry already existing in the ref backup index is marked as 'found' (Tuple.Item2 = true)
            // to allow to detect not found items (deleted) after collecting curent FS items.
            phantomBrd = new BackupRootDriveHandler(rootDrive, this.taskId, 0, 0, 0, BackupLevel.Full, 0, 0, 0);
            phantomBrd.SetCurrentPath(path);
            phantomBrd.SubCompletionEvent += new BackupRootDriveHandler.SubCompletionHandler(BubbleUpSubCompletion);

            foreach (IFSEntry entry in phantomBrd.GetFull(true))
            {
                // New File (inode/id > last refMaxId known inode/id) or doesn't exist in ref backup
                if (entry.ID > refMaxId || !refEntries.ContainsKey(entry.ID))                  //todo : also check CreationTime?
                {
                    Console.WriteLine("Incremental GetFilesToBackup() added NEW entry : " + entry.SnapFullPath);
                    entry.ChangeStatus = DataLayoutInfos.New;
                    yield return(entry);

                    continue;
                }
                else if (entry.LastModifiedTime > refEntries[entry.ID].Item1)
                {
                    entry.ChangeStatus         = DataLayoutInfos.HasChanges;
                    refEntries[entry.ID].Item2 = true;
                    yield return(entry);

                    continue;
                }
                else if (entry.LastMetadataModifiedTime > refBackupTimeStart)
                {
                    entry.ChangeStatus         = DataLayoutInfos.MetadaOnly;
                    refEntries[entry.ID].Item2 = true;
                    yield return(entry);

                    continue;
                }
                else
                {
                    refEntries[entry.ID].Item2 = true;
                }
            }             // // end foreach phantomBrdh

            // last step : returd deleted entries
            foreach (var item in refEntries)
            {
                if (!item.Value.Item2)
                {
                    IFSEntry deleted = prov.GetEmptyItem();
                    deleted.ID           = item.Key;
                    deleted.ChangeStatus = DataLayoutInfos.Deleted;
                    yield return(deleted);
                }
            }
            refEntries = null;
            yield break;
        }
Exemplo n.º 22
0
        public virtual object Clone()
        {
            var obj = (DrawObj)MemberwiseClone();

            obj._basePath    = BasePath.Clone() as GraphicsPath;
            obj._dataBk      = _dataBk.Clone() as CalcData;
            obj._paraManager = _paraManager.Clone() as ExpressionMananger;
            return(obj);
        }
Exemplo n.º 23
0
        /// <summary>
        /// 如果当前基础路径为空,则改变基础路径。
        /// </summary>
        /// <param name="defaultBasePath">给定的默认基础路径。</param>
        /// <returns>返回当前 <see cref="FilePathCombiner"/>。</returns>
        public FilePathCombiner ChangeBasePathIfEmpty(string defaultBasePath)
        {
            if (BasePath.IsEmpty())
            {
                BasePath = defaultBasePath.NotEmpty(nameof(defaultBasePath));
            }

            return(this);
        }
Exemplo n.º 24
0
 /// <summary>
 /// 输出路径提供
 /// </summary>
 /// <param name="path"></param>
 protected override void OnGeneratePath(ref GraphicsPath path)
 {
     if (false == IsNodeOperate)//不是鼠标操作
     {
         ScaleDatas(Rect, DataBk.Rect, NodeDatas, _nodeDatasBk);
     }
     GenerateNodePath(ref path);
     SetDirectRect(BasePath.GetBounds());
 }
Exemplo n.º 25
0
 protected override void OnGeneratePath(ref GraphicsPath path)
 {
     if (EditMode == EditMode.Normal)
     {
         ScaleNode(Rect, DataBk.Rect, _points, _pointsBk);
     }
     BasePath.AddPath(new GraphicsPath(_points, _types), false);
     SetDirectRect(BasePath.GetBounds());
 }
Exemplo n.º 26
0
        /// <summary>
        /// Gets the full url composed of the <see cref="BaseUrl"/> and <see cref="BasePath"/> with no trailing `/`
        /// </summary>
        public virtual string GetUrl()
        {
            var url = new ValueStringBuilder(stackalloc char[ValueStringBuilder.StackallocThreshold]);

            url.Append(BaseUrl.AsSpan().TrimEnd('/'));
            url.Append('/');
            url.Append(BasePath.AsSpan().Trim('/'));
            return(url.ToString());
        }
Exemplo n.º 27
0
 /// <summary>
 /// Creates a v0.3 service
 /// </summary>
 public ServiceV0_3(IServiceFactory factory, JsonDictionary values, FactoryParameters param)
     : base(factory, values, param)
 {
     // If no BasePath has been set, then retrieve it from the json document
     if (BasePath.IsNullOrEmpty())
     {
         BasePath = information.GetMandatoryValue <string>(RestBasePathField);
     }
 }
Exemplo n.º 28
0
        public SoundSystem(Game game)
        {
            _game   = game;
            _musics = new Dictionary <string, Music>();
            _sounds = new Dictionary <string, Sound>();

            AddMusic("main", new Music(BasePath.Sound("main.wav")));
            //Play("main");
        }
Exemplo n.º 29
0
        protected virtual InstallFile ReadManifestItem(XPathNavigator nav, bool checkFileExists)
        {
            string         fileName = Null.NullString;
            XPathNavigator pathNav  = nav.SelectSingleNode("path");

            if (pathNav == null)
            {
                fileName = DefaultPath;
            }
            else
            {
                fileName = pathNav.Value + "\\";
            }
            XPathNavigator nameNav = nav.SelectSingleNode("name");

            if (nameNav != null)
            {
                fileName += nameNav.Value;
            }
            string      sourceFileName = Util.ReadElement(nav, "sourceFileName");
            InstallFile file           = new InstallFile(fileName, sourceFileName, Package.InstallerInfo);

            if ((!string.IsNullOrEmpty(BasePath)) && (BasePath.ToLowerInvariant().StartsWith("app_code") && file.Type == InstallFileType.Other))
            {
                file.Type = InstallFileType.AppCode;
            }
            if (file != null)
            {
                string strVersion = XmlUtils.GetNodeValue(nav, "version");
                if (!string.IsNullOrEmpty(strVersion))
                {
                    file.SetVersion(new System.Version(strVersion));
                }
                else
                {
                    file.SetVersion(Package.Version);
                }
                string strAction = XmlUtils.GetAttributeValue(nav, "action");
                if (!string.IsNullOrEmpty(strAction))
                {
                    file.Action = strAction;
                }
                if (InstallMode == InstallMode.Install && checkFileExists && file.Action != "UnRegister")
                {
                    if (System.IO.File.Exists(file.TempFileName))
                    {
                        Log.AddInfo(string.Format(Util.FILE_Found, file.Path, file.Name));
                    }
                    else
                    {
                        Log.AddFailure(Util.FILE_NotFound + " - " + file.TempFileName);
                    }
                }
            }
            return(file);
        }
Exemplo n.º 30
0
        public ActionResult DayEdit(string category, string id)
        {
            var b = new BasePath()
            {
                Category = category, Date = id
            };
            var d = DayStory.GetSingleDay(b);

            return(View("Day", d));
        }