コード例 #1
0
ファイル: Prereq.cs プロジェクト: DeCarabas/iggy
 public override void Bind(RuleIndex index)
 {
     for (int i = 0; i < this.prereqs.Length; i++)
     {
         this.prereqs[i].Bind(index);
     }
 }
コード例 #2
0
ファイル: Prereq.cs プロジェクト: DeCarabas/iggy
 public override void Bind(RuleIndex index)
 {
     if (this.boundElements == null)
     {
         this.boundElements = index.GetElementsByName(this.name).ToArray();
     }
 }
コード例 #3
0
ファイル: Prereq.cs プロジェクト: DeCarabas/iggy
 public override void Bind(RuleIndex index)
 {
     if (this.boundElement == null)
     {
         this.boundElement = index.GetElement(this.type, this.elementName);
     }
 }
コード例 #4
0
 public void BindRules(RuleIndex index)
 {
     for (int i = 0; i < rules.Count; i++)
     {
         rules[i].Bind(index);
     }
 }
コード例 #5
0
ファイル: Converter.cs プロジェクト: seanohue/iggy
 Converter(RuleIndex index, TextWriter writer)
 {
     this.index = index;
     this.writer = writer as IndentedTextWriter;
     if (this.writer == null)
     {
         this.writer = new IndentedTextWriter(writer, "  ");
     }
 }
コード例 #6
0
ファイル: Converter.cs プロジェクト: seanohue/iggy
        public static void ConvertToFiles(RuleIndex index, string outputPath, ProgressDialog progress)
        {
            if (progress != null) { progress.SetDescription("Converting elements..."); }
            int max = index.Elements.Count;
            int pos = 0;

            var sourceModules = new List<string>();
            foreach (IGrouping<string, RuleElement> source in index.Elements.GroupBy(r => GetRealSource(r.Source)))
            {
                string sourceSegment = GetSafePathSegment(source.Key);
                string sourcePath = Path.Combine(outputPath, sourceSegment);
                if (!Directory.Exists(sourcePath)) { Directory.CreateDirectory(sourcePath); }

                var modules = new List<string>();
                foreach (IGrouping<string, RuleElement> type in source.GroupBy(r => r.Type.ToString()))
                {
                    string moduleName = type.Key;
                    modules.Add(moduleName);

                    string outFile = Path.Combine(sourcePath, moduleName + ".js");
                    using (TextWriter writer = File.CreateText(outFile))
                    {
                        var converter = new Converter(index, writer);
                        converter.WriteGlobalPrefix();
                        converter.WriteTypePrefix(type.Key);
                        foreach (RuleElement element in type.OrderBy(e => e.Name.ToString()))
                        {
                            if (progress != null) { progress.SetProgress(pos++, max); }
                            converter.WriteGenericRulesElement(element);
                        }
                        converter.WriteTypeSuffix();
                        converter.WriteGlobalSuffix();

                        converter.WriteWarnings();
                    }
                }

                string indexModule = Path.Combine(sourceSegment, "all");
                sourceModules.Add(indexModule);

                string indexFile = Path.Combine(outputPath, indexModule + ".js");
                using(TextWriter writer = File.CreateText(indexFile))
                {
                    var converter = new Converter(index, writer);
                    converter.WriteIndexFile(modules);
                }
            }

            string masterIndex = Path.Combine(outputPath, "all.js");
            using(TextWriter writer = File.CreateText(masterIndex))
            {
                var converter = new Converter(index, writer);
                converter.WriteIndexFile(sourceModules);
            }
        }
コード例 #7
0
ファイル: Converter.cs プロジェクト: zombisaur/iggy
        public static string ConvertElement(RuleIndex index, RuleElement element)
        {
            var stringWriter = new StringWriter();
            var converter = new Converter(index, stringWriter);

            converter.WriteGlobalPrefix();
            converter.WriteTypePrefix(element.Type);

            converter.WriteGenericRulesElement(element);

            converter.WriteTypeSuffix();
            converter.WriteGlobalSuffix();

            return stringWriter.ToString();
        }
コード例 #8
0
        public void BindCategories(RuleIndex index)
        {
            this.boundCategories.Add(this.name);
            this.boundCategories.Add(this.id);
            if (this.category != null)
            {
                for (int i = 0; i < this.category.Length; i++)
                {
                    this.boundCategories.Add(this.category[i]);

                    RuleElement category;
                    if (index.TryGetElement(this.category[i], out category))
                    {
                        this.boundCategories.Add(category.Name);
                    }
                }
            }
        }
コード例 #9
0
ファイル: Converter.cs プロジェクト: zombisaur/iggy
        public static void Convert(RuleIndex index, TextWriter writer, ProgressDialog progress)
        {
            var converter = new Converter(index, writer);

            if (progress != null) { progress.SetDescription("Converting elements..."); }
            int max = index.Elements.Count;
            int pos = 0;

            converter.WriteGlobalPrefix();
            foreach (IGrouping<string, RuleElement> ebt in index.Elements.GroupBy(e => e.Type.ToString()))
            {
                converter.WriteTypePrefix(ebt.Key);
                foreach (RuleElement element in ebt.OrderBy(e => e.Name.ToString()))
                {
                    if (progress != null) { progress.SetProgress(pos++, max); }
                    converter.WriteGenericRulesElement(element);
                }
                converter.WriteTypeSuffix();
            }
            converter.WriteGlobalSuffix();

            converter.WriteWarnings();
        }
コード例 #10
0
ファイル: Prereq.cs プロジェクト: zombisaur/iggy
 public override void Bind(RuleIndex index)
 {
     this.left.Bind(index);
     this.right.Bind(index);
 }
コード例 #11
0
ファイル: SelectRule.cs プロジェクト: DeCarabas/iggy
 public override void Bind(RuleIndex index)
 {
     this.index = index;
 }
コード例 #12
0
ファイル: Rule.cs プロジェクト: seanohue/iggy
 public virtual void Bind(RuleIndex index)
 {
 }
コード例 #13
0
ファイル: Prereq.cs プロジェクト: DeCarabas/iggy
 public override void Bind(RuleIndex index)
 {
     this.left.Bind(index);
     this.right.Bind(index);
 }
コード例 #14
0
ファイル: Converter.cs プロジェクト: seanohue/iggy
 public static string ConvertElement(RuleIndex index, RuleElement element)
 {
     var stringWriter = new StringWriter();
     element.WriteJS(new IndentedTextWriter(stringWriter, "  "));
     return stringWriter.ToString();
 }
コード例 #15
0
ファイル: Prereq.cs プロジェクト: DeCarabas/iggy
 public abstract void Bind(RuleIndex index);
コード例 #16
0
 public virtual void Bind(RuleIndex index)
 {
 }
コード例 #17
0
ファイル: Prereq.cs プロジェクト: zombisaur/iggy
 public override void Bind(RuleIndex index)
 {
     if (this.boundElements == null)
     {
         this.boundElements = index.GetElementsByName(this.name).ToArray();
     }
 }
コード例 #18
0
ファイル: Prereq.cs プロジェクト: zombisaur/iggy
 public abstract void Bind(RuleIndex index);
コード例 #19
0
ファイル: Prereq.cs プロジェクト: zombisaur/iggy
 public override void Bind(RuleIndex index)
 {
     this.prereq.Bind(index);
 }
コード例 #20
0
ファイル: Prereq.cs プロジェクト: zombisaur/iggy
 public override void Bind(RuleIndex index)
 {
     for (int i = 0; i < this.prereqs.Length; i++)
     {
         this.prereqs[i].Bind(index);
     }
 }
コード例 #21
0
ファイル: Prereq.cs プロジェクト: DeCarabas/iggy
 public override void Bind(RuleIndex index)
 {
 }
コード例 #22
0
ファイル: Prereq.cs プロジェクト: DeCarabas/iggy
 public override void Bind(RuleIndex index)
 {
     throw new NotImplementedException();
 }
コード例 #23
0
ファイル: Prereq.cs プロジェクト: DeCarabas/iggy
 public override void Bind(RuleIndex index)
 {
     this.prereq.Bind(index);
 }
コード例 #24
0
ファイル: Prereq.cs プロジェクト: zombisaur/iggy
 public override void Bind(RuleIndex index)
 {
 }
コード例 #25
0
ファイル: MainForm.cs プロジェクト: zombisaur/iggy
        void SetupDocument(RuleIndex document)
        {
            this.currentDocument = document;
            Text = this.currentDocument.Name;

            this.theTree.BeginUpdate();
            this.theTree.Nodes.Clear();

            foreach (IGrouping<Identifier, RuleElement> g in this.currentDocument.Elements.OrderBy(e => e.Type.ToString()).GroupBy(e => e.Type))
            {
                Identifier type = g.Key;
                this.theTree.Nodes.Add(new TreeNode
                {
                    Text = type.ToString() + " [" + g.Count() + "]",
                    Tag = type,
                    Nodes = {
                        new TreeNode { Text = "", Tag = dummyMarker }
                    }
                });
            }
            this.theTree.EndUpdate();
        }
コード例 #26
0
ファイル: Prereq.cs プロジェクト: zombisaur/iggy
 public override void Bind(RuleIndex index)
 {
     throw new NotImplementedException();
 }
コード例 #27
0
ファイル: GrantRule.cs プロジェクト: zombisaur/iggy
 public override void Bind(RuleIndex index)
 {
     // TODO: What if binding fails? (Only happens for [Dilettante], I think...)
     index.TryGetElement(this.name, out this.element);
 }
コード例 #28
0
ファイル: Prereq.cs プロジェクト: zombisaur/iggy
 public override void Bind(RuleIndex index)
 {
     if (this.boundElement == null)
     {
         this.boundElement = index.GetElement(this.type, this.elementName);
     }
 }
コード例 #29
0
ファイル: RuleElement.cs プロジェクト: zombisaur/iggy
        public void BindCategories(RuleIndex index)
        {
            this.boundCategories.Add(this.name);
            this.boundCategories.Add(this.id);
            if (this.category != null)
            {
                for (int i = 0; i < this.category.Length; i++)
                {
                    this.boundCategories.Add(this.category[i]);

                    RuleElement category;
                    if (index.TryGetElement(this.category[i], out category))
                    {
                        this.boundCategories.Add(category.Name);
                    }
                }
            }
        }
コード例 #30
0
 public override void Bind(RuleIndex index)
 {
     // TODO: What if binding fails? (Only happens for [Dilettante], I think...)
     index.TryGetElement(this.name, out this.element);
 }
コード例 #31
0
ファイル: RuleElement.cs プロジェクト: zombisaur/iggy
 public void BindRules(RuleIndex index)
 {
     for (int i = 0; i < rules.Count; i++) { rules[i].Bind(index); }
 }
コード例 #32
0
ファイル: SelectRule.cs プロジェクト: seanohue/iggy
 public override void Bind(RuleIndex index)
 {
     this.index = index;
 }
コード例 #33
0
ファイル: Converter.cs プロジェクト: zombisaur/iggy
 public static void Convert(RuleIndex index, TextWriter writer)
 {
     Convert(index, writer, null);
 }