Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace CommonLNG.Resources
- {
- public static class Strings
- {
- public class StringChain
- {
- private StringChain mRequest;
- public StringChain Request => mRequest ?? (mRequest = new StringChain("Request", this));
- private StringChain mResult;
- public StringChain Result => mResult ?? (mResult = new StringChain("Result", this));
- private StringChain mCreate;
- public StringChain Create => mCreate ?? (mCreate = new StringChain("Create", this));
- private StringChain mDestroy;
- public StringChain Destroy => mDestroy ?? (mDestroy = new StringChain("Destroy", this));
- private StringChain mDirectory;
- public StringChain Directory => mDirectory ?? (mDirectory = new StringChain("Directory", this));
- private StringChain mFile;
- public StringChain File => mFile ?? (mFile = new StringChain("File", this));
- private string Text { get; }
- private StringChain Parent { get; set; }
- public StringChain(string text = "", StringChain parent = null)
- {
- Text = text;
- Parent = parent;
- }
- public static implicit operator string(StringChain v)
- {
- var result = "";
- while (v != null)
- {
- result = $".{v.Text}{result}";
- v = v.Parent;
- }
- while (result.StartsWith("."))
- result = result.Substring(1);
- return result;
- }
- public bool IsMe(string category)
- {
- return category.Contains($".{Text}") || category.Contains($"{Text}.");
- }
- }
- public static StringChain Root { get; } = new StringChain();
- public static string RequestCreateDirectoryCategory = Root.Request.Create.Directory;
- public static string RequestCreateFileCategory = Root.Request.Create.File;
- public static string RequestDeleteDirectoryCategory = Root.Request.Destroy.Directory;
- public static string RequestDeleteFileCategory = Root.Request.Destroy.File;
- public static string ResultCreateDirectoryCategory = Root.Result.Create.Directory;
- public static string ResultCreateFileCategory = Root.Result.Create.File;
- public static string ResultDeleteDirectoryCategory = Root.Result.Destroy.Directory;
- public static string ResultDeleteFileCategory = Root.Result.Destroy.File;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement